Bug 1296531 - Expose GraphRate through DOMMediaStream. r=jesup
authorAndreas Pehrson <pehrsons@gmail.com>
Thu, 17 Nov 2016 09:57:02 +0100
changeset 670645 d59f3574e5e80f7389d698d71d802381ffb56cb9
parent 670644 2799df85e817e0d53d7eef0ec57830d45320aa1b
child 670646 38c52a4cbb77c66854adcd8c6876883a398d80be
push id81678
push userkgupta@mozilla.com
push dateTue, 26 Sep 2017 17:28:53 +0000
reviewersjesup
bugs1296531
milestone58.0a1
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.