Bug 1530234 - P1. Ignore init segment for audio only buffer if audio content didn't change. r=bryce
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 27 Feb 2019 14:34:15 +0000
changeset 519433 0bd5d868443675304f64f1d85866338f651f5900
parent 519432 3cbb661802a7496a7045a4ef39f22253a966442a
child 519434 4e5ac450f2b6dd57e9264fddc97971f6b5d8dc18
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbryce
bugs1530234
milestone67.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 1530234 - P1. Ignore init segment for audio only buffer if audio content didn't change. r=bryce This prevents re-creating a new audio decoder which on Android can take an awful long time. Differential Revision: https://phabricator.services.mozilla.com/D20969
dom/media/mediasource/TrackBuffersManager.cpp
--- a/dom/media/mediasource/TrackBuffersManager.cpp
+++ b/dom/media/mediasource/TrackBuffersManager.cpp
@@ -1101,18 +1101,23 @@ void TrackBuffersManager::OnDemuxerInitD
   // resend the same data. In these cases we don't need to change the stream
   // id as it's the same stream. Doing so would recreate decoders, possibly
   // leading to gaps in audio and/or video (see bug 1450952).
   //
   // It's possible to have the different binary representations for the same
   // logical init data. If this case is encountered in the wild then these
   // checks could be revised to compare MediaInfo rather than init segment
   // bytes.
+  // For audio only source buffer we can check that only the AudioInfo has
+  // changed.
   bool isRepeatInitData =
-      mInitData && *(mInitData.get()) == *(mParser->InitData());
+      !mChangeTypeReceived && mInitData &&
+      ((*mInitData.get() == *mParser->InitData()) ||
+       (numVideos == 0 && numAudios > 0 && mAudioTracks.mLastInfo &&
+        *mAudioTracks.mLastInfo->GetAsAudioInfo() == info.mAudio));
 
   MOZ_ASSERT(mFirstInitializationSegmentReceived || !isRepeatInitData,
              "Should never detect repeat init data for first segment!");
 
   // If we have new init data we configure and set track info as needed. If we
   // have repeat init data we carry forward our existing track info.
   if (!isRepeatInitData) {
     // Increase our stream id.