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

Unified Diff: content/renderer/media/track_audio_renderer.cc

Issue 2471733004: Revert of Make more media APIs aware of |delay| and |delay_timestamp| (Closed)
Patch Set: Created 4 years, 1 month 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 | « content/renderer/media/track_audio_renderer.h ('k') | content/renderer/media/webrtc_audio_renderer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/track_audio_renderer.cc
diff --git a/content/renderer/media/track_audio_renderer.cc b/content/renderer/media/track_audio_renderer.cc
index 2e6b0cbe9a0484e8c81c26a59d7eb1128d26df39..a17f85c3a20846673b1f345fe7e6792e2c60bf1a 100644
--- a/content/renderer/media/track_audio_renderer.cc
+++ b/content/renderer/media/track_audio_renderer.cc
@@ -39,10 +39,9 @@
} // namespace
// media::AudioRendererSink::RenderCallback implementation
-int TrackAudioRenderer::Render(base::TimeDelta delay,
- base::TimeTicks delay_timestamp,
- int prior_frames_skipped,
- media::AudioBus* audio_bus) {
+int TrackAudioRenderer::Render(media::AudioBus* audio_bus,
+ uint32_t frames_delayed,
+ uint32_t frames_skipped) {
TRACE_EVENT0("audio", "TrackAudioRenderer::Render");
base::AutoLock auto_lock(thread_lock_);
@@ -51,13 +50,19 @@
return 0;
}
+ // Source sample rate equals to output one, see MaybeStartSink(), so using it.
+ uint32_t audio_delay_milliseconds = static_cast<double>(frames_delayed) *
+ base::Time::kMillisecondsPerSecond /
+ source_params_.sample_rate();
// TODO(miu): Plumbing is needed to determine the actual playout timestamp
// of the audio, instead of just snapshotting TimeTicks::Now(), for proper
// audio/video sync. http://crbug.com/335335
- const base::TimeTicks playout_time = base::TimeTicks::Now() + delay;
+ const base::TimeTicks playout_time =
+ base::TimeTicks::Now() +
+ base::TimeDelta::FromMilliseconds(audio_delay_milliseconds);
DVLOG(2) << "Pulling audio out of shifter to be played "
- << delay.InMilliseconds() << " ms from now.";
+ << audio_delay_milliseconds << " ms from now.";
audio_shifter_->Pull(audio_bus, playout_time);
num_samples_rendered_ += audio_bus->frames();
return audio_bus->frames();
« no previous file with comments | « content/renderer/media/track_audio_renderer.h ('k') | content/renderer/media/webrtc_audio_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698