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

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

Issue 12261003: Possible solution to synchronization problems in webrtc audio capturer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/media/webrtc_audio_capturer.cc ('k') | no next file » | 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/webrtc_local_audio_renderer.h" 5 #include "content/renderer/media/webrtc_local_audio_renderer.h"
6 6
7 #include "base/atomicops.h" 7 #include "base/atomicops.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 156
157 // Use the capturing source audio parameters when opening the output audio 157 // Use the capturing source audio parameters when opening the output audio
158 // device. Any mismatch will be compensated for by the audio output back-end. 158 // device. Any mismatch will be compensated for by the audio output back-end.
159 // Note that the buffer size is modified to make the full-duplex scheme less 159 // Note that the buffer size is modified to make the full-duplex scheme less
160 // resource intensive. By doubling the buffer size (compared to the capture 160 // resource intensive. By doubling the buffer size (compared to the capture
161 // side), the callback frequency of browser side callbacks will be lower and 161 // side), the callback frequency of browser side callbacks will be lower and
162 // tests have shown that it resolves issues with audio glitches for some 162 // tests have shown that it resolves issues with audio glitches for some
163 // cases where resampling is needed on the output side. 163 // cases where resampling is needed on the output side.
164 // TODO(henrika): verify this scheme on as many different devices and 164 // TODO(henrika): verify this scheme on as many different devices and
165 // combinations of sample rates as possible 165 // combinations of sample rates as possible
166 media::AudioParameters source_params = source_->audio_parameter(); 166 media::AudioParameters source_params = source_->audio_parameters();
167 media::AudioParameters sink_params(source_params.format(), 167 media::AudioParameters sink_params(source_params.format(),
168 source_params.channel_layout(), 168 source_params.channel_layout(),
169 source_params.sample_rate(), 169 source_params.sample_rate(),
170 source_params.bits_per_sample(), 170 source_params.bits_per_sample(),
171 2 * source_params.frames_per_buffer()); 171 2 * source_params.frames_per_buffer());
172 sink_ = AudioDeviceFactory::NewOutputDevice(); 172 sink_ = AudioDeviceFactory::NewOutputDevice();
173 if (CommandLine::ForCurrentProcess()->HasSwitch( 173 if (CommandLine::ForCurrentProcess()->HasSwitch(
174 switches::kEnableWebAudioInput)) { 174 switches::kEnableWebAudioInput)) {
175 // TODO(henrika): we could utilize the unified audio here instead and do 175 // TODO(henrika): we could utilize the unified audio here instead and do
176 // sink_->InitializeIO(sink_params, 2, callback_.get()); 176 // sink_->InitializeIO(sink_params, 2, callback_.get());
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 DVLOG(1) << "WebRtcLocalAudioRenderer::OnSourceCaptureDeviceStopped()"; 261 DVLOG(1) << "WebRtcLocalAudioRenderer::OnSourceCaptureDeviceStopped()";
262 if (!Started()) 262 if (!Started())
263 return; 263 return;
264 264
265 // The capture device has stopped and we should therefore stop all activity 265 // The capture device has stopped and we should therefore stop all activity
266 // as well to save resources. 266 // as well to save resources.
267 Stop(); 267 Stop();
268 } 268 }
269 269
270 } // namespace content 270 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/webrtc_audio_capturer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698