Bug 1313497 - Pass TimeUnit by const& in MediaDataDemuxer - r=jya
authorGerald Squelart <gsquelart@mozilla.com>
Sun, 13 Nov 2016 15:13:51 +1100
changeset 324377 b1f632851ee526fbaad66a10bb03ece4df7c3ce1
parent 324376 3583f85c09d443c0759d65efc3a5aba9806f4a09
child 324378 87a0350cf96f2d74023daca71132cdd25056f285
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersjya
bugs1313497
milestone53.0a1
Bug 1313497 - Pass TimeUnit by const& in MediaDataDemuxer - r=jya Thanks to the previous patch, MediaDataDemuxer::Seek and SkipToNextRandomAccessPoint (and all overrides in derived demuxers) can now take their TimeUnit parameter by const&. MozReview-Commit-ID: 6CqfjAXZ7Yk
dom/media/ADTSDemuxer.cpp
dom/media/ADTSDemuxer.h
dom/media/MP3Demuxer.cpp
dom/media/MP3Demuxer.h
dom/media/MediaDataDemuxer.h
dom/media/flac/FlacDemuxer.cpp
dom/media/flac/FlacDemuxer.h
dom/media/fmp4/MP4Demuxer.cpp
dom/media/mediasource/MediaSourceDemuxer.cpp
dom/media/mediasource/MediaSourceDemuxer.h
dom/media/ogg/OggDemuxer.cpp
dom/media/ogg/OggDemuxer.h
dom/media/wave/WaveDemuxer.cpp
dom/media/wave/WaveDemuxer.h
dom/media/webm/WebMDemuxer.cpp
dom/media/webm/WebMDemuxer.h
--- a/dom/media/ADTSDemuxer.cpp
+++ b/dom/media/ADTSDemuxer.cpp
@@ -428,17 +428,17 @@ ADTSTrackDemuxer::Init()
 
 UniquePtr<TrackInfo>
 ADTSTrackDemuxer::GetInfo() const
 {
   return mInfo->Clone();
 }
 
 RefPtr<ADTSTrackDemuxer::SeekPromise>
-ADTSTrackDemuxer::Seek(media::TimeUnit aTime)
+ADTSTrackDemuxer::Seek(const media::TimeUnit& aTime)
 {
   // Efficiently seek to the position.
   FastSeek(aTime);
   // Correct seek position by scanning the next frames.
   const media::TimeUnit seekTime = ScanUntil(aTime);
 
   return SeekPromise::CreateAndResolve(seekTime, __func__);
 }
@@ -550,17 +550,17 @@ ADTSTrackDemuxer::Reset()
   MOZ_ASSERT(mParser);
   if (mParser) {
     mParser->Reset();
   }
   FastSeek(media::TimeUnit());
 }
 
 RefPtr<ADTSTrackDemuxer::SkipAccessPointPromise>
-ADTSTrackDemuxer::SkipToNextRandomAccessPoint(media::TimeUnit aTimeThreshold)
+ADTSTrackDemuxer::SkipToNextRandomAccessPoint(const media::TimeUnit& aTimeThreshold)
 {
   // Will not be called for audio-only resources.
   return SkipAccessPointPromise::CreateAndReject(
     SkipFailureHolder(NS_ERROR_DOM_MEDIA_DEMUXER_ERR, 0), __func__);
 }
 
 int64_t
 ADTSTrackDemuxer::GetResourceOffset() const
--- a/dom/media/ADTSDemuxer.h
+++ b/dom/media/ADTSDemuxer.h
@@ -55,21 +55,21 @@ public:
   media::TimeUnit Duration() const;
 
   // Returns the estimated duration up to the given frame number,
   // or a 0-duration if unknown.
   media::TimeUnit Duration(int64_t aNumFrames) const;
 
   // MediaTrackDemuxer interface.
   UniquePtr<TrackInfo> GetInfo() const override;
