OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DEPENDENCY_FACTORY_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DEPENDENCY_FACTORY_H_ |
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DEPENDENCY_FACTORY_H_ | 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DEPENDENCY_FACTORY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
13 #include "third_party/libjingle/source/talk/app/webrtcv1/peerconnectionfactory.h
" | 13 #include "third_party/libjingle/source/talk/app/webrtc/peerconnection.h" |
14 #include "webkit/glue/p2p_transport.h" | 14 #include "webkit/glue/p2p_transport.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 class IpcNetworkManager; | 17 class IpcNetworkManager; |
18 class IpcPacketSocketFactory; | 18 class IpcPacketSocketFactory; |
19 class P2PSocketDispatcher; | 19 class P2PSocketDispatcher; |
20 } | 20 } |
21 | 21 |
22 namespace cricket { | 22 namespace cricket { |
23 class MediaEngineInterface; | |
24 class PortAllocator; | 23 class PortAllocator; |
25 class WebRtcMediaEngine; | |
26 } | 24 } |
27 | 25 |
28 namespace talk_base { | 26 namespace talk_base { |
29 class NetworkManager; | 27 class NetworkManager; |
30 class PacketSocketFactory; | 28 class PacketSocketFactory; |
31 class Thread; | 29 class Thread; |
32 } | 30 } |
33 | 31 |
34 namespace webrtc { | 32 namespace webrtc { |
35 class PeerConnection; | 33 class PeerConnection; |
36 class VideoCaptureModule; | 34 class VideoCaptureModule; |
37 } | 35 } |
38 | 36 |
39 // Object factory for MediaStreamImpl and PeerConnectionHandler. | 37 // Object factory for MediaStreamImpl and PeerConnectionHandler. |
40 class CONTENT_EXPORT MediaStreamDependencyFactory { | 38 class CONTENT_EXPORT MediaStreamDependencyFactory { |
41 public: | 39 public: |
42 MediaStreamDependencyFactory(); | 40 MediaStreamDependencyFactory(); |
43 virtual ~MediaStreamDependencyFactory(); | 41 virtual ~MediaStreamDependencyFactory(); |
44 | 42 |
45 // WebRtcMediaEngine is used in CreatePeerConnectionFactory(). | |
46 virtual cricket::WebRtcMediaEngine* CreateWebRtcMediaEngine(); | |
47 | |
48 // Creates and deletes |pc_factory_|, which in turn is used for | 43 // Creates and deletes |pc_factory_|, which in turn is used for |
49 // creating PeerConnection objects. |media_engine| is the engine created by | 44 // creating PeerConnection objects. |
50 // CreateWebRtcMediaEngine(). |port_allocator| and |media_engine| will be | |
51 // owned by |pc_factory_|. |worker_thread| is owned by MediaStreamImpl. | |
52 virtual bool CreatePeerConnectionFactory( | 45 virtual bool CreatePeerConnectionFactory( |
53 cricket::MediaEngineInterface* media_engine, | 46 talk_base::Thread* worker_thread, |
54 talk_base::Thread* worker_thread); | 47 talk_base::Thread* signaling_thread, |
55 virtual void DeletePeerConnectionFactory(); | 48 content::P2PSocketDispatcher* socket_dispatcher, |
| 49 talk_base::NetworkManager* network_manager, |
| 50 talk_base::PacketSocketFactory* socket_factory); |
| 51 virtual void ReleasePeerConnectionFactory(); |
56 virtual bool PeerConnectionFactoryCreated(); | 52 virtual bool PeerConnectionFactoryCreated(); |
57 | 53 |
58 // The port allocator is used in CreatePeerConnection(). | 54 // Asks the PeerConnection factory to create a PeerConnection object. |
59 virtual cricket::PortAllocator* CreatePortAllocator( | 55 // The PeerConnection object is owned by PeerConnectionHandler. |
60 content::P2PSocketDispatcher* socket_dispatcher, | 56 virtual talk_base::scoped_refptr<webrtc::PeerConnectionInterface> |
61 talk_base::NetworkManager* network_manager, | 57 CreatePeerConnection(const std::string& config, |
62 talk_base::PacketSocketFactory* socket_factory, | 58 webrtc::PeerConnectionObserver* observer); |
63 const webkit_glue::P2PTransport::Config& config); | |
64 | 59 |
65 // Asks the PeerConnection factory to create a PeerConnection object. See | 60 // Asks the PeerConnection factory to create a Local MediaStream object. |
66 // MediaStreamImpl for details about |signaling_thread|. The PeerConnection | 61 virtual talk_base::scoped_refptr<webrtc::LocalMediaStreamInterface> |
67 // object is owned by PeerConnectionHandler. | 62 CreateLocalMediaStream(const std::string& label); |
68 virtual webrtc::PeerConnection* CreatePeerConnection( | 63 |
69 cricket::PortAllocator* port_allocator, | 64 // Asks the PeerConnection factory to create a Local VideoTrack object. |
70 talk_base::Thread* signaling_thread); | 65 virtual talk_base::scoped_refptr<webrtc::LocalVideoTrackInterface> |
| 66 CreateLocalVideoTrack(const std::string& label, |
| 67 cricket::VideoCapturer* video_device); |
| 68 |
| 69 // Asks the PeerConnection factory to create a Local AudioTrack object. |
| 70 virtual talk_base::scoped_refptr<webrtc::LocalAudioTrackInterface> |
| 71 CreateLocalAudioTrack(const std::string& label, |
| 72 webrtc::AudioDeviceModule* audio_device); |
71 | 73 |
72 private: | 74 private: |
73 scoped_ptr<webrtc::PeerConnectionFactory> pc_factory_; | 75 talk_base::scoped_refptr<webrtc::PeerConnectionFactoryInterface> pc_factory_; |
74 | 76 |
75 DISALLOW_COPY_AND_ASSIGN(MediaStreamDependencyFactory); | 77 DISALLOW_COPY_AND_ASSIGN(MediaStreamDependencyFactory); |
76 }; | 78 }; |
77 | 79 |
78 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DEPENDENCY_FACTORY_H_ | 80 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DEPENDENCY_FACTORY_H_ |
OLD | NEW |