diff --git a/dom/media/MediaDecoderReader.h b/dom/media/MediaDecoderReader.h index 56163df6d711..21df8d719930 100644 --- a/dom/media/MediaDecoderReader.h +++ b/dom/media/MediaDecoderReader.h @@ -164,7 +164,7 @@ public: // Moves the decode head to aTime microseconds. aEndTime denotes the end // time of the media in usecs. This is only needed for OggReader, and should // probably be removed somehow. - virtual RefPtr Seek(SeekTarget aTarget, int64_t aEndTime) = 0; + virtual RefPtr Seek(const SeekTarget& aTarget, int64_t aEndTime) = 0; virtual void SetCDMProxy(CDMProxy* aProxy) {} diff --git a/dom/media/MediaDecoderReaderWrapper.cpp b/dom/media/MediaDecoderReaderWrapper.cpp index 67eb1fc23559..ba8ceccb3c57 100644 --- a/dom/media/MediaDecoderReaderWrapper.cpp +++ b/dom/media/MediaDecoderReaderWrapper.cpp @@ -122,13 +122,16 @@ MediaDecoderReaderWrapper::IsWaitingVideoData() const } RefPtr -MediaDecoderReaderWrapper::Seek(SeekTarget aTarget, media::TimeUnit aEndTime) +MediaDecoderReaderWrapper::Seek(const SeekTarget& aTarget, + const media::TimeUnit& aEndTime) { MOZ_ASSERT(mOwnerThread->IsCurrentThreadIn()); - aTarget.SetTime(aTarget.GetTime() + StartTime()); - return InvokeAsync(mReader->OwnerThread(), mReader.get(), __func__, - &MediaDecoderReader::Seek, aTarget, - aEndTime.ToMicroseconds()); + SeekTarget adjustedTarget = aTarget; + adjustedTarget.SetTime(adjustedTarget.GetTime() + StartTime()); + return InvokeAsync( + mReader->OwnerThread(), mReader.get(), __func__, + &MediaDecoderReader::Seek, + Move(adjustedTarget), aEndTime.ToMicroseconds()); } void diff --git a/dom/media/MediaDecoderReaderWrapper.h b/dom/media/MediaDecoderReaderWrapper.h index 8735c3060068..a1da5029ca19 100644 --- a/dom/media/MediaDecoderReaderWrapper.h +++ b/dom/media/MediaDecoderReaderWrapper.h @@ -68,7 +68,8 @@ public: bool IsWaitingAudioData() const; bool IsWaitingVideoData() const; - RefPtr Seek(SeekTarget aTarget, media::TimeUnit aEndTime); + RefPtr Seek(const SeekTarget& aTarget, + const media::TimeUnit& aEndTime); RefPtr UpdateBufferedWithPromise(); RefPtr Shutdown(); diff --git a/dom/media/MediaFormatReader.cpp b/dom/media/MediaFormatReader.cpp index 53761b9784cb..cca70a52a39c 100644 --- a/dom/media/MediaFormatReader.cpp +++ b/dom/media/MediaFormatReader.cpp @@ -1928,7 +1928,7 @@ MediaFormatReader::OnVideoSkipFailed(MediaTrackDemuxer::SkipFailureHolder aFailu } RefPtr -MediaFormatReader::Seek(SeekTarget aTarget, int64_t aUnused) +MediaFormatReader::Seek(const SeekTarget& aTarget, int64_t aUnused) { MOZ_ASSERT(OnTaskQueue()); @@ -1950,7 +1950,7 @@ MediaFormatReader::Seek(SeekTarget aTarget, int64_t aUnused) return SeekPromise::CreateAndReject(NS_ERROR_FAILURE, __func__); } - SetSeekTarget(Move(aTarget)); + SetSeekTarget(aTarget); RefPtr p = mSeekPromise.Ensure(__func__); diff --git a/dom/media/MediaFormatReader.h b/dom/media/MediaFormatReader.h index 962ff0b55274..7ae008df1b71 100644 --- a/dom/media/MediaFormatReader.h +++ b/dom/media/MediaFormatReader.h @@ -48,7 +48,7 @@ public: void ReadUpdatedMetadata(MediaInfo* aInfo) override; RefPtr - Seek(SeekTarget aTarget, int64_t aUnused) override; + Seek(const SeekTarget& aTarget, int64_t aUnused) override; protected: void NotifyDataArrivedInternal() override; diff --git a/dom/media/android/AndroidMediaReader.cpp b/dom/media/android/AndroidMediaReader.cpp index 5dbd538885fb..c5333f8345ca 100644 --- a/dom/media/android/AndroidMediaReader.cpp +++ b/dom/media/android/AndroidMediaReader.cpp @@ -314,7 +314,7 @@ bool AndroidMediaReader::DecodeAudioData() } RefPtr -AndroidMediaReader::Seek(SeekTarget aTarget, int64_t aEndTime) +AndroidMediaReader::Seek(const SeekTarget& aTarget, int64_t aEndTime) { MOZ_ASSERT(OnTaskQueue()); diff --git a/dom/media/android/AndroidMediaReader.h b/dom/media/android/AndroidMediaReader.h index def85a343bd1..acf34bd675d8 100644 --- a/dom/media/android/AndroidMediaReader.h +++ b/dom/media/android/AndroidMediaReader.h @@ -48,7 +48,7 @@ public: bool DecodeVideoFrame(bool &aKeyframeSkip, int64_t aTimeThreshold) override; nsresult ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) override; - RefPtr Seek(SeekTarget aTarget, int64_t aEndTime) override; + RefPtr Seek(const SeekTarget& aTarget, int64_t aEndTime) override; RefPtr Shutdown() override; diff --git a/dom/media/directshow/DirectShowReader.cpp b/dom/media/directshow/DirectShowReader.cpp index cacf6f8de8ed..ba27548b60f8 100644 --- a/dom/media/directshow/DirectShowReader.cpp +++ b/dom/media/directshow/DirectShowReader.cpp @@ -320,7 +320,7 @@ DirectShowReader::DecodeVideoFrame(bool &aKeyframeSkip, } RefPtr -DirectShowReader::Seek(SeekTarget aTarget, int64_t aEndTime) +DirectShowReader::Seek(const SeekTarget& aTarget, int64_t aEndTime) { nsresult res = SeekInternal(aTarget.GetTime().ToMicroseconds()); if (NS_FAILED(res)) { diff --git a/dom/media/directshow/DirectShowReader.h b/dom/media/directshow/DirectShowReader.h index e1326d416e36..b165f0939190 100644 --- a/dom/media/directshow/DirectShowReader.h +++ b/dom/media/directshow/DirectShowReader.h @@ -58,7 +58,7 @@ public: MetadataTags** aTags) override; RefPtr - Seek(SeekTarget aTarget, int64_t aEndTime) override; + Seek(const SeekTarget& aTarget, int64_t aEndTime) override; static const GUID CLSID_MPEG_LAYER_3_DECODER_FILTER;