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

Issue 2690793002: Add basic resample support to WASAPIAudioInputStream. (Closed)

Created:
3 years, 10 months ago by tommi (sloooow) - chröme
Modified:
3 years, 10 months ago
Reviewers:
DaleCurtis, jwd
CC:
asvitkine+watch_chromium.org, chromium-reviews, feature-media-reviews_chromium.org, Max Morin, o1ka
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add basic resample support to WASAPIAudioInputStream. After removing the legacy Wave capture implementation, we're seeing frequent failures on Windows due to "FORMAT_NOT_SUPPORTED". It seems we still have places that hardcode a specific sample rate instead of querying. This CL adds basic support for resampling to see how much that buys us while we track down the code that still requires this. Notably we don't support cases where there are mismatches in the number of channels etc, so there will possibly still be cases where a user has a mono mic but the calling code has hardcoded requiring stereo input. BUG=684741 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel Review-Url: https://codereview.chromium.org/2690793002 Cr-Commit-Position: refs/heads/master@{#451461} Committed: https://chromium.googlesource.com/chromium/src/+/3d875dfaa149b616ef07c753b4ad55777b636c7e

Patch Set 1 #

Total comments: 15

Patch Set 2 : Use AudioConverter for converting instead of the multi channel resampler. #

Total comments: 5

Patch Set 3 : Add FIFO in cases where we don't get an exact buffer match for resampling #

Total comments: 4

Patch Set 4 : Switch to AudioBlockFifo #

Patch Set 5 : Rebase #

Total comments: 3

Patch Set 6 : Add AudioBlockFifo::PushSilence #

Total comments: 1

Patch Set 7 : Fix comment #

Total comments: 12

Patch Set 8 : Use closest match bits-per-sample, add DCHECKs and address other comments #

Total comments: 3

Patch Set 9 : Add check for bitness #

Patch Set 10 : Add check for unsupported channel layout #

