summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorxians <xians@chromium.org>2014-11-12 14:54:52 -0800
committerCommit bot <commit-bot@chromium.org>2014-11-12 22:55:15 +0000
commit33956f7d3b46358ba7bce3e0ff4e9cecd1e39b0a (patch)
tree073ce5fb6b499aa4511e0a2e4b92be328db4abcc /content
parentf3d4c1f127da66be1a72d84fba71e687026fa20e (diff)
downloadchromium_src-33956f7d3b46358ba7bce3e0ff4e9cecd1e39b0a.zip
chromium_src-33956f7d3b46358ba7bce3e0ff4e9cecd1e39b0a.tar.gz
chromium_src-33956f7d3b46358ba7bce3e0ff4e9cecd1e39b0a.tar.bz2
Reland 720713002: Avoid getting CoreAudio into bad state.
This patch fixes two issues: 1) in audio_low_latency_input_mac.cc, when the number_of_frames is changed on the fly, previously we feed a audio_buffer_list which uses the original number_of_frames_ to CoreAudio, this will put CoreAudio into a bad state, and the consequence is that if the new input stream is trying to use a larger buffer size than what the previous input stream was using, AudioUnitRender() will return -50 for the new stream. Thus it leads to no input audio issue for webrtc. 2) gUM on Mac will create an input stream using 128 samples as buffer size at the beginning, and will re-create the stream using 10ms when a peer connection is connected to a audio track. It discards if audio processing is enabled or not. This patch avoids creating the first stream using 128 samples if audio processing is enabled. BUG=428706 TEST=https://webrtc-phone.appspot.com changes chrome3940Workaround to false, and make a call lots of time. Verify that the input stream always works. Review URL: https://codereview.chromium.org/721923002 Cr-Commit-Position: refs/heads/master@{#303909}
Diffstat (limited to 'content')
-rw-r--r--content/renderer/media/webrtc_audio_capturer.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/content/renderer/media/webrtc_audio_capturer.cc b/content/renderer/media/webrtc_audio_capturer.cc
index 3299987..45034e8 100644
--- a/content/renderer/media/webrtc_audio_capturer.cc
+++ b/content/renderer/media/webrtc_audio_capturer.cc
@@ -579,10 +579,13 @@ int WebRtcAudioCapturer::GetBufferSize(int sample_rate) const {
// Use the native hardware buffer size in non peer connection mode when the
// platform is using a native buffer size smaller than the PeerConnection
- // buffer size.
+ // buffer size and audio processing is off.
int hardware_buffer_size = device_info_.device.input.frames_per_buffer;
if (!peer_connection_mode_ && hardware_buffer_size &&
- hardware_buffer_size <= peer_connection_buffer_size) {
+ hardware_buffer_size <= peer_connection_buffer_size &&
+ !audio_processor_->has_audio_processing()) {
+ DVLOG(1) << "WebRtcAudioCapturer is using hardware buffer size "
+ << hardware_buffer_size;
return hardware_buffer_size;
}