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

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

Issue 1834323002: MediaStream audio: Refactor 3 separate "glue" implementations into one. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: REBASE + Workaround to ensure MediaStreamAudioProcessor is destroyed on the main thread. Created 4 years, 7 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
« no previous file with comments | « content/renderer/media/tagged_list.h ('k') | content/renderer/media/user_media_client_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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 <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 13 matching lines...) Expand all
24 #include "third_party/WebKit/public/platform/WebSourceInfo.h" 24 #include "third_party/WebKit/public/platform/WebSourceInfo.h"
25 #include "third_party/WebKit/public/platform/WebVector.h" 25 #include "third_party/WebKit/public/platform/WebVector.h"
26 #include "third_party/WebKit/public/web/WebMediaDeviceChangeObserver.h" 26 #include "third_party/WebKit/public/web/WebMediaDeviceChangeObserver.h"
27 #include "third_party/WebKit/public/web/WebMediaDevicesRequest.h" 27 #include "third_party/WebKit/public/web/WebMediaDevicesRequest.h"
28 #include "third_party/WebKit/public/web/WebUserMediaClient.h" 28 #include "third_party/WebKit/public/web/WebUserMediaClient.h"
29 #include "third_party/WebKit/public/web/WebUserMediaRequest.h" 29 #include "third_party/WebKit/public/web/WebUserMediaRequest.h"
30 #include "third_party/webrtc/api/mediastreaminterface.h" 30 #include "third_party/webrtc/api/mediastreaminterface.h"
31 31
32 namespace content { 32 namespace content {
33 class PeerConnectionDependencyFactory; 33 class PeerConnectionDependencyFactory;
34 class MediaStreamAudioSource;
34 class MediaStreamDispatcher; 35 class MediaStreamDispatcher;
35 class MediaStreamVideoSource; 36 class MediaStreamVideoSource;
36 class VideoCapturerDelegate; 37 class VideoCapturerDelegate;
37 38
38 // UserMediaClientImpl is a delegate for the Media Stream GetUserMedia API. 39 // UserMediaClientImpl is a delegate for the Media Stream GetUserMedia API.
39 // It ties together WebKit and MediaStreamManager 40 // It ties together WebKit and MediaStreamManager
40 // (via MediaStreamDispatcher and MediaStreamDispatcherHost) 41 // (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 class CONTENT_EXPORT UserMediaClientImpl 44 class CONTENT_EXPORT UserMediaClientImpl
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 blink::WebUserMediaRequest request_info, 113 blink::WebUserMediaRequest request_info,
113 MediaStreamRequestResult result, 114 MediaStreamRequestResult result,
114 const blink::WebString& result_name); 115 const blink::WebString& result_name);
115 116
116 virtual void EnumerateDevicesSucceded( 117 virtual void EnumerateDevicesSucceded(
117 blink::WebMediaDevicesRequest* request, 118 blink::WebMediaDevicesRequest* request,
118 blink::WebVector<blink::WebMediaDeviceInfo>& devices); 119 blink::WebVector<blink::WebMediaDeviceInfo>& devices);
119 virtual void EnumerateSourcesSucceded( 120 virtual void EnumerateSourcesSucceded(
120 blink::WebMediaStreamTrackSourcesRequest* request, 121 blink::WebMediaStreamTrackSourcesRequest* request,
121 blink::WebVector<blink::WebSourceInfo>& sources); 122 blink::WebVector<blink::WebSourceInfo>& sources);
122 // Creates a MediaStreamVideoSource object. 123
123 // This is virtual for test purposes. 124 // Creates a MediaStreamAudioSource/MediaStreamVideoSource objects.
125 // These are virtual for test purposes.
126 virtual MediaStreamAudioSource* CreateAudioSource(
127 const StreamDeviceInfo& device,
128 const blink::WebMediaConstraints& constraints);
124 virtual MediaStreamVideoSource* CreateVideoSource( 129 virtual MediaStreamVideoSource* CreateVideoSource(
125 const StreamDeviceInfo& device, 130 const StreamDeviceInfo& device,
126 const MediaStreamSource::SourceStoppedCallback& stop_callback); 131 const MediaStreamSource::SourceStoppedCallback& stop_callback);
127 132
128 // Class for storing information about a WebKit request to create a 133 // Class for storing information about a WebKit request to create a
129 // MediaStream. 134 // MediaStream.
130 class UserMediaRequestInfo 135 class UserMediaRequestInfo
131 : public base::SupportsWeakPtr<UserMediaRequestInfo> { 136 : public base::SupportsWeakPtr<UserMediaRequestInfo> {
132 public: 137 public:
133 typedef base::Callback<void(UserMediaRequestInfo* request_info, 138 typedef base::Callback<void(UserMediaRequestInfo* request_info,
134 MediaStreamRequestResult result, 139 MediaStreamRequestResult result,
135 const blink::WebString& result_name)> 140 const blink::WebString& result_name)>
136 ResourcesReady; 141 ResourcesReady;
137 142
138 UserMediaRequestInfo(int request_id, 143 UserMediaRequestInfo(int request_id,
139 const blink::WebUserMediaRequest& request, 144 const blink::WebUserMediaRequest& request,
140 bool enable_automatic_output_device_selection); 145 bool enable_automatic_output_device_selection);
141 ~UserMediaRequestInfo(); 146 ~UserMediaRequestInfo();
142 int request_id; 147 int request_id;
143 // True if MediaStreamDispatcher has generated the stream, see 148 // True if MediaStreamDispatcher has generated the stream, see
144 // OnStreamGenerated. 149 // OnStreamGenerated.
145 bool generated; 150 bool generated;
146 const bool enable_automatic_output_device_selection; 151 const bool enable_automatic_output_device_selection;
147 blink::WebMediaStream web_stream; 152 blink::WebMediaStream web_stream;
148 blink::WebUserMediaRequest request; 153 blink::WebUserMediaRequest request;
149 154
150 void StartAudioTrack(const blink::WebMediaStreamTrack& track, 155 void StartAudioTrack(const blink::WebMediaStreamTrack& track);
151 const blink::WebMediaConstraints& constraints);
152 156
153 blink::WebMediaStreamTrack CreateAndStartVideoTrack( 157 blink::WebMediaStreamTrack CreateAndStartVideoTrack(
154 const blink::WebMediaStreamSource& source, 158 const blink::WebMediaStreamSource& source,
155 const blink::WebMediaConstraints& constraints); 159 const blink::WebMediaConstraints& constraints);
156 160
157 // Triggers |callback| when all sources used in this request have either 161 // Triggers |callback| when all sources used in this request have either
158 // successfully started, or a source has failed to start. 162 // successfully started, or a source has failed to start.
159 void CallbackOnTracksStarted(const ResourcesReady& callback); 163 void CallbackOnTracksStarted(const ResourcesReady& callback);
160 164
161 bool IsSourceUsed(const blink::WebMediaStreamSource& source) const; 165 bool IsSourceUsed(const blink::WebMediaStreamSource& source) const;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 // Note: This member must be the last to ensure all outstanding weak pointers 271 // Note: This member must be the last to ensure all outstanding weak pointers
268 // are invalidated first. 272 // are invalidated first.
269 base::WeakPtrFactory<UserMediaClientImpl> weak_factory_; 273 base::WeakPtrFactory<UserMediaClientImpl> weak_factory_;
270 274
271 DISALLOW_COPY_AND_ASSIGN(UserMediaClientImpl); 275 DISALLOW_COPY_AND_ASSIGN(UserMediaClientImpl);
272 }; 276 };
273 277
274 } // namespace content 278 } // namespace content
275 279
276 #endif // CONTENT_RENDERER_MEDIA_USER_MEDIA_CLIENT_IMPL_H_ 280 #endif // CONTENT_RENDERER_MEDIA_USER_MEDIA_CLIENT_IMPL_H_
OLDNEW
« no previous file with comments | « content/renderer/media/tagged_list.h ('k') | content/renderer/media/user_media_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698