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

Unified Diff: content/renderer/media/webrtc_audio_renderer.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: 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: content/renderer/media/webrtc_audio_renderer.cc
diff --git a/content/renderer/media/webrtc_audio_renderer.cc b/content/renderer/media/webrtc_audio_renderer.cc
index 49fc1857f83b3771212249d1dc3dec6efa067201..100c399e2414c67271f657d35e5ffc62c8882099 100644
--- a/content/renderer/media/webrtc_audio_renderer.cc
+++ b/content/renderer/media/webrtc_audio_renderer.cc
@@ -423,13 +423,21 @@ media::OutputDeviceStatus WebRtcAudioRenderer::GetDeviceStatus() {
}
int WebRtcAudioRenderer::Render(media::AudioBus* audio_bus,
- uint32_t audio_delay_milliseconds,
+ uint32_t frames_delayed,
uint32_t frames_skipped) {
DCHECK(audio_renderer_thread_checker_.CalledOnValidThread());
base::AutoLock auto_lock(lock_);
if (!source_)
return 0;
+ // TODO(X): Converting from frames to milliseconds will potentially lose
chcunningham 2016/02/11 01:25:42 X should be one of the RTC folks. Henrik? Can yo
Henrik Grunell 2016/02/12 17:47:01 Put me as reference. Filed 586540. Thanks for poin
chcunningham 2016/02/17 01:56:51 Done.
+ // hundreds of microseconds which may cause audio video drift. Update
+ // this class and all usage of render delay msec -> frames (possibly even
+ // using a double type for frames).
+ uint32_t audio_delay_milliseconds = static_cast<double>(frames_delayed) *
+ base::Time::kMillisecondsPerSecond /
+ sink_params_.sample_rate();
+
DVLOG(2) << "WebRtcAudioRenderer::Render()";
DVLOG(2) << "audio_delay_milliseconds: " << audio_delay_milliseconds;
@@ -481,6 +489,8 @@ void WebRtcAudioRenderer::SourceCallback(
<< audio_bus->frames() << ")";
int output_delay_milliseconds = audio_delay_milliseconds_;
+ // TODO(X): This integer division by sample_rate will cause loss of partial
chcunningham 2016/02/11 01:25:42 Ditto.
Henrik Grunell 2016/02/12 17:47:01 Use same bug.
chcunningham 2016/02/17 01:56:51 Done.
+ // milliseconds, and may cause avsync drift.
output_delay_milliseconds += fifo_frame_delay *
base::Time::kMillisecondsPerSecond /
sink_params_.sample_rate();

Powered by Google App Engine
This is Rietveld 408576698