-  RefPtr<SeekPromise> Seek(media::TimeUnit aTime) override;
+  RefPtr<SeekPromise> Seek(const media::TimeUnit& aTime) override;
   RefPtr<SamplesPromise> GetSamples(int32_t aNumSamples = 1) override;
   void Reset() override;
   RefPtr<SkipAccessPointPromise> SkipToNextRandomAccessPoint(
-    media::TimeUnit aTimeThreshold) override;
+    const media::TimeUnit& aTimeThreshold) override;
   int64_t GetResourceOffset() const override;
   media::TimeIntervals GetBuffered() override;
 
 private:
   // Destructor.
   ~ADTSTrackDemuxer();
 
   // Fast approximate seeking to given time.
--- a/dom/media/MP3Demuxer.cpp
+++ b/dom/media/MP3Demuxer.cpp
@@ -180,17 +180,17 @@ MP3TrackDemuxer::VBRInfo() const {
 }
 
 UniquePtr<TrackInfo>
 MP3TrackDemuxer::GetInfo() const {
   return mInfo->Clone();
 }
 
 RefPtr<MP3TrackDemuxer::SeekPromise>
-MP3TrackDemuxer::Seek(TimeUnit aTime) {
+MP3TrackDemuxer::Seek(const TimeUnit& aTime) {
   // Efficiently seek to the position.
   FastSeek(aTime);
   // Correct seek position by scanning the next frames.
   const TimeUnit seekTime = ScanUntil(aTime);
 
   return SeekPromise::CreateAndResolve(seekTime, __func__);
 }
 
@@ -309,17 +309,17 @@ void
 MP3TrackDemuxer::Reset() {
   MP3LOG("Reset()");
 
   FastSeek(TimeUnit());
   mParser.Reset();
 }
 
 RefPtr<MP3TrackDemuxer::SkipAccessPointPromise>
-MP3TrackDemuxer::SkipToNextRandomAccessPoint(TimeUnit aTimeThreshold) {
+MP3TrackDemuxer::SkipToNextRandomAccessPoint(const TimeUnit& aTimeThreshold) {
   // Will not be called for audio-only resources.
   return SkipAccessPointPromise::CreateAndReject(
     SkipFailureHolder(NS_ERROR_DOM_MEDIA_DEMUXER_ERR, 0), __func__);
 }
 
 int64_t
 MP3TrackDemuxer::GetResourceOffset() const {
   return mOffset;
--- a/dom/media/MP3Demuxer.h
+++ b/dom/media/MP3Demuxer.h
@@ -378,21 +378,21 @@ public:
   const FrameParser::Frame& LastFrame() const;
   RefPtr<MediaRawData> DemuxSample();
 
   const ID3Parser::ID3Header& ID3Header() const;
   const FrameParser::VBRHeader& VBRInfo() const;
 
   // MediaTrackDemuxer interface.
   UniquePtr<TrackInfo> GetInfo() const override;
-  RefPtr<SeekPromise> Seek(media::TimeUnit aTime) override;
+  RefPtr<SeekPromise> Seek(const media::TimeUnit& aTime) override;
   RefPtr<SamplesPromise> GetSamples(int32_t aNumSamples = 1) override;
   void Reset() override;
   RefPtr<SkipAccessPointPromise> SkipToNextRandomAccessPoint(
-    media::TimeUnit aTimeThreshold) override;
+    const media::TimeUnit& aTimeThreshold) override;
   int64_t GetResourceOffset() const override;
   media::TimeIntervals GetBuffered() override;
 
 private:
   // Destructor.
   ~MP3TrackDemuxer() {}
 
   // Fast approximate seeking to given time.
--- a/dom/media/MediaDataDemuxer.h
+++ b/dom/media/MediaDataDemuxer.h
@@ -127,17 +127,17 @@ public:
   // The TrackInfo returned will be:
   // TrackInfo::kVideoTrack -> VideoInfo.
   // TrackInfo::kAudioTrack -> AudioInfo.
   // respectively.
   virtual UniquePtr<TrackInfo> GetInfo() const = 0;
 
   // Seeks to aTime. Upon success, SeekPromise will be resolved with the
   // actual time seeked to. Typically the random access point time
-  virtual RefPtr<SeekPromise> Seek(media::TimeUnit aTime) = 0;
+  virtual RefPtr<SeekPromise> Seek(const media::TimeUnit& aTime) = 0;
 
   // Returns the next aNumSamples sample(s) available.
   // If only a lesser amount of samples is available, only those will be
   // returned.
   // A aNumSamples value of -1 indicates to return all remaining samples.
   // A video sample is typically made of a single video frame while an audio
   // sample will contains multiple audio frames.
   virtual RefPtr<SamplesPromise> GetSamples(int32_t aNumSamples = 1) = 0;
@@ -171,17 +171,18 @@ public:
     return NS_ERROR_NOT_IMPLEMENTED;
   }
 
   // Skip frames until the next Random Access Point located after
   // aTimeThreshold.
   // The first frame returned by the next call to GetSamples() will be the
   // first random access point found after aTimeThreshold.
   // Upon success, returns the number of frames skipped.
-  virtual RefPtr<SkipAccessPointPromise> SkipToNextRandomAccessPoint(media::TimeUnit aTimeThreshold) = 0;
+  virtual RefPtr<SkipAccessPointPromise>
+  SkipToNextRandomAccessPoint(const media::TimeUnit& aTimeThreshold) = 0;
 
   // Gets the resource's offset used for the last Seek() or GetSample().
   // A negative value indicates that this functionality isn't supported.
   virtual int64_t GetResourceOffset() const
   {
     return -1;
   }
 
--- a/dom/media/flac/FlacDemuxer.cpp
+++ b/dom/media/flac/FlacDemuxer.cpp
@@ -717,17 +717,17 @@ bool
 FlacTrackDemuxer::IsSeekable() const
 {
   // For now we only allow seeking if a STREAMINFO block was found and with
   // a known number of samples (duration is set).
   return mParser->Info().IsValid() && mParser->Info().mDuration;
 }
 
 RefPtr<FlacTrackDemuxer::SeekPromise>
-FlacTrackDemuxer::Seek(TimeUnit aTime)
+FlacTrackDemuxer::Seek(const TimeUnit& aTime)
 {
   // Efficiently seek to the position.
   FastSeek(aTime);
   // Correct seek position by scanning the next frames.
   const TimeUnit seekTime = ScanUntil(aTime);
 
   return SeekPromise::CreateAndResolve(seekTime, __func__);
 }
@@ -890,17 +890,17 @@ FlacTrackDemuxer::Reset()
     mSource.Seek(SEEK_SET, mParser->FirstFrame().Offset());
   } else {
     mSource.Seek(SEEK_SET, 0);
   }
   mParser->EndFrameSession();
 }
 
 RefPtr<FlacTrackDemuxer::SkipAccessPointPromise>
