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 d4123a2e777d7ecad519d9fe8b406eebe0777e63..b797f45025a403122e71c4cecbd47ee872b69ade 100644 |
--- a/webrtc/modules/video_coding/codecs/h264/h264.cc |
+++ b/webrtc/modules/video_coding/codecs/h264/h264.cc |
@@ -11,6 +11,8 @@ |
#include "webrtc/modules/video_coding/codecs/h264/include/h264.h" |
+#include "webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.h" |
+#include "webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.h" |
#if defined(WEBRTC_IOS) |
#include "webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_decoder.h" |
#include "webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_encoder.h" |
@@ -23,25 +25,30 @@ namespace webrtc { |
// 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. |
-#if defined(WEBRTC_IOS) |
+#if defined(WEBRTC_IOS) && defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) |
extern bool IsH264CodecSupportedObjC(); |
#endif |
bool IsH264CodecSupported() { |
-#if defined(WEBRTC_IOS) |
- return IsH264CodecSupportedObjC(); |
+#if defined(WEBRTC_IOS) && defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) |
+ if (IsH264CodecSupportedObjC()) { |
+ return true; |
+ } |
#else |
- return false; |
+ // TODO(hbos): OpenH264 defines? |
+ return true; |
#endif |
} |
H264Encoder* H264Encoder::Create() { |
DCHECK(H264Encoder::IsSupported()); |
#if defined(WEBRTC_IOS) && defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) |
- return new H264VideoToolboxEncoder(); |
+ if (IsH264CodecSupportedObjC()) { |
+ return new H264VideoToolboxEncoder(); |
+ } |
#else |
- RTC_NOTREACHED(); |
- return nullptr; |
+ // TODO(hbos): OpenH264 defines? |
+ return new H264EncoderImpl(); |
#endif |
} |
@@ -52,10 +59,12 @@ bool H264Encoder::IsSupported() { |
H264Decoder* H264Decoder::Create() { |
DCHECK(H264Decoder::IsSupported()); |
#if defined(WEBRTC_IOS) && defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) |
- return new H264VideoToolboxDecoder(); |
+ if (IsH264CodecSupportedObjC()) { |
+ return new H264VideoToolboxDecoder(); |
+ } |
#else |
- RTC_NOTREACHED(); |
- return nullptr; |
+ // TODO(hbos): OpenH264 defines? |
+ return new H264DecoderImpl(); |
#endif |
} |