From def92d1b8e9d373e2f6f27c366d578d97d8960c6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:34:50 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- dom/media/ExternalEngineStateMachine.h | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'dom/media/ExternalEngineStateMachine.h') diff --git a/dom/media/ExternalEngineStateMachine.h b/dom/media/ExternalEngineStateMachine.h index 79183f894d..83250b0f3c 100644 --- a/dom/media/ExternalEngineStateMachine.h +++ b/dom/media/ExternalEngineStateMachine.h @@ -56,6 +56,9 @@ class ExternalEngineStateMachine final ExternalEngineStateMachine(MediaDecoder* aDecoder, MediaFormatReader* aReader); + RefPtr InvokeSeek( + const SeekTarget& aTarget) override; + RefPtr InvokeSetSink( const RefPtr& aSink) override; @@ -178,9 +181,9 @@ class ExternalEngineStateMachine final // crashes. struct RecoverEngine : public InitEngine {}; - StateObject() : mData(InitEngine()), mName(State::InitEngine){}; - explicit StateObject(ReadingMetadata&& aArg) - : mData(std::move(aArg)), mName(State::ReadingMetadata){}; + StateObject() : mData(ReadingMetadata()), mName(State::ReadingMetadata){}; + explicit StateObject(InitEngine&& aArg) + : mData(std::move(aArg)), mName(State::InitEngine){}; explicit StateObject(RunningEngine&& aArg) : mData(std::move(aArg)), mName(State::RunningEngine){}; explicit StateObject(SeekingData&& aArg) @@ -308,7 +311,11 @@ class ExternalEngineStateMachine final // Only used if setting CDM happens before the engine finishes initialization. MozPromiseHolder mSetCDMProxyPromise; MozPromiseRequestHolder mSetCDMProxyRequest; - MozPromiseRequestHolder mInitEngineForCDMRequest; + + // If seek happens while the engine is still initializing, then we would + // postpone the seek until the engine is ready. + SeekJob mPendingSeek; + MozPromiseRequestHolder mPendingSeekRequest; // It would be zero for audio-only playback. gfx::IntSize mVideoDisplay; @@ -332,9 +339,11 @@ class ExternalPlaybackEngine { virtual ~ExternalPlaybackEngine() = default; // Init the engine and specify the preload request. - virtual RefPtr Init(bool aShouldPreload) = 0; + virtual RefPtr Init(const MediaInfo& aInfo, + bool aShouldPreload) = 0; virtual void Shutdown() = 0; virtual uint64_t Id() const = 0; + virtual bool IsInited() const = 0; // Following methods should only be called after successfully initialize the // external engine. @@ -347,7 +356,6 @@ class ExternalPlaybackEngine { virtual void SetPreservesPitch(bool aPreservesPitch) = 0; virtual media::TimeUnit GetCurrentPosition() = 0; virtual void NotifyEndOfStream(TrackInfo::TrackType aType) = 0; - virtual void SetMediaInfo(const MediaInfo& aInfo) = 0; virtual bool SetCDMProxy(CDMProxy* aProxy) = 0; virtual void NotifyResizing(uint32_t aWidth, uint32_t aHeight) = 0; -- cgit v1.2.3