-FlacTrackDemuxer::SkipToNextRandomAccessPoint(TimeUnit aTimeThreshold)
+FlacTrackDemuxer::SkipToNextRandomAccessPoint(const TimeUnit& aTimeThreshold)
 {
   // Will not be called for audio-only resources.
   return SkipAccessPointPromise::CreateAndReject(
     SkipFailureHolder(NS_ERROR_DOM_MEDIA_DEMUXER_ERR, 0), __func__);
 }
 
 int64_t
 FlacTrackDemuxer::GetResourceOffset() const
--- a/dom/media/flac/FlacDemuxer.h
+++ b/dom/media/flac/FlacDemuxer.h
@@ -45,23 +45,23 @@ public:
   explicit FlacTrackDemuxer(MediaResource* aSource);
 
   // Initializes the track demuxer by reading the first frame for meta data.
   // Returns initialization success state.
   bool Init();
 
   // MediaTrackDemuxer interface.
   UniquePtr<TrackInfo> GetInfo() const override;
-  RefPtr<SeekPromise> Seek(media::TimeUnit aTime) override;
+  RefPtr<SeekPromise> Seek(const media::TimeUnit& aTime) override;
   RefPtr<SamplesPromise> GetSamples(int32_t aNumSamples = 1) override;
   void Reset() override;
   int64_t GetResourceOffset() const override;
   media::TimeIntervals GetBuffered() override;
   RefPtr<SkipAccessPointPromise> SkipToNextRandomAccessPoint(
-    media::TimeUnit aTimeThreshold) override;
+    const media::TimeUnit& aTimeThreshold) override;
 
   bool IsSeekable() const;
 
 private:
   // Destructor.
   ~FlacTrackDemuxer();
 
   // Returns the estimated stream duration, or a 0-duration if unknown.
