Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Side by Side Diff: webrtc/api/peerconnectionfactory.cc

Issue 1991233004: Moved creation of AudioDecoderFactory to inside PeerConnectionFactory. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@audio-decoder-factory-injections-3
Patch Set: Parental Advisory: Explicit Content Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/api/peerconnectionfactory.h ('k') | webrtc/audio/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 rtc::scoped_refptr<PeerConnectionFactoryInterface> 38 rtc::scoped_refptr<PeerConnectionFactoryInterface>
38 CreatePeerConnectionFactory() { 39 CreatePeerConnectionFactory() {
39 rtc::scoped_refptr<PeerConnectionFactory> pc_factory( 40 rtc::scoped_refptr<PeerConnectionFactory> pc_factory(
40 new rtc::RefCountedObject<PeerConnectionFactory>()); 41 new rtc::RefCountedObject<PeerConnectionFactory>());
(...skipping 10 matching lines...) Expand all
51 52
52 rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory( 53 rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
53 rtc::Thread* network_thread, 54 rtc::Thread* network_thread,
54 rtc::Thread* worker_thread, 55 rtc::Thread* worker_thread,
55 rtc::Thread* signaling_thread, 56 rtc::Thread* signaling_thread,
56 AudioDeviceModule* default_adm, 57 AudioDeviceModule* default_adm,
57 cricket::WebRtcVideoEncoderFactory* encoder_factory, 58 cricket::WebRtcVideoEncoderFactory* encoder_factory,
58 cricket::WebRtcVideoDecoderFactory* decoder_factory) { 59 cricket::WebRtcVideoDecoderFactory* decoder_factory) {
59 rtc::scoped_refptr<PeerConnectionFactory> pc_factory( 60 rtc::scoped_refptr<PeerConnectionFactory> pc_factory(
60 new rtc::RefCountedObject<PeerConnectionFactory>( 61 new rtc::RefCountedObject<PeerConnectionFactory>(
61 network_thread, worker_thread, signaling_thread, default_adm, 62 network_thread,
62 encoder_factory, decoder_factory)); 63 worker_thread,
64 signaling_thread,
65 default_adm,
66 CreateBuiltinAudioDecoderFactory(),
67 encoder_factory,
68 decoder_factory));
63 69
64 // Call Initialize synchronously but make sure its executed on 70 // Call Initialize synchronously but make sure its executed on
65 // |signaling_thread|. 71 // |signaling_thread|.
66 MethodCall0<PeerConnectionFactory, bool> call( 72 MethodCall0<PeerConnectionFactory, bool> call(
67 pc_factory.get(), 73 pc_factory.get(),
68 &PeerConnectionFactory::Initialize); 74 &PeerConnectionFactory::Initialize);
69 bool result = call.Marshal(signaling_thread); 75 bool result = call.Marshal(signaling_thread);
70 76
71 if (!result) { 77 if (!result) {
72 return nullptr; 78 return nullptr;
(...skipping 13 matching lines...) Expand all
86 } 92 }
87 network_thread_->Start(); 93 network_thread_->Start();
88 worker_thread_->Start(); 94 worker_thread_->Start();
89 } 95 }
90 96
91 PeerConnectionFactory::PeerConnectionFactory( 97 PeerConnectionFactory::PeerConnectionFactory(
92 rtc::Thread* network_thread, 98 rtc::Thread* network_thread,
93 rtc::Thread* worker_thread, 99 rtc::Thread* worker_thread,
94 rtc::Thread* signaling_thread, 100 rtc::Thread* signaling_thread,
95 AudioDeviceModule* default_adm, 101 AudioDeviceModule* default_adm,
102 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>&
103 audio_decoder_factory,
96 cricket::WebRtcVideoEncoderFactory* video_encoder_factory, 104 cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
97 cricket::WebRtcVideoDecoderFactory* video_decoder_factory) 105 cricket::WebRtcVideoDecoderFactory* video_decoder_factory)
98 : owns_ptrs_(false), 106 : owns_ptrs_(false),
99 wraps_current_thread_(false), 107 wraps_current_thread_(false),
100 network_thread_(network_thread), 108 network_thread_(network_thread),
101 worker_thread_(worker_thread), 109 worker_thread_(worker_thread),
102 signaling_thread_(signaling_thread), 110 signaling_thread_(signaling_thread),
103 default_adm_(default_adm), 111 default_adm_(default_adm),
112 audio_decoder_factory_(audio_decoder_factory),
104 video_encoder_factory_(video_encoder_factory), 113 video_encoder_factory_(video_encoder_factory),
105 video_decoder_factory_(video_decoder_factory) { 114 video_decoder_factory_(video_decoder_factory) {
106 RTC_DCHECK(network_thread); 115 RTC_DCHECK(network_thread);
107 RTC_DCHECK(worker_thread); 116 RTC_DCHECK(worker_thread);
108 RTC_DCHECK(signaling_thread); 117 RTC_DCHECK(signaling_thread);
109 // TODO: Currently there is no way creating an external adm in 118 // TODO: Currently there is no way creating an external adm in
110 // libjingle source tree. So we can 't currently assert if this is NULL. 119 // libjingle source tree. So we can 't currently assert if this is NULL.
111 // ASSERT(default_adm != NULL); 120 // ASSERT(default_adm != NULL);
112 } 121 }
113 122
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 return worker_thread_; 320 return worker_thread_;
312 } 321 }
313 322
314 rtc::Thread* PeerConnectionFactory::network_thread() { 323 rtc::Thread* PeerConnectionFactory::network_thread() {
315 return network_thread_; 324 return network_thread_;
316 } 325 }
317 326
318 cricket::MediaEngineInterface* PeerConnectionFactory::CreateMediaEngine_w() { 327 cricket::MediaEngineInterface* PeerConnectionFactory::CreateMediaEngine_w() {
319 ASSERT(worker_thread_ == rtc::Thread::Current()); 328 ASSERT(worker_thread_ == rtc::Thread::Current());
320 return cricket::WebRtcMediaEngineFactory::Create( 329 return cricket::WebRtcMediaEngineFactory::Create(
321 default_adm_.get(), video_encoder_factory_.get(), 330 default_adm_.get(),
331 audio_decoder_factory_,
332 video_encoder_factory_.get(),
322 video_decoder_factory_.get()); 333 video_decoder_factory_.get());
323 } 334 }
324 335
325 } // namespace webrtc 336 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/peerconnectionfactory.h ('k') | webrtc/audio/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698