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

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

Issue 166363002: Use the current default capture for the webaudio track to get the correct delay value (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: new solution, ready for review. Created 6 years, 10 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 | « no previous file | content/renderer/media/webrtc_audio_device_impl.h » ('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 #include "content/renderer/media/media_stream_dependency_factory.h" 5 #include "content/renderer/media/media_stream_dependency_factory.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 278
279 scoped_refptr<webrtc::AudioTrackInterface> 279 scoped_refptr<webrtc::AudioTrackInterface>
280 MediaStreamDependencyFactory::CreateNativeAudioMediaStreamTrack( 280 MediaStreamDependencyFactory::CreateNativeAudioMediaStreamTrack(
281 const blink::WebMediaStreamTrack& track) { 281 const blink::WebMediaStreamTrack& track) {
282 blink::WebMediaStreamSource source = track.source(); 282 blink::WebMediaStreamSource source = track.source();
283 DCHECK_EQ(source.type(), blink::WebMediaStreamSource::TypeAudio); 283 DCHECK_EQ(source.type(), blink::WebMediaStreamSource::TypeAudio);
284 MediaStreamAudioSource* source_data = 284 MediaStreamAudioSource* source_data =
285 static_cast<MediaStreamAudioSource*>(source.extraData()); 285 static_cast<MediaStreamAudioSource*>(source.extraData());
286 286
287 scoped_refptr<WebAudioCapturerSource> webaudio_source; 287 scoped_refptr<WebAudioCapturerSource> webaudio_source;
288 if (!source_data) { 288 scoped_refptr<WebRtcAudioCapturer> capturer;
289 if (source_data) {
290 capturer = source_data->GetAudioCapturer();
291 } else {
289 if (source.requiresAudioConsumer()) { 292 if (source.requiresAudioConsumer()) {
290 // We're adding a WebAudio MediaStream. 293 // We're adding a WebAudio MediaStream.
291 // Create a specific capturer for each WebAudio consumer. 294 // Create a specific capturer for each WebAudio consumer.
292 webaudio_source = CreateWebAudioSource(&source); 295 webaudio_source = CreateWebAudioSource(&source);
293 source_data = 296 source_data =
294 static_cast<MediaStreamAudioSource*>(source.extraData()); 297 static_cast<MediaStreamAudioSource*>(source.extraData());
298
299 // Use the current default capturer for the WebAudio track so that the
300 // WebAudio track can pass a valid delay value and |need_audio_processing|
301 // flag to PeerConnection.
302 // TODO(xians): Remove this after moving APM to Chrome.
303 if (GetWebRtcAudioDevice())
304 capturer = GetWebRtcAudioDevice()->GetDefaultCapturer();
295 } else { 305 } else {
296 // TODO(perkj): Implement support for sources from 306 // TODO(perkj): Implement support for sources from
297 // remote MediaStreams. 307 // remote MediaStreams.
298 NOTIMPLEMENTED(); 308 NOTIMPLEMENTED();
299 return NULL; 309 return NULL;
300 } 310 }
301 } 311 }
302 312
303 return CreateLocalAudioTrack(track, 313 return CreateLocalAudioTrack(track,
304 source_data->GetAudioCapturer(), 314 capturer,
305 webaudio_source.get(), 315 webaudio_source.get(),
306 source_data->local_audio_source()); 316 source_data->local_audio_source());
307 } 317 }
308 318
309 scoped_refptr<webrtc::VideoTrackInterface> 319 scoped_refptr<webrtc::VideoTrackInterface>
310 MediaStreamDependencyFactory::CreateNativeVideoMediaStreamTrack( 320 MediaStreamDependencyFactory::CreateNativeVideoMediaStreamTrack(
311 const blink::WebMediaStreamTrack& track) { 321 const blink::WebMediaStreamTrack& track) {
312 DCHECK(track.extraData() == NULL); 322 DCHECK(track.extraData() == NULL);
313 blink::WebMediaStreamSource source = track.source(); 323 blink::WebMediaStreamSource source = track.source();
314 DCHECK_EQ(source.type(), blink::WebMediaStreamSource::TypeVideo); 324 DCHECK_EQ(source.type(), blink::WebMediaStreamSource::TypeVideo);
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 } 846 }
837 847
838 void MediaStreamDependencyFactory::EnsureWebRtcAudioDeviceImpl() { 848 void MediaStreamDependencyFactory::EnsureWebRtcAudioDeviceImpl() {
839 if (audio_device_) 849 if (audio_device_)
840 return; 850 return;
841 851
842 audio_device_ = new WebRtcAudioDeviceImpl(); 852 audio_device_ = new WebRtcAudioDeviceImpl();
843 } 853 }
844 854
845 } // namespace content 855 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/webrtc_audio_device_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698