OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "webrtc/api/peerconnection.h" | 21 #include "webrtc/api/peerconnection.h" |
22 #include "webrtc/api/peerconnectionfactoryproxy.h" | 22 #include "webrtc/api/peerconnectionfactoryproxy.h" |
23 #include "webrtc/api/peerconnectionproxy.h" | 23 #include "webrtc/api/peerconnectionproxy.h" |
24 #include "webrtc/api/videocapturertracksource.h" | 24 #include "webrtc/api/videocapturertracksource.h" |
25 #include "webrtc/api/videosourceproxy.h" | 25 #include "webrtc/api/videosourceproxy.h" |
26 #include "webrtc/api/videotrack.h" | 26 #include "webrtc/api/videotrack.h" |
27 #include "webrtc/base/bind.h" | 27 #include "webrtc/base/bind.h" |
28 #include "webrtc/media/engine/webrtcmediaengine.h" | 28 #include "webrtc/media/engine/webrtcmediaengine.h" |
29 #include "webrtc/media/engine/webrtcvideodecoderfactory.h" | 29 #include "webrtc/media/engine/webrtcvideodecoderfactory.h" |
30 #include "webrtc/media/engine/webrtcvideoencoderfactory.h" | 30 #include "webrtc/media/engine/webrtcvideoencoderfactory.h" |
| 31 #include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h" |
31 #include "webrtc/modules/audio_device/include/audio_device.h" | 32 #include "webrtc/modules/audio_device/include/audio_device.h" |
32 #include "webrtc/p2p/base/basicpacketsocketfactory.h" | 33 #include "webrtc/p2p/base/basicpacketsocketfactory.h" |
33 #include "webrtc/p2p/client/basicportallocator.h" | 34 #include "webrtc/p2p/client/basicportallocator.h" |
34 | 35 |
35 namespace webrtc { | 36 namespace webrtc { |
36 | 37 |
37 namespace { | 38 namespace { |
38 | 39 |
39 // Passes down the calls to |store_|. See usage in CreatePeerConnection. | 40 // Passes down the calls to |store_|. See usage in CreatePeerConnection. |
40 class DtlsIdentityStoreWrapper : public DtlsIdentityStoreInterface { | 41 class DtlsIdentityStoreWrapper : public DtlsIdentityStoreInterface { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 } | 73 } |
73 return PeerConnectionFactoryProxy::Create(pc_factory->signaling_thread(), | 74 return PeerConnectionFactoryProxy::Create(pc_factory->signaling_thread(), |
74 pc_factory); | 75 pc_factory); |
75 } | 76 } |
76 | 77 |
77 rtc::scoped_refptr<PeerConnectionFactoryInterface> | 78 rtc::scoped_refptr<PeerConnectionFactoryInterface> |
78 CreatePeerConnectionFactory( | 79 CreatePeerConnectionFactory( |
79 rtc::Thread* worker_thread, | 80 rtc::Thread* worker_thread, |
80 rtc::Thread* signaling_thread, | 81 rtc::Thread* signaling_thread, |
81 AudioDeviceModule* default_adm, | 82 AudioDeviceModule* default_adm, |
82 cricket::WebRtcVideoEncoderFactory* encoder_factory, | 83 cricket::WebRtcVideoEncoderFactory* video_encoder_factory, |
83 cricket::WebRtcVideoDecoderFactory* decoder_factory) { | 84 cricket::WebRtcVideoDecoderFactory* video_decoder_factory) { |
84 rtc::scoped_refptr<PeerConnectionFactory> pc_factory( | 85 rtc::scoped_refptr<PeerConnectionFactory> pc_factory( |
85 new rtc::RefCountedObject<PeerConnectionFactory>(worker_thread, | 86 new rtc::RefCountedObject<PeerConnectionFactory>( |
86 signaling_thread, | 87 worker_thread, |
87 default_adm, | 88 signaling_thread, |
88 encoder_factory, | 89 default_adm, |
89 decoder_factory)); | 90 std::shared_ptr<AudioDecoderFactory>( |
| 91 CreateBuiltinAudioDecoderFactory()), |
| 92 video_encoder_factory, |
| 93 video_decoder_factory)); |
90 | 94 |
91 // Call Initialize synchronously but make sure its executed on | 95 // Call Initialize synchronously but make sure its executed on |
92 // |signaling_thread|. | 96 // |signaling_thread|. |
93 MethodCall0<PeerConnectionFactory, bool> call( | 97 MethodCall0<PeerConnectionFactory, bool> call( |
94 pc_factory.get(), | 98 pc_factory.get(), |
95 &PeerConnectionFactory::Initialize); | 99 &PeerConnectionFactory::Initialize); |
96 bool result = call.Marshal(signaling_thread); | 100 bool result = call.Marshal(signaling_thread); |
97 | 101 |
98 if (!result) { | 102 if (!result) { |
99 return nullptr; | 103 return nullptr; |
(...skipping 10 matching lines...) Expand all Loading... |
110 signaling_thread_ = rtc::ThreadManager::Instance()->WrapCurrentThread(); | 114 signaling_thread_ = rtc::ThreadManager::Instance()->WrapCurrentThread(); |
111 wraps_current_thread_ = true; | 115 wraps_current_thread_ = true; |
112 } | 116 } |
113 worker_thread_->Start(); | 117 worker_thread_->Start(); |
114 } | 118 } |
115 | 119 |
116 PeerConnectionFactory::PeerConnectionFactory( | 120 PeerConnectionFactory::PeerConnectionFactory( |
117 rtc::Thread* worker_thread, | 121 rtc::Thread* worker_thread, |
118 rtc::Thread* signaling_thread, | 122 rtc::Thread* signaling_thread, |
119 AudioDeviceModule* default_adm, | 123 AudioDeviceModule* default_adm, |
| 124 std::shared_ptr<webrtc::AudioDecoderFactory> audio_decoder_factory, |
120 cricket::WebRtcVideoEncoderFactory* video_encoder_factory, | 125 cricket::WebRtcVideoEncoderFactory* video_encoder_factory, |
121 cricket::WebRtcVideoDecoderFactory* video_decoder_factory) | 126 cricket::WebRtcVideoDecoderFactory* video_decoder_factory) |
122 : owns_ptrs_(false), | 127 : owns_ptrs_(false), |
123 wraps_current_thread_(false), | 128 wraps_current_thread_(false), |
124 signaling_thread_(signaling_thread), | 129 signaling_thread_(signaling_thread), |
125 worker_thread_(worker_thread), | 130 worker_thread_(worker_thread), |
126 default_adm_(default_adm), | 131 default_adm_(default_adm), |
| 132 audio_decoder_factory_(std::move(audio_decoder_factory)), |
127 video_encoder_factory_(video_encoder_factory), | 133 video_encoder_factory_(video_encoder_factory), |
128 video_decoder_factory_(video_decoder_factory) { | 134 video_decoder_factory_(video_decoder_factory) { |
129 ASSERT(worker_thread != NULL); | 135 ASSERT(worker_thread != NULL); |
130 ASSERT(signaling_thread != NULL); | 136 ASSERT(signaling_thread != NULL); |
131 // TODO: Currently there is no way creating an external adm in | 137 // TODO: Currently there is no way creating an external adm in |
132 // libjingle source tree. So we can 't currently assert if this is NULL. | 138 // libjingle source tree. So we can 't currently assert if this is NULL. |
133 // ASSERT(default_adm != NULL); | 139 // ASSERT(default_adm != NULL); |
134 } | 140 } |
135 | 141 |
136 PeerConnectionFactory::~PeerConnectionFactory() { | 142 PeerConnectionFactory::~PeerConnectionFactory() { |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 } | 338 } |
333 | 339 |
334 rtc::Thread* PeerConnectionFactory::worker_thread() { | 340 rtc::Thread* PeerConnectionFactory::worker_thread() { |
335 RTC_DCHECK(signaling_thread_->IsCurrent()); | 341 RTC_DCHECK(signaling_thread_->IsCurrent()); |
336 return worker_thread_; | 342 return worker_thread_; |
337 } | 343 } |
338 | 344 |
339 cricket::MediaEngineInterface* PeerConnectionFactory::CreateMediaEngine_w() { | 345 cricket::MediaEngineInterface* PeerConnectionFactory::CreateMediaEngine_w() { |
340 ASSERT(worker_thread_ == rtc::Thread::Current()); | 346 ASSERT(worker_thread_ == rtc::Thread::Current()); |
341 return cricket::WebRtcMediaEngineFactory::Create( | 347 return cricket::WebRtcMediaEngineFactory::Create( |
342 default_adm_.get(), video_encoder_factory_.get(), | 348 default_adm_.get(), |
| 349 audio_decoder_factory_, |
| 350 video_encoder_factory_.get(), |
343 video_decoder_factory_.get()); | 351 video_decoder_factory_.get()); |
344 } | 352 } |
345 | 353 |
346 } // namespace webrtc | 354 } // namespace webrtc |
OLD | NEW |