--- a/dom/media/fmp4/MP4Demuxer.cpp
+++ b/dom/media/fmp4/MP4Demuxer.cpp
@@ -36,25 +36,26 @@ class MP4TrackDemuxer : public MediaTrac
 {
 public:
   MP4TrackDemuxer(MP4Demuxer* aParent,
                   UniquePtr<TrackInfo>&& aInfo,
                   const nsTArray<mp4_demuxer::Index::Indice>& indices);
 
   UniquePtr<TrackInfo> GetInfo() const override;
 
-  RefPtr<SeekPromise> Seek(media::TimeUnit aTime) override;
+  RefPtr<SeekPromise> Seek(const media::TimeUnit& aTime) override;
 
   RefPtr<SamplesPromise> GetSamples(int32_t aNumSamples = 1) override;
 
   void Reset() override;
 
   nsresult GetNextRandomAccessPoint(media::TimeUnit* aTime) override;
 
-  RefPtr<SkipAccessPointPromise> SkipToNextRandomAccessPoint(media::TimeUnit aTimeThreshold) override;
+  RefPtr<SkipAccessPointPromise>
+  SkipToNextRandomAccessPoint(const media::TimeUnit& aTimeThreshold) override;
 
   media::TimeIntervals GetBuffered() override;
 
   void BreakCycles() override;
 
 private:
   friend class MP4Demuxer;
   void NotifyDataArrived();
@@ -281,17 +282,17 @@ MP4TrackDemuxer::EnsureUpToDateIndex()
   if (NS_FAILED(rv)) {
     return;
   }
   mIndex->UpdateMoofIndex(byteRanges);
   mNeedReIndex = false;
 }
 
 RefPtr<MP4TrackDemuxer::SeekPromise>
-MP4TrackDemuxer::Seek(media::TimeUnit aTime)
+MP4TrackDemuxer::Seek(const media::TimeUnit& aTime)
 {
   int64_t seekTime = aTime.ToMicroseconds();
   mQueuedSample = nullptr;
 
   mIterator->Seek(seekTime);
 
   // Check what time we actually seeked to.
   RefPtr<MediaRawData> sample;
@@ -438,17 +439,17 @@ MP4TrackDemuxer::GetNextRandomAccessPoin
       media::TimeUnit::FromMicroseconds(std::numeric_limits<int64_t>::max());
   } else {
     *aTime = mNextKeyframeTime.value();
   }
   return NS_OK;
 }
 
 RefPtr<MP4TrackDemuxer::SkipAccessPointPromise>
