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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 const VideoFrameProvider::RepaintCB& repaint_cb) OVERRIDE; | 70 const VideoFrameProvider::RepaintCB& repaint_cb) OVERRIDE; |
71 virtual scoped_refptr<MediaStreamAudioRenderer> | 71 virtual scoped_refptr<MediaStreamAudioRenderer> |
72 GetAudioRenderer(const GURL& url, int render_frame_id) OVERRIDE; | 72 GetAudioRenderer(const GURL& url, int render_frame_id) OVERRIDE; |
73 | 73 |
74 // MediaStreamDispatcherEventHandler implementation. | 74 // MediaStreamDispatcherEventHandler implementation. |
75 virtual void OnStreamGenerated( | 75 virtual void OnStreamGenerated( |
76 int request_id, | 76 int request_id, |
77 const std::string& label, | 77 const std::string& label, |
78 const StreamDeviceInfoArray& audio_array, | 78 const StreamDeviceInfoArray& audio_array, |
79 const StreamDeviceInfoArray& video_array) OVERRIDE; | 79 const StreamDeviceInfoArray& video_array) OVERRIDE; |
80 virtual void OnStreamGenerationFailed(int request_id) OVERRIDE; | 80 virtual void OnStreamGenerationFailed( |
| 81 int request_id, |
| 82 content::MediaStreamRequestResult result) OVERRIDE; |
81 virtual void OnDeviceStopped(const std::string& label, | 83 virtual void OnDeviceStopped(const std::string& label, |
82 const StreamDeviceInfo& device_info) OVERRIDE; | 84 const StreamDeviceInfo& device_info) OVERRIDE; |
83 virtual void OnDevicesEnumerated( | 85 virtual void OnDevicesEnumerated( |
84 int request_id, | 86 int request_id, |
85 const StreamDeviceInfoArray& device_array) OVERRIDE; | 87 const StreamDeviceInfoArray& device_array) OVERRIDE; |
86 virtual void OnDeviceOpened( | 88 virtual void OnDeviceOpened( |
87 int request_id, | 89 int request_id, |
88 const std::string& label, | 90 const std::string& label, |
89 const StreamDeviceInfo& device_info) OVERRIDE; | 91 const StreamDeviceInfo& device_info) OVERRIDE; |
90 virtual void OnDeviceOpenFailed(int request_id) OVERRIDE; | 92 virtual void OnDeviceOpenFailed(int request_id) OVERRIDE; |
(...skipping 13 matching lines...) Expand all Loading... |
104 // applications should move to use MediaStreamTrack::Stop instead and this | 106 // applications should move to use MediaStreamTrack::Stop instead and this |
105 // method be removed. | 107 // method be removed. |
106 void OnLocalMediaStreamStop(const std::string& label); | 108 void OnLocalMediaStreamStop(const std::string& label); |
107 | 109 |
108 // This function is virtual for test purposes. A test can override this to | 110 // This function is virtual for test purposes. A test can override this to |
109 // test requesting local media streams. The function notifies WebKit that the | 111 // test requesting local media streams. The function notifies WebKit that the |
110 // |request| have completed and generated the MediaStream |stream|. | 112 // |request| have completed and generated the MediaStream |stream|. |
111 virtual void CompleteGetUserMediaRequest( | 113 virtual void CompleteGetUserMediaRequest( |
112 const blink::WebMediaStream& stream, | 114 const blink::WebMediaStream& stream, |
113 blink::WebUserMediaRequest* request_info, | 115 blink::WebUserMediaRequest* request_info, |
114 bool request_succeeded); | 116 content::MediaStreamRequestResult result); |
115 | 117 |
116 // Returns the WebKit representation of a MediaStream given an URL. | 118 // Returns the WebKit representation of a MediaStream given an URL. |
117 // This is virtual for test purposes. | 119 // This is virtual for test purposes. |
118 virtual blink::WebMediaStream GetMediaStream(const GURL& url); | 120 virtual blink::WebMediaStream GetMediaStream(const GURL& url); |
119 | 121 |
120 // Creates a MediaStreamVideoSource object. | 122 // Creates a MediaStreamVideoSource object. |
121 // This is virtual for test purposes. | 123 // This is virtual for test purposes. |
122 virtual MediaStreamVideoSource* CreateVideoSource( | 124 virtual MediaStreamVideoSource* CreateVideoSource( |
123 const StreamDeviceInfo& device, | 125 const StreamDeviceInfo& device, |
124 const MediaStreamSource::SourceStoppedCallback& stop_callback); | 126 const MediaStreamSource::SourceStoppedCallback& stop_callback); |
125 | 127 |
126 private: | 128 private: |
127 // Class for storing information about a WebKit request to create a | 129 // Class for storing information about a WebKit request to create a |
128 // MediaStream. | 130 // MediaStream. |
129 class UserMediaRequestInfo | 131 class UserMediaRequestInfo |
130 : public base::SupportsWeakPtr<UserMediaRequestInfo> { | 132 : public base::SupportsWeakPtr<UserMediaRequestInfo> { |
131 public: | 133 public: |
132 typedef base::Callback<void(UserMediaRequestInfo* request_info, | 134 typedef base::Callback<void(UserMediaRequestInfo* request_info, |
133 bool request_succeeded)> ResourcesReady; | 135 content::MediaStreamRequestResult result)> |
| 136 ResourcesReady; |
134 | 137 |
135 UserMediaRequestInfo(int request_id, | 138 UserMediaRequestInfo(int request_id, |
136 blink::WebFrame* frame, | 139 blink::WebFrame* frame, |
137 const blink::WebUserMediaRequest& request, | 140 const blink::WebUserMediaRequest& request, |
138 bool enable_automatic_output_device_selection); | 141 bool enable_automatic_output_device_selection); |
139 ~UserMediaRequestInfo(); | 142 ~UserMediaRequestInfo(); |
140 int request_id; | 143 int request_id; |
141 // True if MediaStreamDispatcher has generated the stream, see | 144 // True if MediaStreamDispatcher has generated the stream, see |
142 // OnStreamGenerated. | 145 // OnStreamGenerated. |
143 bool generated; | 146 bool generated; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 void CreateAudioTracks( | 203 void CreateAudioTracks( |
201 const StreamDeviceInfoArray& devices, | 204 const StreamDeviceInfoArray& devices, |
202 const blink::WebMediaConstraints& constraints, | 205 const blink::WebMediaConstraints& constraints, |
203 blink::WebVector<blink::WebMediaStreamTrack>* webkit_tracks, | 206 blink::WebVector<blink::WebMediaStreamTrack>* webkit_tracks, |
204 UserMediaRequestInfo* request); | 207 UserMediaRequestInfo* request); |
205 | 208 |
206 // Callback function triggered when all native versions of the | 209 // Callback function triggered when all native versions of the |
207 // underlying media sources and tracks have been created and started. | 210 // underlying media sources and tracks have been created and started. |
208 void OnCreateNativeTracksCompleted( | 211 void OnCreateNativeTracksCompleted( |
209 UserMediaRequestInfo* request, | 212 UserMediaRequestInfo* request, |
210 bool request_succeeded); | 213 content::MediaStreamRequestResult result); |
211 | 214 |
212 UserMediaRequestInfo* FindUserMediaRequestInfo(int request_id); | 215 UserMediaRequestInfo* FindUserMediaRequestInfo(int request_id); |
213 UserMediaRequestInfo* FindUserMediaRequestInfo( | 216 UserMediaRequestInfo* FindUserMediaRequestInfo( |
214 const blink::WebUserMediaRequest& request); | 217 const blink::WebUserMediaRequest& request); |
215 UserMediaRequestInfo* FindUserMediaRequestInfo(const std::string& label); | 218 UserMediaRequestInfo* FindUserMediaRequestInfo(const std::string& label); |
216 void DeleteUserMediaRequestInfo(UserMediaRequestInfo* request); | 219 void DeleteUserMediaRequestInfo(UserMediaRequestInfo* request); |
217 | 220 |
218 // Returns the source that use a device with |device.session_id| | 221 // Returns the source that use a device with |device.session_id| |
219 // and |device.device.id|. NULL if such source doesn't exist. | 222 // and |device.device.id|. NULL if such source doesn't exist. |
220 const blink::WebMediaStreamSource* FindLocalSource( | 223 const blink::WebMediaStreamSource* FindLocalSource( |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 UserMediaRequests user_media_requests_; | 259 UserMediaRequests user_media_requests_; |
257 | 260 |
258 LocalStreamSources local_sources_; | 261 LocalStreamSources local_sources_; |
259 | 262 |
260 DISALLOW_COPY_AND_ASSIGN(MediaStreamImpl); | 263 DISALLOW_COPY_AND_ASSIGN(MediaStreamImpl); |
261 }; | 264 }; |
262 | 265 |
263 } // namespace content | 266 } // namespace content |
264 | 267 |
265 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ | 268 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ |
OLD | NEW |