Bug 1275596 - Ignore ended tracks when selecting new track in MediaStreamAudioSourceNode and MediaElementSourceNode. r=padenot
authorAndreas Pehrson <pehrsons@gmail.com>
Thu, 26 May 2016 15:56:58 +0200
changeset 340290 0fa7d5fb96afee035e4fe0cfa27692c9c7d344a2
parent 340289 daf83079577fa7b8407c18164c6cf490290c8304
child 340291 2f504de936e78b736b52cff7f860305f82531ba4
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1275596, 1208371
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1275596 - Ignore ended tracks when selecting new track in MediaStreamAudioSourceNode and MediaElementSourceNode. r=padenot This is how it was meant to work when the refactor landed in Bug 1208371. We have no test coverage of seeking apparently. MozReview-Commit-ID: IhyGbjctO7E
dom/media/webaudio/MediaStreamAudioSourceNode.cpp
--- a/dom/media/webaudio/MediaStreamAudioSourceNode.cpp
+++ b/dom/media/webaudio/MediaStreamAudioSourceNode.cpp
@@ -112,21 +112,24 @@ MediaStreamAudioSourceNode::DetachFromTr
 }
 
 void
 MediaStreamAudioSourceNode::AttachToFirstTrack(const RefPtr<DOMMediaStream>& aMediaStream)
 {
   nsTArray<RefPtr<AudioStreamTrack>> tracks;
   aMediaStream->GetAudioTracks(tracks);
 
-  if (tracks.IsEmpty()) {
+  for (const RefPtr<AudioStreamTrack>& track : tracks) {
+    if (track->Ended()) {
+      continue;
+    }
+
+    AttachToTrack(track);
     return;
   }
-
-  AttachToTrack(tracks[0]);
 }
 
 void
 MediaStreamAudioSourceNode::NotifyTrackAdded(const RefPtr<MediaStreamTrack>& aTrack)
 {
   if (mInputTrack) {
     return;
   }