Bug 1185827: [MSE] Error when detecting an audio format configuration change. r=gerald
authorJean-Yves Avenard <jyavenard@mozilla.com>
Fri, 14 Aug 2015 11:58:58 +1000
changeset 257769 d3e2e816df2e00b30104705d32c55c87f23ab262
parent 257768 7bd651ae54dd6b090555d4420f34525de3fda931
child 257770 77aa950d8fbdacd540a9c8bf07df7c5f6a44067e
push id63718
push userjyavenard@mozilla.com
push dateFri, 14 Aug 2015 06:08:41 +0000
treeherdermozilla-inbound@c2a85adcd4c0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1185827
milestone43.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 1185827: [MSE] Error when detecting an audio format configuration change. r=gerald
dom/media/mediasource/TrackBuffersManager.cpp
--- a/dom/media/mediasource/TrackBuffersManager.cpp
+++ b/dom/media/mediasource/TrackBuffersManager.cpp
@@ -973,16 +973,23 @@ TrackBuffersManager::OnDemuxerInitDone(n
     // 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 {
+    // Check that audio configuration hasn't changed as this is something
+    // we do not support yet (bug 1185827).
+    if (mAudioTracks.mNumTracks &&
+        (info.mAudio.mChannels != mAudioTracks.mInfo->GetAsAudioInfo()->mChannels ||
+         info.mAudio.mRate != mAudioTracks.mInfo->GetAsAudioInfo()->mRate)) {
+      RejectAppend(NS_ERROR_FAILURE, __func__);
+    }
     mAudioTracks.mLastInfo = new SharedTrackInfo(info.mAudio, streamID);
     mVideoTracks.mLastInfo = new SharedTrackInfo(info.mVideo, streamID);
   }
 
   UniquePtr<EncryptionInfo> crypto = mInputDemuxer->GetCrypto();
   if (crypto && crypto->IsEncrypted()) {
 #ifdef MOZ_EME
     // Try and dispatch 'encrypted'. Won't go if ready state still HAVE_NOTHING.