summaryrefslogtreecommitdiffstats
path: root/dom/media/platforms
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 15:18:54 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 15:18:54 +0000
commita5f28e22cc28ca53d092f6545bc924ee43a8bbe4 (patch)
tree7e02d01734d97de08bdeed66d2d5185f8e4f0a61 /dom/media/platforms
parentReleasing progress-linux version 115.8.0esr-1~deb12u1progress7u1. (diff)
downloadfirefox-esr-a5f28e22cc28ca53d092f6545bc924ee43a8bbe4.tar.xz
firefox-esr-a5f28e22cc28ca53d092f6545bc924ee43a8bbe4.zip
Merging upstream version 115.9.0esr.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/platforms')
-rw-r--r--dom/media/platforms/wrappers/MediaChangeMonitor.cpp27
-rw-r--r--dom/media/platforms/wrappers/MediaChangeMonitor.h2
2 files changed, 24 insertions, 5 deletions
diff --git a/dom/media/platforms/wrappers/MediaChangeMonitor.cpp b/dom/media/platforms/wrappers/MediaChangeMonitor.cpp
index 17387204ed..544abea161 100644
--- a/dom/media/platforms/wrappers/MediaChangeMonitor.cpp
+++ b/dom/media/platforms/wrappers/MediaChangeMonitor.cpp
@@ -519,6 +519,10 @@ RefPtr<MediaDataDecoder::InitPromise> MediaChangeMonitor::Init() {
mDecoderInitialized = true;
mConversionRequired = Some(mDecoder->NeedsConversion());
mCanRecycleDecoder = Some(CanRecycleDecoder());
+ if (mPendingSeekThreshold) {
+ mDecoder->SetSeekThreshold(*mPendingSeekThreshold);
+ mPendingSeekThreshold.reset();
+ }
}
return mInitPromise.ResolveOrRejectIfExists(std::move(aValue),
__func__);
@@ -686,11 +690,19 @@ bool MediaChangeMonitor::IsHardwareAccelerated(
}
void MediaChangeMonitor::SetSeekThreshold(const media::TimeUnit& aTime) {
- if (mDecoder) {
- mDecoder->SetSeekThreshold(aTime);
- } else {
- MediaDataDecoder::SetSeekThreshold(aTime);
- }
+ GetCurrentSerialEventTarget()->Dispatch(NS_NewRunnableFunction(
+ "MediaChangeMonitor::SetSeekThreshold",
+ [self = RefPtr<MediaChangeMonitor>(this), time = aTime, this] {
+ // During the shutdown.
+ if (mShutdownPromise) {
+ return;
+ }
+ if (mDecoder && mDecoderInitialized) {
+ mDecoder->SetSeekThreshold(time);
+ } else {
+ mPendingSeekThreshold = Some(time);
+ }
+ }));
}
RefPtr<MediaChangeMonitor::CreateDecoderPromise>
@@ -744,6 +756,11 @@ MediaResult MediaChangeMonitor::CreateDecoderAndInit(MediaRawData* aSample) {
mConversionRequired = Some(mDecoder->NeedsConversion());
mCanRecycleDecoder = Some(CanRecycleDecoder());
+ if (mPendingSeekThreshold) {
+ mDecoder->SetSeekThreshold(*mPendingSeekThreshold);
+ mPendingSeekThreshold.reset();
+ }
+
if (!mFlushPromise.IsEmpty()) {
// A Flush is pending, abort the current operation.
mFlushPromise.Resolve(true, __func__);
diff --git a/dom/media/platforms/wrappers/MediaChangeMonitor.h b/dom/media/platforms/wrappers/MediaChangeMonitor.h
index a85c23fcb2..843dd9035b 100644
--- a/dom/media/platforms/wrappers/MediaChangeMonitor.h
+++ b/dom/media/platforms/wrappers/MediaChangeMonitor.h
@@ -135,6 +135,8 @@ class MediaChangeMonitor final
Maybe<MediaDataDecoder::ConversionRequired> mConversionRequired;
bool mDecoderInitialized = false;
const CreateDecoderParamsForAsync mParams;
+ // Keep any seek threshold set for after decoder creation and initialization.
+ Maybe<media::TimeUnit> mPendingSeekThreshold;
};
} // namespace mozilla