Index: webrtc/modules/video_coding/codecs/h264/h264.cc |
diff --git a/webrtc/modules/video_coding/codecs/h264/h264.cc b/webrtc/modules/video_coding/codecs/h264/h264.cc |
index 6f7316b10a69e9cd1db76ed0b5aa37cd15ae13fa..3da3b595d5035fd813aa32e9f328096722246fb6 100644 |
--- a/webrtc/modules/video_coding/codecs/h264/h264.cc |
+++ b/webrtc/modules/video_coding/codecs/h264/h264.cc |
@@ -11,9 +11,9 @@ |
#include "webrtc/modules/video_coding/codecs/h264/include/h264.h" |
-#if defined(WEBRTC_THIRD_PARTY_H264) |
-#include "webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.h" |
+#if defined(WEBRTC_USE_H264) |
#include "webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.h" |
+#include "webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.h" |
tommi
2016/02/02 16:33:13
for what do we need the encoder header?
hbos
2016/02/02 17:08:19
H264Encoder::Create() and H264Decoder::Create().
tommi
2016/02/02 17:11:19
ah sorry, I was thinking openh264 encode. never mi
|
#endif |
#if defined(WEBRTC_IOS) |
#include "webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_decoder.h" |
@@ -25,6 +25,20 @@ |
namespace webrtc { |
+namespace { |
+ |
+#if defined(WEBRTC_USE_H264) |
tommi
2016/02/02 16:33:13
Is this flag for h264 in general or specific to op
hbos
2016/02/02 17:08:19
It's for OpenH264 encoding + FFmpeg decoding both.
tommi
2016/02/02 17:11:19
Acknowledged.
|
+bool rtc_use_h264 = true; |
tommi
2016/02/02 16:33:13
since this is a global variable, should have the g
hbos
2016/02/02 17:08:19
Done.
|
+#endif |
+ |
+} // namespace |
+ |
+void SetRtcUseH264(bool enable) { |
tommi
2016/02/02 16:33:13
I'm assuming we do not want to allow flipping this
hbos
2016/02/02 17:08:19
Done. (Calling it DisableRtcUseH264() after |rtc_u
tommi
2016/02/02 17:11:19
Acknowledged.
|
+#if defined(WEBRTC_USE_H264) |
+ rtc_use_h264 = enable; |
tommi
2016/02/02 16:33:13
how do we guarantee thread safety? Wondering if w
hbos
2016/02/02 17:08:19
It's not, as per function comment in header.
|
+#endif |
+} |
+ |
// We need this file to be C++ only so it will compile properly for all |
// platforms. In order to write ObjC specific implementations we use private |
// externs. This function is defined in h264.mm. |
@@ -39,8 +53,8 @@ bool IsH264CodecSupported() { |
return true; |
} |
#endif |
-#if defined(WEBRTC_THIRD_PARTY_H264) |
- return true; |
+#if defined(WEBRTC_USE_H264) |
+ return rtc_use_h264; |
#else |
return false; |
#endif |
@@ -54,13 +68,14 @@ H264Encoder* H264Encoder::Create() { |
return new H264VideoToolboxEncoder(); |
} |
#endif |
-#if defined(WEBRTC_THIRD_PARTY_H264) |
- LOG(LS_INFO) << "Creating H264EncoderImpl."; |
- return new H264EncoderImpl(); |
-#else |
+#if defined(WEBRTC_USE_H264) |
+ if (rtc_use_h264) { |
tommi
2016/02/02 16:33:13
here, I would rather do:
RTC_[D]CHECK(rtc_use_h26
hbos
2016/02/02 17:08:19
Done.
|
+ LOG(LS_INFO) << "Creating H264EncoderImpl."; |
+ return new H264EncoderImpl(); |
+ } |
+#endif |
RTC_NOTREACHED(); |
return nullptr; |
-#endif |
} |
bool H264Encoder::IsSupported() { |
@@ -75,13 +90,14 @@ H264Decoder* H264Decoder::Create() { |
return new H264VideoToolboxDecoder(); |
} |
#endif |
-#if defined(WEBRTC_THIRD_PARTY_H264) |
- LOG(LS_INFO) << "Creating H264DecoderImpl."; |
- return new H264DecoderImpl(); |
-#else |
+#if defined(WEBRTC_USE_H264) |
+ if (rtc_use_h264) { |
tommi
2016/02/02 16:33:13
RTC_CHECK(rtc_use_h264)
hbos
2016/02/02 17:08:19
Done.
|
+ LOG(LS_INFO) << "Creating H264DecoderImpl."; |
+ return new H264DecoderImpl(); |
+ } |
+#endif |
RTC_NOTREACHED(); |
return nullptr; |
-#endif |
} |
bool H264Decoder::IsSupported() { |