Bug 1216417 - Add logging for audio and video output changes in MSG. r=roc, a=ritu, a=sylvestre
authorAndreas Pehrson <pehrsons@gmail.com>
Thu, 29 Oct 2015 13:19:51 +0800
changeset 296653 09bdeec1b65c
parent 296652 37d6cc360023
child 296654 412a3f1e075f
push id5276
push usercbook@mozilla.com
push date2015-11-09 10:31 +0000
treeherdermozilla-beta@be9dcc3b97b3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, ritu, sylvestre
bugs1216417
milestone43.0
Bug 1216417 - Add logging for audio and video output changes in MSG. r=roc, a=ritu, a=sylvestre
dom/media/MediaStreamGraph.cpp
dom/media/MediaStreamGraph.h
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -580,16 +580,18 @@ MediaStreamGraphImpl::CreateOrDestroyAud
     return;
   }
 
   if (!aStream->GetStreamBuffer().GetAndResetTracksDirty() &&
       !aStream->mAudioOutputStreams.IsEmpty()) {
     return;
   }
 
+  STREAM_LOG(LogLevel::Debug, ("Updating AudioOutputStreams for MediaStream %p", aStream));
+
   nsAutoTArray<bool,2> audioOutputStreamsFound;
   for (uint32_t i = 0; i < aStream->mAudioOutputStreams.Length(); ++i) {
     audioOutputStreamsFound.AppendElement(false);
   }
 
   for (StreamBuffer::TrackIter tracks(aStream->GetStreamBuffer(), MediaSegment::AUDIO);
        !tracks.IsEnded(); tracks.Next()) {
     uint32_t i;
@@ -1801,18 +1803,28 @@ MediaStream::SetAudioOutputVolume(void* 
     }
     void* mKey;
     float mVolume;
   };
   GraphImpl()->AppendMessage(new Message(this, aKey, aVolume));
 }
 
 void
+MediaStream::AddAudioOutputImpl(void* aKey)
+{
+  STREAM_LOG(LogLevel::Info, ("MediaStream %p Adding AudioOutput for key %p",
+                              this, aKey));
+  mAudioOutputs.AppendElement(AudioOutput(aKey));
+}
+
+void
 MediaStream::RemoveAudioOutputImpl(void* aKey)
 {
+  STREAM_LOG(LogLevel::Info, ("MediaStream %p Removing AudioOutput for key %p",
+                              this, aKey));
   for (uint32_t i = 0; i < mAudioOutputs.Length(); ++i) {
     if (mAudioOutputs[i].mKey == aKey) {
       mAudioOutputs.RemoveElementAt(i);
       return;
     }
   }
   NS_ERROR("Audio output key not found");
 }
@@ -1829,16 +1841,36 @@ MediaStream::RemoveAudioOutput(void* aKe
       mStream->RemoveAudioOutputImpl(mKey);
     }
     void* mKey;
   };
   GraphImpl()->AppendMessage(new Message(this, aKey));
 }
 
 void
+MediaStream::AddVideoOutputImpl(already_AddRefed<VideoFrameContainer> aContainer)
+{
+  RefPtr<VideoFrameContainer> container = aContainer;
+  STREAM_LOG(LogLevel::Info, ("MediaStream %p Adding VideoFrameContainer %p as output",
+                              this, container.get()));
+  *mVideoOutputs.AppendElement() = container.forget();
+}
+
+void
+MediaStream::RemoveVideoOutputImpl(VideoFrameContainer* aContainer)
+{
+  STREAM_LOG(LogLevel::Info, ("MediaStream %p Removing VideoFrameContainer %p as output",
+                              this, aContainer));
+  // Ensure that any frames currently queued for playback by the compositor
+  // are removed.
+  aContainer->ClearFutureFrames();
+  mVideoOutputs.RemoveElement(aContainer);
+}
+
+void
 MediaStream::AddVideoOutput(VideoFrameContainer* aContainer)
 {
   class Message : public ControlMessage {
   public:
     Message(MediaStream* aStream, VideoFrameContainer* aContainer) :
       ControlMessage(aStream), mContainer(aContainer) {}
     virtual void Run()
     {
--- a/dom/media/MediaStreamGraph.h
+++ b/dom/media/MediaStreamGraph.h
@@ -428,37 +428,25 @@ public:
    * This must be idempotent.
    */
   virtual void DestroyImpl();
   StreamTime GetBufferEnd() { return mBuffer.GetEnd(); }
 #ifdef DEBUG
   void DumpTrackInfo() { return mBuffer.DumpTrackInfo(); }
 #endif
   void SetAudioOutputVolumeImpl(void* aKey, float aVolume);
-  void AddAudioOutputImpl(void* aKey)
-  {
-    mAudioOutputs.AppendElement(AudioOutput(aKey));
-  }
+  void AddAudioOutputImpl(void* aKey);
   // Returns true if this stream has an audio output.
   bool HasAudioOutput()
   {
     return !mAudioOutputs.IsEmpty();
   }
   void RemoveAudioOutputImpl(void* aKey);
-  void AddVideoOutputImpl(already_AddRefed<VideoFrameContainer> aContainer)
-  {
-    *mVideoOutputs.AppendElement() = aContainer;
-  }
-  void RemoveVideoOutputImpl(VideoFrameContainer* aContainer)
-  {
-    // Ensure that any frames currently queued for playback by the compositor
-    // are removed.
-    aContainer->ClearFutureFrames();
-    mVideoOutputs.RemoveElement(aContainer);
-  }
+  void AddVideoOutputImpl(already_AddRefed<VideoFrameContainer> aContainer);
+  void RemoveVideoOutputImpl(VideoFrameContainer* aContainer);
   void AddListenerImpl(already_AddRefed<MediaStreamListener> aListener);
   void RemoveListenerImpl(MediaStreamListener* aListener);
   void RemoveAllListenersImpl();
   virtual void SetTrackEnabledImpl(TrackID aTrackID, bool aEnabled);
 
   void AddConsumer(MediaInputPort* aPort)
   {
     mConsumers.AppendElement(aPort);