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

Issue 700247 link

Starred by 1 user

Issue metadata

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

Blocking:
issue 658048



Sign in to add a comment

For internal device, cras should remember last active audio node for pinning stream

Project Member Reported by warx@chromium.org, Mar 10 2017

Issue description

Background: cras_client_add_pinned_stream api allows pinning stream to/from device. For internal device, it can have two audio nodes. Right now, cras_client_add_pinned_stream is always to/from internal_speaker/internal_mic if 3.5mm headphone/micjack is not set as active.

Propose that cras should remember last active node for internal devices, so that pinning stream to/from destination/source will not surprise users. For example,

A 3.5mm headphone is plugged and has lastly been selected as active (but now system is selecting another output such as a usb-headset). Now a web pin stream wants to play to "internal device", the virtual device that can represent either internal speaker or 3.5mm headphone. Expect this web pin stream is played back to headphone, not internal speaker.

This would help  issue 658048 .
 

Comment 1 by hychao@chromium.org, Mar 30 2017

Status: Started (was: Assigned)
It turns out the problem is not that complex as I expected. Uploaded fix to:
https://chromium-review.googlesource.com/462736

With the fix cherry-picked, I can use 'cras_test_client --pin_stream 7 --playback_file /usr/local/bla.wav' to verify audio comes from the last used node on the internal sound card. (where the '7' is the index of internal sound card in my case)

Please note that there's scenario might surprise user:

1. I lastly select to 'headphone' output node from UI, and have USB output selected as active now.
2. Run 'cras_test_client --pin_device 7 --playback_file ...' to create a output pin stream.
3. Can hear audio coming out from my 3.5mm headphone.
4. Manually select output node to 'Internal Speaker'.
5. Upon the selection is made in (4), the sound generated by (2) switches to internal speaker.

We can do nothing for this use case because this is hardware restriction that internal sound card can only have one node playing(internal speaker or headphone).
Project Member

Comment 2 by bugdroid1@chromium.org, Mar 30 2017

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

commit 2a609e202c8565477a73b5600ab12e86668cf232
Author: Hsin-Yu Chao <hychao@chromium.org>
Date: Thu Mar 30 14:29:42 2017

CRAS: iodev_list - Enable/disable active node for pinned stream

When a pinned stream is connected, the active node on the iodev-
to-pin might not work properly due to it was left in disabled
state when user's last action was switching to the other iodev.
Fix this problem by calling update_active_node() when a pinned
stream connected and removed.

BUG= chromium:700247 
TEST=Plug 3.5mm headphone and a USB headset, select to headphone
in UI tray and then select to USB headset as output.
Execute 'cras_test_client --pin_device <id-of-internal-card>' to
play something, and verify audio coming out from headphone.
Next, click on UI to select to internal speaker and then select to
USB headset as output. Execute cras_test_client --pin_device to
play something, verify audio coming out from internal speaker this
time.

Change-Id: I438fdfc591b52186ed5a5079f8d3125b47f3499a
Reviewed-on: https://chromium-review.googlesource.com/462736
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Chinyue Chen <chinyue@chromium.org>

[modify] https://crrev.com/2a609e202c8565477a73b5600ab12e86668cf232/cras/src/server/cras_iodev_list.c

Comment 3 by warx@chromium.org, Mar 30 2017

Re #1, I think what you mentioned is not that surprise if user selects 'Internal Speaker' on system.

Thanks for this fix.

Comment 4 by warx@chromium.org, Apr 4 2017

Status: Fixed (was: Started)
Project Member

Comment 5 by bugdroid1@chromium.org, Apr 5 2017

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

commit 0c7b27b714f5f381a5e630ceb2ecb7a7a6633b40
Author: Hsin-Yu Chao <hychao@chromium.org>
Date: Wed Apr 05 20:10:10 2017

CRAS: iodev_list_unittest - update active node for pinned stream

BUG= chromium:700247 
TEST=make check

Change-Id: Ibd3ef6b81d3e55baa35dcfe84229b96b77cd34d3
Reviewed-on: https://chromium-review.googlesource.com/464489
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/0c7b27b714f5f381a5e630ceb2ecb7a7a6633b40/cras/src/tests/iodev_list_unittest.cc

Comment 6 by dchan@google.com, May 30 2017

Labels: VerifyIn-60

Comment 7 by dchan@chromium.org, Aug 1 2017

Labels: VerifyIn-61
Status: Verified (was: Fixed)
Verified in Chrome OS 9824.0.0, 62.0.3176.0. 

Sign in to add a comment