| 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_USER_MEDIA_CLIENT_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_USER_MEDIA_CLIENT_IMPL_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_USER_MEDIA_CLIENT_IMPL_H_ | 6 #define CONTENT_RENDERER_MEDIA_USER_MEDIA_CLIENT_IMPL_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 const StreamDeviceInfo& device, | 116 const StreamDeviceInfo& device, |
| 117 const blink::WebMediaConstraints& constraints, | 117 const blink::WebMediaConstraints& constraints, |
| 118 const MediaStreamSource::ConstraintsCallback& source_ready); | 118 const MediaStreamSource::ConstraintsCallback& source_ready); |
| 119 virtual MediaStreamVideoSource* CreateVideoSource( | 119 virtual MediaStreamVideoSource* CreateVideoSource( |
| 120 const StreamDeviceInfo& device, | 120 const StreamDeviceInfo& device, |
| 121 const MediaStreamSource::SourceStoppedCallback& stop_callback); | 121 const MediaStreamSource::SourceStoppedCallback& stop_callback); |
| 122 | 122 |
| 123 // Returns no value if there is no request being processed. Use only for | 123 // Returns no value if there is no request being processed. Use only for |
| 124 // testing. | 124 // testing. |
| 125 // TODO(guidou): Remove this method once spec-compliant constraints algorithm | 125 // TODO(guidou): Remove this method once spec-compliant constraints algorithm |
| 126 // for audio is implemented. http://crbug.com/657733 | 126 // for audio is implemented. http://crbug.com/543997 |
| 127 base::Optional<bool> AutomaticOutputDeviceSelectionEnabledForCurrentRequest(); | 127 base::Optional<bool> AutomaticOutputDeviceSelectionEnabledForCurrentRequest(); |
| 128 | 128 |
| 129 private: | 129 private: |
| 130 class UserMediaRequestInfo; | 130 class UserMediaRequestInfo; |
| 131 typedef std::vector<blink::WebMediaStreamSource> LocalStreamSources; | 131 typedef std::vector<blink::WebMediaStreamSource> LocalStreamSources; |
| 132 | 132 |
| 133 void MaybeProcessNextRequestInfo(); | 133 void MaybeProcessNextRequestInfo(); |
| 134 bool IsCurrentRequestInfo(int request_id) const; | 134 bool IsCurrentRequestInfo(int request_id) const; |
| 135 bool IsCurrentRequestInfo(const blink::WebUserMediaRequest& request) const; | 135 bool IsCurrentRequestInfo(const blink::WebUserMediaRequest& request) const; |
| 136 bool DeleteRequestInfo(const blink::WebUserMediaRequest& request); | 136 bool DeleteRequestInfo(const blink::WebUserMediaRequest& request); |
| 137 void DelayedGetUserMediaRequestSucceeded(const blink::WebMediaStream& stream, | 137 void DelayedGetUserMediaRequestSucceeded(const blink::WebMediaStream& stream, |
| 138 blink::WebUserMediaRequest request); | 138 blink::WebUserMediaRequest request); |
| 139 void DelayedGetUserMediaRequestFailed(blink::WebUserMediaRequest request, | 139 void DelayedGetUserMediaRequestFailed(blink::WebUserMediaRequest request, |
| 140 MediaStreamRequestResult result, | 140 MediaStreamRequestResult result, |
| 141 const blink::WebString& result_name); | 141 const blink::WebString& result_name); |
| 142 | 142 |
| 143 // RenderFrameObserver implementation. | 143 // RenderFrameObserver implementation. |
| 144 void OnDestruct() override; | 144 void OnDestruct() override; |
| 145 | 145 |
| 146 // Called when |source| has been stopped from JavaScript. | 146 // Called when |source| has been stopped from JavaScript. |
| 147 void OnLocalSourceStopped(const blink::WebMediaStreamSource& source); | 147 void OnLocalSourceStopped(const blink::WebMediaStreamSource& source); |
| 148 | 148 |
| 149 // Creates a WebKit representation of stream sources based on | 149 // Creates a WebKit representation of stream sources based on |
| 150 // |devices| from the MediaStreamDispatcher. | 150 // |devices| from the MediaStreamDispatcher. |
| 151 blink::WebMediaStreamSource InitializeVideoSourceObject( | 151 blink::WebMediaStreamSource InitializeVideoSourceObject( |
| 152 const StreamDeviceInfo& device, | 152 const StreamDeviceInfo& device); |
| 153 const blink::WebMediaConstraints& constraints); | |
| 154 | 153 |
| 155 blink::WebMediaStreamSource InitializeAudioSourceObject( | 154 blink::WebMediaStreamSource InitializeAudioSourceObject( |
| 156 const StreamDeviceInfo& device, | 155 const StreamDeviceInfo& device, |
| 157 const blink::WebMediaConstraints& constraints, | 156 const blink::WebMediaConstraints& constraints, |
| 158 bool* is_pending); | 157 bool* is_pending); |
| 159 | 158 |
| 160 void CreateVideoTracks( | 159 void CreateVideoTracks( |
| 161 const StreamDeviceInfoArray& devices, | 160 const StreamDeviceInfoArray& devices, |
| 162 const blink::WebMediaConstraints& constraints, | |
| 163 blink::WebVector<blink::WebMediaStreamTrack>* webkit_tracks); | 161 blink::WebVector<blink::WebMediaStreamTrack>* webkit_tracks); |
| 164 | 162 |
| 165 void CreateAudioTracks( | 163 void CreateAudioTracks( |
| 166 const StreamDeviceInfoArray& devices, | 164 const StreamDeviceInfoArray& devices, |
| 167 const blink::WebMediaConstraints& constraints, | 165 const blink::WebMediaConstraints& constraints, |
| 168 blink::WebVector<blink::WebMediaStreamTrack>* webkit_tracks); | 166 blink::WebVector<blink::WebMediaStreamTrack>* webkit_tracks); |
| 169 | 167 |
| 170 // Callback function triggered when all native versions of the | 168 // Callback function triggered when all native versions of the |
| 171 // underlying media sources and tracks have been created and started. | 169 // underlying media sources and tracks have been created and started. |
| 172 void OnCreateNativeTracksCompleted(const std::string& label, | 170 void OnCreateNativeTracksCompleted(const std::string& label, |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 // Note: This member must be the last to ensure all outstanding weak pointers | 283 // Note: This member must be the last to ensure all outstanding weak pointers |
| 286 // are invalidated first. | 284 // are invalidated first. |
| 287 base::WeakPtrFactory<UserMediaClientImpl> weak_factory_; | 285 base::WeakPtrFactory<UserMediaClientImpl> weak_factory_; |
| 288 | 286 |
| 289 DISALLOW_COPY_AND_ASSIGN(UserMediaClientImpl); | 287 DISALLOW_COPY_AND_ASSIGN(UserMediaClientImpl); |
| 290 }; | 288 }; |
| 291 | 289 |
| 292 } // namespace content | 290 } // namespace content |
| 293 | 291 |
| 294 #endif // CONTENT_RENDERER_MEDIA_USER_MEDIA_CLIENT_IMPL_H_ | 292 #endif // CONTENT_RENDERER_MEDIA_USER_MEDIA_CLIENT_IMPL_H_ |
| OLD | NEW |