ObjC SDK: Stop using built-in SW video codecs

This CL removes the use of default built-in SW in the ObjC layer. If a
client want to depend on the video SW codecs, they must inject them
explicitly.

Bug: webrtc:7925
Change-Id: If752e7f02109ff768dc5ec38d935203de85987c2
Reviewed-on: https://webrtc-review.googlesource.com/69800
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Anders Carlsson <andersc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23073}
This commit is contained in:
Magnus Jedvert
2018-04-13 15:36:43 +02:00
committed by Commit Bot
parent be80681295
commit 8b4e92d0a5
15 changed files with 39 additions and 218 deletions

View File

@ -58,7 +58,7 @@
- (instancetype)init {
#ifdef HAVE_NO_MEDIA
return [self initWithNoMedia];
#elif !defined(USE_BUILTIN_SW_CODECS)
#else
return [self initWithNativeAudioEncoderFactory:webrtc::CreateBuiltinAudioEncoderFactory()
nativeAudioDecoderFactory:webrtc::CreateBuiltinAudioDecoderFactory()
nativeVideoEncoderFactory:webrtc::ObjCToNativeVideoEncoderFactory(
@ -67,18 +67,6 @@
[[RTCVideoDecoderFactoryH264 alloc] init])
audioDeviceModule:nullptr
audioProcessingModule:nullptr];
#else
// Here we construct webrtc::ObjCVideoEncoderFactory directly because we rely
// on the fact that they inherit from both webrtc::VideoEncoderFactory and
// cricket::WebRtcVideoEncoderFactory.
return [self initWithNativeAudioEncoderFactory:webrtc::CreateBuiltinAudioEncoderFactory()
nativeAudioDecoderFactory:webrtc::CreateBuiltinAudioDecoderFactory()
legacyNativeVideoEncoderFactory:new webrtc::ObjCVideoEncoderFactory(
[[RTCVideoEncoderFactoryH264 alloc] init])
legacyNativeVideoDecoderFactory:new webrtc::ObjCVideoDecoderFactory(
[[RTCVideoDecoderFactoryH264 alloc] init])
audioDeviceModule:nullptr];
#endif
}
@ -151,18 +139,6 @@
return [self initWithNoMedia];
#else
if (self = [self initNative]) {
#if defined(USE_BUILTIN_SW_CODECS)
if (!videoEncoderFactory) {
auto legacy_video_encoder_factory = rtc::MakeUnique<webrtc::ObjCVideoEncoderFactory>(
[[RTCVideoEncoderFactoryH264 alloc] init]);
videoEncoderFactory = ConvertVideoEncoderFactory(std::move(legacy_video_encoder_factory));
}
if (!videoDecoderFactory) {
auto legacy_video_decoder_factory = rtc::MakeUnique<webrtc::ObjCVideoDecoderFactory>(
[[RTCVideoDecoderFactoryH264 alloc] init]);
videoDecoderFactory = ConvertVideoDecoderFactory(std::move(legacy_video_decoder_factory));
}
#endif
_nativeFactory = webrtc::CreatePeerConnectionFactory(_networkThread.get(),
_workerThread.get(),
_signalingThread.get(),
@ -179,34 +155,6 @@
#endif
}
#if defined(USE_BUILTIN_SW_CODECS)
- (instancetype)
initWithNativeAudioEncoderFactory:
(rtc::scoped_refptr<webrtc::AudioEncoderFactory>)audioEncoderFactory
nativeAudioDecoderFactory:
(rtc::scoped_refptr<webrtc::AudioDecoderFactory>)audioDecoderFactory
legacyNativeVideoEncoderFactory:(cricket::WebRtcVideoEncoderFactory *)videoEncoderFactory
legacyNativeVideoDecoderFactory:(cricket::WebRtcVideoDecoderFactory *)videoDecoderFactory
audioDeviceModule:(nullable webrtc::AudioDeviceModule *)audioDeviceModule {
#ifdef HAVE_NO_MEDIA
return [self initWithNoMedia];
#else
if (self = [self initNative]) {
_nativeFactory = webrtc::CreatePeerConnectionFactory(_networkThread.get(),
_workerThread.get(),
_signalingThread.get(),
audioDeviceModule,
audioEncoderFactory,
audioDecoderFactory,
videoEncoderFactory,
videoDecoderFactory);
NSAssert(_nativeFactory, @"Failed to initialize PeerConnectionFactory!");
}
return self;
#endif
}
#endif
- (RTCAudioSource *)audioSourceWithConstraints:(nullable RTCMediaConstraints *)constraints {
std::unique_ptr<webrtc::MediaConstraints> nativeConstraints;
if (constraints) {