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

Unified Diff: media/base/fake_audio_render_callback.cc

Issue 2567143002: media::SilentSinkSuspender should simulate |delay| and |delay_timestamp| (Closed)
Patch Set: Created 4 years 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/fake_audio_render_callback.cc
diff --git a/media/base/fake_audio_render_callback.cc b/media/base/fake_audio_render_callback.cc
index 030883b21397a636ef9c3ab09c7038f9edba2c13..3f439cddb93b06a990f1966558a10ba04a939af5 100644
--- a/media/base/fake_audio_render_callback.cc
+++ b/media/base/fake_audio_render_callback.cc
@@ -15,7 +15,7 @@ namespace media {
FakeAudioRenderCallback::FakeAudioRenderCallback(double step)
: half_fill_(false),
step_(step),
- last_frames_delayed_(-1),
+ last_delay_(base::TimeDelta::Max()),
last_channel_count_(-1),
volume_(1) {
reset();
@@ -27,24 +27,24 @@ int FakeAudioRenderCallback::Render(base::TimeDelta delay,
base::TimeTicks delay_timestamp,
int prior_frames_skipped,
AudioBus* audio_bus) {
- const int kSampleRate = 48000;
- auto frames_delayed = AudioTimestampHelper::TimeToFrames(delay, kSampleRate);
- return RenderInternal(audio_bus, frames_delayed, volume_);
+ return RenderInternal(audio_bus, delay, volume_);
}
double FakeAudioRenderCallback::ProvideInput(AudioBus* audio_bus,
uint32_t frames_delayed) {
// Volume should only be applied by the caller to ProvideInput, so don't bake
// it into the rendered audio.
- RenderInternal(audio_bus, frames_delayed, 1.0);
+ constexpr int kSampleRate = 48000;
chcunningham 2016/12/20 18:36:42 I think this should be defined and passed in (to c
Mikhail 2016/12/20 21:45:50 Done.
+ auto delay = AudioTimestampHelper::FramesToTime(frames_delayed, kSampleRate);
+ RenderInternal(audio_bus, delay, 1.0);
return volume_;
}
int FakeAudioRenderCallback::RenderInternal(AudioBus* audio_bus,
- uint32_t frames_delayed,
+ base::TimeDelta delay,
double volume) {
- DCHECK_LE(frames_delayed, static_cast<uint32_t>(INT_MAX));
- last_frames_delayed_ = static_cast<int>(frames_delayed);
+ DCHECK_LE(delay, base::TimeDelta::Max());
+ last_delay_ = delay;
last_channel_count_ = audio_bus->channels();
int number_of_frames = audio_bus->frames();

Powered by Google App Engine
This is Rietveld 408576698