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

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

Issue 1528473003: Feed the WebRTC APM with empty far-end frames for the number of frames skipped by OS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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: content/renderer/media/media_stream_audio_processor.cc
diff --git a/content/renderer/media/media_stream_audio_processor.cc b/content/renderer/media/media_stream_audio_processor.cc
index 5e4c1c0569d0c01044246d82c01ab07a12b74392..e0ddd634820afcf020e07a81be78f30fdfee8b28 100644
--- a/content/renderer/media/media_stream_audio_processor.cc
+++ b/content/renderer/media/media_stream_audio_processor.cc
@@ -432,7 +432,8 @@ void MediaStreamAudioProcessor::OnIpcClosing() {
void MediaStreamAudioProcessor::OnPlayoutData(media::AudioBus* audio_bus,
int sample_rate,
- int audio_delay_milliseconds) {
+ int audio_delay_milliseconds,
+ uint32_t skipped_frames) {
DCHECK(render_thread_checker_.CalledOnValidThread());
DCHECK(audio_processing_->echo_control_mobile()->is_enabled() ^
audio_processing_->echo_cancellation()->is_enabled());
@@ -447,6 +448,18 @@ void MediaStreamAudioProcessor::OnPlayoutData(media::AudioBus* audio_bus,
render_fifo_->Push(
*audio_bus, base::TimeDelta::FromMilliseconds(audio_delay_milliseconds));
+
+ // Feed the APM with empty frames corresponding to |skipped_frames|.
+ if (skipped_frames > 0) {
+ MediaStreamAudioBus empty_bus(audio_bus->channels(), skipped_frames);
peah 2015/12/16 10:26:57 Does this call also set all samples in the empty_b
Henrik Grunell 2015/12/18 10:17:33 I doesn't. Fixed.
+ audio_processing_->AnalyzeReverseStream(
+ empty_bus.channel_ptrs(),
+ empty_bus.bus()->frames(),
peah 2015/12/16 10:26:57 Is there any restriction on the values of skipped_
Henrik Grunell 2015/12/18 10:17:33 No, it can be any value. OK, I added storing the n
peah 2015/12/18 13:34:12 What does this mean? Does it mean that typically a
+ sample_rate,
+ ChannelsToLayout(empty_bus.bus()->channels()));
+ }
+
+ // Pull data from the fifo and feed the APM.
MediaStreamAudioBus* analysis_bus;
base::TimeDelta audio_delay;
while (render_fifo_->Consume(&analysis_bus, &audio_delay)) {
@@ -455,7 +468,7 @@ void MediaStreamAudioProcessor::OnPlayoutData(media::AudioBus* audio_bus,
analysis_bus->channel_ptrs(),
analysis_bus->bus()->frames(),
sample_rate,
- ChannelsToLayout(audio_bus->channels()));
+ ChannelsToLayout(analysis_bus->bus()->channels()));
}
}
« no previous file with comments | « content/renderer/media/media_stream_audio_processor.h ('k') | content/renderer/media/media_stream_audio_processor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698