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

Unified Diff: media/audio/audio_device_thread.cc

Issue 12379071: Use multiple shared memory buffers cyclically for audio capture. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: code review Created 7 years, 9 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 | « media/audio/audio_device_thread.h ('k') | media/audio/audio_input_device.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_device_thread.cc
===================================================================
--- media/audio/audio_device_thread.cc (revision 186364)
+++ media/audio/audio_device_thread.cc (working copy)
@@ -177,16 +177,22 @@
AudioDeviceThread::Callback::Callback(
const AudioParameters& audio_parameters,
- base::SharedMemoryHandle memory, int memory_length)
+ base::SharedMemoryHandle memory,
+ int memory_length,
+ int total_segments)
: audio_parameters_(audio_parameters),
samples_per_ms_(audio_parameters.sample_rate() / 1000),
bytes_per_ms_(audio_parameters.channels() *
(audio_parameters_.bits_per_sample() / 8) *
samples_per_ms_),
shared_memory_(memory, false),
- memory_length_(memory_length) {
+ memory_length_(memory_length),
+ total_segments_(total_segments) {
CHECK_NE(bytes_per_ms_, 0); // Catch division by zero early.
CHECK_NE(samples_per_ms_, 0);
+ CHECK_GT(total_segments_, 0);
+ CHECK_EQ(memory_length_ % total_segments_, 0);
+ segment_length_ = memory_length_ / total_segments_;
}
AudioDeviceThread::Callback::~Callback() {}
« no previous file with comments | « media/audio/audio_device_thread.h ('k') | media/audio/audio_input_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698