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

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

Issue 2517503003: Reland: Make more media APIs aware of |delay| and |delay_timestamp| (Closed)
Patch Set: Comments from chcunningham@ and Dale 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
« 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 a17f85c3a20846673b1f345fe7e6792e2c60bf1a..2e6b0cbe9a0484e8c81c26a59d7eb1128d26df39 100644
--- a/content/renderer/media/track_audio_renderer.cc
+++ b/content/renderer/media/track_audio_renderer.cc
@@ -39,9 +39,10 @@ base::TimeDelta ComputeTotalElapsedRenderTime(
} // namespace
// media::AudioRendererSink::RenderCallback implementation
-int TrackAudioRenderer::Render(media::AudioBus* audio_bus,
- uint32_t frames_delayed,
- uint32_t frames_skipped) {
+int TrackAudioRenderer::Render(base::TimeDelta delay,
+ base::TimeTicks delay_timestamp,
+ int prior_frames_skipped,
+ media::AudioBus* audio_bus) {
TRACE_EVENT0("audio", "TrackAudioRenderer::Render");
base::AutoLock auto_lock(thread_lock_);
@@ -50,19 +51,13 @@ int TrackAudioRenderer::Render(media::AudioBus* audio_bus,
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() +
- base::TimeDelta::FromMilliseconds(audio_delay_milliseconds);
+ const base::TimeTicks playout_time = base::TimeTicks::Now() + delay;
DVLOG(2) << "Pulling audio out of shifter to be played "
- << audio_delay_milliseconds << " ms from now.";
+ << delay.InMilliseconds() << " 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