-MP4TrackDemuxer::SkipToNextRandomAccessPoint(media::TimeUnit aTimeThreshold)
+MP4TrackDemuxer::SkipToNextRandomAccessPoint(const media::TimeUnit& aTimeThreshold)
 {
   mQueuedSample = nullptr;
   // Loop until we reach the next keyframe after the threshold.
   uint32_t parsed = 0;
   bool found = false;
   RefPtr<MediaRawData> sample;
   while (!found && (sample = GetNextSample())) {
     parsed++;
--- a/dom/media/mediasource/MediaSourceDemuxer.cpp
+++ b/dom/media/mediasource/MediaSourceDemuxer.cpp
@@ -299,17 +299,17 @@ MediaSourceTrackDemuxer::MediaSourceTrac
 
 UniquePtr<TrackInfo>
 MediaSourceTrackDemuxer::GetInfo() const
 {
   return mParent->GetTrackInfo(mType)->Clone();
 }
 
 RefPtr<MediaSourceTrackDemuxer::SeekPromise>
-MediaSourceTrackDemuxer::Seek(media::TimeUnit aTime)
+MediaSourceTrackDemuxer::Seek(const media::TimeUnit& aTime)
 {
   MOZ_ASSERT(mParent, "Called after BreackCycle()");
   return InvokeAsync<media::TimeUnit&&>(
            mParent->GetTaskQueue(), this, __func__,
            &MediaSourceTrackDemuxer::DoSeek, aTime);
 }
 
 RefPtr<MediaSourceTrackDemuxer::SamplesPromise>
@@ -344,17 +344,17 @@ nsresult
 MediaSourceTrackDemuxer::GetNextRandomAccessPoint(media::TimeUnit* aTime)
 {
   MonitorAutoLock mon(mMonitor);
   *aTime = mNextRandomAccessPoint;
   return NS_OK;
 }
 
 RefPtr<MediaSourceTrackDemuxer::SkipAccessPointPromise>
-MediaSourceTrackDemuxer::SkipToNextRandomAccessPoint(media::TimeUnit aTimeThreshold)
+MediaSourceTrackDemuxer::SkipToNextRandomAccessPoint(const media::TimeUnit& aTimeThreshold)
 {
   return InvokeAsync<media::TimeUnit&&>(
            mParent->GetTaskQueue(), this, __func__,
            &MediaSourceTrackDemuxer::DoSkipToNextRandomAccessPoint,
            aTimeThreshold);
 }
 
 media::TimeIntervals
--- a/dom/media/mediasource/MediaSourceDemuxer.h
+++ b/dom/media/mediasource/MediaSourceDemuxer.h
@@ -91,25 +91,25 @@ class MediaSourceTrackDemuxer : public M
 {
 public:
   MediaSourceTrackDemuxer(MediaSourceDemuxer* aParent,
                           TrackInfo::TrackType aType,
                           TrackBuffersManager* aManager);
 
   UniquePtr<TrackInfo> GetInfo() const override;
 
-  RefPtr<SeekPromise> Seek(media::TimeUnit aTime) override;
+  RefPtr<SeekPromise> Seek(const media::TimeUnit& aTime) override;
 
   RefPtr<SamplesPromise> GetSamples(int32_t aNumSamples = 1) override;
 
   void Reset() override;
 
   nsresult GetNextRandomAccessPoint(media::TimeUnit* aTime) override;
 
-  RefPtr<SkipAccessPointPromise> SkipToNextRandomAccessPoint(media::TimeUnit aTimeThreshold) override;
+  RefPtr<SkipAccessPointPromise> SkipToNextRandomAccessPoint(const media::TimeUnit& aTimeThreshold) override;
 
   media::TimeIntervals GetBuffered() override;
 
   void BreakCycles() override;
 
   bool GetSamplesMayBlock() const override
   {
     return false;
--- a/dom/media/ogg/OggDemuxer.cpp
+++ b/dom/media/ogg/OggDemuxer.cpp
@@ -1455,17 +1455,17 @@ OggTrackDemuxer::~OggTrackDemuxer()
 
 UniquePtr<TrackInfo>
 OggTrackDemuxer::GetInfo() const
 {
   return mInfo->Clone();
 }
 
 RefPtr<OggTrackDemuxer::SeekPromise>
-OggTrackDemuxer::Seek(TimeUnit aTime)
+OggTrackDemuxer::Seek(const TimeUnit& aTime)
 {
   // Seeks to aTime. Upon success, SeekPromise will be resolved with the
   // actual time seeked to. Typically the random access point time
   mQueuedSample = nullptr;
   TimeUnit seekTime = aTime;
   if (mParent->SeekInternal(mType, aTime) == NS_OK) {
     RefPtr<MediaRawData> sample(NextSample());
 
@@ -1533,17 +1533,17 @@ OggTrackDemuxer::GetSamples(int32_t aNum
 void
 OggTrackDemuxer::Reset()
 {
   mParent->Reset(mType);
   mQueuedSample = nullptr;
 }
 
 RefPtr<OggTrackDemuxer::SkipAccessPointPromise>
-OggTrackDemuxer::SkipToNextRandomAccessPoint(TimeUnit aTimeThreshold)
+OggTrackDemuxer::SkipToNextRandomAccessPoint(const TimeUnit& aTimeThreshold)
 {
   uint32_t parsed = 0;
   bool found = false;
   RefPtr<MediaRawData> sample;
 
   OGG_DEBUG("TimeThreshold: %f", aTimeThreshold.ToSeconds());
   while (!found && (sample = NextSample())) {
     parsed++;
--- a/dom/media/ogg/OggDemuxer.h
+++ b/dom/media/ogg/OggDemuxer.h
@@ -347,23 +347,23 @@ class OggTrackDemuxer : public MediaTrac
 {
 public:
   OggTrackDemuxer(OggDemuxer* aParent,
                   TrackInfo::TrackType aType,
                   uint32_t aTrackNumber);
 
   UniquePtr<TrackInfo> GetInfo() const override;
 
-  RefPtr<SeekPromise> Seek(media::TimeUnit aTime) override;
+  RefPtr<SeekPromise> Seek(const media::TimeUnit& aTime) override;
 
   RefPtr<SamplesPromise> GetSamples(int32_t aNumSamples = 1) override;
 
   void Reset() override;
 
-  RefPtr<SkipAccessPointPromise> SkipToNextRandomAccessPoint(media::TimeUnit aTimeThreshold) override;
+  RefPtr<SkipAccessPointPromise> SkipToNextRandomAccessPoint(const media::TimeUnit& aTimeThreshold) override;
 
   media::TimeIntervals GetBuffered() override;
 
   void BreakCycles() override;
 
 private:
   ~OggTrackDemuxer();
   void SetNextKeyFrameTime();
--- a/dom/media/wave/WaveDemuxer.cpp
+++ b/dom/media/wave/WaveDemuxer.cpp
@@ -296,17 +296,17 @@ WAVTrackDemuxer::DemuxSample()
 
 UniquePtr<TrackInfo>
 WAVTrackDemuxer::GetInfo() const
 {
   return mInfo->Clone();
 }
 
 RefPtr<WAVTrackDemuxer::SeekPromise>
-WAVTrackDemuxer::Seek(TimeUnit aTime)
+WAVTrackDemuxer::Seek(const TimeUnit& aTime)
 {
   FastSeek(aTime);
   const TimeUnit seekTime = ScanUntil(aTime);
   return SeekPromise::CreateAndResolve(seekTime, __func__);
 }
 
 TimeUnit
 WAVTrackDemuxer::FastSeek(const TimeUnit& aTime)
@@ -369,17 +369,17 @@ WAVTrackDemuxer::Reset()
   FastSeek(TimeUnit());
   mParser.Reset();
   mHeaderParser.Reset();
   mRIFFParser.Reset();
   mFmtParser.Reset();
 }
 
 RefPtr<WAVTrackDemuxer::SkipAccessPointPromise>
-WAVTrackDemuxer::SkipToNextRandomAccessPoint(TimeUnit aTimeThreshold)
+WAVTrackDemuxer::SkipToNextRandomAccessPoint(const TimeUnit& aTimeThreshold)
 {
   return SkipAccessPointPromise::CreateAndReject(
     SkipFailureHolder(NS_ERROR_DOM_MEDIA_DEMUXER_ERR, 0), __func__);
 }
 
 int64_t
 WAVTrackDemuxer::GetResourceOffset() const
 {
--- a/dom/media/wave/WaveDemuxer.h
+++ b/dom/media/wave/WaveDemuxer.h
@@ -185,21 +185,21 @@ public:
   media::TimeUnit DurationFromBytes(uint32_t aNumBytes) const;
 
   media::TimeUnit SeekPosition() const;
 
   RefPtr<MediaRawData> DemuxSample();
 
   // MediaTrackDemuxer interface.
   UniquePtr<TrackInfo> GetInfo() const override;
-  RefPtr<SeekPromise> Seek(media::TimeUnit aTime) override;
+  RefPtr<SeekPromise> Seek(const media::TimeUnit& aTime) override;
   RefPtr<SamplesPromise> GetSamples(int32_t aNumSamples) override;
   void Reset() override;
   RefPtr<SkipAccessPointPromise> SkipToNextRandomAccessPoint(
-    media::TimeUnit aTimeThreshold) override;
+    const media::TimeUnit& aTimeThreshold) override;
   int64_t GetResourceOffset() const override;
   media::TimeIntervals GetBuffered() override;
 
 private:
   ~WAVTrackDemuxer() {}
 
   media::TimeUnit FastSeek(const media::TimeUnit& aTime);
   media::TimeUnit ScanUntil(const media::TimeUnit& aTime);
--- a/dom/media/webm/WebMDemuxer.cpp
+++ b/dom/media/webm/WebMDemuxer.cpp
@@ -914,17 +914,17 @@ WebMTrackDemuxer::~WebMTrackDemuxer()
 
 UniquePtr<TrackInfo>
 WebMTrackDemuxer::GetInfo() const
 {
   return mInfo->Clone();
 }
 
 RefPtr<WebMTrackDemuxer::SeekPromise>
-WebMTrackDemuxer::Seek(media::TimeUnit aTime)
+WebMTrackDemuxer::Seek(const media::TimeUnit& aTime)
 {
   // Seeks to aTime. Upon success, SeekPromise will be resolved with the
   // actual time seeked to. Typically the random access point time
 
   media::TimeUnit seekTime = aTime;
   mSamples.Reset();
   mParent->SeekInternal(mType, aTime);
   mParent->GetNextPacket(mType, &mSamples);
@@ -1078,17 +1078,17 @@ WebMTrackDemuxer::GetNextRandomAccessPoi
       media::TimeUnit::FromMicroseconds(std::numeric_limits<int64_t>::max());
   } else {
     *aTime = mNextKeyframeTime.ref();
   }
   return NS_OK;
 }
 
 RefPtr<WebMTrackDemuxer::SkipAccessPointPromise>
-WebMTrackDemuxer::SkipToNextRandomAccessPoint(media::TimeUnit aTimeThreshold)
+WebMTrackDemuxer::SkipToNextRandomAccessPoint(const media::TimeUnit& aTimeThreshold)
 {
   uint32_t parsed = 0;
   bool found = false;
   RefPtr<MediaRawData> sample;
   int64_t sampleTime;
 
   WEBM_DEBUG("TimeThreshold: %f", aTimeThreshold.ToSeconds());
   while (!found && (sample = NextSample())) {
--- a/dom/media/webm/WebMDemuxer.h
+++ b/dom/media/webm/WebMDemuxer.h
@@ -250,25 +250,25 @@ class WebMTrackDemuxer : public MediaTra
 {
 public:
   WebMTrackDemuxer(WebMDemuxer* aParent,
                   TrackInfo::TrackType aType,
                   uint32_t aTrackNumber);
 
   UniquePtr<TrackInfo> GetInfo() const override;
 
-  RefPtr<SeekPromise> Seek(media::TimeUnit aTime) override;
+  RefPtr<SeekPromise> Seek(const media::TimeUnit& aTime) override;
 
   RefPtr<SamplesPromise> GetSamples(int32_t aNumSamples = 1) override;
 
   void Reset() override;
 
   nsresult GetNextRandomAccessPoint(media::TimeUnit* aTime) override;
 
-  RefPtr<SkipAccessPointPromise> SkipToNextRandomAccessPoint(media::TimeUnit aTimeThreshold) override;
+  RefPtr<SkipAccessPointPromise> SkipToNextRandomAccessPoint(const media::TimeUnit& aTimeThreshold) override;
 
   media::TimeIntervals GetBuffered() override;
 
   int64_t GetEvictionOffset(const media::TimeUnit& aTime) override;
 
   void BreakCycles() override;
 
 private: