New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 593218 link

Starred by 2 users

Issue metadata

Status: Verified
Owner:
Closed: Mar 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug

Blocking:
issue 404701



Sign in to add a comment

CRAS: need api for "map stream left and right to mono, then play that mono stream to the left and right speaker"

Project Member Reported by dgreid@chromium.org, Mar 9 2016

Issue description

For accessibility we need a way to mix all channels of a stream, then play the resulting mono stream to all output channel.

hychao, is the channel mapping api flexible enough to do this?  It might be easier to have an option that can be set globally so the clients don't each need to set a channel map.
 
cras_audio_area can do that, each cras_channel_area can have channel set specified to more than one channel.
For example we configure a 4-channel output for this, in CRAS server side.

area->channel[0]->ch_set = FL | FR | RL | RR;
area->channel[1]->ch_set = FL | FR | RL | RR;
area->channel[2]->ch_set = FL | FR | RL | RR;
area->channel[3]->ch_set = FL | FR | RL | RR;

cras_audio_are is used for input stream when we added support for keyboard mic(3-ch to stereo mapping). We need to port this to output stream as well. 

Comment 2 by warx@chromium.org, Mar 9 2016

I am the owner of issue 404701, can be added to this thread for discussion and update.

hychao: where is cras_audio_area?

Comment 3 by hychao@chromium.org, Mar 10 2016

Cc: warx@chromium.org
At https://chromium.googlesource.com/chromiumos/third_party/adhd/+/master/cras/src/server/cras_audio_area.c

It's used in CRAS server side for a more flexible audio mixing. Two functions are useful to understand how it is used:
cras_audio_area_config_channels(), cras_audio_area_copy()

Basically like Dylan suggested, we need to have a flag so that when it's set, server side will rewrite the channel bit sets from [ FL, FR] to [ FL|FR, FL|FR ].

Comment 4 by dgreid@chromium.org, Mar 10 2016

hychao, can you own adding that flag, or maybe a more general API for setting a downmix matrix for all output?

Comment 5 by hychao@chromium.org, Mar 10 2016

Status: Assigned (was: Untriaged)
Sure.
Looks like we want to have this apply to affect all streams, maybe add a dbus method is suitable to configure this.

Comment 6 by dgreid@chromium.org, Mar 10 2016

sounds like the right idea to me.  Please add a libcras API too so that we can use it from cheets systems.

Comment 7 by warx@chromium.org, Mar 10 2016

hychao, thanks, I see it is a different code base.
Will this API be added to https://code.google.com/p/chromium/codesearch#chromium/src/third_party/cros_system_api/dbus/service_constants.h  ?

Comment 8 by hychao@chromium.org, Mar 11 2016

Dylan:
I will create the same API in libcras.

warx:
Yes the new API will be added there, together with the methods under 'kCrasControlInterface', most of which are now called by src/chromeos/dbus/cras_audio_client.cc
I will think about the interface detail and update on this issue.

Comment 9 by hychao@chromium.org, Mar 14 2016

Status: Started (was: Assigned)
There is code in cras_fmt_conv can reuse for this purpose, using  N * N float matrix to remix N-channel audio data.
In this case we just need to allocate a global 2*2 matrix.
[ 0.5 0.5 ]
[ 0.5 0.5 ]

Suggest the dbus API to be like.

dbus-send --system  --type=method_call  --print-reply \
    --dest=org.chromium.cras /org/chromium/cras \
    org.chromium.cras.Control.SetGlobalChannelRemix uint32:2 array:double:0.5,0.5,0.5,0.5

Comment 10 by warx@chromium.org, Mar 16 2016

hychao:
Do you have a timeline about when it is landed?
Labels: M-52
I have working patches already, will upload for review after some more testing today.
Let's assume they got merged earlier next week, then I can add the new API to cros_system_api/dbus/service_constants.h 

Comment 12 by warx@chromium.org, Mar 17 2016

Glad to hear it. Thanks.

Comment 13 by warx@chromium.org, Mar 17 2016

Blocking: 404701
@hychao, would this still make it into M51? If this change gets merged early next week, that seems like plenty of time to get it into M51 (feature freeze: Mar 25; branch: Apr 08).
I am OK to merge to M51. How's the Chrome UI side change?

Comment 16 by warx@chromium.org, Mar 21 2016

hychao,
We are OK to make it into M51 on 404701, once this API is ready.
Labels: -M-52 M-51
Project Member

Comment 18 by bugdroid1@chromium.org, Mar 25 2016

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

commit 2cc79ec9a81d62c9741b489b26c1d2a6660131dd
Author: Hsin-Yu Chao <hychao@chromium.org>
Date: Thu Mar 17 09:19:20 2016

CRAS: dbus_control - Add SetGlobalOutputChannelRemix method

For accessibility purpose, we need to let user mix audio from
all output channels and then write it to all channels of device.
Expose dbus method to set the conversion matrix for global
output channel remix, so that Chrome UI will use this API to
let user configure how they want the audio to be remixed.

BUG= chromium:593218 
TEST=Play speaker test on YouTube, execute
"dbus-send --system  --type=method_call  --print-reply
--dest=org.chromium.cras /org/chromium/cras
org.chromium.cras.Control.SetGlobalOutputChannelRemix int32:2
array:double:0.5,0.5,0.5,0.5" to verify all channels are
mixed together.

Change-Id: Ib58e133932aa9daa79642da9bcc5004bddc75ae1
Reviewed-on: https://chromium-review.googlesource.com/333252
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/2cc79ec9a81d62c9741b489b26c1d2a6660131dd/cras/src/server/cras_dbus_control.c
[modify] https://crrev.com/2cc79ec9a81d62c9741b489b26c1d2a6660131dd/cras/README.dbus-api

