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

Unified Diff: media/audio/audio_parameters.cc

Issue 22886005: Switch audio synchronization from sleep() based to select() based. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix DCHECK. Created 7 years, 2 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_parameters.h ('k') | media/audio/shared_memory_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_parameters.cc
diff --git a/media/audio/audio_parameters.cc b/media/audio/audio_parameters.cc
index 5e77c60cb94484a4db36cba14f31c84a994fd3c0..b7ea4870c23c2bf5f6b51c2bfbfaa5279c566ef1 100644
--- a/media/audio/audio_parameters.cc
+++ b/media/audio/audio_parameters.cc
@@ -89,6 +89,12 @@ int AudioParameters::GetBytesPerFrame() const {
return channels_ * bits_per_sample_ / 8;
}
+base::TimeDelta AudioParameters::GetBufferDuration() const {
+ return base::TimeDelta::FromMicroseconds(
+ frames_per_buffer_ * base::Time::kMicrosecondsPerSecond /
+ static_cast<float>(sample_rate_));
+}
+
void AudioParameters::SetDiscreteChannels(int channels) {
channel_layout_ = CHANNEL_LAYOUT_DISCRETE;
channels_ = channels;
« no previous file with comments | « media/audio/audio_parameters.h ('k') | media/audio/shared_memory_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698