OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2017 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 "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h" |
| 12 #include "webrtc/api/audio_codecs/builtin_audio_encoder_factory.h" |
| 13 #include "webrtc/api/peerconnectioninterface.h" |
| 14 #include "webrtc/base/bind.h" |
| 15 #include "webrtc/base/scoped_ref_ptr.h" |
| 16 #include "webrtc/base/thread.h" |
| 17 #include "webrtc/call/callfactoryinterface.h" |
| 18 #include "webrtc/logging/rtc_event_log/rtc_event_log_factory_interface.h" |
| 19 #include "webrtc/media/engine/webrtcmediaengine.h" |
| 20 |
| 21 namespace webrtc { |
| 22 |
| 23 rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory( |
| 24 rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory, |
| 25 rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory) { |
| 26 return CreatePeerConnectionFactoryWithAudioMixer( |
| 27 nullptr /*network_thread*/, |
| 28 nullptr /*worker_thread*/, nullptr /*signaling_thread*/, |
| 29 nullptr /*default_adm*/, audio_encoder_factory, audio_decoder_factory, |
| 30 nullptr /*video_encoder_factory*/, nullptr /*video_decoder_factory*/, |
| 31 nullptr /*audio_mixer*/); |
| 32 } |
| 33 |
| 34 rtc::scoped_refptr<PeerConnectionFactoryInterface> |
| 35 CreatePeerConnectionFactory() { |
| 36 return CreatePeerConnectionFactory(CreateBuiltinAudioEncoderFactory(), |
| 37 CreateBuiltinAudioDecoderFactory()); |
| 38 } |
| 39 |
| 40 // Note: all the other CreatePeerConnectionFactory variants just end up calling |
| 41 // this, ultimately. |
| 42 rtc::scoped_refptr<PeerConnectionFactoryInterface> |
| 43 CreatePeerConnectionFactoryWithAudioMixer( |
| 44 rtc::Thread* network_thread, |
| 45 rtc::Thread* worker_thread, |
| 46 rtc::Thread* signaling_thread, |
| 47 AudioDeviceModule* default_adm, |
| 48 rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory, |
| 49 rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory, |
| 50 cricket::WebRtcVideoEncoderFactory* video_encoder_factory, |
| 51 cricket::WebRtcVideoDecoderFactory* video_decoder_factory, |
| 52 rtc::scoped_refptr<AudioMixer> audio_mixer) { |
| 53 std::unique_ptr<cricket::MediaEngineInterface> media_engine( |
| 54 cricket::WebRtcMediaEngineFactory::Create( |
| 55 default_adm, audio_encoder_factory, audio_decoder_factory, |
| 56 video_encoder_factory, video_decoder_factory, audio_mixer)); |
| 57 |
| 58 std::unique_ptr<CallFactoryInterface> call_factory = CreateCallFactory(); |
| 59 |
| 60 std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory = |
| 61 CreateRtcEventLogFactory(); |
| 62 |
| 63 return CreateModularPeerConnectionFactory( |
| 64 network_thread, worker_thread, signaling_thread, default_adm, |
| 65 audio_encoder_factory, audio_decoder_factory, video_encoder_factory, |
| 66 video_decoder_factory, audio_mixer, std::move(media_engine), |
| 67 std::move(call_factory), std::move(event_log_factory)); |
| 68 } |
| 69 |
| 70 rtc::scoped_refptr<PeerConnectionFactoryInterface> |
| 71 CreatePeerConnectionFactoryWithAudioMixer( |
| 72 rtc::Thread* network_thread, |
| 73 rtc::Thread* worker_thread, |
| 74 rtc::Thread* signaling_thread, |
| 75 AudioDeviceModule* default_adm, |
| 76 cricket::WebRtcVideoEncoderFactory* encoder_factory, |
| 77 cricket::WebRtcVideoDecoderFactory* decoder_factory, |
| 78 rtc::scoped_refptr<AudioMixer> audio_mixer) { |
| 79 return CreatePeerConnectionFactoryWithAudioMixer( |
| 80 network_thread, worker_thread, signaling_thread, default_adm, |
| 81 CreateBuiltinAudioEncoderFactory(), CreateBuiltinAudioDecoderFactory(), |
| 82 encoder_factory, decoder_factory, audio_mixer); |
| 83 } |
| 84 |
| 85 rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory( |
| 86 rtc::Thread* network_thread, |
| 87 rtc::Thread* worker_thread, |
| 88 rtc::Thread* signaling_thread, |
| 89 AudioDeviceModule* default_adm, |
| 90 cricket::WebRtcVideoEncoderFactory* encoder_factory, |
| 91 cricket::WebRtcVideoDecoderFactory* decoder_factory) { |
| 92 return CreatePeerConnectionFactoryWithAudioMixer( |
| 93 network_thread, worker_thread, signaling_thread, default_adm, |
| 94 encoder_factory, decoder_factory, nullptr); |
| 95 } |
| 96 |
| 97 rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory( |
| 98 rtc::Thread* network_thread, |
| 99 rtc::Thread* worker_thread, |
| 100 rtc::Thread* signaling_thread, |
| 101 AudioDeviceModule* default_adm, |
| 102 rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory, |
| 103 rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory, |
| 104 cricket::WebRtcVideoEncoderFactory* video_encoder_factory, |
| 105 cricket::WebRtcVideoDecoderFactory* video_decoder_factory) { |
| 106 return CreatePeerConnectionFactoryWithAudioMixer( |
| 107 network_thread, worker_thread, signaling_thread, default_adm, |
| 108 audio_encoder_factory, audio_decoder_factory, video_encoder_factory, |
| 109 video_decoder_factory, nullptr); |
| 110 } |
| 111 |
| 112 } // namespace webrtc |
OLD | NEW |