Bug 1509548 - Rename track-end-time methods in StreamTracks. r=padenot
authorAndreas Pehrson <apehrson@mozilla.com>
Thu, 29 Nov 2018 17:37:17 +0000
changeset 505193 8a064f0dbb2f09c589514f71b06e37ed36362cd1
parent 505192 1d1b47e235375f3a52faafe37a2e560a98c5b51f
child 505194 dfde7b2c53a63c1fbeb90f984f912c8fd73da623
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1509548
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1509548 - Rename track-end-time methods in StreamTracks. r=padenot They deserve descriptive names. Differential Revision: https://phabricator.services.mozilla.com/D12925
dom/media/MediaStreamGraph.cpp
dom/media/MediaStreamGraph.h
dom/media/StreamTracks.cpp
dom/media/StreamTracks.h
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -191,17 +191,17 @@ void MediaStreamGraphImpl::UpdateCurrent
         }
       }
     }
 
     // The stream is fully finished when all of its track data has been played
     // out.
     if (stream->mFinished && !stream->mNotifiedFinished &&
         mProcessedTime >= stream->StreamTimeToGraphTime(
-                              stream->GetStreamTracks().GetAllTracksEnd())) {
+                              stream->GetStreamTracks().GetLatestTrackEnd())) {
       stream->mNotifiedFinished = true;
       SetStreamOrderDirty();
     }
   }
 }
 
 template <typename C, typename Chunk>
 void MediaStreamGraphImpl::ProcessChunkMetadataForInterval(MediaStream* aStream,
@@ -1195,17 +1195,17 @@ void MediaStreamGraphImpl::UpdateGraph(G
     if (SourceMediaStream* is = stream->AsSourceStream()) {
       ensureNextIteration |= is->PullNewData(aEndBlockingDecisions);
       is->ExtractPendingInput(mStateComputedTime);
     }
     if (stream->mFinished) {
       // The stream's not suspended, and since it's finished, underruns won't
       // stop it playing out. So there's no blocking other than what we impose
       // here.
-      GraphTime endTime = stream->GetStreamTracks().GetAllTracksEnd() +
+      GraphTime endTime = stream->GetStreamTracks().GetLatestTrackEnd() +
                           stream->mTracksStartTime;
       if (endTime <= mStateComputedTime) {
         LOG(LogLevel::Verbose,
             ("%p: MediaStream %p is blocked due to being finished", this,
              stream));
         stream->mStartBlocking = mStateComputedTime;
       } else {
         LOG(LogLevel::Verbose,
@@ -1302,17 +1302,17 @@ void MediaStreamGraphImpl::Process() {
           // Since an AudioNodeStream is present, go ahead and
           // produce audio block by block for all the rest of the streams.
           ProduceDataForStreamsBlockByBlock(i, n->SampleRate());
           doneAllProducing = true;
         } else {
           ps->ProcessInput(mProcessedTime, mStateComputedTime,
                            ProcessedMediaStream::ALLOW_FINISH);
           NS_ASSERTION(
-              stream->mTracks.GetEnd() >=
+              stream->mTracks.GetEarliestTrackEnd() >=
                   GraphTimeToStreamTimeWithBlocking(stream, mStateComputedTime),
               "Stream did not produce enough data");
         }
       }
     }
     // Only playback audio and video in real-time mode
     if (mRealtime) {
       CreateOrDestroyAudioStreams(stream);
@@ -2515,17 +2515,17 @@ bool SourceMediaStream::PullNewData(Grap
   TRACE_AUDIO_CALLBACK_COMMENT("SourceMediaStream %p", this);
   MutexAutoLock lock(mMutex);
   if (!mPullEnabled || mFinished) {
     return false;
   }
   // Compute how much stream time we'll need assuming we don't block
   // the stream at all.
   StreamTime t = GraphTimeToStreamTime(aDesiredUpToTime);
-  StreamTime current = mTracks.GetEnd();
+  StreamTime current = mTracks.GetEarliestTrackEnd();
   LOG(LogLevel::Verbose,
       ("%p: Calling NotifyPull aStream=%p t=%f current end=%f", GraphImpl(),
        this, GraphImpl()->MediaTimeToSeconds(t),
        GraphImpl()->MediaTimeToSeconds(current)));
   if (t <= current) {
     return false;
   }
   for (const TrackData& track : mUpdateTracks) {
@@ -2596,17 +2596,17 @@ void SourceMediaStream::ExtractPendingIn
       dest->AppendFrom(data->mData);
     }
     if (data->mCommands & SourceMediaStream::TRACK_END) {
       mTracks.FindTrack(data->mID)->SetEnded();
       mUpdateTracks.RemoveElementAt(i);
     }
   }
 
-  if (mTracks.GetEnd() > 0) {
+  if (mTracks.GetEarliestTrackEnd() > 0) {
     mHasCurrentData = true;
   }
 
   if (finished) {
     FinishOnGraphThread();
   }
 }
 
--- a/dom/media/MediaStreamGraph.h
+++ b/dom/media/MediaStreamGraph.h
@@ -415,17 +415,17 @@ class MediaStream : public mozilla::Link
 
   // These Impl methods perform the core functionality of the control methods
   // above, on the media graph thread.
   /**
    * Stop all stream activity and disconnect it from all inputs and outputs.
    * This must be idempotent.
    */
   virtual void DestroyImpl();
-  StreamTime GetTracksEnd() const { return mTracks.GetEnd(); }
+  StreamTime GetTracksEnd() const { return mTracks.GetEarliestTrackEnd(); }
 #ifdef DEBUG
   void DumpTrackInfo() const { return mTracks.DumpTrackInfo(); }
 #endif
   void SetAudioOutputVolumeImpl(void* aKey, float aVolume);
   void AddAudioOutputImpl(void* aKey);
   void RemoveAudioOutputImpl(void* aKey);
   void AddVideoOutputImpl(already_AddRefed<MediaStreamVideoSink> aSink,
                           TrackID aID);
--- a/dom/media/StreamTracks.cpp
+++ b/dom/media/StreamTracks.cpp
@@ -23,32 +23,28 @@ void StreamTracks::DumpTrackInfo() const
     } else {
       STREAM_LOG(LogLevel::Info, ("Track[%d] %d: %" PRId64 "", i,
                                   track->GetID(), track->GetEnd()));
     }
   }
 }
 #endif
 
-StreamTime StreamTracks::GetEnd() const {
-  StreamTime t = mTracksKnownTime;
+StreamTime StreamTracks::GetEarliestTrackEnd() const {
+  StreamTime t = STREAM_TIME_MAX;
   for (uint32_t i = 0; i < mTracks.Length(); ++i) {
     Track* track = mTracks[i];
     if (!track->IsEnded()) {
       t = std::min(t, track->GetEnd());
     }
   }
   return t;
 }
 
-StreamTime StreamTracks::GetAllTracksEnd() const {
-  if (mTracksKnownTime < STREAM_TIME_MAX) {
-    // A track might be added.
-    return STREAM_TIME_MAX;
-  }
+StreamTime StreamTracks::GetLatestTrackEnd() const {
   StreamTime t = 0;
   for (uint32_t i = 0; i < mTracks.Length(); ++i) {
     Track* track = mTracks[i];
     if (!track->IsEnded()) {
       return STREAM_TIME_MAX;
     }
     t = std::max(t, track->GetEnd());
   }
--- a/dom/media/StreamTracks.h
+++ b/dom/media/StreamTracks.h
@@ -195,24 +195,24 @@ class StreamTracks {
 
     return *track;
   }
 
   /**
    * The end time for the StreamTracks is the latest time for which we have
    * data for all tracks that haven't ended by that time.
    */
-  StreamTime GetEnd() const;
+  StreamTime GetEarliestTrackEnd() const;
 
   /**
    * Returns the earliest time >= 0 at which all tracks have ended and all
    * their data has been played out, or STREAM_TIME_MAX if there is no such
    * time.
    */
-  StreamTime GetAllTracksEnd() const;
+  StreamTime GetLatestTrackEnd() const;
 
 #ifdef DEBUG
   void DumpTrackInfo() const;
 #endif
 
   Track* FindTrack(TrackID aID) const;
 
   class MOZ_STACK_CLASS TrackIter final {