Bug 1100913 - Fix incorrect playback of MSE with HE-AAC audio streams. r=cajbir
authorJean-Yves Avenard <jyavenard@mozilla.com>
Tue, 18 Nov 2014 23:23:00 +1100
changeset 216459 c3f8e00d646e7ba160b9d26ddb1e2c5695370ee1
parent 216458 de71b9d01773fb6894ce754f923bdaa5d2121c3b
child 216460 b7acf8f21edc6f4336348648cf05bdccb728ff25
push id52048
push usercbook@mozilla.com
push dateWed, 19 Nov 2014 13:57:10 +0000
treeherdermozilla-inbound@f46bc389856d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscajbir
bugs1100913
milestone36.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 1100913 - Fix incorrect playback of MSE with HE-AAC audio streams. r=cajbir
dom/media/mediasource/MediaSourceReader.cpp
dom/media/mediasource/MediaSourceReader.h
--- a/dom/media/mediasource/MediaSourceReader.cpp
+++ b/dom/media/mediasource/MediaSourceReader.cpp
@@ -638,16 +638,39 @@ MediaSourceReader::ReadMetadata(MediaInf
 
   *aInfo = mInfo;
   *aTags = nullptr; // TODO: Handle metadata.
 
   return NS_OK;
 }
 
 void
+MediaSourceReader::ReadUpdatedMetadata(MediaInfo* aInfo)
+{
+  if (mAudioTrack) {
+    MOZ_ASSERT(mAudioTrack->IsReady());
+    mAudioReader = mAudioTrack->Decoders()[0]->GetReader();
+
+    const MediaInfo& info = mAudioReader->GetMediaInfo();
+    MOZ_ASSERT(info.HasAudio());
+    mInfo.mAudio = info.mAudio;
+  }
+
+  if (mVideoTrack) {
+    MOZ_ASSERT(mVideoTrack->IsReady());
+    mVideoReader = mVideoTrack->Decoders()[0]->GetReader();
+
+    const MediaInfo& info = mVideoReader->GetMediaInfo();
+    MOZ_ASSERT(info.HasVideo());
+    mInfo.mVideo = info.mVideo;
+  }
+  *aInfo = mInfo;
+}
+
+void
 MediaSourceReader::Ended()
 {
   mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
   mEnded = true;
 }
 
 bool
 MediaSourceReader::IsEnded()
--- a/dom/media/mediasource/MediaSourceReader.h
+++ b/dom/media/mediasource/MediaSourceReader.h
@@ -79,16 +79,17 @@ public:
   // "don't have enough") don't really make sense for MSE. The delay is
   // essentially a streaming heuristic, but JS is supposed to take care of that
   // in the MSE world. Avoid injecting inexplicable delays.
   virtual uint32_t GetBufferingWait() { return 0; }
 
   bool IsMediaSeekable() { return true; }
 
   nsresult ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags) MOZ_OVERRIDE;
+  void ReadUpdatedMetadata(MediaInfo* aInfo) MOZ_OVERRIDE;
   void Seek(int64_t aTime, int64_t aStartTime, int64_t aEndTime,
             int64_t aCurrentTime) MOZ_OVERRIDE;
 
   // Acquires the decoder monitor, and is thus callable on any thread.
   nsresult GetBuffered(dom::TimeRanges* aBuffered) MOZ_OVERRIDE;
 
   already_AddRefed<SourceBufferDecoder> CreateSubDecoder(const nsACString& aType);