Bug 1296531 - Expose GraphRate through DOMMediaStream. r=jesup
authorAndreas Pehrson <pehrsons@gmail.com>
Thu, 17 Nov 2016 09:57:02 +0100
changeset 383044 d59f3574e5e80f7389d698d71d802381ffb56cb9
parent 383043 2799df85e817e0d53d7eef0ec57830d45320aa1b
child 383045 38c52a4cbb77c66854adcd8c6876883a398d80be
push id95491
push userkwierso@gmail.com
push dateWed, 27 Sep 2017 00:14:56 +0000
treeherdermozilla-inbound@792d4db07bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs1296531
milestone58.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 1296531 - Expose GraphRate through DOMMediaStream. r=jesup MozReview-Commit-ID: 6kwuLiEgtDI
dom/media/DOMMediaStream.cpp
dom/media/DOMMediaStream.h
--- a/dom/media/DOMMediaStream.cpp
+++ b/dom/media/DOMMediaStream.cpp
@@ -860,16 +860,27 @@ DOMMediaStream::RemoveDirectListener(Dir
 }
 
 bool
 DOMMediaStream::IsFinished() const
 {
   return !mPlaybackStream || mPlaybackStream->IsFinished();
 }
 
+TrackRate
+DOMMediaStream::GraphRate()
+{
+  if (mPlaybackStream) { return mPlaybackStream->GraphRate(); }
+  if (mOwnedStream) { return mOwnedStream->GraphRate(); }
+  if (mInputStream) { return mInputStream->GraphRate(); }
+
+  MOZ_ASSERT(false, "Not hooked up to a graph");
+  return 0;
+}
+
 void
 DOMMediaStream::SetInactiveOnFinish()
 {
   mSetInactiveOnFinish = true;
 }
 
 void
 DOMMediaStream::InitSourceStream(MediaStreamGraph* aGraph)
--- a/dom/media/DOMMediaStream.h
+++ b/dom/media/DOMMediaStream.h
@@ -459,16 +459,18 @@ public:
    */
   bool IsFinished() const;
 
   /**
    * Becomes inactive only when the playback stream has finished.
    */
   void SetInactiveOnFinish();
 
+  TrackRate GraphRate();
+
   /**
    * Returns a principal indicating who may access this stream. The stream contents
    * can only be accessed by principals subsuming this principal.
    */
   nsIPrincipal* GetPrincipal() { return mPrincipal; }
 
   /**
    * Returns a principal indicating who may access video data of this stream.