1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3  * You can obtain one at http://mozilla.org/MPL/2.0/. */
4 
5 #include "common/browser_logging/CSFLog.h"
6 #include "nspr.h"
7 #include "mozilla/StaticPrefs_media.h"
8 
9 #include "WebrtcMediaCodecVP8VideoCodec.h"
10 #include "MediaCodecVideoCodec.h"
11 
12 namespace mozilla {
13 
14 static const char* mcvcLogTag = "MediaCodecVideoCodec";
15 #ifdef LOGTAG
16 #  undef LOGTAG
17 #endif
18 #define LOGTAG mcvcLogTag
19 
CreateEncoder(CodecType aCodecType)20 WebrtcVideoEncoder* MediaCodecVideoCodec::CreateEncoder(CodecType aCodecType) {
21   CSFLogDebug(LOGTAG, "%s ", __FUNCTION__);
22   if (aCodecType == CODEC_VP8) {
23     if (StaticPrefs::
24             media_navigator_hardware_vp8_encode_acceleration_remote_enabled()) {
25       return new WebrtcMediaCodecVP8VideoRemoteEncoder();
26     } else {
27       return new WebrtcMediaCodecVP8VideoEncoder();
28     }
29   }
30   return nullptr;
31 }
32 
CreateDecoder(CodecType aCodecType)33 WebrtcVideoDecoder* MediaCodecVideoCodec::CreateDecoder(CodecType aCodecType) {
34   CSFLogDebug(LOGTAG, "%s ", __FUNCTION__);
35   if (aCodecType == CODEC_VP8) {
36     return new WebrtcMediaCodecVP8VideoDecoder();
37   }
38   return nullptr;
39 }
40 
41 }  // namespace mozilla
42