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

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

Issue 218763007: Update MediaStreamTrack::Stop to latest draft. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments. Created 6 years, 8 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 | Annotate | Revision Log
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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 virtual void OnDeviceOpenFailed(int request_id) OVERRIDE; 92 virtual void OnDeviceOpenFailed(int request_id) OVERRIDE;
93 93
94 // RenderViewObserver OVERRIDE 94 // RenderViewObserver OVERRIDE
95 virtual void FrameDetached(blink::WebFrame* frame) OVERRIDE; 95 virtual void FrameDetached(blink::WebFrame* frame) OVERRIDE;
96 virtual void FrameWillClose(blink::WebFrame* frame) OVERRIDE; 96 virtual void FrameWillClose(blink::WebFrame* frame) OVERRIDE;
97 97
98 protected: 98 protected:
99 // Called when |source| has been stopped from JavaScript. 99 // Called when |source| has been stopped from JavaScript.
100 void OnLocalSourceStopped(const blink::WebMediaStreamSource& source); 100 void OnLocalSourceStopped(const blink::WebMediaStreamSource& source);
101 101
102 // Called when a MediaStream with label |label| has been ordered to stop from 102 // These methods are virtual for test purposes. A test can override them to
103 // JavaScript. The implementation must stop all sources that are not used by
104 // other MediaStreams.
105 // TODO(perkj): MediaStream::Stop has been deprecated from the spec and all
106 // applications should move to use MediaStreamTrack::Stop instead and this
107 // method be removed.
108 void OnLocalMediaStreamStop(const std::string& label);
109
110 // This function is virtual for test purposes. A test can override this to
111 // test requesting local media streams. The function notifies WebKit that the 103 // test requesting local media streams. The function notifies WebKit that the
112 // |request| have completed and generated the MediaStream |stream|. 104 // |request| have completed.
113 virtual void CompleteGetUserMediaRequest( 105 virtual void GetUserMediaRequestSucceeded(
114 const blink::WebMediaStream& stream, 106 const blink::WebMediaStream& stream,
107 blink::WebUserMediaRequest* request_info);
108 virtual void GetUserMediaRequestFailed(
115 blink::WebUserMediaRequest* request_info, 109 blink::WebUserMediaRequest* request_info,
116 content::MediaStreamRequestResult result); 110 content::MediaStreamRequestResult result);
117 111
112
118 // Returns the WebKit representation of a MediaStream given an URL. 113 // Returns the WebKit representation of a MediaStream given an URL.
119 // This is virtual for test purposes. 114 // This is virtual for test purposes.
120 virtual blink::WebMediaStream GetMediaStream(const GURL& url); 115 virtual blink::WebMediaStream GetMediaStream(const GURL& url);
121 116
122 // Creates a MediaStreamVideoSource object. 117 // Creates a MediaStreamVideoSource object.
123 // This is virtual for test purposes. 118 // This is virtual for test purposes.
124 virtual MediaStreamVideoSource* CreateVideoSource( 119 virtual MediaStreamVideoSource* CreateVideoSource(
125 const StreamDeviceInfo& device, 120 const StreamDeviceInfo& device,
126 const MediaStreamSource::SourceStoppedCallback& stop_callback); 121 const MediaStreamSource::SourceStoppedCallback& stop_callback);
127 122
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 208
214 // Callback function triggered when all native versions of the 209 // Callback function triggered when all native versions of the
215 // underlying media sources and tracks have been created and started. 210 // underlying media sources and tracks have been created and started.
216 void OnCreateNativeTracksCompleted( 211 void OnCreateNativeTracksCompleted(
217 UserMediaRequestInfo* request, 212 UserMediaRequestInfo* request,
218 content::MediaStreamRequestResult result); 213 content::MediaStreamRequestResult result);
219 214
220 UserMediaRequestInfo* FindUserMediaRequestInfo(int request_id); 215 UserMediaRequestInfo* FindUserMediaRequestInfo(int request_id);
221 UserMediaRequestInfo* FindUserMediaRequestInfo( 216 UserMediaRequestInfo* FindUserMediaRequestInfo(
222 const blink::WebUserMediaRequest& request); 217 const blink::WebUserMediaRequest& request);
223 UserMediaRequestInfo* FindUserMediaRequestInfo(const std::string& label);
224 void DeleteUserMediaRequestInfo(UserMediaRequestInfo* request); 218 void DeleteUserMediaRequestInfo(UserMediaRequestInfo* request);
225 219
226 // Returns the source that use a device with |device.session_id| 220 // Returns the source that use a device with |device.session_id|
227 // and |device.device.id|. NULL if such source doesn't exist. 221 // and |device.device.id|. NULL if such source doesn't exist.
228 const blink::WebMediaStreamSource* FindLocalSource( 222 const blink::WebMediaStreamSource* FindLocalSource(
229 const StreamDeviceInfo& device) const; 223 const StreamDeviceInfo& device) const;
230 224
231 // Returns true if |source| exists in |user_media_requests_|
232 bool IsSourceInRequests(const blink::WebMediaStreamSource& source) const;
233
234 void StopLocalSource(const blink::WebMediaStreamSource& source, 225 void StopLocalSource(const blink::WebMediaStreamSource& source,
235 bool notify_dispatcher); 226 bool notify_dispatcher);
236 // Stops all local sources that don't exist in exist in
237 // |user_media_requests_|.
238 void StopUnreferencedSources(bool notify_dispatcher);
239 227
240 scoped_refptr<WebRtcAudioRenderer> CreateRemoteAudioRenderer( 228 scoped_refptr<WebRtcAudioRenderer> CreateRemoteAudioRenderer(
241 webrtc::MediaStreamInterface* stream, int render_frame_id); 229 webrtc::MediaStreamInterface* stream, int render_frame_id);
242 scoped_refptr<WebRtcLocalAudioRenderer> CreateLocalAudioRenderer( 230 scoped_refptr<WebRtcLocalAudioRenderer> CreateLocalAudioRenderer(
243 const blink::WebMediaStreamTrack& audio_track, 231 const blink::WebMediaStreamTrack& audio_track,
244 int render_frame_id); 232 int render_frame_id);
245 233
246 // Returns a valid session id if a single capture device is currently open 234 // Returns a valid session id if a single capture device is currently open
247 // (and then the matching session_id), otherwise -1. 235 // (and then the matching session_id), otherwise -1.
248 // This is used to pass on a session id to a webrtc audio renderer (either 236 // This is used to pass on a session id to a webrtc audio renderer (either
249 // local or remote), so that audio will be rendered to a matching output 237 // local or remote), so that audio will be rendered to a matching output
250 // device, should one exist. 238 // device, should one exist.
251 // Note that if there are more than one open capture devices the function 239 // Note that if there are more than one open capture devices the function
252 // will not be able to pick an appropriate device and return false. 240 // will not be able to pick an appropriate device and return false.
253 bool GetAuthorizedDeviceInfoForAudioRenderer( 241 bool GetAuthorizedDeviceInfoForAudioRenderer(
254 int* session_id, int* output_sample_rate, int* output_buffer_size); 242 int* session_id, int* output_sample_rate, int* output_buffer_size);
255 243
256 // Weak ref to a MediaStreamDependencyFactory, owned by the RenderThread. 244 // Weak ref to a MediaStreamDependencyFactory, owned by the RenderThread.
257 // It's valid for the lifetime of RenderThread. 245 // It's valid for the lifetime of RenderThread.
258 MediaStreamDependencyFactory* dependency_factory_; 246 MediaStreamDependencyFactory* dependency_factory_;
259 247
260 // media_stream_dispatcher_ is a weak reference, owned by RenderView. It's 248 // media_stream_dispatcher_ is a weak reference, owned by RenderView. It's
261 // valid for the lifetime of RenderView. 249 // valid for the lifetime of RenderView.
262 MediaStreamDispatcher* media_stream_dispatcher_; 250 MediaStreamDispatcher* media_stream_dispatcher_;
263 251
252 LocalStreamSources local_sources_;
253
264 UserMediaRequests user_media_requests_; 254 UserMediaRequests user_media_requests_;
265 255
266 LocalStreamSources local_sources_;
267
268 DISALLOW_COPY_AND_ASSIGN(MediaStreamImpl); 256 DISALLOW_COPY_AND_ASSIGN(MediaStreamImpl);
269 }; 257 };
270 258
271 } // namespace content 259 } // namespace content
272 260
273 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ 261 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_
OLDNEW
« no previous file with comments | « content/renderer/media/media_stream_dependency_factory_unittest.cc ('k') | content/renderer/media/media_stream_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698