Line data Source code
1 : /*
2 : * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 : *
4 : * Use of this source code is governed by a BSD-style license
5 : * that can be found in the LICENSE file in the root of the source
6 : * tree. An additional intellectual property rights grant can be found
7 : * in the file PATENTS. All contributing project authors may
8 : * be found in the AUTHORS file in the root of the source tree.
9 : *
10 : */
11 :
12 : #include "webrtc/modules/video_coding/codecs/h264/include/h264.h"
13 :
14 : #if defined(WEBRTC_USE_H264)
15 : #include "webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.h"
16 : #include "webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.h"
17 : #endif
18 :
19 : #include "webrtc/base/checks.h"
20 : #include "webrtc/base/logging.h"
21 :
22 : namespace webrtc {
23 :
24 : namespace {
25 :
26 : #if defined(WEBRTC_USE_H264)
27 : bool g_rtc_use_h264 = true;
28 : #endif
29 :
30 : } // namespace
31 :
32 0 : void DisableRtcUseH264() {
33 : #if defined(WEBRTC_USE_H264)
34 : g_rtc_use_h264 = false;
35 : #endif
36 0 : }
37 :
38 : // If any H.264 codec is supported (iOS HW or OpenH264/FFmpeg).
39 0 : bool IsH264CodecSupported() {
40 : #if defined(WEBRTC_USE_H264)
41 : return g_rtc_use_h264;
42 : #else
43 0 : return false;
44 : #endif
45 : }
46 :
47 0 : H264Encoder* H264Encoder::Create(const cricket::VideoCodec& codec) {
48 0 : RTC_DCHECK(H264Encoder::IsSupported());
49 : #if defined(WEBRTC_USE_H264)
50 : RTC_CHECK(g_rtc_use_h264);
51 : LOG(LS_INFO) << "Creating H264EncoderImpl.";
52 : return new H264EncoderImpl(codec);
53 : #else
54 0 : RTC_NOTREACHED();
55 0 : return nullptr;
56 : #endif
57 : }
58 :
59 0 : bool H264Encoder::IsSupported() {
60 0 : return IsH264CodecSupported();
61 : }
62 :
63 0 : H264Decoder* H264Decoder::Create() {
64 0 : RTC_DCHECK(H264Decoder::IsSupported());
65 : #if defined(WEBRTC_USE_H264)
66 : RTC_CHECK(g_rtc_use_h264);
67 : LOG(LS_INFO) << "Creating H264DecoderImpl.";
68 : return new H264DecoderImpl();
69 : #else
70 0 : RTC_NOTREACHED();
71 0 : return nullptr;
72 : #endif
73 : }
74 :
75 0 : bool H264Decoder::IsSupported() {
76 0 : return IsH264CodecSupported();
77 : }
78 :
79 : } // namespace webrtc
|