Bug 1188804: [MSE] P2. Disambiguate naming of mActiveTrack boolean. r=gerald
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 29 Jul 2015 15:23:12 +1000
changeset 286771 ce9a1842eae243ce24eaedf6cddb8d18f1e82053
parent 286770 af0fcf52e4b7c10297d10aad1db80b8dc530e1ae
child 286772 c911a3b09f6fc44cdf0690cc851d2638db2bb848
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1188804
milestone42.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 1188804: [MSE] P2. Disambiguate naming of mActiveTrack boolean. r=gerald We considered that mActiveTrack was a global variable, however it is reset each time a new init segment is received. Should two init segments be received in the same appendBuffer it would have been set to false, causing metadata to never be parsed.
dom/media/mediasource/TrackBuffersManager.cpp
--- a/dom/media/mediasource/TrackBuffersManager.cpp
+++ b/dom/media/mediasource/TrackBuffersManager.cpp
@@ -872,17 +872,17 @@ TrackBuffersManager::OnDemuxerInitDone(n
     mVideoTracks.mNeedRandomAccessPoint = true;
     mAudioTracks.mNeedRandomAccessPoint = true;
 
     mVideoTracks.mLongestFrameDuration = mVideoTracks.mLastFrameDuration;
     mAudioTracks.mLongestFrameDuration = mAudioTracks.mLastFrameDuration;
   }
 
   // 4. Let active track flag equal false.
-  mActiveTrack = false;
+  bool activeTrack = false;
 
   // Increase our stream id.
   uint32_t streamID = sStreamSourceID++;
 
   // 5. If the first initialization segment received flag is false, then run the following steps:
   if (!mFirstInitializationSegmentReceived) {
     mAudioTracks.mNumTracks = numAudios;
     // TODO:
@@ -905,17 +905,17 @@ TrackBuffersManager::OnDemuxerInitDone(n
       //   2. Let new audio track be a new AudioTrack object.
       //   3. Generate a unique ID and assign it to the id property on new audio track.
       //   4. Assign audio language to the language property on new audio track.
       //   5. Assign audio label to the label property on new audio track.
       //   6. Assign current audio kind to the kind property on new audio track.
       //   7. If audioTracks.length equals 0, then run the following steps:
       //     1. Set the enabled property on new audio track to true.
       //     2. Set active track flag to true.
-      mActiveTrack = true;
+      activeTrack = true;
       //   8. Add new audio track to the audioTracks attribute on this SourceBuffer object.
       //   9. Queue a task to fire a trusted event named addtrack, that does not bubble and is not cancelable, and that uses the TrackEvent interface, at the AudioTrackList object referenced by the audioTracks attribute on this SourceBuffer object.
       //   10. Add new audio track to the audioTracks attribute on the HTMLMediaElement.
       //   11. Queue a task to fire a trusted event named addtrack, that does not bubble and is not cancelable, and that uses the TrackEvent interface, at the AudioTrackList object referenced by the audioTracks attribute on the HTMLMediaElement.
       mAudioTracks.mBuffers.AppendElement(TrackBuffer());
       // 10. Add the track description for this track to the track buffer.
       mAudioTracks.mInfo = new SharedTrackInfo(info.mAudio, streamID);
       mAudioTracks.mLastInfo = mAudioTracks.mInfo;
@@ -937,29 +937,32 @@ TrackBuffersManager::OnDemuxerInitDone(n
       //   2. Let new video track be a new VideoTrack object.
       //   3. Generate a unique ID and assign it to the id property on new video track.
       //   4. Assign video language to the language property on new video track.
       //   5. Assign video label to the label property on new video track.
       //   6. Assign current video kind to the kind property on new video track.
       //   7. If videoTracks.length equals 0, then run the following steps:
       //     1. Set the selected property on new video track to true.
       //     2. Set active track flag to true.
-      mActiveTrack = true;
+      activeTrack = true;
       //   8. Add new video track to the videoTracks attribute on this SourceBuffer object.
       //   9. Queue a task to fire a trusted event named addtrack, that does not bubble and is not cancelable, and that uses the TrackEvent interface, at the VideoTrackList object referenced by the videoTracks attribute on this SourceBuffer object.
       //   10. Add new video track to the videoTracks attribute on the HTMLMediaElement.
       //   11. Queue a task to fire a trusted event named addtrack, that does not bubble and is not cancelable, and that uses the TrackEvent interface, at the VideoTrackList object referenced by the videoTracks attribute on the HTMLMediaElement.
       mVideoTracks.mBuffers.AppendElement(TrackBuffer());
       // 10. Add the track description for this track to the track buffer.
       mVideoTracks.mInfo = new SharedTrackInfo(info.mVideo, streamID);
       mVideoTracks.mLastInfo = mVideoTracks.mInfo;
     }
     // 4. For each text track in the initialization segment, run following steps:
     // 5. If active track flag equals true, then run the following steps:
     // This is handled by SourceBuffer once the promise is resolved.
+    if (activeTrack) {
+      mActiveTrack = true;
+    }
 
     // 6. Set first initialization segment received flag to true.
     mFirstInitializationSegmentReceived = true;
   } else {
     mAudioTracks.mLastInfo = new SharedTrackInfo(info.mAudio, streamID);
     mVideoTracks.mLastInfo = new SharedTrackInfo(info.mVideo, streamID);
   }