Bug 1572627 expose ProcessedTime() as a graph-global time updated after processing all tracks r=padenot
authorKarl Tomlinson <karlt+@karlt.net>
Thu, 21 Nov 2019 13:43:04 +0000
changeset 503398 75a9f4f8b4908f53e2b315f1475acfa15f48575e
parent 503397 e1838026425e8ac7b2b204f16165d4232a0e26ca
child 503399 29ecee49005452f5b675b8a2a6eccd2ffa9239a2
push id101299
push userktomlinson@mozilla.com
push dateFri, 22 Nov 2019 15:33:37 +0000
treeherderautoland@29ecee490054 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1572627
milestone72.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 1572627 expose ProcessedTime() as a graph-global time updated after processing all tracks r=padenot This is similar to [[current frame]] in Web Audio, but is in GraphTime, not AudioContext-specific time. Depends on D54083 Differential Revision: https://phabricator.services.mozilla.com/D54084
dom/media/MediaTrackGraph.cpp
dom/media/MediaTrackGraph.h
--- a/dom/media/MediaTrackGraph.cpp
+++ b/dom/media/MediaTrackGraph.cpp
@@ -3624,9 +3624,14 @@ void MediaTrackGraph::DispatchToMainThre
       ->mPendingUpdateRunnables.AppendElement(std::move(aRunnable));
 }
 
 Watchable<mozilla::GraphTime>& MediaTrackGraphImpl::CurrentTime() {
   MOZ_ASSERT(NS_IsMainThread());
   return mMainThreadGraphTime;
 }
 
+GraphTime MediaTrackGraph::ProcessedTime() const {
+  AssertOnGraphThreadOrNotRunning();
+  return static_cast<const MediaTrackGraphImpl*>(this)->mProcessedTime;
+}
+
 }  // namespace mozilla
--- a/dom/media/MediaTrackGraph.h
+++ b/dom/media/MediaTrackGraph.h
@@ -1112,16 +1112,22 @@ class MediaTrackGraph {
   }
 
   /**
    * Returns a watchable of the graph's main-thread observable graph time.
    * Main thread only.
    */
   virtual Watchable<GraphTime>& CurrentTime() = 0;
 
+  /**
+   * Graph thread function to return the time at which all processing has been
+   * completed.  Some tracks may have performed processing beyond this time.
+   */
+  GraphTime ProcessedTime() const;
+
  protected:
   explicit MediaTrackGraph(TrackRate aSampleRate) : mSampleRate(aSampleRate) {
     MOZ_COUNT_CTOR(MediaTrackGraph);
   }
   virtual ~MediaTrackGraph() { MOZ_COUNT_DTOR(MediaTrackGraph); }
 
   // Intended only for assertions, either on graph thread or not running (in
   // which case we must be on the main thread).