Skip to content

Commit

Permalink
Move MediaStreamAudioProcessor processing code to new class in media/
Browse files Browse the repository at this point in the history
This moves the bulk of the implementation of MediaStreamAudioProcessor - the audio processing - to a separate class media::AudioProcessor in the media component.
MediaStreamAudioProcessor is essentially reduced to managing renderer-specific data and control flow for the audio processor:
- aec dump interface toward browser
- stats interface toward WebRTC
- playout data sink towards WebRTC audio source
... as well as enforcing renderer-specific threading expectations.

This CL widens the distance between MediaStreamAudioProcessor::WouldModifyAudio() and the logic (AudioProcessor::InitializeAudioProcessingModule()). Tests are added to enforce that the functions agree.

Notes for reviewing in Gerrit:
- audio_processor.* is branched from media_stream_audio_processor.*
  - diff vs patch set 1 to get a clean diffbase
- audio_processor_test.cc is branched from media_stream_audio_processor_test.cc
  - diff vs patch set 6 to get a clean diffbase

Tested: Made WebRTC call with a release build (+dchecks), and checked 1) audio experience 2) logs 3) echo cancellation 4) contents of diagnostic audio recordings (wav+aecdump)
Bug: chromium:1215061
Change-Id: I6c49bc71d2b1441b27199a137cb8a3204c6566b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3269221
Reviewed-by: Olga Sharonova <olka@chromium.org>
Reviewed-by: Henrik Boström <hbos@chromium.org>
Commit-Queue: Sam Zackrisson <saza@chromium.org>
Cr-Commit-Position: refs/heads/main@{#949987}
  • Loading branch information
Sam Zackrisson authored and Chromium LUCI CQ committed Dec 9, 2021
1 parent d66603b commit d33edbc
Show file tree
Hide file tree
Showing 13 changed files with 1,804 additions and 843 deletions.
2 changes: 1 addition & 1 deletion media/base/audio_processing.h
Expand Up @@ -31,7 +31,7 @@ struct MEDIA_EXPORT AudioProcessingSettings {
bool multi_channel_capture_processing = true;
bool stereo_mirroring = false;

// TODO(https://crbug.com/1215061): Deprecate this setting.
// TODO(https://crbug.com/1269723): Deprecate this setting.
// This flag preserves the behavior of the to-be-deprecated flag / constraint
// |AudioProcessingProperties::goog_experimental_echo_cancellation|: It has no
// effect on what effects are enabled, but for legacy reasons, it forces APM
Expand Down
8 changes: 7 additions & 1 deletion media/webrtc/BUILD.gn
Expand Up @@ -11,6 +11,8 @@ component("webrtc") {
sources = [
"audio_delay_stats_reporter.cc",
"audio_delay_stats_reporter.h",
"audio_processor.cc",
"audio_processor.h",
"constants.h",
"helpers.cc",
"helpers.h",
Expand All @@ -23,6 +25,7 @@ component("webrtc") {
deps = [
"//base",
"//build:chromecast_buildflags",
"//build:chromeos_buildflags",
"//media",
"//media:shared_memory_support",
"//third_party/webrtc_overrides:webrtc_component",
Expand All @@ -41,5 +44,8 @@ source_set("unit_tests") {
"//testing/gtest",
"//third_party/webrtc_overrides:webrtc_component",
]
sources = [ "helpers_unittests.cc" ]
sources = [
"audio_processor_test.cc",
"helpers_unittests.cc",
]
}

0 comments on commit d33edbc

Please sign in to comment.