Bug 1278027 - Reuse some codes of MediaEncoder::NotifyQueuedTrackChanges in MediaEncoder::NotifyQueuedAudioData. r=jesup, a=lizzard
authorctai <ctai@mozilla.com>
Tue, 07 Jun 2016 12:25:04 +0800
changeset 339732 8f2d601499b58989abbce9d73e5acd508379fd03
parent 339731 f42e0b7e135a24347c414285ae531c879ee338d4
child 339733 600b784594941680e63e2005e795f3481169545a
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup, lizzard
bugs1278027
milestone49.0a2
Bug 1278027 - Reuse some codes of MediaEncoder::NotifyQueuedTrackChanges in MediaEncoder::NotifyQueuedAudioData. r=jesup, a=lizzard MozReview-Commit-ID: JBRdxD1wA4c
dom/media/TrackUnionStream.cpp
dom/media/encoder/MediaEncoder.cpp
--- a/dom/media/TrackUnionStream.cpp
+++ b/dom/media/TrackUnionStream.cpp
@@ -322,17 +322,20 @@ TrackUnionStream::TrackUnionStream(DOMMe
         }
       }
       ApplyTrackDisabling(outputTrack->GetID(), segment);
       for (uint32_t j = 0; j < mListeners.Length(); ++j) {
         MediaStreamListener* l = mListeners[j];
         // Separate Audio and Video.
         if (segment->GetType() == MediaSegment::AUDIO) {
           l->NotifyQueuedAudioData(Graph(), outputTrack->GetID(),
-                                   outputStart, *static_cast<AudioSegment*>(segment));
+                                   outputStart,
+                                   *static_cast<AudioSegment*>(segment),
+                                   map->mInputPort->GetSource(),
+                                   map->mInputTrackID);
         } else {
           // This part will be removed in bug 1201363.
           l->NotifyQueuedTrackChanges(Graph(), outputTrack->GetID(),
                                       outputStart, 0, *segment,
                                       map->mInputPort->GetSource(),
                                       map->mInputTrackID);
         }
       }
--- a/dom/media/encoder/MediaEncoder.cpp
+++ b/dom/media/encoder/MediaEncoder.cpp
@@ -107,18 +107,25 @@ MediaEncoder::NotifyQueuedTrackChanges(M
 
 void
 MediaEncoder::NotifyQueuedAudioData(MediaStreamGraph* aGraph, TrackID aID,
                                     StreamTime aTrackOffset,
                                     const AudioSegment& aQueuedMedia,
                                     MediaStream* aInputStream,
                                     TrackID aInputTrackID)
 {
-  mAudioEncoder->NotifyQueuedTrackChanges(aGraph, aID, aTrackOffset, 0,
-                                          aQueuedMedia);
+  if (!mDirectConnected) {
+    NotifyRealtimeData(aGraph, aID, aTrackOffset, 0, aQueuedMedia);
+  } else {
+    if (mSuspended == RECORD_RESUMED) {
+      if (!mVideoEncoder) {
+        mSuspended = RECORD_NOT_SUSPENDED; // no video
+      }
+    }
+  }
 }
 
 void
 MediaEncoder::NotifyEvent(MediaStreamGraph* aGraph,
                           MediaStreamListener::MediaStreamGraphEvent event)
 {
   // In case that MediaEncoder does not receive a TRACK_EVENT_ENDED event.
   LOG(LogLevel::Debug, ("NotifyRemoved in [MediaEncoder]."));