Age | Commit message (Collapse) | Author |
|
BSP will implement the get_internal_ucm_suffix script to read
hardware specific info from VPD and pass it to CRAS through
the --internal_ucm_suffix argument.
BUG=chrome-os-partner:61501
TEST=Add fake /etc/cras/get_internal_ucm_suffix and run cras with
--syslog_mask=7 to verify the fake suffix is used.
Change-Id: I35c2ff1e2386aa41363b4efb2f5cd540173086d9
Reviewed-on: https://chromium-review.googlesource.com/425599
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Chinyue Chen <chinyue@chromium.org>
|
|
There's requirement that one board image will run on multiple
hardwares with different UCM config.
With this change we can run CRAS with --internal_ucm_suffix arguemnt
to pass in a string <suffix>, and different UCM config files
will be installed under directory named as <card-name>.<suffix> so
they can be loaded depend on this hardware specific string.
BUG=chrome-os-partner:61501
TEST=Run CRAS with --internal_ucm_suffix=fake and --syslog_mask=7
to verify from syslog that this suffix is append to internal card
name when loading UCM config.
Change-Id: Ib6160e60a29a88f390abad32755e08a271b74f4d
Reviewed-on: https://chromium-review.googlesource.com/425598
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Chinyue Chen <chinyue@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
|
|
Expose more DMIC types to UI so these input nodes can be
handled differently.
This commit introduces the 'position' field to differentiate nodes
of the same type but different locations on the system, and also
expose new nodes 'Front Mic' and 'Rear Mic' to UI.
BUG=chrome-os-partner:59780
TEST=Manual modify UCM then use cras_test_client to verify
DMICs are correctly displayed.
Change-Id: I089562a7c374cb0bd4f5175c82937dfff0aef685
Reviewed-on: https://chromium-review.googlesource.com/425469
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
|
|
There was a compiler warning with gcc that it could be used
uninitialized. Initializing the variable allows the removal of the
is_ramping variable as a side effect.
Change-Id: Ieb8b91ef7900048db609f63383257799d871dac6
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/424845
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Chinyue Chen <chinyue@chromium.org>
|
|
The new timer APIs have been in use for a while, reflect that
requirement in the makefile.
Change-Id: I4c40bf6f62094b30e022fd05fcc215ba806e61bb
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/424844
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Chinyue Chen <chinyue@chromium.org>
|
|
For readability, don't reassign the dev pointer with the parent dev
pointer. Give the parent dev pointer its own name.
Change-Id: Ieb1e636f0f38ff7b3cba3705f2cc053b607d8075
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/424843
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Chinyue Chen <chinyue@chromium.org>
|
|
When snd_pcm_avail returns a number that equals buffer size, it should
be counted as underrun as well although it might not be an underrun if
total_written happens to be greater than zero.
This is because audio_thread calls cras_iodev_output_underrun when
hw_level and total_written are both zero. If we do not count the case
where avail == buffer_size (that is, hw_level == 0) as an underrun,
num_underrun dumped in audio thread log will be 0, while there is delay
caused by cras_iodev_output_underrun.
With this change, we can rely on num_underrun == 0 in audio thread log
to examine that hw_level remains high enough.
BUG=chromium:667674
TEST=check num_underruns is the same as number of times
cras_iodev_output_underrun is called.
Change-Id: I170753485b135e5170ff810830668a1b03ece04f
Reviewed-on: https://chromium-review.googlesource.com/425054
Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org>
Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Chinyue Chen <chinyue@chromium.org>
|
|
Use "Speech" as UCM verb and CRAS_STREAM_TYPE_SPEECH_RECOGNITION
as stream type so that it's easier to tell them from "Voice Call"
and CRAS_STREAM_TYPE_VOICE_COMMUNICATION.
BUG=None
TEST=make check
Change-Id: I9fc9dcceef920ba8a831bfcc0a4c595d43692888
Reviewed-on: https://chromium-review.googlesource.com/424496
Commit-Ready: Chinyue Chen <chinyue@chromium.org>
Tested-by: Chinyue Chen <chinyue@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
|
|
- Use mandatory UCM to specify jack for kernel 4.4.
- Remove redundant 'Left Speaker Mixer Left DAC Switch' and
'Right Speaker Mixer Right DAC Switch' in initial sequence.
- Remove 'HP Left Out Switch' and 'HP Right out Switch'
because kernel 4.4 does not export such control. This can be
added back when kernel support is ready.
BUG=chromium:675006
TEST=check headphone / external mic works on squawks.
TEST=check internal speaker / internal mic works on squawks.
Note sometimes recording fail because of PLL unlocked issue.
Change-Id: Id680d058bff6e1038e109d0ba32cf31e6e9d893b
Reviewed-on: https://chromium-review.googlesource.com/422793
Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org>
Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
|
|
There exists platform with input device that only a subset
of channels are valid. Add the ability to UCM to specify
desired capture channel map. For example if a stereo dmic
has only the second channel valid, use
"1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1" to indicate that the data
at channel index 1 should be treated as front left and channel
index 0 should be excluded.
BUG=chrome-os-partner:59780
TEST=Test on Kevin, manual modify UCM to specify CaptureChannelMap
"1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1" or "-1 0 -1 -1 -1 -1 -1 -1 -1 -1 -1"
Execute 'cras_test_client --capture_file /tmp/1' and use Audacity to
verify only one channel is has sound recorded while the other is not.
Change-Id: I136115a38f989e9e6d8c56ec928fef4446bb51a9
Reviewed-on: https://chromium-review.googlesource.com/418420
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
|
|
The purpose of the skip_zero argument has already been replaced
by the work in commit da9e4afc so remove them.
BUG=None
TEST=unittest still pass
Change-Id: I8fad0d1201943be413b7bc70ea965dc662e3040c
Reviewed-on: https://chromium-review.googlesource.com/418419
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
|
|
Now that we have ramp in alsa_io, we should let ramp finish first and
then set mute control after that.
Putting volume and mute control together causes mute control to be
turned to mute state before ramp is finished.
1. System state has mute = 1 and volume = 0
2. set_alsa_volume is called. It sees mute in system state is 1 so it
set mute state to muted.
To avoid above problem, we should separate set_volume and set_mute ops
of alsa_io.
This simplifies each ops. Now set_volume only changes
volume, and set_mute only changes mute state.
BUG=chromium:669662
TEST=make check
TEST=On samus, check ramping down works fine when pressing volume down
quickly and repeatedly until 0.
TEST=On samus, play a sine tone in youtube. Press volume down until
volume is the lowest but not zero. Press "down down down up" very
quickly. There will be no pop noise.
Change-Id: I722367f9577653b0b05f56965ea61038d227cc91
Reviewed-on: https://chromium-review.googlesource.com/423447
Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org>
Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
|
|
Let alsa_io hold a cras_ramp member to control ramping.
The start/update of cras_ramp is done in audio thread.
The reset of cras_ramp is done in main thread when closing device.
Ramping is used in these places:
1. When the sample from new stream is ready, ramping up.
2. When system mute state is changed from unmute to mute, ramp samples down.
Set a callback in cras_ramp so the callback can set mute state on device
after ramping is done. This process let device plays samples that are
close to zero before it is turned to mute state.
3. When system mute state is changed from mute to unmute, starts ramping
up samples and switch mute control to unmute state. This process let
device plays samples that are close to zero after it is turned to
unmute state.
For example, when user mutes the system, the flow of 2 is:
a. Mute state in cras_system_state changed.
b. iodev_list asks audio thread to start ramping down.
c. audio_thread gets the message and starts ramping down active
devices.
d. audio_thread updates ramped sample in cras_iodev_put_output_buffer
in each output cycle.
e. Ramping is done. audio_thread executes callback in cras_ramp to use
cras_device_monitor_set_device_mute_state to ask main thread to set
mute state on device.
f. Main thread receives message and calls cras_iodev_set_mute on
device to actually change device mute state using set_mute ops.
BUG=chromium:669662
TEST=make check
TEST=on samus, play sine tone in youtube, press mute and volume up
repeatedly, observe the ramping up and down without pop noise.
TEST=On samus, play a sine tone in youtube, change volume to somewhere
close to 0 and press "down down down up" quickly. Observe there is pop
noise at unmute. This is to be solved in the next patch.
Change-Id: I71659edfa0a15d9aafa9db2e8b933c19ef48793f
Reviewed-on: https://chromium-review.googlesource.com/415012
Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org>
Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
|
|
Device monitor let audio thread request main thread to set mute state on
a device. This is needed when audio thread finds that ramping is done,
and mute/unmute is requested after that using callback in cras_ramp.
BUG=chromium:669662
TEST=make check
Change-Id: I34baace5898ccd2fbe5884f68fb24738ea0b0ac9
Reviewed-on: https://chromium-review.googlesource.com/422615
Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org>
Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
|
|
It will be cleaner for users to access set_mute from this interface.
BUG=chromium:669662
TEST=make check
Change-Id: I41dba8ba8fdba492b71cda3b09b4ca4703953b24
Reviewed-on: https://chromium-review.googlesource.com/422614
Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org>
Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
|
|
Set callback and callback data at cras_ramp_start. When ramping is done,
call that callback with data. This is to set mute control after ramping
is done.
BUG=chromium:669662
TEST=make check
Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Change-Id: I24e7880917acfd982de1c11c030868248d5aa2ce
Reviewed-on: https://chromium-review.googlesource.com/422613
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
|
|
Add ops to scale a buffer starting from certain scaler and
increase/descrease for every frame.
BUG=chromium:669662
TEST=make check
Change-Id: I1332167080aed94de23090fcfeedb75f5738bed5
Reviewed-on: https://chromium-review.googlesource.com/416471
Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org>
Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
|
|
Add cras_ramp module to handle ramping of data.
1. When device goes from mute to unmute, ramp the data from last
scaler to 1. If there is no last scaler, start from 0.
2. When device goes from unmute to mute, ramp the data from last
scaler to 0. If there is no last scaler, start from 1.
For case 1, device will have smooth transition from mute to unmute.
For case 2, ramp can not finish its full duration. This is because device
samples are muted in cras_iodev_put_output_buffer. Also, device output
switch is turned off right away. These need to be changed in the future
so we can have smooth transition from unmute to mute.
BUG=chromium:669662
TEST=make check
Change-Id: I25173becd826053c4fa0b0a3bf9ff0d611352d15
Reviewed-on: https://chromium-review.googlesource.com/415750
Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org>
Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
|
|
copy ucm config from veyron, and rename.
delete speaker & int mic.
BUG=chrome-os-partner:58861
TEST=check on fievel, no speaker & int mic
Change-Id: I94ad50da2ced4ef93df9e1ccdfe69a42b84cee0d
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Reviewed-on: https://chromium-review.googlesource.com/423294
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
|
|
BUG=chrome-os-partner:58861
TEST=check speaker/headphone on minnie
Change-Id: I7ec8fb49036c3102dc9bdb99abcb82fdb69753fc
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Reviewed-on: https://chromium-review.googlesource.com/423293
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
|
|
We now using software dsp to do it.
BUG=chrome-os-partner:58861
TEST=None
Change-Id: I77fbbb2796bd3fa01cf6e2ad3b6c5e0a12f86de6
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Reviewed-on: https://chromium-review.googlesource.com/422619
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
|
|
Move wait_for_dev_input_access to cras_utils so we can overwrite it in
unittest.
BUG=None
TEST=make check, run alsa_jack_unittest and see it finishes within 1
second instead of 40 seconds.
Change-Id: Id0f293e9b5ee1d56c151d918314ea85ff936a3c9
Reviewed-on: https://chromium-review.googlesource.com/416091
Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org>
Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
|
|
Setting volume goes through different path as set_mute.
When the adjusted volume changes from 0 to nonzero or vice versa,
and causes output switch to be turned off/on, ramp needs to be triggered
beforhand.
Since it is not easy to see if there is such a change, do not turn off
switch for volume zero.
Output will still be muted by cras_iodev_put_output_buffer.
There will be no ramp of data in volume changes.
BUG=chromium:669662
TEST=change volume between 0 and 1 on samus, observe there is no pop
noise.
Change-Id: Ib652eafe85ef1f94fbb439dcc6455ea8e044656f
Reviewed-on: https://chromium-review.googlesource.com/415751
Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org>
Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
|
|
When supported gain limit is changed, current gain should be updated
too.
BUG=chromium:673656
TEST=Use apprtc and switch between internal mic and headset mic. Check
cras_test_client --dump_s and see capture gain is changed to be within limit.
TEST=make check
Change-Id: Ia5f551d6d92fdb7cc90370f933664ae7db407008
Reviewed-on: https://chromium-review.googlesource.com/422709
Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org>
Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Chinyue Chen <chinyue@chromium.org>
|
|
We noticed some pop noise after switching output from headphone.
It seems like adding "Headphone Switch" control like other platform
would help.
BUG=chrome-os-partner:57435
TEST=manually, no more pop noise
Change-Id: I43b89200b9193c62f770f0659fcc7e5f7db3cc86
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Reviewed-on: https://chromium-review.googlesource.com/419933
Reviewed-by: Dylan Reid <dgreid@chromium.org>
|
|
Add output_underrun ops to cras_iodev to handle output underrun.
The default behavior is to fill one block of zeros.
Implement output_underrun ops for alsa_io.
It first cleans up whole buffer with zeros.
Then, it moves appl_ptr to min_cb_level + min_buffer_level ahead of hw_ptr.
This is better than filling one block of zeros in a waking up cycle.
BUG=chrome-os-partner:60497
TEST=cras_test_client --playback_f
/usr/local/autotest/cros/audio/fix_440_16.raw Then press p and enter.
There will be no noise.
Change-Id: I8945d65088600be9d1479127a50a59057a5d6c62
Reviewed-on: https://chromium-review.googlesource.com/418607
Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org>
Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
|
|
When severe underrun is triggered, audio thread will send multiple reset
request in a short time, while main thread has not handle the first
request yet. Add a flag in cras_iodev so we can ignore multiple reset
request until device is actually opened.
BUG=chrome-os-partner:60497
TEST=modify SEVERE_UNDERRUN_MS to 0.1 and trigger underrun by
cras_test_client. Check messages and see there is only one reset request
works.
Change-Id: Ida091fa8f5f7fa31bf070317c302ea17e4e9fdac
Reviewed-on: https://chromium-review.googlesource.com/419941
Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org>
Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
|
|
As explained in the issue, severe underrun is only targeted for special
case where bad dma driver makes hw_ptr jumps by a large distance and
creates a severe underrun that can not be recovered by filling blocks of
zeros. It should not be easily triggered by normal underrun or stressing
system.
BUG=chrome-os-partner:60497, chromium:662786
TEST=run balloon test in issue 60497, should not see resetting device.
Change-Id: I78d13d428cf11b06dbec05454340abc376f2290e
Reviewed-on: https://chromium-review.googlesource.com/418566
Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org>
Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
|
|
Add test cases for input client handling capture buffer in noremal
scenario, beginning of buffer overrun, and in the middle of buffer
underrun.
BUG=chromium:673454
TEST=make check
Change-Id: I7b3cea4d6a485a5cbf1dd7f1e0625e7615ed54d1
Reviewed-on: https://chromium-review.googlesource.com/419932
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
|
|
BUG=None
TEST=None
Change-Id: Ic9eab3da91c25709a0ccf9df5b8c9168529260ca
Reviewed-on: https://chromium-review.googlesource.com/418131
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
|
|
When an input client hangs at processing the captured buffer, server
side could encounter buffer overrun. When that happens and client
later recovers from busy state, the read buffer would no longer be a
whole captured chunk. Assuming Chrome processes the read buffer while
it's in the middle of overrun, only partial of the buffer is consumed
and that causes non-zero read offset. This makes Chrome crash at the
next time it handles capture data because buffer pointer won't start
from the beginning.
BUG=chromium:673454
TEST=Run apprtc app on Kevin.
Change-Id: I7ef61140081ec2e466fc8eace854ec02c065c6da
Reviewed-on: https://chromium-review.googlesource.com/418130
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
|
|
The change eliminates the hard-coded use case verb and uses the
corresponding verb of the selected use case in snd_use_case_xxx
calls.
BUG=chromium:643039
TEST=make check && verify correct playback on DUT
Change-Id: Ide36b089abc62ae337387a1b48c364602aa2dcba
Reviewed-on: https://chromium-review.googlesource.com/416532
Commit-Ready: Chinyue Chen <chinyue@chromium.org>
Tested-by: Chinyue Chen <chinyue@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
|
|
The new ucm_set_ues_case function will be used later to change use case
in run-time. It checks if the UCM config for the requested use case is
availalble, and uses default use case if not.
BUG=chromium:643039
TEST=make check
Change-Id: I499e2be999ad74c2996ee26d56e42e39892a02ee
Reviewed-on: https://chromium-review.googlesource.com/416531
Commit-Ready: Chinyue Chen <chinyue@chromium.org>
Tested-by: Chinyue Chen <chinyue@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
|
|
The cras_use_case_mgr wraps the ALSA snd_use_case_mgr and can hold the
selected use case for the ALSA card. The benefit is that the use case
verb can be looked up from cras_use_case_mgr and doesn't need to be
passed around or hard-coded. Following commits will make use of the new
wrapper.
BUG=chromium:643039
TEST=make check
Change-Id: I0ffe94e6d635c8c0b62aa5f9ccc40bf49808d1a3
Reviewed-on: https://chromium-review.googlesource.com/415749
Commit-Ready: Chinyue Chen <chinyue@chromium.org>
Tested-by: Chinyue Chen <chinyue@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
|
|
Get additional sys attribute for "serial" which is serial number in
udev.
Add it into the stable_id_new calcuation and keep stable_id for backward
compitable.
BUG=chromium:661861
TEST=Plug 2 same type USB speakers into chromebook.
execute
"dbus-send --system
--type=method_call
--print-reply
--dest=org.chromium.cras
/org/chromium/cras
org.chromium.cras.Control.GetNodes"
Check if we have the same stable_id but different stable_id_new for the 2
speakers.
pass make check for unit test.
Change-Id: Iefefe383fd6143dd7c28fdba3cf3f3872c2dd726
Reviewed-on: https://chromium-review.googlesource.com/407723
Commit-Ready: Hsu Wei-Cheng <mojahsu@chromium.org>
Tested-by: Hsu Wei-Cheng <mojahsu@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
|
|
There are cases that iodev fails to open and that results silent
playback or recording to user.
When this type of error happens, let iodev_list do a retry to open
iodev because user has very few clue on what has happened.
BUG=chromium:666405
TEST=Use hack patch to make USB iodev fail to open, check debug log
to verify open dev retry is working when add new streams and select
different output nodes.
Change-Id: I5163f79c881d88b32f8c02045c1954e20118d44a
Reviewed-on: https://chromium-review.googlesource.com/414854
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
|
|
When an iodev fails to open, an error is returned immediately by
current implementation. That makes the new connected stream
an orphan because it doesn't attach to any iodev. If it happens
on a video app, video will hang because it needs to align with audio.
For better user experience, this error case can be handled by
enabling fallback device and move streams to it. After the change
user will just hear nothing instead of seeing blocked video if audio
device fails to open. It's also a better hint for user to guess this
is more an audio issue and not related to video.
BUG=chromium:666405
TEST=Unittest.
Use hack patch to make a2dp iodev always fail to open and test:
1. select a2dp as output, play YouTube and see video doesn't hang.
Select audio output to/from internal speaker to verify audio routes
correctly and video playback is smooth.
2. select internal speaker as output, and play YouTUbe. From
system tray select output node to a2dp to verify video plays
smoothly. Switch output node back to speaker, verify audio plays
and aligned to video.
Change-Id: I12cf3000b79ed4fc93984c206335657912990518
Reviewed-on: https://chromium-review.googlesource.com/413790
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
|
|
Need to check is_pinned flag of a rstream otherwise its member
'pinned_dev_idx' could collide with the index of fallback iodev.
BUG=chromium:666405
TEST=None
Change-Id: I973d2eb78e69f08b73e7ba819c5d7ada12969ade
Reviewed-on: https://chromium-review.googlesource.com/413789
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Chinyue Chen <chinyue@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
|
|
Get buffer should not return frames more than requrested.
BUG=chromium:657510
TEST=cras_test_client --loopback_file /tmp/loopback
Change-Id: Ie789cbff30ede279e63e67f5822c36ab8a8c4dc7
Reviewed-on: https://chromium-review.googlesource.com/414750
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Chinyue Chen <chinyue@chromium.org>
|
|
The original strategy of flush_data() function is to encode PCM
buffer to SBC format blocks whenever there's data and try writing the
encoded data to A2DP socket. This could consume too much PCM buffer
in one callback to cause buffer level drops below min_buffer_level so
audio thread thinks it underruns.
BUG=chromium:635426
TEST=unittest
Change-Id: I2f294a397868132b8810edb4a91a98f269376212
Reviewed-on: https://chromium-review.googlesource.com/411647
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
|
|
Use macros defined in unistd.h for how argument of
int access(const char *file, int how) function.
BUG=chrome-os-partner:59363
TEST=reboot and test headset plug status
Change-Id: I62318948dd4e4f70fa869d7ce7f0f7d27ce8a706
Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/412203
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>
Tested-by: Anson Tseng <ansonfcu@gmail.com>
Reviewed-by: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>
Reviewed-by: Anson Tseng <ansonfcu@gmail.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
|
|
Fix cras_shm_check_write_overrun() function in detecting when
unread data is overwritten, and return the result so audio
thread can ATLOG this problem.
BUG=chromium:662886
TEST=Use 'cras_test_client --capture_file /tmp/1' and hit
'p','enter' a few times to emulate a bad client. Check audio
dump to veriy there's AUDIO_OVERRUN logged.
Change-Id: Ib5b90ce05d957487b29639dffbbe3067ab5f6915
Reviewed-on: https://chromium-review.googlesource.com/412428
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
|
|
CRAS client could handles multiple messages from server about
capture data ready. We should check if the read offset of stream
shm reaches write offset, to avoid reading repeated data.
BUG=chromium:662886
TEST=Execute 'cras_test_client --capture_file /tmp/1' and then
hit 'p', 'enter', 'p', 'enter'... repeat 10 times while making
some sound to internal mic.
Inspect the recorded /tmp/1 file using Audacity to verify there
are no repeated samples, but with several short discontinuity
instead.
Change-Id: I40bf34cbae31f76bd013ec855a4d5ef4055399f2
Reviewed-on: https://chromium-review.googlesource.com/411668
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
|
|
Track number of severe underruns in alsa_io.
User can see it through audio thread log.
BUG=chromium:662786
TEST=with hack patch, cras_test_client --dump_a and see
num_severe_underruns increased.
Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Change-Id: I02a644971bfcc43e7589c95a3f1ca6db750c75d4
Reviewed-on: https://chromium-review.googlesource.com/411644
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
|
|
BUG=None
TEST=None
Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Change-Id: Ie5ff1060e6083f15ac67068611deadd25decc17a
Reviewed-on: https://chromium-review.googlesource.com/411643
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
|
|
Use device monitor to handle message from audio thread.
When audio thread finds a device in bad state, it can send a message to
main thread to reset a device properly from iodev_list.
BUG=chromium:662786
TEST=make check
TEST=With hack patch of severe underrun, check device reset upon severe
underrun. Also check audio thread log.
Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Change-Id: Iac6d3f688f40cfe434002064407363151857ec6b
Reviewed-on: https://chromium-review.googlesource.com/411743
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
|
|
Previously, cras_alsa_get_avail_frames masks underrun and only
logs an error message.
This patch sets a threshold for severe underrun.
If severe underrun happens, the error should be propagated to audio
thread.
The following commit will reset the device so device can be recovered
from severe underrun.
BUG=chromium:662786
TEST=make check
Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Change-Id: Ib2a385a808936d0673590c0c0ab73c4ed97ada89
Reviewed-on: https://chromium-review.googlesource.com/411022
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
|
|
The length in the message header should be length of the message.
BUG=None
TEST=use cras_test_client --playback <file> and press p to cause
long delay. After the stream is removed, check debug message
that handler has handle metric message.
Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Change-Id: I8167358a39c9abaf5b62e246fb4c76cc76ecb37f
Reviewed-on: https://chromium-review.googlesource.com/411742
Reviewed-by: Dylan Reid <dgreid@chromium.org>
|
|
Clang bug https://llvm.org/bugs/show_bug.cgi?id=31050 is fixed.
So remove some unnecessary pointer casts that had to be added to
avoid the following warning from clang.
clang error taking address of packed member 'update_count'
of class or structure 'cras_server_state' may result in an
unaligned pointer value [-Werror,-Waddress-of-packed-member]
BUG=chromium:665647
TEST=adhd now builds with clang
Change-Id: If7e09a133c4d41f9a8197b435687fd8cb756b58a
Reviewed-on: https://chromium-review.googlesource.com/413052
Commit-Ready: Manoj Gupta <manojgupta@chromium.org>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Chinyue Chen <chinyue@chromium.org>
|
|
MIN() macro would make function called twice and sometimes
that wastes a lot of computation.
BUG=chromium:662886
TEST=None
Change-Id: I800633caf152f1e13e03c29ff9e278ba5180a815
Reviewed-on: https://chromium-review.googlesource.com/409236
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
|