New issue
Advanced search Search tips

Issue 802173 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jan 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

Incorrect closest match audio input format on Windows

Project Member Reported by grunell@chromium.org, Jan 16 2018

Issue description

If the audio input format we try to use isn't supported by the audio engine on Windows, but there exists a closest match that we try to use, we might set the bits per sample incorrectly.

Using Windows 7 with built-in an RealTek device as well as a SoundBlaster USB headset, both gives a closest match in float format. However, we assume fixed format, which is what we still use after adjusting the format to the closest match. This leads to changing the bits per sample to 32 (instead of 16).

In my case, the audio client initialization was successful and we do convert from 16 to 32 so it could just work fine. I imagine though that it could fail in other cases (with other device, on Windows 10, etc.)

We should only change the bits per sample if the closest match format is fixed point.

In the long run, we should use float if that's what the audio engine uses. We'll avoid a silly conversion float->fixed-float that we have now. Will file bug for this.
 
If the audio client initialization fails due to this, it will lead to a getUserMedia NotReadableError(M64+) / TrackStartError(M63-).

Comment 2 by tommi@chromium.org, Jan 16 2018

Is there a way for us to understand how frequently we see this in the field? (could be good to track how well the fix works)
I'll take a look at that. Should be possible to add stats for this.
We can either separate the format failures (AUDCLNT_E_UNSUPPORTED_FORMAT and probably E_INVALIDARG) into with/without closest match or add a new histogram. I'll write a CL tomorrow.

For tracking how well the fix works, we can look at those two errors in Media.Audio.Capture.Win.InitError.
Project Member

Comment 5 by bugdroid1@chromium.org, Jan 17 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/df1d6e91e9b53c4c0c63eac4a070807e2ae43ee8

commit df1d6e91e9b53c4c0c63eac4a070807e2ae43ee8
Author: Henrik Grunell <grunell@chromium.org>
Date: Wed Jan 17 10:55:44 2018

Fix input audio format on Windows when a closest match is used.

Currently we assume the closest match is fixed point PCM, but is is likely to be floating point. The bits per sample is incorrectly changed. This could possibly lead to later initialization failure.

Bug:  802173 

Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;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
Change-Id: I3dd6f2dab2e313489b6d4855b29d1f558d273c3f
Reviewed-on: https://chromium-review.googlesource.com/867060
Commit-Queue: Henrik Grunell <grunell@chromium.org>
Reviewed-by: Tommi <tommi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#529698}
[modify] https://crrev.com/df1d6e91e9b53c4c0c63eac4a070807e2ae43ee8/media/audio/win/audio_low_latency_input_win.cc

Project Member

Comment 6 by bugdroid1@chromium.org, Jan 18 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/87cb413ea5addcc68d78be5e3b8c8ed9b45d0ec9

commit 87cb413ea5addcc68d78be5e3b8c8ed9b45d0ec9
Author: Henrik Grunell <grunell@chromium.org>
Date: Thu Jan 18 17:08:57 2018

Log stream formats at audio capture open failure for Windows.

Replaces the single |format_| with |input_format_| and |output_format_|. Logs their parameters at stream open failure.

Bug:  802173 
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;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
Change-Id: Ib8dce6653e8cb4313ca279296f0a59465a6410b9
Reviewed-on: https://chromium-review.googlesource.com/868210
Commit-Queue: Henrik Grunell <grunell@chromium.org>
Reviewed-by: Tommi <tommi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#530174}
[modify] https://crrev.com/87cb413ea5addcc68d78be5e3b8c8ed9b45d0ec9/media/audio/win/audio_low_latency_input_win.cc
[modify] https://crrev.com/87cb413ea5addcc68d78be5e3b8c8ed9b45d0ec9/media/audio/win/audio_low_latency_input_win.h

Project Member

Comment 7 by bugdroid1@chromium.org, Jan 18 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e9634d2a90081ef9c7b0fb00ddcb3dae45c20b7b

commit e9634d2a90081ef9c7b0fb00ddcb3dae45c20b7b
Author: Henrik Grunell <grunell@chromium.org>
Date: Thu Jan 18 22:51:48 2018

Add UMA stats for format related audio capture initialization errors on Windows.

Bug:  802173 
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;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
Change-Id: I385214a72e4eeab4a5b092acc169f19b731923da
Reviewed-on: https://chromium-review.googlesource.com/870450
Commit-Queue: Henrik Grunell <grunell@chromium.org>
Reviewed-by: Steven Holte <holte@chromium.org>
Reviewed-by: Tommi <tommi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#530321}
[modify] https://crrev.com/e9634d2a90081ef9c7b0fb00ddcb3dae45c20b7b/media/audio/win/audio_low_latency_input_win.cc
[modify] https://crrev.com/e9634d2a90081ef9c7b0fb00ddcb3dae45c20b7b/media/audio/win/audio_low_latency_input_win.h
[modify] https://crrev.com/e9634d2a90081ef9c7b0fb00ddcb3dae45c20b7b/tools/metrics/histograms/enums.xml
[modify] https://crrev.com/e9634d2a90081ef9c7b0fb00ddcb3dae45c20b7b/tools/metrics/histograms/histograms.xml

Status: Fixed (was: Started)

Sign in to add a comment