Bug 1295296 - Ignore video tracks in MediaStreamAudioSourceNode. r=jesup a=sylvestre FIREFOX_48_0_1_BUILD3 FIREFOX_48_0_1_RELEASE
authorAndreas Pehrson <pehrsons@gmail.com>
Wed, 17 Aug 2016 14:26:47 +0200
changeset 407645 f36f7ace6f487e06f315f343d560b205fa8bd736
parent 407644 e360efec6839e500742b9112e798b56f1d3eb4e7
child 407646 74c31875377892cecfd182dbd40deaf0b352405a
push id28002
push userfelipc@gmail.com
push dateTue, 30 Aug 2016 18:14:28 +0000
reviewersjesup, sylvestre
bugs1295296
milestone48.0.1
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
@@ -81,16 +81,18 @@ MediaStreamAudioSourceNode::Init(DOMMedi
 }
 
 MediaStreamAudioSourceNode::~MediaStreamAudioSourceNode() {}
 
 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);
@@ -129,16 +131,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;