Enable building WebRTC without built-in software codecs
This CL adds a GN build flag to include builtin software codecs (enabled by default). When setting the flag to false, libvpx can also be excluded. The benefit is that the resulting binary is smaller. Replaces https://webrtc-review.googlesource.com/c/src/+/29203 Bug: webrtc:7925 Change-Id: Id330ea8a43169e449ee139eca18e4557cc932e10 Reviewed-on: https://webrtc-review.googlesource.com/36340 Commit-Queue: Anders Carlsson <andersc@webrtc.org> Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Reviewed-by: Magnus Jedvert <magjed@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21818}
This commit is contained in:
committed by
Commit Bot
parent
70294c8eab
commit
dd8c16574e
@ -58,6 +58,17 @@
|
||||
- (instancetype)init {
|
||||
#ifdef HAVE_NO_MEDIA
|
||||
return [self initWithNoMedia];
|
||||
#elif !defined(USE_BUILTIN_SW_CODECS)
|
||||
return [self initWithNativeAudioEncoderFactory:webrtc::CreateBuiltinAudioEncoderFactory()
|
||||
nativeAudioDecoderFactory:webrtc::CreateBuiltinAudioDecoderFactory()
|
||||
nativeVideoEncoderFactory:std::unique_ptr<webrtc::VideoEncoderFactory>(
|
||||
new webrtc::ObjCVideoEncoderFactory(
|
||||
[[RTCVideoEncoderFactoryH264 alloc] init]))
|
||||
nativeVideoDecoderFactory:std::unique_ptr<webrtc::VideoDecoderFactory>(
|
||||
new webrtc::ObjCVideoDecoderFactory(
|
||||
[[RTCVideoDecoderFactoryH264 alloc] init]))
|
||||
audioDeviceModule:nullptr
|
||||
audioProcessingModule:nullptr];
|
||||
#else
|
||||
return [self initWithNativeAudioEncoderFactory:webrtc::CreateBuiltinAudioEncoderFactory()
|
||||
nativeAudioDecoderFactory:webrtc::CreateBuiltinAudioDecoderFactory()
|
||||
@ -139,6 +150,7 @@
|
||||
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]);
|
||||
@ -149,6 +161,7 @@
|
||||
[[RTCVideoDecoderFactoryH264 alloc] init]);
|
||||
videoDecoderFactory = ConvertVideoDecoderFactory(std::move(legacy_video_decoder_factory));
|
||||
}
|
||||
#endif
|
||||
_nativeFactory = webrtc::CreatePeerConnectionFactory(_networkThread.get(),
|
||||
_workerThread.get(),
|
||||
_signalingThread.get(),
|
||||
@ -165,6 +178,7 @@
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(USE_BUILTIN_SW_CODECS)
|
||||
- (instancetype)
|
||||
initWithNativeAudioEncoderFactory:
|
||||
(rtc::scoped_refptr<webrtc::AudioEncoderFactory>)audioEncoderFactory
|
||||
@ -190,6 +204,7 @@
|
||||
return self;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
- (RTCAudioSource *)audioSourceWithConstraints:(nullable RTCMediaConstraints *)constraints {
|
||||
std::unique_ptr<webrtc::MediaConstraints> nativeConstraints;
|
||||
|
||||
Reference in New Issue
Block a user