enable_media_with_defaults.cc (1644B)
1 /* 2 * Copyright 2023 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 #include "api/enable_media_with_defaults.h" 12 13 #include <memory> 14 15 #include "api/audio/builtin_audio_processing_builder.h" 16 #include "api/audio_codecs/builtin_audio_decoder_factory.h" 17 #include "api/audio_codecs/builtin_audio_encoder_factory.h" 18 #include "api/enable_media.h" 19 #include "api/peer_connection_interface.h" 20 #include "api/scoped_refptr.h" 21 #include "api/video_codecs/builtin_video_decoder_factory.h" 22 #include "api/video_codecs/builtin_video_encoder_factory.h" 23 24 namespace webrtc { 25 26 void EnableMediaWithDefaults(PeerConnectionFactoryDependencies& deps) { 27 if (deps.audio_encoder_factory == nullptr) { 28 deps.audio_encoder_factory = CreateBuiltinAudioEncoderFactory(); 29 } 30 if (deps.audio_decoder_factory == nullptr) { 31 deps.audio_decoder_factory = CreateBuiltinAudioDecoderFactory(); 32 } 33 34 if (deps.audio_processing_builder == nullptr) { 35 deps.audio_processing_builder = 36 std::make_unique<BuiltinAudioProcessingBuilder>(); 37 } 38 if (deps.video_encoder_factory == nullptr) { 39 deps.video_encoder_factory = CreateBuiltinVideoEncoderFactory(); 40 } 41 if (deps.video_decoder_factory == nullptr) { 42 deps.video_decoder_factory = CreateBuiltinVideoDecoderFactory(); 43 } 44 EnableMedia(deps); 45 } 46 47 } // namespace webrtc