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

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

Issue 11783059: Ensures that WebRTC works for device selection using a different sample rate than default (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix after review from Chris Created 7 years, 11 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_DEPENDENCY_FACTORY_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DEPENDENCY_FACTORY_H_
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DEPENDENCY_FACTORY_H_ 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DEPENDENCY_FACTORY_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/threading/thread.h" 12 #include "base/threading/thread.h"
13 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
14 #include "content/renderer/media/media_stream_extra_data.h" 14 #include "content/renderer/media/media_stream_extra_data.h"
15 #include "content/renderer/media/webaudio_capturer_source.h"
16 #include "content/renderer/p2p/socket_dispatcher.h" 15 #include "content/renderer/p2p/socket_dispatcher.h"
17 #include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h " 16 #include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h "
18 #include "third_party/libjingle/source/talk/app/webrtc/videosourceinterface.h" 17 #include "third_party/libjingle/source/talk/app/webrtc/videosourceinterface.h"
19 18
20 namespace base { 19 namespace base {
21 class WaitableEvent; 20 class WaitableEvent;
22 } 21 }
23 22
24 namespace talk_base { 23 namespace talk_base {
25 class NetworkManager; 24 class NetworkManager;
(...skipping 14 matching lines...) Expand all
40 class WebRTCPeerConnectionHandler; 39 class WebRTCPeerConnectionHandler;
41 class WebRTCPeerConnectionHandlerClient; 40 class WebRTCPeerConnectionHandlerClient;
42 } 41 }
43 42
44 namespace content { 43 namespace content {
45 44
46 class IpcNetworkManager; 45 class IpcNetworkManager;
47 class IpcPacketSocketFactory; 46 class IpcPacketSocketFactory;
48 class VideoCaptureImplManager; 47 class VideoCaptureImplManager;
49 class WebRtcAudioDeviceImpl; 48 class WebRtcAudioDeviceImpl;
49 struct StreamDeviceInfo;
50 50
51 // Object factory for RTC MediaStreams and RTC PeerConnections. 51 // Object factory for RTC MediaStreams and RTC PeerConnections.
52 class CONTENT_EXPORT MediaStreamDependencyFactory 52 class CONTENT_EXPORT MediaStreamDependencyFactory
53 : NON_EXPORTED_BASE(public base::NonThreadSafe) { 53 : NON_EXPORTED_BASE(public base::NonThreadSafe) {
54 public: 54 public:
55 // MediaSourcesCreatedCallback is used in CreateNativeMediaSources. 55 // MediaSourcesCreatedCallback is used in CreateNativeMediaSources.
56 typedef base::Callback<void(WebKit::WebMediaStreamDescriptor* description, 56 typedef base::Callback<void(WebKit::WebMediaStreamDescriptor* description,
57 bool live)> MediaSourcesCreatedCallback; 57 bool live)> MediaSourcesCreatedCallback;
58 MediaStreamDependencyFactory( 58 MediaStreamDependencyFactory(
59 VideoCaptureImplManager* vc_manager, 59 VideoCaptureImplManager* vc_manager,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // Asks the PeerConnection factory to create a Local MediaStream object. 123 // Asks the PeerConnection factory to create a Local MediaStream object.
124 virtual scoped_refptr<webrtc::LocalMediaStreamInterface> 124 virtual scoped_refptr<webrtc::LocalMediaStreamInterface>
125 CreateLocalMediaStream(const std::string& label); 125 CreateLocalMediaStream(const std::string& label);
126 126
127 // Asks the PeerConnection factory to create a Local Video Source. 127 // Asks the PeerConnection factory to create a Local Video Source.
128 virtual scoped_refptr<webrtc::VideoSourceInterface> 128 virtual scoped_refptr<webrtc::VideoSourceInterface>
129 CreateVideoSource(int video_session_id, 129 CreateVideoSource(int video_session_id,
130 bool is_screen_cast, 130 bool is_screen_cast,
131 const webrtc::MediaConstraintsInterface* constraints); 131 const webrtc::MediaConstraintsInterface* constraints);
132 132
133 // Initializes the source using audio parameters for the selected
134 // capture device and specifies which capture device to use as capture
135 // source.
136 virtual bool InitializeAudioSource(const StreamDeviceInfo& device_info);
137
138 // Creates a media::AudioCapturerSource with an implementation that is
139 // specific for a WebAudio source. The created WebAudioCapturerSource
140 // instance will function as audio source instead of the default
141 // WebRtcAudioCapturer.
142 virtual bool CreateWebAudioSource(WebKit::WebMediaStreamSource* source);
143
133 // Asks the PeerConnection factory to create a Local VideoTrack object. 144 // Asks the PeerConnection factory to create a Local VideoTrack object.
134 virtual scoped_refptr<webrtc::VideoTrackInterface> 145 virtual scoped_refptr<webrtc::VideoTrackInterface>
135 CreateLocalVideoTrack(const std::string& label, 146 CreateLocalVideoTrack(const std::string& label,
136 webrtc::VideoSourceInterface* source); 147 webrtc::VideoSourceInterface* source);
137 148
138 // Asks the PeerConnection factory to create a Local AudioTrack object. 149 // Asks the PeerConnection factory to create a Local AudioTrack object.
139 virtual scoped_refptr<webrtc::LocalAudioTrackInterface> 150 virtual scoped_refptr<webrtc::LocalAudioTrackInterface>
140 CreateLocalAudioTrack(const std::string& label, 151 CreateLocalAudioTrack(const std::string& label,
141 webrtc::AudioDeviceModule* audio_device); 152 webrtc::AudioDeviceModule* audio_device);
142 153
143 virtual bool EnsurePeerConnectionFactory(); 154 virtual bool EnsurePeerConnectionFactory();
144 virtual bool PeerConnectionFactoryCreated(); 155 virtual bool PeerConnectionFactoryCreated();
145 virtual void SetAudioDeviceSessionId(int session_id);
146 156
147 private: 157 private:
148 // Creates and deletes |pc_factory_|, which in turn is used for 158 // Creates and deletes |pc_factory_|, which in turn is used for
149 // creating PeerConnection objects. 159 // creating PeerConnection objects.
150 bool CreatePeerConnectionFactory(); 160 bool CreatePeerConnectionFactory();
151 161
152 void InitializeWorkerThread(talk_base::Thread** thread, 162 void InitializeWorkerThread(talk_base::Thread** thread,
153 base::WaitableEvent* event); 163 base::WaitableEvent* event);
154 164
155 void CreateIpcNetworkManagerOnWorkerThread(base::WaitableEvent* event); 165 void CreateIpcNetworkManagerOnWorkerThread(base::WaitableEvent* event);
(...skipping 10 matching lines...) Expand all
166 scoped_refptr<VideoCaptureImplManager> vc_manager_; 176 scoped_refptr<VideoCaptureImplManager> vc_manager_;
167 scoped_refptr<P2PSocketDispatcher> p2p_socket_dispatcher_; 177 scoped_refptr<P2PSocketDispatcher> p2p_socket_dispatcher_;
168 scoped_refptr<WebRtcAudioDeviceImpl> audio_device_; 178 scoped_refptr<WebRtcAudioDeviceImpl> audio_device_;
169 179
170 // PeerConnection threads. signaling_thread_ is created from the 180 // PeerConnection threads. signaling_thread_ is created from the
171 // "current" chrome thread. 181 // "current" chrome thread.
172 talk_base::Thread* signaling_thread_; 182 talk_base::Thread* signaling_thread_;
173 talk_base::Thread* worker_thread_; 183 talk_base::Thread* worker_thread_;
174 base::Thread chrome_worker_thread_; 184 base::Thread chrome_worker_thread_;
175 185
176 // Handles audio from MediaStreamAudioDestinationNode.
177 scoped_refptr<WebAudioCapturerSource> webaudio_capturer_source_;
178
179 DISALLOW_COPY_AND_ASSIGN(MediaStreamDependencyFactory); 186 DISALLOW_COPY_AND_ASSIGN(MediaStreamDependencyFactory);
180 }; 187 };
181 188
182 } // namespace content 189 } // namespace content
183 190
184 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DEPENDENCY_FACTORY_H_ 191 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DEPENDENCY_FACTORY_H_
OLDNEW
« no previous file with comments | « content/public/common/media_stream_request.cc ('k') | content/renderer/media/media_stream_dependency_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698