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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 const blink::WebMediaStreamSource& source, | 139 const blink::WebMediaStreamSource& source, |
140 const blink::WebMediaConstraints& constraints); | 140 const blink::WebMediaConstraints& constraints); |
141 | 141 |
142 // Triggers |callback| when all sources used in this request have either | 142 // Triggers |callback| when all sources used in this request have either |
143 // successfully started, or a source has failed to start. | 143 // successfully started, or a source has failed to start. |
144 void CallbackOnTracksStarted(const ResourcesReady& callback); | 144 void CallbackOnTracksStarted(const ResourcesReady& callback); |
145 | 145 |
146 bool IsSourceUsed(const blink::WebMediaStreamSource& source) const; | 146 bool IsSourceUsed(const blink::WebMediaStreamSource& source) const; |
147 void RemoveSource(const blink::WebMediaStreamSource& source); | 147 void RemoveSource(const blink::WebMediaStreamSource& source); |
148 | 148 |
149 bool AreAllSourcesRemoved() const { return sources_.empty(); } | 149 bool HasPendingSources() const; |
150 | 150 |
151 private: | 151 private: |
152 void OnTrackStarted(MediaStreamSource* source, bool success); | 152 void OnTrackStarted(MediaStreamSource* source, bool success); |
153 void CheckAllTracksStarted(); | 153 void CheckAllTracksStarted(); |
154 | 154 |
155 ResourcesReady ready_callback_; | 155 ResourcesReady ready_callback_; |
156 bool request_failed_; | 156 bool request_failed_; |
157 // Sources used in this request. | 157 // Sources used in this request. |
158 std::vector<blink::WebMediaStreamSource> sources_; | 158 std::vector<blink::WebMediaStreamSource> sources_; |
159 std::vector<MediaStreamSource*> sources_waiting_for_callback_; | 159 std::vector<MediaStreamSource*> sources_waiting_for_callback_; |
(...skipping 24 matching lines...) Expand all Loading... |
184 const blink::WebMediaConstraints& constraints, | 184 const blink::WebMediaConstraints& constraints, |
185 blink::WebVector<blink::WebMediaStreamTrack>* webkit_tracks, | 185 blink::WebVector<blink::WebMediaStreamTrack>* webkit_tracks, |
186 UserMediaRequestInfo* request); | 186 UserMediaRequestInfo* request); |
187 | 187 |
188 // Callback function triggered when all native versions of the | 188 // Callback function triggered when all native versions of the |
189 // underlying media sources and tracks have been created and started. | 189 // underlying media sources and tracks have been created and started. |
190 void OnCreateNativeTracksCompleted( | 190 void OnCreateNativeTracksCompleted( |
191 UserMediaRequestInfo* request, | 191 UserMediaRequestInfo* request, |
192 content::MediaStreamRequestResult result); | 192 content::MediaStreamRequestResult result); |
193 | 193 |
| 194 void OnStreamGeneratedForCancelledRequest( |
| 195 const StreamDeviceInfoArray& audio_array, |
| 196 const StreamDeviceInfoArray& video_array); |
| 197 |
194 UserMediaRequestInfo* FindUserMediaRequestInfo(int request_id); | 198 UserMediaRequestInfo* FindUserMediaRequestInfo(int request_id); |
195 UserMediaRequestInfo* FindUserMediaRequestInfo( | 199 UserMediaRequestInfo* FindUserMediaRequestInfo( |
196 const blink::WebUserMediaRequest& request); | 200 const blink::WebUserMediaRequest& request); |
197 void DeleteUserMediaRequestInfo(UserMediaRequestInfo* request); | 201 void DeleteUserMediaRequestInfo(UserMediaRequestInfo* request); |
| 202 void DeleteAllUserMediaRequests(); |
198 | 203 |
199 MediaDevicesRequestInfo* FindMediaDevicesRequestInfo(int request_id); | 204 MediaDevicesRequestInfo* FindMediaDevicesRequestInfo(int request_id); |
200 MediaDevicesRequestInfo* FindMediaDevicesRequestInfo( | 205 MediaDevicesRequestInfo* FindMediaDevicesRequestInfo( |
201 const blink::WebMediaDevicesRequest& request); | 206 const blink::WebMediaDevicesRequest& request); |
202 void CancelAndDeleteMediaDevicesRequest(MediaDevicesRequestInfo* request); | 207 void CancelAndDeleteMediaDevicesRequest(MediaDevicesRequestInfo* request); |
203 | 208 |
204 // Returns the source that use a device with |device.session_id| | 209 // Returns the source that use a device with |device.session_id| |
205 // and |device.device.id|. NULL if such source doesn't exist. | 210 // and |device.device.id|. NULL if such source doesn't exist. |
206 const blink::WebMediaStreamSource* FindLocalSource( | 211 const blink::WebMediaStreamSource* FindLocalSource( |
207 const StreamDeviceInfo& device) const; | 212 const StreamDeviceInfo& device) const; |
(...skipping 21 matching lines...) Expand all Loading... |
229 // Note: This member must be the last to ensure all outstanding weak pointers | 234 // Note: This member must be the last to ensure all outstanding weak pointers |
230 // are invalidated first. | 235 // are invalidated first. |
231 base::WeakPtrFactory<MediaStreamImpl> weak_factory_; | 236 base::WeakPtrFactory<MediaStreamImpl> weak_factory_; |
232 | 237 |
233 DISALLOW_COPY_AND_ASSIGN(MediaStreamImpl); | 238 DISALLOW_COPY_AND_ASSIGN(MediaStreamImpl); |
234 }; | 239 }; |
235 | 240 |
236 } // namespace content | 241 } // namespace content |
237 | 242 |
238 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ | 243 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ |
OLD | NEW |