Unified diffs Side-by-side diffs Delta from patch set Stats (+320 lines, -116 lines) Patch
M media/audio/win/audio_low_latency_input_win.h View 1 2 3 5 chunks +17 lines, -5 lines 0 comments Download
M media/audio/win/audio_low_latency_input_win.cc View 1 2 3 4 5 6 7 8 9 11 chunks +138 lines, -48 lines 0 comments Download
M media/audio/win/audio_low_latency_input_win_unittest.cc View 1 2 12 chunks +80 lines, -22 lines 0 comments Download
M media/base/audio_block_fifo.h View 1 2 3 4 5 6 2 chunks +8 lines, -0 lines 0 comments Download
M media/base/audio_block_fifo.cc View 1 2 3 4 5 3 chunks +48 lines, -33 lines 0 comments Download
M media/base/audio_block_fifo_unittest.cc View 1 2 3 4 5 5 chunks +28 lines, -8 lines 0 comments Download
M tools/metrics/histograms/histograms.xml View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 53 (19 generated)
tommi (sloooow) - chröme
dale - main review jwd - histograms.xml (one more enum addition to a recently reviewed ...
3 years, 10 months ago (2017-02-11 20:50:35 UTC) #3
tommi (sloooow) - chröme
3 years, 10 months ago (2017-02-11 22:49:18 UTC) #8
DaleCurtis
https://codereview.chromium.org/2690793002/diff/1/media/audio/win/audio_low_latency_input_win.cc File media/audio/win/audio_low_latency_input_win.cc (right): https://codereview.chromium.org/2690793002/diff/1/media/audio/win/audio_low_latency_input_win.cc#newcode127 media/audio/win/audio_low_latency_input_win.cc:127: if (SUCCEEDED(hr) && resampler_.get() != nullptr) just "&& resampler_" ...
3 years, 10 months ago (2017-02-13 19:40:43 UTC) #9
DaleCurtis
https://codereview.chromium.org/2690793002/diff/1/media/audio/win/audio_low_latency_input_win.cc File media/audio/win/audio_low_latency_input_win.cc (right): https://codereview.chromium.org/2690793002/diff/1/media/audio/win/audio_low_latency_input_win.cc#newcode607 media/audio/win/audio_low_latency_input_win.cc:607: if (hr == S_FALSE && closest_match->nChannels == format_.nChannels) { ...
3 years, 10 months ago (2017-02-13 23:59:00 UTC) #10
jwd
histograms LGTM
3 years, 10 months ago (2017-02-14 16:04:10 UTC) #11
tommi (sloooow) - chröme
Use AudioConverter for converting instead of the multi channel resampler.
3 years, 10 months ago (2017-02-15 13:40:36 UTC) #12
DaleCurtis
https://codereview.chromium.org/2690793002/diff/20001/media/audio/win/audio_low_latency_input_win.cc File media/audio/win/audio_low_latency_input_win.cc (right): https://codereview.chromium.org/2690793002/diff/20001/media/audio/win/audio_low_latency_input_win.cc#newcode441 media/audio/win/audio_low_latency_input_win.cc:441: LOG(ERROR) << "Failed to convert enough samples."; Won't this ...
3 years, 10 months ago (2017-02-16 02:03:36 UTC) #13
tommi (sloooow) - chröme
Add FIFO in cases where we don't get an exact buffer match for resampling
3 years, 10 months ago (2017-02-16 17:07:29 UTC) #14
tommi (sloooow) - chröme
Hey Dale - I switched to AudioConverter and added a FIFO in cases such as ...
3 years, 10 months ago (2017-02-16 17:08:47 UTC) #15
tommi (sloooow) - chröme
https://codereview.chromium.org/2690793002/diff/1/media/audio/win/audio_low_latency_input_win.cc File media/audio/win/audio_low_latency_input_win.cc (right): https://codereview.chromium.org/2690793002/diff/1/media/audio/win/audio_low_latency_input_win.cc#newcode619 media/audio/win/audio_low_latency_input_win.cc:619: resampler_.reset(new MultiChannelResampler( On 2017/02/16 17:08:47, tommi (krómíum) wrote: > ...
3 years, 10 months ago (2017-02-16 17:09:49 UTC) #16
DaleCurtis
I still strongly recommend you switch to an AudioBlockFifo for the capture buffers, it will ...
3 years, 10 months ago (2017-02-16 19:59:48 UTC) #17
DaleCurtis
(Also I think you missed some comments from Ps#2, though I'm not sure if your ...
3 years, 10 months ago (2017-02-16 20:00:25 UTC) #18
tommi (sloooow) - chröme
Thanks Dale - indeed I missed those comments. Acking those below and I'll upload a ...
3 years, 10 months ago (2017-02-16 21:59:46 UTC) #19
tommi (sloooow) - chröme
Switch to AudioBlockFifo
3 years, 10 months ago (2017-02-17 15:58:12 UTC) #20
tommi (sloooow) - chröme
Rebase
3 years, 10 months ago (2017-02-17 17:01:49 UTC) #21
tommi (sloooow) - chröme
Switched to AudioBlockFifo now. ptal. It's indeed, much simpler, but there's one particular case I'm ...
3 years, 10 months ago (2017-02-17 17:09:21 UTC) #24
DaleCurtis
https://codereview.chromium.org/2690793002/diff/80001/media/audio/win/audio_low_latency_input_win.cc File media/audio/win/audio_low_latency_input_win.cc (right): https://codereview.chromium.org/2690793002/diff/80001/media/audio/win/audio_low_latency_input_win.cc#newcode399 media/audio/win/audio_low_latency_input_win.cc:399: memset(data_ptr, 0, num_frames_to_read * frame_size_); On 2017/02/17 at 17:09:21, ...
3 years, 10 months ago (2017-02-17 17:25:18 UTC) #25
tommi (sloooow) - chröme
Add AudioBlockFifo::PushSilence
3 years, 10 months ago (2017-02-17 18:04:06 UTC) #26
tommi (sloooow) - chröme
https://codereview.chromium.org/2690793002/diff/80001/media/audio/win/audio_low_latency_input_win.cc File media/audio/win/audio_low_latency_input_win.cc (right): https://codereview.chromium.org/2690793002/diff/80001/media/audio/win/audio_low_latency_input_win.cc#newcode399 media/audio/win/audio_low_latency_input_win.cc:399: memset(data_ptr, 0, num_frames_to_read * frame_size_); On 2017/02/17 17:25:18, DaleCurtis ...
3 years, 10 months ago (2017-02-17 18:04:12 UTC) #27
tommi (sloooow) - chröme
https://codereview.chromium.org/2690793002/diff/100001/media/base/audio_block_fifo.h File media/base/audio_block_fifo.h (right): https://codereview.chromium.org/2690793002/diff/100001/media/base/audio_block_fifo.h#newcode32 media/base/audio_block_fifo.h:32: // Pushes zeroed out interleaved audio data to the ...
3 years, 10 months ago (2017-02-17 18:07:23 UTC) #28
tommi (sloooow) - chröme
Fix comment
3 years, 10 months ago (2017-02-17 18:09:02 UTC) #29
DaleCurtis
lgtm % some nits! https://codereview.chromium.org/2690793002/diff/120001/media/audio/win/audio_low_latency_input_win.cc File media/audio/win/audio_low_latency_input_win.cc (right): https://codereview.chromium.org/2690793002/diff/120001/media/audio/win/audio_low_latency_input_win.cc#newcode7 media/audio/win/audio_low_latency_input_win.cc:7: #include <math.h> cmath? for modf? ...
3 years, 10 months ago (2017-02-17 18:23:23 UTC) #30
tommi (sloooow) - chröme
Use closest match bits-per-sample, add DCHECKs and address other comments
3 years, 10 months ago (2017-02-17 22:19:39 UTC) #31
tommi (sloooow) - chröme
https://codereview.chromium.org/2690793002/diff/120001/media/audio/win/audio_low_latency_input_win.cc File media/audio/win/audio_low_latency_input_win.cc (right): https://codereview.chromium.org/2690793002/diff/120001/media/audio/win/audio_low_latency_input_win.cc#newcode7 media/audio/win/audio_low_latency_input_win.cc:7: #include <math.h> On 2017/02/17 18:23:23, DaleCurtis wrote: > cmath? ...
3 years, 10 months ago (2017-02-17 22:21:27 UTC) #32
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2690793002/140001
3 years, 10 months ago (2017-02-17 22:22:50 UTC) #35
DaleCurtis
Still a couple of potential failures, but are more theoretical, so up to you. I.e., ...
3 years, 10 months ago (2017-02-17 22:29:23 UTC) #36
tommi (sloooow) - chröme
On 2017/02/17 22:29:23, DaleCurtis wrote: > Still a couple of potential failures, but are more ...
3 years, 10 months ago (2017-02-17 23:13:55 UTC) #38
tommi (sloooow) - chröme
https://codereview.chromium.org/2690793002/diff/120001/media/audio/win/audio_low_latency_input_win.cc File media/audio/win/audio_low_latency_input_win.cc (right): https://codereview.chromium.org/2690793002/diff/120001/media/audio/win/audio_low_latency_input_win.cc#newcode614 media/audio/win/audio_low_latency_input_win.cc:614: // We need to be careful here to not ...
3 years, 10 months ago (2017-02-17 23:14:03 UTC) #39
DaleCurtis
https://codereview.chromium.org/2690793002/diff/120001/media/audio/win/audio_low_latency_input_win.cc File media/audio/win/audio_low_latency_input_win.cc (right): https://codereview.chromium.org/2690793002/diff/120001/media/audio/win/audio_low_latency_input_win.cc#newcode614 media/audio/win/audio_low_latency_input_win.cc:614: // We need to be careful here to not ...
3 years, 10 months ago (2017-02-17 23:30:55 UTC) #40
tommi (sloooow) - chröme
Add check for bitness
3 years, 10 months ago (2017-02-18 11:20:47 UTC) #41
tommi (sloooow) - chröme
Add check for unsupported channel layout
3 years, 10 months ago (2017-02-18 11:29:39 UTC) #42
tommi (sloooow) - chröme
https://codereview.chromium.org/2690793002/diff/120001/media/audio/win/audio_low_latency_input_win.cc File media/audio/win/audio_low_latency_input_win.cc (right): https://codereview.chromium.org/2690793002/diff/120001/media/audio/win/audio_low_latency_input_win.cc#newcode614 media/audio/win/audio_low_latency_input_win.cc:614: // We need to be careful here to not ...
3 years, 10 months ago (2017-02-18 11:29:49 UTC) #43
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2690793002/180001
3 years, 10 months ago (2017-02-18 13:01:54 UTC) #50
commit-bot: I haz the power
3 years, 10 months ago (2017-02-18 14:19:50 UTC) #53
Message was sent while issue was closed.
Committed patchset #10 (id:180001) as
https://chromium.googlesource.com/chromium/src/+/3d875dfaa149b616ef07c753b4ad...

Powered by Google App Engine
This is Rietveld 408576698