New issue
Advanced search Search tips

Issue 847748 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2018
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

cras may not correctly open device when downmixing to a smaller number of channels

Project Member Reported by louiscollard@chromium.org, May 30 2018

Issue description

cras selects the best available channel map when opening a device; the process for doing this can fail if the stream that caused the device to be opened has more channels than the best channel map, and a conversion matrix is required.

cras attempts to set the format for the device to the format of the stream, but reduces the number of channels if required:

https://chromium.googlesource.com/chromiumos/third_party/adhd/+/master/cras/src/server/cras_iodev.c#456

cras then updates the channel layout based on the new number of channels:

https://chromium.googlesource.com/chromiumos/third_party/adhd/+/master/cras/src/server/cras_iodev.c#474

For ALSA devices where a conversion matrix is needed, the attempt to create a conversion matrix checks that the channels referenced in the channel map are < the number of channels:

https://chromium.googlesource.com/chromiumos/third_party/adhd/+/master/cras/src/common/cras_audio_format.c#116

The channel layout at this point is still the layout specified by the incoming stream, and whilst the number of channels has been updated to match that provided by the device, the channel layout has not, and so it may include channels from the incoming stream that are not supported in the device.

An example:

cras stream is 8 channel, output device only supports 4 channels

1. cras_iodev finds the best channel map for 8 channel stream, returns 4 channel
2. cras_iodev updates device format to be 4 channel
3. cras attempts to find best 4 channel channel-map for the device
-- no exact-match channel map exists on the device
-- cras tries to find a conversion matrix
4. code to search for conversion matrix errors as the channel layout contains 8 channels, but the device format has been reduced to 4 channels

When reducing the number of channels to match what the device supports, we should also update the channel layout to remove any no-longer-used channels.

 
Project Member

Comment 1 by bugdroid1@chromium.org, May 31 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/adhd/+/016f66b37b1cc3a993deed72602f1478a879cafc

commit 016f66b37b1cc3a993deed72602f1478a879cafc
Author: Louis Collard <louiscollard@chromium.org>
Date: Thu May 31 07:19:27 2018

CRAS: iodev - Remove unused channel layout data.

When opening a device with fewer channels than the stream and the
number of channels is reduced, also update the channel layout data
to remove the now-unused channels.

BUG= chromium:847748 
TEST=tested locally on eve

Change-Id: I97606591c9a86dad035ec46189282c22bb2e2e2d
Reviewed-on: https://chromium-review.googlesource.com/1077917
Commit-Ready: Louis Collard <louiscollard@chromium.org>
Tested-by: Louis Collard <louiscollard@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/016f66b37b1cc3a993deed72602f1478a879cafc/cras/src/server/cras_iodev.c

Status: Fixed (was: Untriaged)

Sign in to add a comment