| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_WEBRTC_PEER_CONNECTION_DEPENDENCY_FACTORY_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_PEER_CONNECTION_DEPENDENCY_FACTORY_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_PEER_CONNECTION_DEPENDENCY_FACTORY_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_PEER_CONNECTION_DEPENDENCY_FACTORY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 145 |
| 146 protected: | 146 protected: |
| 147 // Asks the PeerConnection factory to create a Local Audio Source. | 147 // Asks the PeerConnection factory to create a Local Audio Source. |
| 148 virtual scoped_refptr<webrtc::AudioSourceInterface> | 148 virtual scoped_refptr<webrtc::AudioSourceInterface> |
| 149 CreateLocalAudioSource( | 149 CreateLocalAudioSource( |
| 150 const webrtc::MediaConstraintsInterface* constraints); | 150 const webrtc::MediaConstraintsInterface* constraints); |
| 151 | 151 |
| 152 // Creates a media::AudioCapturerSource with an implementation that is | 152 // Creates a media::AudioCapturerSource with an implementation that is |
| 153 // specific for a WebAudio source. The created WebAudioCapturerSource | 153 // specific for a WebAudio source. The created WebAudioCapturerSource |
| 154 // instance will function as audio source instead of the default | 154 // instance will function as audio source instead of the default |
| 155 // WebRtcAudioCapturer. | 155 // WebRtcAudioCapturer. Ownership of the new WebAudioCapturerSource is |
| 156 virtual scoped_refptr<WebAudioCapturerSource> CreateWebAudioSource( | 156 // transferred to |source|. |
| 157 blink::WebMediaStreamSource* source); | 157 virtual void CreateWebAudioSource(blink::WebMediaStreamSource* source); |
| 158 | 158 |
| 159 // Asks the PeerConnection factory to create a Local VideoTrack object with | 159 // Asks the PeerConnection factory to create a Local VideoTrack object with |
| 160 // the video source using |capturer|. | 160 // the video source using |capturer|. |
| 161 virtual scoped_refptr<webrtc::VideoTrackInterface> | 161 virtual scoped_refptr<webrtc::VideoTrackInterface> |
| 162 CreateLocalVideoTrack(const std::string& id, | 162 CreateLocalVideoTrack(const std::string& id, |
| 163 cricket::VideoCapturer* capturer); | 163 cricket::VideoCapturer* capturer); |
| 164 | 164 |
| 165 virtual const scoped_refptr<webrtc::PeerConnectionFactoryInterface>& | 165 virtual const scoped_refptr<webrtc::PeerConnectionFactoryInterface>& |
| 166 GetPcFactory(); | 166 GetPcFactory(); |
| 167 virtual bool PeerConnectionFactoryCreated(); | 167 virtual bool PeerConnectionFactoryCreated(); |
| 168 | 168 |
| 169 // Returns a new capturer or existing capturer based on the |render_frame_id| | 169 // Returns a new capturer or existing capturer based on the |render_frame_id| |
| 170 // and |device_info|; if both are valid, it reuses existing capture if any -- | 170 // and |device_info|; if both are valid, it reuses existing capture if any -- |
| 171 // otherwise it creates a new capturer. | 171 // otherwise it creates a new capturer. |
| 172 virtual scoped_refptr<WebRtcAudioCapturer> CreateAudioCapturer( | 172 virtual scoped_ptr<WebRtcAudioCapturer> CreateAudioCapturer( |
| 173 int render_frame_id, | 173 int render_frame_id, |
| 174 const StreamDeviceInfo& device_info, | 174 const StreamDeviceInfo& device_info, |
| 175 const blink::WebMediaConstraints& constraints, | 175 const blink::WebMediaConstraints& constraints, |
| 176 MediaStreamAudioSource* audio_source); | 176 MediaStreamAudioSource* audio_source); |
| 177 | 177 |
| 178 // Adds the audio device as a sink to the audio track and starts the local | |
| 179 // audio track. This is virtual for test purposes since no real audio device | |
| 180 // exist in unit tests. | |
| 181 virtual void StartLocalAudioTrack(WebRtcLocalAudioTrack* audio_track); | |
| 182 | |
| 183 private: | 178 private: |
| 184 // Implement base::MessageLoop::DestructionObserver. | 179 // Implement base::MessageLoop::DestructionObserver. |
| 185 // This makes sure the libjingle PeerConnectionFactory is released before | 180 // This makes sure the libjingle PeerConnectionFactory is released before |
| 186 // the renderer message loop is destroyed. | 181 // the renderer message loop is destroyed. |
| 187 void WillDestroyCurrentMessageLoop() override; | 182 void WillDestroyCurrentMessageLoop() override; |
| 188 | 183 |
| 189 // Functions related to Stun probing trial to determine how fast we could send | 184 // Functions related to Stun probing trial to determine how fast we could send |
| 190 // Stun request without being dropped by NAT. | 185 // Stun request without being dropped by NAT. |
| 191 void TryScheduleStunProbeTrial(); | 186 void TryScheduleStunProbeTrial(); |
| 192 void StartStunProbeTrialOnWorkerThread(const std::string& params); | 187 void StartStunProbeTrialOnWorkerThread(const std::string& params); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 rtc::Thread* worker_thread_; | 222 rtc::Thread* worker_thread_; |
| 228 base::Thread chrome_signaling_thread_; | 223 base::Thread chrome_signaling_thread_; |
| 229 base::Thread chrome_worker_thread_; | 224 base::Thread chrome_worker_thread_; |
| 230 | 225 |
| 231 DISALLOW_COPY_AND_ASSIGN(PeerConnectionDependencyFactory); | 226 DISALLOW_COPY_AND_ASSIGN(PeerConnectionDependencyFactory); |
| 232 }; | 227 }; |
| 233 | 228 |
| 234 } // namespace content | 229 } // namespace content |
| 235 | 230 |
| 236 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_PEER_CONNECTION_DEPENDENCY_FACTORY_H_ | 231 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_PEER_CONNECTION_DEPENDENCY_FACTORY_H_ |
| OLD | NEW |