Project Member

Comment 19 by bugdroid1@chromium.org, Mar 25 2016

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

commit f4d68a96948ce913348cc35ba34d9202014a9bdb
Author: Hsin-Yu Chao <hychao@chromium.org>
Date: Wed Mar 16 10:45:10 2016

CRAS: client - API to config global remix

BUG= chromium:593218 
TEST=Play left/right speaker test on YouTube.
"cras_test_client --config_global_remix 2:0.5,0.5,0.5,0.5"
to verify that both channels are mixed.
"cras_test_client --config_global_remix 2:0.1,0.9,0.9,0.1"
to verify that both channels are switched.
"cras_test_client --config_global_remix 2:1,0,0,1"
to verify left/right channels are back to normal.

Change-Id: I4386cc3e14a9645dfee3649243cce23a051a0b04
Reviewed-on: https://chromium-review.googlesource.com/333251
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/f4d68a96948ce913348cc35ba34d9202014a9bdb/cras/src/tests/iodev_list_unittest.cc
[modify] https://crrev.com/f4d68a96948ce913348cc35ba34d9202014a9bdb/cras/src/tests/iodev_unittest.cc
[modify] https://crrev.com/f4d68a96948ce913348cc35ba34d9202014a9bdb/cras/src/tests/cras_test_client.c
[modify] https://crrev.com/f4d68a96948ce913348cc35ba34d9202014a9bdb/cras/src/tests/rclient_unittest.cc
[modify] https://crrev.com/f4d68a96948ce913348cc35ba34d9202014a9bdb/cras/src/libcras/cras_client.h
[modify] https://crrev.com/f4d68a96948ce913348cc35ba34d9202014a9bdb/cras/src/server/audio_thread.c
[modify] https://crrev.com/f4d68a96948ce913348cc35ba34d9202014a9bdb/cras/src/tests/audio_thread_unittest.cc
[modify] https://crrev.com/f4d68a96948ce913348cc35ba34d9202014a9bdb/cras/src/server/audio_thread.h
[modify] https://crrev.com/f4d68a96948ce913348cc35ba34d9202014a9bdb/cras/src/common/cras_messages.h
[modify] https://crrev.com/f4d68a96948ce913348cc35ba34d9202014a9bdb/cras/src/server/cras_iodev.c
[modify] https://crrev.com/f4d68a96948ce913348cc35ba34d9202014a9bdb/cras/src/libcras/cras_client.c
[modify] https://crrev.com/f4d68a96948ce913348cc35ba34d9202014a9bdb/cras/src/server/cras_rclient.c

Project Member

Comment 20 by bugdroid1@chromium.org, Mar 25 2016

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

commit 82bbc68832fccb257d83a56e35a4d50b5f82a173
Author: Hsin-Yu Chao <hychao@chromium.org>
Date: Mon Mar 14 09:47:47 2016

CRAS: fmt_conv - Add channel remix support

For accessibility use we need to mix all channels of output
stream and then write to all output channels.
Reuse cras_fmt_conv to remix channels of PCM data according to
given conversion matrix. This new remix converter will be added
to the end of output format conversion chain.

        fmt_conv1
stream1 ----------\
                   \ mix
                    O ----------> O --------> device
        fmt_conv2  /        channel remix
stream2 ----------/

 ...
        fmt_convN
streamN ----------/

BUG= chromium:593218 
TEST=unittest

Change-Id: I79e66fa890c1b9736ba8c1b16a6261b97e50adb6
Reviewed-on: https://chromium-review.googlesource.com/333250
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>

[modify] https://crrev.com/82bbc68832fccb257d83a56e35a4d50b5f82a173/cras/src/tests/fmt_conv_unittest.cc
[modify] https://crrev.com/82bbc68832fccb257d83a56e35a4d50b5f82a173/cras/src/server/cras_fmt_conv.c
[modify] https://crrev.com/82bbc68832fccb257d83a56e35a4d50b5f82a173/cras/src/server/cras_fmt_conv.h

Project Member

Comment 21 by bugdroid1@chromium.org, Mar 25 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/system_api/+/452060bb03235f1241f5822f326f2abbc936e656

commit 452060bb03235f1241f5822f326f2abbc936e656
Author: Hsin-Yu Chao <hychao@chromium.org>
Date: Fri Mar 25 11:14:30 2016

service_constants: Add SetGlobalOutputChannelRemix property

The new dbus method will be used by Chrome UI to configure
output remix for accessibility use.

BUG= chromium:593218 
TEST=None

Change-Id: I7b90a98fecfb3a35f2133e40cf374ffbba96fb9c
Reviewed-on: https://chromium-review.googlesource.com/335011
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>

[modify] https://crrev.com/452060bb03235f1241f5822f326f2abbc936e656/dbus/service_constants.h

Cc: bhthompson@chromium.org
Labels: Merge-Request-51

Comment 23 by tin...@google.com, Mar 30 2016

Labels: -Merge-Request-51 Merge-Review-51 Hotlist-Merge-Review
[Automated comment] We don't branch for M51 for another 9 days, was this request meant for M50?
Labels: -Hotlist-Merge-review -Merge-Review-51
Status: Fixed (was: Started)
Oops, my mistake in the M-number. No need to merge to any release.
Labels: VerifyIn-54

Comment 26 by ka...@chromium.org, Aug 31 2016

Labels: Bulk-Verified
Status: Verified (was: Fixed)

Sign in to add a comment