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

Unified Diff: media/base/audio_renderer_mixer.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: Fixes for feedback 2. 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
Index: media/base/audio_renderer_mixer.cc
diff --git a/media/base/audio_renderer_mixer.cc b/media/base/audio_renderer_mixer.cc
index 218bb9e2c560de40398bf3696195905bbfcee365..92dc279318df77e17f4ad7518f1bef123e5ec947 100644
--- a/media/base/audio_renderer_mixer.cc
+++ b/media/base/audio_renderer_mixer.cc
@@ -4,6 +4,8 @@
#include "media/base/audio_renderer_mixer.h"
+#include <cmath>
+
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/logging.h"
@@ -117,7 +119,7 @@ OutputDevice* AudioRendererMixer::GetOutputDevice() {
}
int AudioRendererMixer::Render(AudioBus* audio_bus,
- uint32_t audio_delay_milliseconds,
+ uint32_t frames_delayed,
uint32_t frames_skipped) {
base::AutoLock auto_lock(lock_);
@@ -132,8 +134,12 @@ int AudioRendererMixer::Render(AudioBus* audio_bus,
playing_ = false;
}
- master_converter_.ConvertWithDelay(
- base::TimeDelta::FromMilliseconds(audio_delay_milliseconds), audio_bus);
+ // TODO(chcunningham): Delete this conversion and change ConvertWith delay to
+ // expect a count of frames delayed instead of TimeDelta (less precise).
Henrik Grunell 2016/02/17 08:13:47 Did you have a bug for this?
chcunningham 2016/02/17 18:32:37 Done. http://crbug.com/587522. Updated the comment
+ base::TimeDelta audio_delay = base::TimeDelta::FromMicroseconds(
+ std::round(frames_delayed * output_params_.GetMicrosecondsPerFrame()));
+
+ master_converter_.ConvertWithDelay(audio_delay, audio_bus);
return audio_bus->frames();
}

Powered by Google App Engine
This is Rietveld 408576698