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

Unified Diff: media/audio/win/audio_unified_win.cc

Issue 12049070: Avoids irregular OnMoreData callbacks on Windows using Core Audio (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved FillRenderEndpointBufferWithSilence to CoreAudioUtil 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 side-by-side diff with in-line comments
Download patch
Index: media/audio/win/audio_unified_win.cc
diff --git a/media/audio/win/audio_unified_win.cc b/media/audio/win/audio_unified_win.cc
index 677f9e0260aea59c10879be3e4daef4e10a206e7..de84aaa6e5b6d6c57fe7aa8bb588ac09969a3f4b 100644
--- a/media/audio/win/audio_unified_win.cc
+++ b/media/audio/win/audio_unified_win.cc
@@ -246,12 +246,15 @@ void WASAPIUnifiedStream::Start(AudioSourceCallback* callback) {
return;
}
- // Reset the counter for number of rendered frames taking into account the
- // fact that we always initialize the render side with silence.
- UINT32 num_queued_frames = 0;
- audio_output_client_->GetCurrentPadding(&num_queued_frames);
- DCHECK_EQ(num_queued_frames, endpoint_render_buffer_size_frames_);
- num_written_frames_ = num_queued_frames;
+ // Ensure that the endpoint buffer is prepared with silence.
+ if (share_mode_ == AUDCLNT_SHAREMODE_SHARED) {
+ if (!CoreAudioUtil::FillRenderEndpointBufferWithSilence(
+ audio_output_client_, audio_render_client_)) {
tommi (sloooow) - chröme 2013/01/31 16:18:24 same here
henrika (OOO until Aug 14) 2013/02/01 10:55:56 Done.
+ DLOG(WARNING) << "Failed to prepare endpoint buffers with silence.";
+ return;
+ }
+ }
+ num_written_frames_ = endpoint_render_buffer_size_frames_;
// Start output streaming data between the endpoint buffer and the audio
// engine.

Powered by Google App Engine
This is Rietveld 408576698