Bug 1168674: [ogg] P2. Hook up new OggDemuxer. r=me
authorBrion Vibber <brion@pobox.com>
Thu, 21 Jul 2016 11:34:42 +1000
changeset 307231 8577afd128306601718956f9e096d20eb59b5bed
parent 307230 dd8e8efffcb33224c661ea51323ceaffc81bf914
child 307232 06bab9aac05e886c511e5bf799725f6d3c639d19
push id30922
push userjyavenard@mozilla.com
push dateFri, 29 Jul 2016 16:41:01 +0000
treeherderautoland@70cda19d2159 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1168674
milestone50.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 1168674: [ogg] P2. Hook up new OggDemuxer. r=me Not on by default yet. use media.format-reader.ogg preference MozReview-Commit-ID: 7pH67XERTbW
dom/media/DecoderTraits.cpp
dom/media/ogg/OggDecoder.cpp
modules/libpref/init/all.js
--- a/dom/media/DecoderTraits.cpp
+++ b/dom/media/DecoderTraits.cpp
@@ -8,16 +8,17 @@
 #include "MediaDecoder.h"
 #include "nsCharSeparatedTokenizer.h"
 #include "nsMimeTypes.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Telemetry.h"
 
 #include "OggDecoder.h"
 #include "OggReader.h"
+#include "OggDemuxer.h"
 
 #include "WebMDecoder.h"
 #include "WebMDemuxer.h"
 
 #ifdef MOZ_RAW
 #include "RawDecoder.h"
 #include "RawReader.h"
 #endif
@@ -684,17 +685,19 @@ MediaDecoderReader* DecoderTraits::Creat
     decoderReader = new MediaFormatReader(aDecoder, new WAVDemuxer(aDecoder->GetResource()));
   } else
 #ifdef MOZ_RAW
   if (IsRawType(aType)) {
     decoderReader = new RawReader(aDecoder);
   } else
 #endif
   if (IsOggType(aType)) {
-    decoderReader = new OggReader(aDecoder);
+    decoderReader = Preferences::GetBool("media.format-reader.ogg", true) ?
+      static_cast<MediaDecoderReader*>(new MediaFormatReader(aDecoder, new OggDemuxer(aDecoder->GetResource()))) :
+      new OggReader(aDecoder);
   } else
   if (IsWaveType(aType)) {
     decoderReader = new WaveReader(aDecoder);
   } else
 #ifdef MOZ_OMX_DECODER
   if (IsOmxSupportedType(aType)) {
     decoderReader = new MediaOmxReader(aDecoder);
   } else
--- a/dom/media/ogg/OggDecoder.cpp
+++ b/dom/media/ogg/OggDecoder.cpp
@@ -1,18 +1,26 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+#include "mozilla/Preferences.h"
 #include "MediaDecoderStateMachine.h"
+#include "MediaFormatReader.h"
+#include "OggDemuxer.h"
 #include "OggReader.h"
 #include "OggDecoder.h"
 
 namespace mozilla {
 
 MediaDecoderStateMachine* OggDecoder::CreateStateMachine()
 {
-  return new MediaDecoderStateMachine(this, new OggReader(this));
+  bool useFormatDecoder =
+    Preferences::GetBool("media.format-reader.ogg", true);
+  RefPtr<MediaDecoderReader> reader = useFormatDecoder ?
+      static_cast<MediaDecoderReader*>(new MediaFormatReader(this, new OggDemuxer(GetResource()), GetVideoFrameContainer())) :
+      new OggReader(this);
+  return new MediaDecoderStateMachine(this, reader);
 }
 
 } // namespace mozilla
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -538,16 +538,19 @@ pref("media.mediasource.mp4.enabled", tr
 
 #if defined(XP_WIN) || defined(XP_MACOSX) || defined(MOZ_WIDGET_GONK)
 pref("media.mediasource.webm.enabled", false);
 #else
 pref("media.mediasource.webm.enabled", true);
 #endif
 pref("media.mediasource.webm.audio.enabled", true);
 
+// Use new MediaFormatReader architecture for plain ogg.
+pref("media.format-reader.ogg", false);
+
 pref("media.benchmark.vp9.threshold", 150);
 pref("media.benchmark.frames", 300);
 pref("media.benchmark.timeout", 1000);
 
 #ifdef MOZ_WEBSPEECH
 pref("media.webspeech.recognition.enable", false);
 pref("media.webspeech.synth.enabled", false);
 #endif