Bug 1355048: P1. Have WebrtcMediaDataDecoder placeholder. r?jesup
The code currently does nothing.
MozReview-Commit-ID: 6C0sLKIoJEV
--- a/dom/media/MediaPrefs.h
+++ b/dom/media/MediaPrefs.h
@@ -119,16 +119,18 @@ private:
#ifdef MOZ_GONK_MEDIACODEC
DECL_MEDIA_PREF("media.gonk.enabled", PDMGonkDecoderEnabled, bool, true);
#endif
#ifdef MOZ_WIDGET_ANDROID
DECL_MEDIA_PREF("media.android-media-codec.enabled", PDMAndroidMediaCodecEnabled, bool, false);
DECL_MEDIA_PREF("media.android-media-codec.preferred", PDMAndroidMediaCodecPreferred, bool, false);
DECL_MEDIA_PREF("media.navigator.hardware.vp8_encode.acceleration_remote_enabled", RemoteMediaCodecVP8EncoderEnabled, bool, false);
#endif
+ // WebRTC
+ DECL_MEDIA_PREF("media.navigator.mediadatadecoder_enabled", MediaDataDecoderEnabled, bool, false);
#ifdef MOZ_FFMPEG
DECL_MEDIA_PREF("media.ffmpeg.enabled", PDMFFmpegEnabled, bool, true);
DECL_MEDIA_PREF("media.libavcodec.allow-obsolete", LibavcodecAllowObsolete, bool, false);
#endif
#if defined(MOZ_FFMPEG) || defined(MOZ_FFVPX)
DECL_MEDIA_PREF("media.ffmpeg.low-latency.enabled", PDMFFmpegLowLatencyEnabled, bool, false);
#endif
#ifdef MOZ_FFVPX
--- a/media/webrtc/signaling/signaling.gyp
+++ b/media/webrtc/signaling/signaling.gyp
@@ -69,16 +69,17 @@
'./src/common/time_profiling',
'./src/media',
'./src/media-conduit',
'./src/mediapipeline',
'./src/peerconnection',
'./src/sdp/sipcc',
'../../../dom/base',
'../../../dom/media',
+ '../../../dom/media/platforms',
'../../../media/mtransport',
'../trunk',
'../../libyuv/libyuv/include',
'../../mtransport/third_party/nrappkit/src/util/libekr',
],
#
# DEPENDENCIES
@@ -274,17 +275,19 @@
'defines' : [
'NO_CHROMIUM_LOGGING',
'USE_FAKE_PCOBSERVER',
],
}],
['build_for_standalone==0', {
'sources': [
'./src/media-conduit/GmpVideoCodec.cpp',
+ './src/media-conduit/MediaDataDecoderCodec.cpp',
'./src/media-conduit/WebrtcGmpVideoCodec.cpp',
+ './src/media-conduit/WebrtcMediaDataDecoderCodec.cpp',
],
}],
['build_for_standalone!=0', {
'include_dirs': [
'./test'
],
'defines' : [
'NO_CHROMIUM_LOGGING',
new file mode 100644
--- /dev/null
+++ b/media/webrtc/signaling/src/media-conduit/MediaDataDecoderCodec.cpp
@@ -0,0 +1,23 @@
+/* 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 "MediaDataDecoderCodec.h"
+
+namespace mozilla {
+
+/* static */ WebrtcVideoEncoder*
+MediaDataDecoderCodec::CreateEncoder(
+ webrtc::VideoCodecType aCodecType)
+{
+ return nullptr;
+}
+
+/* static */ WebrtcVideoDecoder*
+MediaDataDecoderCodec::CreateDecoder(
+ webrtc::VideoCodecType aCodecbType)
+{
+ return nullptr;
+}
+
+} // namespace mozilla
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/media/webrtc/signaling/src/media-conduit/MediaDataDecoderCodec.h
@@ -0,0 +1,33 @@
+/* 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/. */
+
+#ifndef MEDIA_DATA_DECODER_CODEC_H_
+#define MEDIA_DATA_DECODER_CODEC_H_
+
+#include "MediaConduitInterface.h"
+#include "webrtc/common_types.h"
+#include "webrtc/video_decoder.h"
+
+namespace mozilla {
+
+class MediaDataDecoderCodec
+{
+ public:
+ /**
+ * Create encoder object for codec type |aCodecType|. Return |nullptr| when
+ * failed.
+ */
+ static WebrtcVideoEncoder* CreateEncoder(
+ webrtc::VideoCodecType aCodecType);
+
+ /**
+ * Create decoder object for codec type |aCodecType|. Return |nullptr| when
+ * failed.
+ */
+ static WebrtcVideoDecoder* CreateDecoder(
+ webrtc::VideoCodecType aCodecType);
+};
+}
+
+#endif // MEDIA_DATA_DECODER_CODEC_H_
--- a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
+++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
@@ -47,16 +47,18 @@
#include "OMXVideoCodec.h"
#endif
#ifdef MOZ_WEBRTC_MEDIACODEC
#include "MediaCodecVideoCodec.h"
#endif
#include "WebrtcGmpVideoCodec.h"
+#include "MediaDataDecoderCodec.h"
+
// for ntohs
#ifdef _MSC_VER
#include "Winsock2.h"
#else
#include <netinet/in.h>
#endif
#include <algorithm>
@@ -1432,16 +1434,22 @@ WebrtcVideoConduit::ConfigureRecvMediaCo
webrtc::VideoDecoder*
WebrtcVideoConduit::CreateDecoder(webrtc::VideoCodecType aType)
{
webrtc::VideoDecoder* decoder = nullptr;
#ifdef MOZ_WEBRTC_MEDIACODEC
bool enabled = false;
#endif
+ // Attempt to create a decoder using MediaDataDecoder.
+ decoder = MediaDataDecoderCodec::CreateDecoder(aType);
+ if (decoder) {
+ return decoder;
+ }
+
switch (aType) {
case webrtc::VideoCodecType::kVideoCodecH264:
// get an external decoder
#ifdef MOZ_WEBRTC_OMX
decoder = OMXVideoCodec::CreateDecoder(OMXVideoCodec::CodecType::CODEC_H264);
#else
decoder = GmpVideoCodec::CreateDecoder();
#endif
new file mode 100644
--- /dev/null
+++ b/media/webrtc/signaling/src/media-conduit/WebrtcMediaDataDecoderCodec.cpp
@@ -0,0 +1,51 @@
+/* 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 "WebrtcMediaDataDecoderCodec.h"
+#include "PlatformDecoderModule.h"
+
+namespace mozilla {
+
+class MediaDataDecoder;
+
+WebrtcMediaDataDecoder::WebrtcMediaDataDecoder()
+{
+}
+
+WebrtcMediaDataDecoder::~WebrtcMediaDataDecoder()
+{
+}
+
+int32_t
+WebrtcMediaDataDecoder::InitDecode(const webrtc::VideoCodec* codecSettings,
+ int32_t numberOfCores)
+{
+ return 0;
+}
+
+int32_t
+WebrtcMediaDataDecoder::Decode(
+ const webrtc::EncodedImage& inputImage,
+ bool missingFrames,
+ const webrtc::RTPFragmentationHeader* fragmentation,
+ const webrtc::CodecSpecificInfo* codecSpecificInfo,
+ int64_t renderTimeMs)
+{
+ return 0;
+}
+
+int32_t
+WebrtcMediaDataDecoder::RegisterDecodeCompleteCallback(
+ webrtc::DecodedImageCallback* callback)
+{
+ return 0;
+}
+
+int32_t
+WebrtcMediaDataDecoder::Release()
+{
+ return 0;
+}
+
+} // namespace mozilla
new file mode 100644
--- /dev/null
+++ b/media/webrtc/signaling/src/media-conduit/WebrtcMediaDataDecoderCodec.h
@@ -0,0 +1,44 @@
+/* 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/. */
+
+#ifndef WebrtcMediaDataDecoderCodec_h__
+#define WebrtcMediaDataDecoderCodec_h__
+
+#include "MediaConduitInterface.h"
+#include "mozilla/RefPtr.h"
+
+#include "webrtc/modules/video_coding/include/video_codec_interface.h"
+
+namespace mozilla {
+
+class MediaDataDecoder;
+
+class WebrtcMediaDataDecoder : public WebrtcVideoDecoder
+{
+public:
+ WebrtcMediaDataDecoder();
+
+ virtual ~WebrtcMediaDataDecoder();
+
+ // Implement VideoDecoder interface.
+ uint64_t PluginID() const override { return 0; }
+
+ int32_t InitDecode(const webrtc::VideoCodec* codecSettings,
+ int32_t numberOfCores) override;
+
+ int32_t Decode(const webrtc::EncodedImage& inputImage,
+ bool missingFrames,
+ const webrtc::RTPFragmentationHeader* fragmentation,
+ const webrtc::CodecSpecificInfo* codecSpecificInfo = NULL,
+ int64_t renderTimeMs = -1) override;
+
+ int32_t RegisterDecodeCompleteCallback(
+ webrtc::DecodedImageCallback* callback) override;
+
+ int32_t Release() override;
+};
+
+} // namespace mozilla
+
+#endif // WebrtcMediaDataDecoderCodec_h__
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -558,16 +558,19 @@ pref("media.peerconnection.capture_delay
pref("media.getusermedia.playout_delay", 50);
pref("media.navigator.audio.full_duplex", true);
#else
// *BSD, others - merely a guess for now
pref("media.peerconnection.capture_delay", 50);
pref("media.getusermedia.playout_delay", 50);
pref("media.navigator.audio.full_duplex", false);
#endif
+// Use MediaDataDecoder API for WebRTC, this includes hardware acceleration for
+// decoding.
+pref("media.navigator.mediadatadecoder_enabled", false);
#endif
pref("dom.webaudio.enabled", true);
#if !defined(ANDROID)
pref("media.getusermedia.screensharing.enabled", true);
#endif