Bug 1295296 - Ignore video tracks in MediaStreamAudioSourceNode. r=jesup a=sylvestre
authorAndreas Pehrson <pehrsons@gmail.com>
Wed, 17 Aug 2016 14:26:47 +0200
changeset 349771 12f39bee3e5a15eb4b2698327b38cffce1aebf50
parent 349770 8bf3072e8e924fc4fbfd150daf4c2106a62bae0e
child 349772 6e2bee015c3558d815c136c03ce816bfc38c70c8
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup, sylvestre
bugs1295296
milestone50.0a2
Bug 1295296 - Ignore video tracks in MediaStreamAudioSourceNode. r=jesup a=sylvestre MozReview-Commit-ID: 1NeFS5wIpxC
dom/media/webaudio/MediaStreamAudioSourceNode.cpp
--- a/dom/media/webaudio/MediaStreamAudioSourceNode.cpp
+++ b/dom/media/webaudio/MediaStreamAudioSourceNode.cpp
@@ -91,16 +91,18 @@ MediaStreamAudioSourceNode::~MediaStream
 {
   Destroy();
 }
 
 void
 MediaStreamAudioSourceNode::AttachToTrack(const RefPtr<MediaStreamTrack>& aTrack)
 {
   MOZ_ASSERT(!mInputTrack);
+  MOZ_ASSERT(aTrack->AsAudioStreamTrack());
+
   if (!mStream) {
     return;
   }
 
   mInputTrack = aTrack;
   ProcessedMediaStream* outputStream =
     static_cast<ProcessedMediaStream*>(mStream.get());
   mInputPort = mInputTrack->ForwardTrackContentsTo(outputStream);
@@ -143,16 +145,20 @@ MediaStreamAudioSourceNode::AttachToFirs
 
 void
 MediaStreamAudioSourceNode::NotifyTrackAdded(const RefPtr<MediaStreamTrack>& aTrack)
 {
   if (mInputTrack) {
     return;
   }
 
+  if (!aTrack->AsAudioStreamTrack()) {
+    return;
+  }
+
   AttachToTrack(aTrack);
 }
 
 void
 MediaStreamAudioSourceNode::NotifyTrackRemoved(const RefPtr<MediaStreamTrack>& aTrack)
 {
   if (aTrack != mInputTrack) {
     return;