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

Side by Side Diff: content/renderer/media/media_stream_impl.h

Issue 9309078: Adding a skeleton MediaStreamCenter. (Closed)
Patch Set: Review comments attended Created 8 years, 10 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
OLDNEW
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_IMPL_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 23 matching lines...) Expand all
34 class IpcNetworkManager; 34 class IpcNetworkManager;
35 class IpcPacketSocketFactory; 35 class IpcPacketSocketFactory;
36 class P2PSocketDispatcher; 36 class P2PSocketDispatcher;
37 } 37 }
38 38
39 namespace talk_base { 39 namespace talk_base {
40 class Thread; 40 class Thread;
41 } 41 }
42 42
43 namespace WebKit { 43 namespace WebKit {
44 class WebMediaStreamCenter;
45 class WebMediaStreamCenterClient;
44 class WebPeerConnectionHandler; 46 class WebPeerConnectionHandler;
45 class WebPeerConnectionHandlerClient; 47 class WebPeerConnectionHandlerClient;
46 } 48 }
47 49
50 class MediaStreamCenter;
48 class MediaStreamDispatcher; 51 class MediaStreamDispatcher;
49 class MediaStreamDependencyFactory; 52 class MediaStreamDependencyFactory;
50 class PeerConnectionHandler; 53 class PeerConnectionHandler;
51 class VideoCaptureImplManager; 54 class VideoCaptureImplManager;
52 class RTCVideoDecoder; 55 class RTCVideoDecoder;
53 56
54 // MediaStreamImpl is a delegate for the Media Stream API messages used by 57 // MediaStreamImpl is a delegate for the Media Stream API messages used by
55 // WebKit. It ties together WebKit, native PeerConnection in libjingle and 58 // WebKit. It ties together WebKit, native PeerConnection in libjingle and
56 // MediaStreamManager (via MediaStreamDispatcher and MediaStreamDispatcherHost) 59 // MediaStreamManager (via MediaStreamDispatcher and MediaStreamDispatcherHost)
57 // in the browser process. It must be created, called and destroyed on the 60 // in the browser process. It must be created, called and destroyed on the
58 // render thread. 61 // render thread.
59 class CONTENT_EXPORT MediaStreamImpl 62 class CONTENT_EXPORT MediaStreamImpl
60 : NON_EXPORTED_BASE(public WebKit::WebUserMediaClient), 63 : NON_EXPORTED_BASE(public WebKit::WebUserMediaClient),
61 NON_EXPORTED_BASE(public webkit_media::MediaStreamClient), 64 NON_EXPORTED_BASE(public webkit_media::MediaStreamClient),
62 public MediaStreamDispatcherEventHandler, 65 public MediaStreamDispatcherEventHandler,
63 NON_EXPORTED_BASE(public base::NonThreadSafe), 66 NON_EXPORTED_BASE(public base::NonThreadSafe),
64 public base::RefCountedThreadSafe<MediaStreamImpl> { 67 public base::RefCountedThreadSafe<MediaStreamImpl> {
65 public: 68 public:
66 MediaStreamImpl( 69 MediaStreamImpl(
67 MediaStreamDispatcher* media_stream_dispatcher, 70 MediaStreamDispatcher* media_stream_dispatcher,
68 content::P2PSocketDispatcher* p2p_socket_dispatcher, 71 content::P2PSocketDispatcher* p2p_socket_dispatcher,
69 VideoCaptureImplManager* vc_manager, 72 VideoCaptureImplManager* vc_manager,
70 MediaStreamDependencyFactory* dependency_factory); 73 MediaStreamDependencyFactory* dependency_factory);
71 virtual ~MediaStreamImpl(); 74 virtual ~MediaStreamImpl();
72 75
73 virtual WebKit::WebPeerConnectionHandler* CreatePeerConnectionHandler( 76 virtual WebKit::WebPeerConnectionHandler* CreatePeerConnectionHandler(
74 WebKit::WebPeerConnectionHandlerClient* client); 77 WebKit::WebPeerConnectionHandlerClient* client);
78 virtual WebKit::WebMediaStreamCenter* CreateMediaStreamCenter(
79 WebKit::WebMediaStreamCenterClient* client);
75 virtual void ClosePeerConnection(); 80 virtual void ClosePeerConnection();
76 virtual webrtc::MediaStreamTrackInterface* GetLocalMediaStreamTrack( 81 virtual webrtc::MediaStreamTrackInterface* GetLocalMediaStreamTrack(
77 const std::string& label); 82 const std::string& label);
78 83
79 // WebKit::WebUserMediaClient implementation 84 // WebKit::WebUserMediaClient implementation
80 virtual void requestUserMedia( 85 virtual void requestUserMedia(
81 const WebKit::WebUserMediaRequest& user_media_request, 86 const WebKit::WebUserMediaRequest& user_media_request,
82 const WebKit::WebVector<WebKit::WebMediaStreamSource>& 87 const WebKit::WebVector<WebKit::WebMediaStreamSource>&
83 media_stream_source_vector) OVERRIDE; 88 media_stream_source_vector) OVERRIDE;
84 virtual void cancelUserMediaRequest( 89 virtual void cancelUserMediaRequest(
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 156
152 scoped_ptr<content::IpcPacketSocketFactory> socket_factory_; 157 scoped_ptr<content::IpcPacketSocketFactory> socket_factory_;
153 158
154 scoped_refptr<VideoCaptureImplManager> vc_manager_; 159 scoped_refptr<VideoCaptureImplManager> vc_manager_;
155 160
156 // peer_connection_handler_ is a weak reference, owned by WebKit. It's valid 161 // peer_connection_handler_ is a weak reference, owned by WebKit. It's valid
157 // until stop is called on it (which will call ClosePeerConnection on us). 162 // until stop is called on it (which will call ClosePeerConnection on us).
158 // TODO(grunell): Support several PeerConnectionsHandlers. 163 // TODO(grunell): Support several PeerConnectionsHandlers.
159 PeerConnectionHandler* peer_connection_handler_; 164 PeerConnectionHandler* peer_connection_handler_;
160 165
166 // media_stream_center_ is a weak reference, owned by WebKit.
Henrik Grunell 2012/02/06 20:00:38 Add a comment about the lifetime of |media_stream_
tommyw 2012/02/07 09:26:25 Done.
167 MediaStreamCenter* media_stream_center_;
168
161 // We keep a list of the generated local tracks, so that we can add capture 169 // We keep a list of the generated local tracks, so that we can add capture
162 // devices when generated and also use them for recording. 170 // devices when generated and also use them for recording.
163 typedef talk_base::scoped_refptr<webrtc::MediaStreamTrackInterface> 171 typedef talk_base::scoped_refptr<webrtc::MediaStreamTrackInterface>
164 MediaStreamTrackPtr; 172 MediaStreamTrackPtr;
165 typedef std::map<std::string, MediaStreamTrackPtr> MediaStreamTrackPtrMap; 173 typedef std::map<std::string, MediaStreamTrackPtr> MediaStreamTrackPtrMap;
166 MediaStreamTrackPtrMap local_tracks_; 174 MediaStreamTrackPtrMap local_tracks_;
167 175
168 talk_base::scoped_refptr<VideoRendererWrapper> video_renderer_; 176 talk_base::scoped_refptr<VideoRendererWrapper> video_renderer_;
169 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; 177 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
170 178
171 // PeerConnection threads. signaling_thread_ is created from the 179 // PeerConnection threads. signaling_thread_ is created from the
172 // "current" chrome thread. 180 // "current" chrome thread.
173 talk_base::Thread* signaling_thread_; 181 talk_base::Thread* signaling_thread_;
174 talk_base::Thread* worker_thread_; 182 talk_base::Thread* worker_thread_;
175 base::Thread chrome_worker_thread_; 183 base::Thread chrome_worker_thread_;
176 184
177 static int next_request_id_; 185 static int next_request_id_;
178 typedef std::map<int, WebKit::WebUserMediaRequest> MediaRequestMap; 186 typedef std::map<int, WebKit::WebUserMediaRequest> MediaRequestMap;
179 MediaRequestMap user_media_requests_; 187 MediaRequestMap user_media_requests_;
180 188
181 DISALLOW_COPY_AND_ASSIGN(MediaStreamImpl); 189 DISALLOW_COPY_AND_ASSIGN(MediaStreamImpl);
182 }; 190 };
183 191
184 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ 192 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_
OLDNEW
« no previous file with comments | « content/renderer/media/media_stream_center.cc ('k') | content/renderer/media/media_stream_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698