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_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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" | 24 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" |
25 #include "webkit/media/media_stream_client.h" | 25 #include "webkit/media/media_stream_client.h" |
26 | 26 |
27 namespace webkit_media { | 27 namespace webkit_media { |
28 class MediaStreamAudioRenderer; | 28 class MediaStreamAudioRenderer; |
29 } | 29 } |
30 | 30 |
31 namespace content { | 31 namespace content { |
32 class MediaStreamDependencyFactory; | 32 class MediaStreamDependencyFactory; |
33 class MediaStreamDispatcher; | 33 class MediaStreamDispatcher; |
| 34 class MediaStreamSourceObserver; |
34 class VideoCaptureImplManager; | 35 class VideoCaptureImplManager; |
35 class WebRtcAudioRenderer; | 36 class WebRtcAudioRenderer; |
36 class WebRtcLocalAudioRenderer; | 37 class WebRtcLocalAudioRenderer; |
37 | 38 |
38 // MediaStreamImpl is a delegate for the Media Stream API messages used by | 39 // MediaStreamImpl is a delegate for the Media Stream API messages used by |
39 // WebKit. It ties together WebKit, native PeerConnection in libjingle and | 40 // WebKit. It ties together WebKit, native PeerConnection in libjingle and |
40 // MediaStreamManager (via MediaStreamDispatcher and MediaStreamDispatcherHost) | 41 // MediaStreamManager (via MediaStreamDispatcher and MediaStreamDispatcherHost) |
41 // in the browser process. It must be created, called and destroyed on the | 42 // in the browser process. It must be created, called and destroyed on the |
42 // render thread. | 43 // render thread. |
43 // MediaStreamImpl have weak pointers to a MediaStreamDispatcher. | 44 // MediaStreamImpl have weak pointers to a MediaStreamDispatcher. |
(...skipping 11 matching lines...) Expand all Loading... |
55 VideoCaptureImplManager* vc_manager, | 56 VideoCaptureImplManager* vc_manager, |
56 MediaStreamDependencyFactory* dependency_factory); | 57 MediaStreamDependencyFactory* dependency_factory); |
57 virtual ~MediaStreamImpl(); | 58 virtual ~MediaStreamImpl(); |
58 | 59 |
59 // Return true when the |url| is media stream. | 60 // Return true when the |url| is media stream. |
60 // This static function has the same functionalilty as IsMediaStream | 61 // This static function has the same functionalilty as IsMediaStream |
61 // except that it doesn't require an instance of this class. | 62 // except that it doesn't require an instance of this class. |
62 // This can save some overhead time when the |url| is not media stream. | 63 // This can save some overhead time when the |url| is not media stream. |
63 static bool CheckMediaStream(const GURL& url); | 64 static bool CheckMediaStream(const GURL& url); |
64 | 65 |
| 66 // Release source observers from WebMediaStream. This breaks circular |
| 67 // references to MediaStreamSource. See MediaStreamSourceObserver's comment |
| 68 // for detail. |
| 69 static void ReleaseSourceObservers(WebKit::WebMediaStream descriptor); |
| 70 |
65 // WebKit::WebUserMediaClient implementation | 71 // WebKit::WebUserMediaClient implementation |
66 virtual void requestUserMedia( | 72 virtual void requestUserMedia( |
67 const WebKit::WebUserMediaRequest& user_media_request, | 73 const WebKit::WebUserMediaRequest& user_media_request, |
68 const WebKit::WebVector<WebKit::WebMediaStreamSource>& audio_sources, | 74 const WebKit::WebVector<WebKit::WebMediaStreamSource>& audio_sources, |
69 const WebKit::WebVector<WebKit::WebMediaStreamSource>& video_sources) | 75 const WebKit::WebVector<WebKit::WebMediaStreamSource>& video_sources) |
70 OVERRIDE; | 76 OVERRIDE; |
71 virtual void cancelUserMediaRequest( | 77 virtual void cancelUserMediaRequest( |
72 const WebKit::WebUserMediaRequest& user_media_request) OVERRIDE; | 78 const WebKit::WebUserMediaRequest& user_media_request) OVERRIDE; |
73 | 79 |
74 // webkit_media::MediaStreamClient implementation. | 80 // webkit_media::MediaStreamClient implementation. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 struct UserMediaRequestInfo { | 138 struct UserMediaRequestInfo { |
133 UserMediaRequestInfo() | 139 UserMediaRequestInfo() |
134 : request_id(0), generated(false), frame(NULL), request() { | 140 : request_id(0), generated(false), frame(NULL), request() { |
135 } | 141 } |
136 UserMediaRequestInfo(int request_id, | 142 UserMediaRequestInfo(int request_id, |
137 WebKit::WebFrame* frame, | 143 WebKit::WebFrame* frame, |
138 const WebKit::WebUserMediaRequest& request) | 144 const WebKit::WebUserMediaRequest& request) |
139 : request_id(request_id), generated(false), frame(frame), | 145 : request_id(request_id), generated(false), frame(frame), |
140 request(request) { | 146 request(request) { |
141 } | 147 } |
| 148 ~UserMediaRequestInfo(); |
142 int request_id; | 149 int request_id; |
143 // True if MediaStreamDispatcher has generated the stream, see | 150 // True if MediaStreamDispatcher has generated the stream, see |
144 // OnStreamGenerated. | 151 // OnStreamGenerated. |
145 bool generated; | 152 bool generated; |
146 WebKit::WebFrame* frame; // WebFrame that requested the MediaStream. | 153 WebKit::WebFrame* frame; // WebFrame that requested the MediaStream. |
147 WebKit::WebMediaStream descriptor; | 154 WebKit::WebMediaStream descriptor; |
148 WebKit::WebUserMediaRequest request; | 155 WebKit::WebUserMediaRequest request; |
149 }; | 156 }; |
150 typedef ScopedVector<UserMediaRequestInfo> UserMediaRequests; | 157 typedef ScopedVector<UserMediaRequestInfo> UserMediaRequests; |
151 | 158 |
(...skipping 26 matching lines...) Expand all Loading... |
178 scoped_refptr<VideoCaptureImplManager> vc_manager_; | 185 scoped_refptr<VideoCaptureImplManager> vc_manager_; |
179 | 186 |
180 UserMediaRequests user_media_requests_; | 187 UserMediaRequests user_media_requests_; |
181 | 188 |
182 DISALLOW_COPY_AND_ASSIGN(MediaStreamImpl); | 189 DISALLOW_COPY_AND_ASSIGN(MediaStreamImpl); |
183 }; | 190 }; |
184 | 191 |
185 } // namespace content | 192 } // namespace content |
186 | 193 |
187 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ | 194 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ |
OLD | NEW |