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

Unified Diff: media/audio/audio_parameters.cc

Issue 1687213002: Express audio delay more precisely in frames rather than milliseconds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 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 | « media/audio/audio_parameters.h ('k') | media/base/audio_capturer_source.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 08e5825da4062a1cf829ddbfe6a445b835ba8350..10f41d50452261a181849909157d36d179172f36 100644
--- a/media/audio/audio_parameters.cc
+++ b/media/audio/audio_parameters.cc
@@ -77,6 +77,10 @@ int AudioParameters::GetBytesPerFrame() const {
return channels_ * bits_per_sample_ / 8;
}
+double AudioParameters::GetMicrosecondsPerFrame() const {
+ return static_cast<double>(base::Time::kMicrosecondsPerSecond) / sample_rate_;
+}
+
base::TimeDelta AudioParameters::GetBufferDuration() const {
return base::TimeDelta::FromMicroseconds(static_cast<int64_t>(
frames_per_buffer_ * base::Time::kMicrosecondsPerSecond /
« no previous file with comments | « media/audio/audio_parameters.h ('k') | media/base/audio_capturer_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698