OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | |
scherkus (not reviewing)
2011/11/09 02:29:10
2011
Henrik Grunell
2011/11/09 20:36:04
Done.
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "content/renderer/media/media_stream_dependency_factory.h" | |
6 | |
7 #include "content/renderer/media/video_capture_module_impl.h" | |
8 #include "content/renderer/media/webrtc_audio_device_impl.h" | |
9 #include "content/renderer/p2p/ipc_network_manager.h" | |
10 #include "content/renderer/p2p/ipc_socket_factory.h" | |
11 #include "jingle/glue/thread_wrapper.h" | |
12 #include "third_party/libjingle/source/talk/app/webrtc/peerconnection.h" | |
13 #include "third_party/libjingle/source/talk/p2p/client/httpportallocator.h" | |
14 #include "third_party/libjingle/source/talk/session/phone/dummydevicemanager.h" | |
15 #include "third_party/libjingle/source/talk/session/phone/webrtcmediaengine.h" | |
16 | |
17 MediaStreamDependencyFactory::MediaStreamDependencyFactory() {} | |
18 | |
19 MediaStreamDependencyFactory::~MediaStreamDependencyFactory() {} | |
20 | |
21 cricket::WebRtcMediaEngine* | |
22 MediaStreamDependencyFactory::CreateWebRtcMediaEngine() { | |
23 webrtc::AudioDeviceModule* adm = new WebRtcAudioDeviceImpl(); | |
24 webrtc::AudioDeviceModule* adm_sc = new WebRtcAudioDeviceImpl(); | |
25 return new cricket::WebRtcMediaEngine(adm, adm_sc, NULL); | |
26 } | |
27 | |
28 bool MediaStreamDependencyFactory::CreatePeerConnectionFactory( | |
29 cricket::PortAllocator* port_allocator, | |
30 cricket::MediaEngineInterface* media_engine, | |
31 talk_base::Thread* worker_thread) { | |
32 if (!pc_factory_.get()) { | |
33 scoped_ptr<webrtc::PeerConnectionFactory> factory( | |
34 new webrtc::PeerConnectionFactory(port_allocator, | |
35 media_engine, | |
36 new cricket::DummyDeviceManager(), | |
37 worker_thread)); | |
38 if (factory->Initialize()) | |
39 pc_factory_.reset(factory.release()); | |
40 } | |
41 return pc_factory_.get() != NULL; | |
42 } | |
43 | |
44 void MediaStreamDependencyFactory::DeletePeerConnectionFactory() { | |
45 pc_factory_.reset(); | |
46 } | |
47 | |
48 bool MediaStreamDependencyFactory::PeerConnectionFactoryCreated() { | |
49 return pc_factory_.get() != NULL; | |
50 } | |
51 | |
52 webrtc::PeerConnection* MediaStreamDependencyFactory::CreatePeerConnection( | |
53 talk_base::Thread* signaling_thread) { | |
54 return pc_factory_->CreatePeerConnection(signaling_thread); | |
55 } | |
OLD | NEW |