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

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

Issue 2703253003: WASAPIAudioInputStream: Revert to the previous buffer size calculation. (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/win/audio_low_latency_input_win.cc
diff --git a/media/audio/win/audio_low_latency_input_win.cc b/media/audio/win/audio_low_latency_input_win.cc
index df491b1a59036fd64545705539297b266dfac39e..14a2f0d94f83218f5894148a4ba6b4f6b4ba7efb 100644
--- a/media/audio/win/audio_low_latency_input_win.cc
+++ b/media/audio/win/audio_low_latency_input_win.cc
@@ -356,13 +356,18 @@ void WASAPIAudioInputStream::Run() {
// However if the buffer ratio is imperfect, we will need 3 buffers to safely
// be able to buffer up data in cases where a conversion requires two audio
// buffers (and we need to be able to write to the third one).
+ size_t capture_buffer_size =
+ std::max(2 * endpoint_buffer_size_frames_ * frame_size_,
+ 2 * packet_size_frames_ * frame_size_);
+ int buffers_required = capture_buffer_size / packet_size_bytes_;
+ if (converter_ && imperfect_buffer_size_conversion_)
+ ++buffers_required;
+
DCHECK(!fifo_);
- const int buffers_required =
- converter_ && imperfect_buffer_size_conversion_ ? 3 : 2;
fifo_.reset(new AudioBlockFifo(format_.nChannels, packet_size_frames_,
buffers_required));
- DVLOG(1) << "AudioBlockFifo needs " << buffers_required << " buffers";
+ DVLOG(1) << "AudioBlockFifo buffer count: " << buffers_required;
LARGE_INTEGER now_count = {};
bool recording = true;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698