Scott James Remnant [Wed, 15 May 2013 17:22:40 +0000 (10:22 -0700)]
CRAS: bluetooth - handle changes in transport state
When we receive a suspend from an A2DP device, release the transport
stream and drop the iodev; and when we receive a start from an A2DP
device, re-create the iodev and, if music is playing, re-acquire the
transport stream.
Rename the endpoint methods since they are called in multiple scenarios
now, and track the endpoint/transport relationship.
BUG=chromium:238740
TEST=power off Monster Clarity HD while playing music,
power back on and reconnect,
verify music transitions to internal speaker when device issues a suspend,
and back to device when it issues the start.
Change-Id: Ie278f5addd5a5d3997b320e2c8421b6dc0c6c092
Signed-off-by: Scott James Remnant <keybuk@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/51070
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Scott James Remnant [Wed, 15 May 2013 17:14:31 +0000 (10:14 -0700)]
CRAS dbus: Initialize thread support
BUG=chromium:238944
TEST=disconnect/reconnect speaker and verify cras does not crash
Change-Id: I97dec0ce496a33cf16c727eca1fcc7e83855fb93
Signed-off-by: Scott James Remnant <keybuk@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/51307
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Chih-Chung Chang [Mon, 13 May 2013 11:33:06 +0000 (19:33 +0800)]
Add audio diagnostic script.
We will use this in generate_logs script to identify the cause of
audio issues.
BUG=chrome-os-partner:19180
TEST=run the script on spring and link.
Change-Id: I6ad89ff6bb97e32c0506c801aeb5d4c1e190f0c1
Reviewed-on: https://gerrit.chromium.org/gerrit/50978
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Dylan Reid [Sat, 11 May 2013 05:14:48 +0000 (22:14 -0700)]
CRAS: audio_thread - unified, playback same amount as captured.
When playing back one or more unified streams, render the same amount
of samples as is captured. Symetry is good.
BUG=chromium:238791
TEST=use web audio demos and listen to audio, sounds OK.
Change-Id: I0be6eca7eac30c753a2287408529156514d896f4
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50951
Dylan Reid [Sat, 11 May 2013 06:12:22 +0000 (23:12 -0700)]
CRAS: audio_thread - rework wake up levels for capture.
Change the way the next wake up time is calculated for capture and
unified streams. Instead of relying on the hardware device's level,
use the level of the stream that will be ready next. This allows for
multiple capture streams with non-integer multiple buffer sizes to run
concurrently.
possibly_read_audio is changed to fill in a parameter with the number
of frames until the next stream is ready. It now limits the number of
frames read from hardware to the amount that will fit in the stream
with the least buffer until its callback threshold is met.
unified_io is changed to not ignore captured samples if they don't
meet the callback threshold of the device. Instead always process
samples as a stream using that device could have its level met by this
wakeup.
This leaves output alone, it can be changes similarly, but there isn't
any bugs provoking the change so it will be left for a later date.
BUG=chromium:238971
TEST=web audio demos and updated audio_thread unit tests.
Change-Id: I36735b9cdcb2b0dc0312f911b287ca126d531178
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50950
Dylan Reid [Sat, 11 May 2013 06:01:19 +0000 (23:01 -0700)]
CRAS: audio_thread - Apply input dsp to amount of data in buffer.
The number of frames that have been written to the buffer is the
correct amount to pass through the DSP. Using anything else can break
when there are multiple input streams with different buffer sizes
leading to partial writes.
BUG=chromium:238971
TEST=web audio input tests, listen for breakups.
Change-Id: I3e50fb06aba2b0921950b5d54bf3a1edafc16e0b
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50949
Dylan Reid [Sat, 11 May 2013 05:52:55 +0000 (22:52 -0700)]
CRAS: shm - Add parameter to get_writeable_frames
Allow the total number of frames to be specified in calls to
cras_shm_get_writeable_frames. A following commit will use this to
limit the amount unified streams read to the amount that should be
passed to the stream instead of greedily taking everything that will
fit in the buffer.
BUG=chromium:238971
TEST=make check, no functional change yet.
Change-Id: Ib6753ab484c0ef4bb6f6015bb1bb4d71b15d30f8
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50948
Dylan Reid [Sat, 11 May 2013 05:34:05 +0000 (22:34 -0700)]
CRAS: iodev - Pass desired level to sleep_frames.
Pass the desited hardware level at the next wake to
cras_iodev_sleep_frames. In a following commit, this parameter will
be changed so that unified streams can wake based on the level of the
next stream instead of the level of the device.
BUG=chromium:238791
TEST=make check, no functional change yet.
Change-Id: I025a4c7be424d9c7886bf888b2390ae43d00877b
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50947
Dylan Reid [Wed, 8 May 2013 02:46:39 +0000 (19:46 -0700)]
CRAS: audio_thread - properly limit frames when reading.
Each stream would over-write the limit of available frames. Instead
only set the limit if the new stream is more restrictive than the
previous. Also actually limit the amount of frames read to the amount
that fit in shm.
BUG=none
TEST=record with test client, input visualizer demo.
Change-Id: I54bf2c9d76fe95190fd235c992ffd4d335bc38e5
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50462
Dylan Reid [Fri, 10 May 2013 16:01:01 +0000 (09:01 -0700)]
CRAS: a2dp_ut - Link against pthread.
Allows the test to run on gPrecise, useful for testing.
BUG=chromium:238971
TEST='make check' on gPrecise.
Change-Id: I8bd11bdccfe8471df43b002587647e026f6d0921
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50833
Hsin-Yu Chao [Thu, 9 May 2013 09:57:02 +0000 (17:57 +0800)]
CRAS a2dp: Fix a2dp iodev switching
Use cras_iodev_add_node and cras_iodev_rm_node to
add and remove nodes to a2dp iodev, so it hooks
to dbus API and can be auto switched to.
BUG=chromium:239458, chromium:175798
TEST=emerge adhd, use Chrome UI to connect and disconnect
to bluetooth speaker, verify auto-swithing works good.
Change-Id: I5c1dceda01a720e6f9e9cf49ecbf9791427ef083
Reviewed-on: https://gerrit.chromium.org/gerrit/50758
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Hsin-Yu Chao [Fri, 3 May 2013 11:56:02 +0000 (19:56 +0800)]
CRAS A2DP: Flush buffer at dev_running callback
When a2dp_write fails several times in a row, too much
audio sample queued in a2dp iodev causing wake_threshold_met
check always fail, at this point audio thread will always
wait for queued buffer be consumed.
Flush the queued buffer in dev_running callback.
BUG=chromium:236690
TEST=Manual add fake return value of a2dp_writen, make a2dp
dev into a state that queued too much data. No audio can be
heard from bluetooth device before this fix. After applied
this change, audio can play smoothly to BT device.
Change-Id: Ic86bdf1b25d8708d5096dd7c07e4ce89efdf9000
Reviewed-on: https://gerrit.chromium.org/gerrit/50035
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Dylan Reid [Wed, 1 May 2013 21:55:10 +0000 (21:55 +0000)]
CRAS: Remove automatic device selection.
Don't auto select devices when they are added. Chrome can now handle
this. Keep the first added device as default, it will be the
emtpy_iodev and is used to store streams when an active device is
removed. Chrome will react to the removal and move the stream to a
new active device.
CQ-DEPEND=CL:49921
BUG=175798
TEST=plug unplug devices, make sure audio goes to the right place.
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Change-Id: I937fd89141e8d404d173ccf2f585f2ae656b77c2
Reviewed-on: https://gerrit.chromium.org/gerrit/49812
Dylan Reid [Tue, 7 May 2013 20:33:50 +0000 (13:33 -0700)]
CRAS: client - audio request size tweaks.
Chrome always wants to be called back with min_cb_level frames, make
sure to limit the frame count to that many.
For unified streams, allow capture to control the number of requested
frames. If also doing playback format conversion, the number of
frames provided should be unaffected.
BUG=chromium:238795
TEST=web audio input demos.
Change-Id: I1097ab4a63ac90f1658633081e599d7039b45ca1
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50359
Hsin-Yu Chao [Tue, 7 May 2013 07:17:41 +0000 (15:17 +0800)]
CRAS unitetst: Test static function of cras_client
BUG=chromium:237379
TEST=make check
Change-Id: Ib935553cc09673a4372ea8593d537bd2f87e1fd5
Reviewed-on: https://gerrit.chromium.org/gerrit/50268
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Hsin-Yu Chao [Mon, 6 May 2013 13:27:47 +0000 (21:27 +0800)]
CRAS client: Fix compile warning for cras_client
After this change we can start add unittest for static
functions of cras_client.
BUG=None
TEST=emerge-daisy adhd
Change-Id: Id7a70c1635fc90cbe363e97b7bb6ca7d358bc750
Reviewed-on: https://gerrit.chromium.org/gerrit/50267
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Andrew Chew [Thu, 2 May 2013 20:34:26 +0000 (13:34 -0700)]
ADHD: Add board puppy
Add asound.state file for puppy.
BUG=none
TEST=Was able to emerge-puppy adhd, and saw that the correct asound.state
is installed.
Change-Id: I2538d47284cd7e1978efe4cf4eca0f409a074112
Signed-off-by: Andrew Chew <achew@nvidia.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/49946
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Hsin-Yu Chao [Mon, 6 May 2013 11:18:14 +0000 (19:18 +0800)]
CRAS client: Fix bug when converting sample rate to 16KHz
In config_playback_buf function, should restrict the frames count
by shm limit first, then re-calculate it according to sampling
rate change. Or cras_client will request too many frames that
can write to shm, causing some data dropped.
BUG=chromium:237379
TEST=Manual limit supported_rate to only 16KHz, play youtube
can hear smooth audio.
Change-Id: Ic3d1134963639699e85f2fac83c2d44aef8c89bc
Reviewed-on: https://gerrit.chromium.org/gerrit/50174
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Dylan Reid [Wed, 1 May 2013 19:54:40 +0000 (19:54 +0000)]
CRAS: Rename default to active.
The "default" device is really the active device, name it
appropriately.
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Change-Id: If684e8e32990695907c550bfeeca92e251b703c6
Reviewed-on: https://gerrit.chromium.org/gerrit/49811
Reviewed-by: Chih-Chung Chang <chihchung@chromium.org>
Dylan Reid [Tue, 30 Apr 2013 18:40:52 +0000 (11:40 -0700)]
CRAS: audio_thread - don't adjust sleep for extra USB buffer
This code was belt-and-suspenders anyways and it was getting confused
by offsetting the sleep time for the stream. The sleep time should
only be based on the stream level, not the hw level.
Sleeping for too short a time was causing repeated audio samples.
BUG=chromium:231975
TEST=start hangout from gchat with usb headset attached.
Change-Id: Idbc8d34f9b42b72f43f64e21b69793d3db0b6239
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49631
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Dylan Reid [Tue, 30 Apr 2013 15:52:07 +0000 (15:52 +0000)]
CRAS: dbus - fix overflow and indent.
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Change-Id: I891932cce3b3ac33e1e1f941d7a9127627ae4f87
Reviewed-on: https://gerrit.chromium.org/gerrit/49590
Rahul Chaturvedi [Wed, 24 Apr 2013 23:46:48 +0000 (16:46 -0700)]
Pass up the priority and plugged in time to Chrome.
On the GetNodes call, when passing up the nodes to Chrome, send the node
priority and plugged time also.
BUG=chromium:175798
TEST=None.
Change-Id: I4194db1d68949a506b3975db79bd1fc65d42978e
Reviewed-on: https://gerrit.chromium.org/gerrit/49117
Commit-Queue: Rahul Chaturvedi <rkc@chromium.org>
Reviewed-by: Rahul Chaturvedi <rkc@chromium.org>
Tested-by: Rahul Chaturvedi <rkc@chromium.org>
Hsin-Yu Chao [Fri, 26 Apr 2013 08:41:16 +0000 (16:41 +0800)]
CRAS a2dp: Add softvolume to a2dp device
BUG=chromium:220380
TEST=gmerge adhd, connect to a2dp device, can use volume key
to adjust volume.
Change-Id: Ic9a07187e03a155ba8c152b9344bf7cdf9f271cc
Reviewed-on: https://gerrit.chromium.org/gerrit/49300
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Chih-Chung Chang [Thu, 25 Apr 2013 03:45:53 +0000 (11:45 +0800)]
CRAS: Only access dsp context_list from one thread.
BUG=chromium:235500
TEST=build and run cras
Change-Id: I105b73ca4f7d4a475bf139bcd9ba510a509dfbeb
Reviewed-on: https://gerrit.chromium.org/gerrit/49286
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
Tested-by: Dylan Reid <dgreid@chromium.org>
Dylan Reid [Wed, 24 Apr 2013 21:18:32 +0000 (21:18 +0000)]
CRAS: Update name of headphone node.
The name of the headphone node was changed to be more specific for the device
selection UI. This broke the check if the headphone was plugged. Update the
string to match the headphone node name on stumpy, the only system that uses
this API.
BUG=chromium:234397
TEST=set short suspend time and watch powerd log for message about not
suspending because of the headphone jack.
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Change-Id: Idab2ca4231f7acfbd4ac8fe3c68ae7558802660a
Reviewed-on: https://gerrit.chromium.org/gerrit/49092
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Hsin-Yu Chao [Wed, 24 Apr 2013 08:41:57 +0000 (16:41 +0800)]
CRAS: Free resources properly when destroy iodev
Do not free resources if we got error indicate device was busy
while removing it. However we will not see this EBUSY error at
all now, it appears only if is_open() reports incorrect state
after close() has been called. This change corrects the handle
logic and add error log so we can debug when seeing this error.
BUG=None
TEST=emerge adhd. Unplug USB headset while playing to it. Disconnect
bluetooth headset while playing to it. Confirm at all these scenarios
should have audio route correctly.
Change-Id: I1f9a9879e22bc64be391245d859925ef9c2dd86e
Reviewed-on: https://gerrit.chromium.org/gerrit/49040
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Dylan Reid [Mon, 22 Apr 2013 16:57:26 +0000 (09:57 -0700)]
CRAS: a2dp - Prevent leak of supported formats.
The list of supported sample rates and number of channels is set when
setting the format. This can happen multiple times during the life of
an iodev. Free these structures before allocating them when setting
the format. Don't set them at init time as the format must be set
before the device is opened.
BUG=none
TEST=none
Change-Id: I8f354cd1ca33b619e8e55b2b1c0f8921c9d0728c
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48792
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Yunlian Jiang [Tue, 23 Apr 2013 22:44:15 +0000 (15:44 -0700)]
adhd: fix clang warning.
This fixes the warning of
"error: comparison of unsigned expression < 0 is always false"
"tests/rclient_unittest.cc:151:32: error: field 'shm_' with
variable sized type 'struct cras_audio_shm_area' not at the end
of a struct or class is a GNU extension [-Werror,-Wgnu]"
"tests/audio_thread_unittest.cc:1365:3:
error: template argument uses unnamed type
[-Werror,-Wunnamed-type-template-args]"
BUG=chromium:230512
TEST=FEATURES="test" CXXFLAGS="-clang" emerge-lumpy adhd passes.
Change-Id: If88992ab1ef396aaa565b93ce1cb88211cb08f9c
Reviewed-on: https://gerrit.chromium.org/gerrit/48984
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Yunlian Jiang <yunlian@chromium.org>
Tested-by: Yunlian Jiang <yunlian@chromium.org>
Chih-Chung Chang [Fri, 19 Apr 2013 03:04:09 +0000 (11:04 +0800)]
Pass model option to sound driver for lumpy.
BUG=chromium:233458
TEST=gmerge adhd, reboot, and cat /sys/module/snd_hda_intel/parameters/model
Change-Id: Ief68ec03b90cd6e24aab3ce634e74cb7a953791c
Reviewed-on: https://gerrit.chromium.org/gerrit/48609
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Dylan Reid [Thu, 11 Apr 2013 00:10:40 +0000 (17:10 -0700)]
CRAS: audio thread: remove stream if iodev open fails.
When adding a stream to a thread, if the device fails to open, the
procedure is repeated on the next best device. In this case the
stream wasn't removed from the newly created thread and when the
thread was destroyed an extra message was sent to the client telling
it that the stream was removed.
BUG=chromium:190557
TEST=cause iodev open failure (by removing device) and check that the
stream moves smoothly to the next device.
Change-Id: Ic9e8c994a7e7c01937ff7b922b41eca4a8727e4f
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47825
Reviewed-by: Chih-Chung Chang <chihchung@chromium.org>
Shawn Nematbakhsh [Tue, 2 Apr 2013 00:41:09 +0000 (17:41 -0700)]
Add volume curve for stout32 platform.
Add volume curve for stout32 (identical to stout).
TEST=Manual. Build stout32 image, verify custom volume curve exists.
BUG=chrome-os-partner:18474
Change-Id: Ia8668bf6412152eb5e8a11fc093069d04ae1b3be
Reviewed-on: https://gerrit.chromium.org/gerrit/47082
Tested-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Shawn Nematbakhsh <shawnn@chromium.org>
Chih-Chung Chang [Mon, 1 Apr 2013 06:34:57 +0000 (14:34 +0800)]
CRAS: Run external metrics_client command instead of linking metrics library.
This reduces the memory usage of cras.
BUG=none
TEST=start cras with and without codec driver loaded
Change-Id: I315a365245ab0dee0880a7afee7cbff74cfad9ec
Reviewed-on: https://gerrit.chromium.org/gerrit/47005
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Chih-Chung Chang [Tue, 2 Apr 2013 07:15:18 +0000 (15:15 +0800)]
CRAS: Only free dsp context when then iodev is destroyed.
We had a problem that the audio thread closes the iodev and frees the
dsp context while the main thread is still using it. Now we avoid the
problem by only freeing the dsp context when the iodev is destroyed.
BUG=chromium:189214
TEST=make check
Change-Id: Ia16ece72523866d77f78e47cf26ff1308bd75b22
Reviewed-on: https://gerrit.chromium.org/gerrit/47108
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Dylan Reid [Tue, 2 Apr 2013 02:11:27 +0000 (19:11 -0700)]
CRAS: Disable All input processing blocks on the codec.
BUG=chromium:224107
TEST=Hangout, check with person on other end about audio quality
Change-Id: I028e2d94a25d52d10b7a2fd40f9a396a7660579f
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47089
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Dylan Reid [Fri, 29 Mar 2013 22:59:26 +0000 (15:59 -0700)]
spring ucm: update mic switching.
When switching from internal to external mic, toggle the digital mic
enable.
CQ-DEPEND=CL:46904
BUG=chrome-os-partner:18454
TEST=check control state with amixer
Change-Id: I30839f4b61ef254d339f1f9128bec5fb203c5e47
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46939
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Dylan Reid [Wed, 27 Mar 2013 21:30:48 +0000 (14:30 -0700)]
CRAS: audio_thread - For unified always play buffer size frames.
When playing back a unified stream, the playback side should always
get the callback_threshold of frames. This guarantees that the input
and output both process the same number of frames each interval.
BUG=chromium:217385
TEST=play back a unified stream and run a capture stream with a lower
latency to fragment the packets, make sure all requests to the client
are the correct size.
Change-Id: I4f6b6bf8553e5942b5c367796167b8551907ea2e
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46688
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Dylan Reid [Tue, 26 Mar 2013 23:26:18 +0000 (16:26 -0700)]
disable aec on link until software aec is turned off
BUG=chromium:224107
TEST=gmerge adhd and restart cras, check AEC control.
Change-Id: Id49fd297fe9a80365a0dd446c788ca4f78b42c3a
Reviewed-on: https://gerrit.chromium.org/gerrit/46581
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Tested-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
Dylan Reid [Tue, 26 Mar 2013 23:08:24 +0000 (16:08 -0700)]
CRAS: softvol - Add software volume curve and apply.
Apply software volume from the audio thread when the output device
indicates that it needs software volume. This is used by the HDMI
outputs so that the volume keys will affect what is heard on the sink.
BUG=chromium:214954
TEST=udpated unittest, play audio to HDMI and adjust volume.
Change-Id: I2776ced2382491e7c272dd0e5d408034a19c0618
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46579
Dylan Reid [Tue, 26 Mar 2013 18:56:22 +0000 (11:56 -0700)]
CRAS: iodev - Add software volume flag.
Add a flag to iodev that signals that the volume should be applied in
software when this iodev is active. Use this flag for ALSA HDMI
devices. HDMI outputs don't have volume control (because they are
digital) do it in software.
BUG=chromium:214954
TEST=none
Change-Id: I85d3e661af74861915e1ac9a2539d033b6f0ce14
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46578
Dylan Reid [Tue, 26 Mar 2013 18:29:57 +0000 (11:29 -0700)]
CRAS: mix - Allow an output volume scaler.
Add an argument to the output mix that allows for all samples to be
scaled by a system volume before they are played. This will be used
to implement a software volume control when playing to outputs such as
HDMI that don't have volume controls.
BUG=chromimum:214954
TEST=updated mix_unittest
Change-Id: I5fc39b7382a5db474041af12059bff5b73b0cd51
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46577
Dylan Reid [Wed, 20 Mar 2013 02:17:20 +0000 (19:17 -0700)]
CRAS: Bound limit for read and write differently.
Write pointers will now be limited to the max size for the buffers,
and read buffers are limited to 0 if they are invalid.
This way if the write pointer passes the end, the audio will still be
played.
BUG=none.
TEST=updated unit test.
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Change-Id: I3432054c4704c0b5657fab8f39a1fef16962b44d
Reviewed-on: https://gerrit.chromium.org/gerrit/45950
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Dylan Reid [Tue, 26 Mar 2013 16:57:33 +0000 (09:57 -0700)]
CRAS: iodev - remove unused declarations.
These functions don't exist anymore.
BUG=none
TEST=compiles
Change-Id: If57301dc288903ee9a1aac5e0131ce4783379ec6
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46576
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Dylan Reid [Wed, 20 Mar 2013 02:01:38 +0000 (19:01 -0700)]
CRAS: Request the correct number of samples for the stream
If there are two streams attached to an iodev, they would both get the
cb_threshold size requested of them. Fix it to ask for the
appropriate number for the stream.
BUG=none
TEST=updated audio_thread_unittest
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Change-Id: I683ecafdceb56fa0d67fea3dfc233d3ff633a3b7
Reviewed-on: https://gerrit.chromium.org/gerrit/45949
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Scott James Remnant [Fri, 1 Mar 2013 03:00:47 +0000 (19:00 -0800)]
CRAS: bluetooth - enable A2DP Source endpoint
Hook up an A2DP Source endpoint using the A2DP iodev.
BUG=chromium:204431
TEST=connect bluetooth speakers and play YouTube video
Change-Id: I2450c4a1023d462f045c4badb51b46f484d5fe14
Signed-off-by: Scott James Remnant <keybuk@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45113
Hsin-Yu Chao [Mon, 4 Feb 2013 09:23:13 +0000 (17:23 +0800)]
CRAS BT: Bluetooth queued frames calculation
The total queued frames can break down to three types:
- Queued frames in bluetotoh transmission
- Queued frames in a2dp buffer
- Queued frames in pcm buffer
Since there no way to query queued frames from bluez, we
maintain a virtual queued frames value as frames written
and time passed.
BUG=chromium-os:38228
TEST=Unittest. make check;
Change-Id: I769f6bece0b1020ed9dce5473e94d5aa3c40c09f
Reviewed-on: https://gerrit.chromium.org/gerrit/45111
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Hsin-Yu Chao [Wed, 30 Jan 2013 14:09:14 +0000 (22:09 +0800)]
CRAS BT: Create avdtp_write and a2dp_write
Implement get_buf and put_buf callbacks for cras_a2dp_iodev.
cras_sbc_codec does the transcode job from pcm buffer to
a2dp buffer before write to the stream fd acquired from bluez
BUG=chromium-os:38228
TEST=Unittest. make check;
Change-Id: I9ec495d3af1d016bf415bd75d89edc36649b31ee
Reviewed-on: https://gerrit.chromium.org/gerrit/45109
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Hsin-Yu Chao [Tue, 26 Feb 2013 23:20:20 +0000 (07:20 +0800)]
CRAS BT: Export codesize and frame_length of sbc codec
Add getter functions for codesize and frame_length, the
input and ouput block of SBC codec in bytes. These fields
will be used to back calculate how many PCM frames are queued
in a2dp buffer or have transmitted.
BUG=chromium-os:38228
TEST=None
Change-Id: I81b38be0e65697e73e7801e6df0fd4ae08bbb9cb
Reviewed-on: https://gerrit.chromium.org/gerrit/45110
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Hsin-Yu Chao [Sat, 23 Feb 2013 01:38:20 +0000 (09:38 +0800)]
CRAS BT: Add a2dp_info structure
Create a2dp_info structure to hold codec and encoded buffer
as well as the info we need in rtp header and payload, which
will be used later for transmitting encoded frames.
BUG=chromium-os:38228
TEST=Unittest. make check;
Change-Id: I0eebb5dc12c03c561dd85b5bcbef781759ae996f
Reviewed-on: https://gerrit.chromium.org/gerrit/45108
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Hsin-Yu Chao [Tue, 8 Jan 2013 12:50:26 +0000 (20:50 +0800)]
CRAS BT: Add cras_sbc_codec to bt_iodev
Create a cras_audio_codec for each bt_iodev and
config cras_sbc_codec by requested capability
BUG=chromium-os:38228
TEST=make check;
Change-Id: Id93fd7dd621a7505fdd35a5b4c353b94e11faf00
Reviewed-on: https://gerrit.chromium.org/gerrit/45107
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Hsin-Yu Chao [Tue, 8 Jan 2013 11:24:47 +0000 (19:24 +0800)]
CRAS BT: Add cras_a2dp_iodev
Basic implementation of cras_a2dp_iodev.
BUG=chromium-os:38228
TEST=Unittest. make check;
Change-Id: Ida8f93deee4dab94e03ba8de888c112131e817ae
Reviewed-on: https://gerrit.chromium.org/gerrit/45106
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Hsin-Yu Chao [Mon, 14 Jan 2013 14:15:10 +0000 (22:15 +0800)]
CRAS BT: Add rtp.h and a2dp-codecs.h from bluez
Need a2dp-codecs.h for sbc capability and rtp.h to
send samples.
These header files will be used in later changes.
BUG=chromium-os:38228
TEST=None
Change-Id: Ifbf2a7ff9e3ff19c82a5e35b397d66902e67447e
Reviewed-on: https://gerrit.chromium.org/gerrit/45105
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Hsin-Yu Chao [Thu, 1 Nov 2012 09:49:53 +0000 (17:49 +0800)]
CRAS BT: Add cras_audio_codec, cras_sbc_codec interface
cras_sbc_codec uses media-libs/sbc library for SBC
encode/decode. Will be used in future bluetooth audio code
CQ-DEPEND=I596926f73d317a2eb0a0161a2a378890628dfaf6
BUG=chromium-os:38228
TEST=cras_test_client --sbc --capture_file test_record;
cras_test_client --sbc --playback_file test_record;
can hear good sound to make sure encode/decode works good
Change-Id: Ie1ba030c960479de564c6874de8ed0fea74a02c6
Reviewed-on: https://gerrit.chromium.org/gerrit/45104
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Dylan Reid [Tue, 26 Mar 2013 17:53:32 +0000 (10:53 -0700)]
CRAS: dbus - Eliminate "Control" object.
The control interface belongs in the root object.
BUG=chromium:215835
TEST=dbus-monitor --system
Change-Id: I7dfef8666c58738b9a8db10e5487eac4c015b0ab
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46469
Reviewed-by: Scott James Remnant <keybuk@chromium.org>
Dylan Reid [Fri, 22 Mar 2013 22:05:09 +0000 (15:05 -0700)]
CRAS: Set floor for USB audio buffering.
Don't let the audio buffer drop too low for USB devices. This will
prevent a situation where the device needs a large number of samples
and under-runs because the buffer hasn't been filled yet. Even if the
buffer is filled before the samples would be played according to the
audio clock, an underrun can occur if a large chunk of audio is
requested. Often URB size is ~400 frames. Pad an extra 768 to be
safe.
BUG=chrome-os-partner:17660
TEST=play audio with buffer size 480 to USB device before and after
change. Before the change, it would glitch, after it plays smoothly.
Change-Id: I559f488c496cded2f17b865290372e374e1d6d51
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46321
Dylan Reid [Fri, 22 Mar 2013 21:54:39 +0000 (14:54 -0700)]
CRAS: Allow iodev to specify a minimum buffer level.
This additional buffering can be used for devices that transfer data
in chunks > 1. HDA or i2s devices allow for continuous transfer of
samples, USB devices grab samples in URB sized chunks. If the buffer
level isn't filled with more than the chunk size when a URB needs to
be sent, the device will under-run. This new buffer level can be used
to set the floor for the number of samples queued. A subsequent
change will set the floor to a non-zero value for ALSA USB devices.
BUG=chrome-os-partner:17660
TEST=set min buffer level and play to USB device with a buffer size of
480 frames, no glitches.
Change-Id: I3dc3b88983ef50850d9089f7e16343e74f804d56
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46320
Dylan Reid [Wed, 20 Mar 2013 01:14:02 +0000 (18:14 -0700)]
CRAS: Don't try to play input streams.
If both an input and a unified stream are attached, the input stream
would be asked for samples. Check if a stream has an output before
addressing its output shm area.
BUG=none
TEST=attach an input and a unified stream with two test clients.
update audio_thread unit test, fails before change.
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Change-Id: Idfd947e9a7a71d9343e7e21fe45fb3c10d3f614d
Reviewed-on: https://gerrit.chromium.org/gerrit/45948
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Scott James Remnant [Fri, 1 Mar 2013 02:19:35 +0000 (18:19 -0800)]
CRAS: bluetooth - rewrite for BlueZ 5.2
BlueZ 5.2 brings us support for Bluetooth 4.0 and LE, but at the cost
of a different D-Bus API. It was easier to write fresh clean code
for the new API and remove the old code than incrementally refactor.
BUG=204431
TEST=build and run cras, verify logs
Change-Id: I3147aa7d59535b743425c7d48737f8c70614e5cd
Signed-off-by: Scott James Remnant <keybuk@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45103
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Chih-Chung Chang [Thu, 14 Mar 2013 10:30:49 +0000 (18:30 +0800)]
CRAS: Fix issues found by running valgrind on unit tests.
The issues are memory leak and uninitialized memory access.
After this change, all unit tests other than audio_thread_unittest and
rclient_unittest (they have issues only in unit tests and harder to fix)
run cleanly under valgrind.
BUG=none
TEST=make check and run each unit test under valgrind
Change-Id: I72829f1e88b5927eee58f438cd580563a73d95bb
Reviewed-on: https://gerrit.chromium.org/gerrit/45415
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Chih-Chung Chang [Tue, 12 Mar 2013 07:59:14 +0000 (15:59 +0800)]
CRAS: Add "Type" field in the output of GetNodes dbus API.
TEST=check the output of
dbus-send --system --type=method_call --print-reply \
--dest=org.chromium.cras /org/chromium/cras/Control \
org.chromium.cras.Control.GetNodes
Change-Id: I2cd9dbaa67ea1bc15929ced28142aad02a9dd037
Reviewed-on: https://gerrit.chromium.org/gerrit/45196
Commit-Queue: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: Dylan Reid <dgreid@chromium.org>
Dylan Reid [Wed, 13 Feb 2013 02:14:05 +0000 (18:14 -0800)]
Add asound.state and ucm config for spring with 98088 codec.
Spring is switching to the MAX98088 codec instead of 98095. Update
asound.state and the ucm configuration to reflect this.
BUG=chrome-os-partner:17794
TEST=play audio from speakers and headphones on a modified spring with
the 98088.
Change-Id: I53e88acb163a93a36ae1bb92ed1440f400a4e900
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43360
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Chih-Chung Chang [Tue, 12 Mar 2013 06:57:19 +0000 (14:57 +0800)]
CRAS: Update GetNodes dbus API to match the new document.
Instead of accepting a direction parameter, output both output and
input nodes.
TEST=check the output of
dbus-send --system --type=method_call --print-reply \
--dest=org.chromium.cras /org/chromium/cras/Control \
org.chromium.cras.Control.GetNodes
Change-Id: Iafb629661251fb640bdf6a9bff5da8b9c067d507
Reviewed-on: https://gerrit.chromium.org/gerrit/45195
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Chih-Chung Chang [Tue, 12 Mar 2013 06:42:27 +0000 (14:42 +0800)]
CRAS: Update dbus API code to match the document.
- Remove "System" and "Capture". Use "Output" and "Input" instead.
- Replace byte with int32 for volume.
BUG=chromium-os:33666
TEST=test each api using dbus-send
Change-Id: Iebde136ce974f3c8c5d97f80ef276c7a297cec39
Reviewed-on: https://gerrit.chromium.org/gerrit/45194
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Chih-Chung Chang [Tue, 12 Mar 2013 04:06:59 +0000 (12:06 +0800)]
CRAS: Implement dbus Active{Output|Input}NodeChanged signal.
The signal is sent whenever the active output/input node changes.
BUG=chromium-os:33666
TEST=dbus-monitoe --system and plug/unplug headaphone to see the signals are sent.
Change-Id: I02fd445e3e4f3b09ed18dbbed5ca31dfe6d25815
Reviewed-on: https://gerrit.chromium.org/gerrit/45193
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Chih-Chung Chang [Tue, 12 Mar 2013 03:41:06 +0000 (11:41 +0800)]
CRAS: Add get active node id function.
This will be used to determine if we need to send "active node changed" signal.
BUG=chromium-os:33666
TEST=make check
Change-Id: I98d5d3fae47874183fc7f987e37b4e7f9e53c74a
Reviewed-on: https://gerrit.chromium.org/gerrit/45192
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Chih-Chung Chang [Tue, 12 Mar 2013 02:15:43 +0000 (10:15 +0800)]
CRAS: Refactor code setting active node into an iodev function.
In a future change, we will send "active nodes changed" signal to clients in
this function.
BUG=chromium-os:33666
TEST=make check
Change-Id: I9e041e01cceb9219feaf6da6620129d479b791f2
Reviewed-on: https://gerrit.chromium.org/gerrit/45191
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Chih-Chung Chang [Mon, 11 Mar 2013 11:24:46 +0000 (19:24 +0800)]
CRAS: Implement dbus NodesChanged signal.
The NodesChanged signal will be sent whenever nodes are added/removed.
BUG=chromium-os:33666
TEST=run "dbus-monitor --system" and plug/unplug usb headset to obsever the signal.
Change-Id: Iafb9e496fb1e3f88073ffaa6465842ee1deeea3a
Reviewed-on: https://gerrit.chromium.org/gerrit/45190
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Chih-Chung Chang [Mon, 11 Mar 2013 10:30:08 +0000 (18:30 +0800)]
CRAS: Update cras_system_state to use the new alert functions.
BUG=chromium-os:33666
TEST=make check
Change-Id: Icef4a10af3b51a64b1c5598fae33dfc05d9f126f
Reviewed-on: https://gerrit.chromium.org/gerrit/45189
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Chih-Chung Chang [Mon, 11 Mar 2013 04:59:54 +0000 (12:59 +0800)]
CRAS: Add cras_alert facility.
This is a similar to the state_callback_list used in
cras_system_state. The differences are:
(1) We do not call the callbacks immediately. We mark an alert as
"pending" when we know the callbacks should be called, but only actually
do so at the end of the event loop. This collapses multiple callbacks into
one (for example, if there are multiple nodes added at the same time,
we will only fire "nodes changed" signal once)
(2) We added a "prepare" function which will be called before calling the
callbacks. This gives each alert a chance to update the system to a
consistent state before signalling the clients.
We will move cras_system_state to use cras_alert in the next change.
BUG=chromium-os:33666
TEST=make check
Change-Id: I2c98430754f7395dfa96f82cde82dfb5fac65f00
Reviewed-on: https://gerrit.chromium.org/gerrit/45188
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Chih-Chung Chang [Fri, 8 Mar 2013 10:36:25 +0000 (18:36 +0800)]
CRAS: Refactor code adding and removing nodes into iodev functions.
In a future change, we will send "nodes changed" signal to clients in
these functions.
BUG=chromium-os:33666
TEST=make check
Change-Id: Ic026f7cd9cdeb333d3378e3f4a1c01cabd646e65
Reviewed-on: https://gerrit.chromium.org/gerrit/45017
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Chih-Chung Chang [Fri, 8 Mar 2013 10:05:35 +0000 (18:05 +0800)]
CRAS: Rename the function from update_clients() to update_device_list().
The new name better reflects what the function does.
BUG=none
TEST=make check
Change-Id: I08d557af40b18cf63b1966709a515feffc8777e4
Reviewed-on: https://gerrit.chromium.org/gerrit/45016
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Chih-Chung Chang [Sat, 9 Mar 2013 04:24:34 +0000 (12:24 +0800)]
CRAS: Update the dbus API document.
Change the dbus API according to feedbacks.
BUG=chromium-os:33666
TEST=none
Change-Id: I56b51e14f062b873a24827a72e6852d4042b12ed
Reviewed-on: https://gerrit.chromium.org/gerrit/45019
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Chih-Chung Chang [Thu, 7 Mar 2013 11:37:41 +0000 (19:37 +0800)]
CRAS: Add dbus SetActiveOutputNode and SetActiveInputNode API.
BUG=chromium-os:33666
TEST=switch output using
dbus-send --system --type=method_call --print-reply \
--dest=org.chromium.cras /org/chromium/cras/Control \
org.chromium.cras.Control.SetActiveOutputNode uint64:0x0000000300000001
and check the output of cras_test_client --dump_s
Change-Id: Id78376297acd7ded8ff6febe69d851c70110ab69
Reviewed-on: https://gerrit.chromium.org/gerrit/44839
Reviewed-by: Chih-Chung Chang <chihchung@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Chih-Chung Chang [Wed, 6 Mar 2013 10:59:39 +0000 (18:59 +0800)]
CRAS: Make a standalone select_node API.
Node selection was done using set_node_attr API, but now selection is
not a per-node property. Move it to a standalone API.
BUG=chromium-os:33666
TEST=cras_test_client --select_output and --select_input
Change-Id: Ic2b82242d3270dfa3713156c56831bf59b0e05b1
Reviewed-on: https://gerrit.chromium.org/gerrit/44838
Reviewed-by: Chih-Chung Chang <chihchung@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Chih-Chung Chang [Wed, 6 Mar 2013 10:08:05 +0000 (18:08 +0800)]
CRAS: show selected nodes in cras_test_client.
BUG=chromium-os:33666
TEST=cras_test-client --dump_s
Change-Id: I020c8b1ac9cf9a3a8de4a93baf84c50b125eb554
Reviewed-on: https://gerrit.chromium.org/gerrit/44837
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Chih-Chung Chang [Tue, 5 Mar 2013 08:57:38 +0000 (16:57 +0800)]
CRAS: Move "selected" from a per-node state to a global state.
"selected" was a per-node state, so there can be multiple selected
node. Now we only want to have one (or zero) selected node per direction.
BUG=chromium-os:33666
TEST=make check
Change-Id: I1f09c7cb2db70a04d3fcce89c27c6304bcd87cb9
Reviewed-on: https://gerrit.chromium.org/gerrit/44836
Reviewed-by: Chih-Chung Chang <chihchung@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Chih-Chung Chang [Tue, 5 Mar 2013 10:08:30 +0000 (18:08 +0800)]
CRAS: In the set_node_attr API, use cras_node_id_t.
Instead of passing two indices, pass one node id. This makes things
easier to understand for the clients.
CQ-DEPEND=CL:44915
BUG=none
TEST=make check
Change-Id: If693e8c0368fdf3565ff63a43eef91f860b218e5
Reviewed-on: https://gerrit.chromium.org/gerrit/44835
Reviewed-by: Chih-Chung Chang <chihchung@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Chih-Chung Chang [Tue, 5 Mar 2013 08:52:19 +0000 (16:52 +0800)]
CRAS: Extract find_dev and find_node methods.
These methods will be reused in the future.
BUG=none
TEST=make check
Change-Id: Iee74375678ffc35934324bbad80e6021386744b3
Reviewed-on: https://gerrit.chromium.org/gerrit/44834
Reviewed-by: Chih-Chung Chang <chihchung@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Chih-Chung Chang [Tue, 5 Mar 2013 08:29:09 +0000 (16:29 +0800)]
CRAS: Make device and node index use 32 bit integer type.
Make it clear that the index is 32 bit, not platform-dependent size_t.
Also add a cras_node_id_t typedef and utility functions to create node
id and extract index from node id.
BUG=chromium-os:33666
TEST=make check
Change-Id: I7b8e0a9be7bb907669a4710f4483db407d89888a
Reviewed-on: https://gerrit.chromium.org/gerrit/44833
Reviewed-by: Chih-Chung Chang <chihchung@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Chih-Chung Chang [Tue, 5 Mar 2013 09:16:20 +0000 (17:16 +0800)]
CRAS: Remove extra iodev parameter.
Now we have iodev pointer in ionode, so we don't need to pass both.
BUG=none.
TEST=make check
Change-Id: I0d2bc78b95c03477a02377bca46a92302874f345
Reviewed-on: https://gerrit.chromium.org/gerrit/44832
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Chih-Chung Chang [Tue, 5 Mar 2013 07:58:17 +0000 (15:58 +0800)]
CRAS: Add a iodev pointer in ionode.
So we don't need to pass both as parameters in the future.
BUG=none
TEST=make check
Change-Id: I9a172481cc8731b954c285dfe198985a4550f00a
Reviewed-on: https://gerrit.chromium.org/gerrit/44831
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Chih-Chung Chang [Wed, 6 Mar 2013 09:35:25 +0000 (17:35 +0800)]
CRAS: Fix a cast error.
Both alsa_output_node and alsa_input_node has a jack, but they are
at a different offset. Found this by tracking down a segfault while
developing.
BUG=none
TEST=cras no longer segfaults
Change-Id: Ib72b42e312448d43e25049ae4e86213099732913
Reviewed-on: https://gerrit.chromium.org/gerrit/44830
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Chih-Chung Chang [Wed, 6 Mar 2013 07:21:41 +0000 (15:21 +0800)]
CRAS: Correct the priority values for jack nodes and USB headset nodes.
Jack nodes and USB headset had low priorities, so it was not selected.
Also set the plugged_time value if a node is initially plugged.
BUG=chromium-os:39571
TEST=plug/unplug headphone and USB headset on lumpy/daisy
Change-Id: I07cd314ea6a7f9ad731fe2db9975df0a6b927cac
Reviewed-on: https://gerrit.chromium.org/gerrit/44718
Commit-Queue: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: Dylan Reid <dgreid@chromium.org>
Dylan Reid [Wed, 6 Mar 2013 20:07:01 +0000 (12:07 -0800)]
CRAS: Add UMA logging for no codecs found.
Add the ability to log events to UMA. This is behind a config flag to
preserve building on desktop linuxes where the chromeos metrics
library isn't present. The ebuild for chromeos will be changed to
pass --enable-chromeos-metrics.
BUG=chromium-os:39634
TEST=start cras with and without codec driver loaded
Change-Id: I6c394bcef7ad411a3057ae3ae93a7adeb575a022
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44744
Dylan Reid [Wed, 6 Mar 2013 18:39:52 +0000 (10:39 -0800)]
CRAS: Check that there is a real output device.
Check if there is an output device in the system. Do this 5 seconds
after the server is started. The five second delay is to allow for
udev enumeration to complete. This log will be converted to an UMA
stat so that codec failures can be monitored.
BUG=none
TEST=start cras check that no message is present, remove codec driver
module from kernel, restart cras and see message in /var/log/messages.
Change-Id: I92d30159e01446248c85adb3ce7d6e038c134b85
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44743
Reviewed-by: Chih-Chung Chang <chihchung@chromium.org>
Dylan Reid [Wed, 6 Mar 2013 18:21:24 +0000 (10:21 -0800)]
CRAS: iodev_list - Allow a null list pointer to get_outputs.
If passing a null list pointer to get_outputs/get_inputs return the
size of this list, without filling in the details.
BUG=none
TEST=updated iodev_list_unittest
Change-Id: Ie5723416a994752dea1c6d92a048f6d117dc5aef
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44742
Reviewed-by: Chih-Chung Chang <chihchung@chromium.org>
Chih-Chung Chang [Mon, 4 Mar 2013 11:19:06 +0000 (19:19 +0800)]
CRAS: Implement the dbus API GetNodes.
The GetNodes API returns information about available nodes.
BUG=chromium-os:33666
TEST=compare the output of
dbus-send --system --type=method_call --print-reply --dest=org.chromium.cras
/org/chromium/cras/Control org.chromium.cras.Control.GetNodes byte:0
and
cras_test_client --dump_server_info
Change-Id: I5738eec795459b2f801ce5588d524ed8a017ca74
Reviewed-on: https://gerrit.chromium.org/gerrit/44519
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Reviewed-by: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Dylan Reid [Fri, 1 Mar 2013 23:53:18 +0000 (15:53 -0800)]
CRAS: dbus - Use introspection for methods.
Don't add matches for each method. Instead use introspection to list the available methods.
BUG=none
TEST= use dbus-send to test each message:
dbus-send --system --type=method_call --print-reply --dest=org.chromium.cras /org/chromium/cras/Control org.freedesktop.DBus.Introspectable.Introspect
dbus-send --system --type=method_call --dest=org.chromium.cras /org/chromium/cras/Control org.chromium.cras.Control.SetSystemVolume byte:55
dbus-send --system --type=method_call --dest=org.chromium.cras /org/chromium/cras/Control org.chromium.cras.Control.SetSystemCaptureGain int32:300
dbus-send --system --type=method_call --dest=org.chromium.cras /org/chromium/cras/Control org.chromium.cras.Control.SetSystemCaptureMute boolean:true
dbus-send --system --type=method_call --dest=org.chromium.cras /org/chromium/cras/Control org.chromium.cras.Control.SetSystemMute boolean:true
dbus-send --system --print-reply --type=method_call --dest=org.chromium.cras /org/chromium/cras/Control org.chromium.cras.Control.GetSystemVolumeState
watch signals with "dbus-monitor --system"
Change-Id: Ia047818f4a59eca35ab8b9e5f0f5fe0d9102351f
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44434
Chih-Chung Chang [Sat, 2 Mar 2013 01:38:15 +0000 (09:38 +0800)]
CRAS: Add direction parameter to the node list and active node API.
BUG=chromium-os:33666
TEST=none
Change-Id: Ie670b76a74ca018590d443912b76458112497127
Reviewed-on: https://gerrit.chromium.org/gerrit/44447
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Dylan Reid [Fri, 1 Mar 2013 23:44:34 +0000 (15:44 -0800)]
CRAS: dbus - Don't request replacement for name.
This should fail is there is already a cras server running.
BUG=none
TEST=dbus-send --system --type=method_call --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListNames
to check if the device registers correctly. Start two and watch syslog for an error.
Change-Id: I5733db6793c14a59b92b755de84343dd0d9e940b
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44433
Reviewed-by: Chih-Chung Chang <chihchung@chromium.org>
Reviewed-by: Scott James Remnant <keybuk@chromium.org>
Chih-Chung Chang [Fri, 1 Mar 2013 22:51:41 +0000 (06:51 +0800)]
CRAS: Add dbus API doc for input/output nodes information.
BUG=chromium-os:33666
TEST=none
Change-Id: I5000680b5b52ef69324dc2507261080cdc573613
Reviewed-on: https://gerrit.chromium.org/gerrit/44424
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Dylan Reid [Fri, 1 Mar 2013 16:06:00 +0000 (08:06 -0800)]
CRAS: Send DBus signals when volume/mute changes.
Emit a DBus signal for volume, mute, capture_gain, and capture_mute.
BUG=chromium-os:39387
TEST=dbus_monitor --system, watch for signals when changing volume.
Change-Id: I92a6a2b5beb9bf4b234c63327c8023d773e2f1cd
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44392
Reviewed-by: Chih-Chung Chang <chihchung@chromium.org>
Dylan Reid [Fri, 1 Mar 2013 00:55:36 +0000 (16:55 -0800)]
CRAS: Add GetSystemVolumeState DBus message.
Handle DBus message that gets the volume state of both the input and
output.
BUg=chromium-os:39387
TEST=dbus-end and check output:
dbus-send --system --type=method_call --print-reply --dest=org.chromium.cras /org/chromium/cras org.chromium.cras.GetSystemVolumeState
Change-Id: I5ba39c8a2013effc983efd38f0ef2e8c9c3347ad
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44352
Reviewed-by: Chih-Chung Chang <chihchung@chromium.org>
Dylan Reid [Thu, 28 Feb 2013 23:13:24 +0000 (15:13 -0800)]
CRAS: DBus - Enable some control methods over DBus.
Start to handle some DBus messages. Add support for setting volume
and mute for both input and output.
BUG=chromium-os:39287
TEST=Set each newly exported method with dbus-send:
dbus-send --system --type=method_call --dest=org.chromium.cras /org/chromium/cras org.chromium.cras.SetSystemCaptureGain int32:-1100
dbus-send --system --type=method_call --dest=org.chromium.cras /org/chromium/cras org.chromium.cras.SetSystemCaptureMute boolean:true
dbus-send --system --type=method_call --dest=org.chromium.cras /org/chromium/cras org.chromium.cras.SetSystemMute boolean:true
dbus-send --system --type=method_call --dest=org.chromium.cras /org/chromium/cras org.chromium.cras.SetSystemVolume byte:15
Verify that each worked with cras_test_client --dump_server_info
Change-Id: I587bb503528ab2b6cdd3800dbb415cedfbd91114
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44351
Reviewed-by: Chih-Chung Chang <chihchung@chromium.org>
Dylan Reid [Thu, 28 Feb 2013 23:07:40 +0000 (15:07 -0800)]
CRAS: DBus - request org.chromium.cras
Get the name from DBus so that CRAS can receive method calls addressed
to it.
CQ-DEPEND=CL:44325
BUG=chromium-os:39387
TEST=gmerge adhd, check for success.
Change-Id: I759bba66ac9ff66040f2c3993ea85a2610553dff
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44331
Reviewed-by: Chih-Chung Chang <chihchung@chromium.org>
Dylan Reid [Thu, 28 Feb 2013 22:42:21 +0000 (14:42 -0800)]
Add DBus config file.
Tell DBus that org.chromium.cras shoudl be owned by the user "cras".
This file will be install by an ebuild change that depends on this.
BUG=chromium-os:39387
TEST=none
Change-Id: I7be379e963e42f7939c62496ba65d6ddd87ce666
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44322
Reviewed-by: Chih-Chung Chang <chihchung@chromium.org>
Dylan Reid [Thu, 28 Feb 2013 22:18:59 +0000 (14:18 -0800)]
CRAS: Add initial dbus api README
BUG=chromium-os:39387
TEST=none.
Change-Id: Ia9c2d8640ab29bd728358f1eb8b2396b258b5f9e
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44316
Reviewed-by: Chih-Chung Chang <chihchung@chromium.org>
Hsin-Yu Chao [Thu, 28 Feb 2013 18:30:39 +0000 (02:30 +0800)]
CRAS cras_client: Move cb_threshold check to old params create all
Unified params creation already configures buf_size to double
the cb_threshold. Move the cb_threshold check to make it not
affect unified params.
BUG=chromium-os:39290
TEST=make check; Manual test youtube and gtalk both playback&capture
work good; Manual test loopback_latency tool no longer hangs.
Change-Id: I473277dd72592c704f2f0c2b94b09460c0fdae13
Reviewed-on: https://gerrit.chromium.org/gerrit/44288
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Chih-Chung Chang [Thu, 28 Feb 2013 19:22:58 +0000 (03:22 +0800)]
CRAS: Clear node selection after a node is plugged in.
We want to reset the user preference when a node (like Headphone)
is plugged in. When that happens, most likely the user wants to use
that node instead of the previous preference.
BUG=chromium-os:33666
TEST=plug in headphone and use cras_test_client --dump_s to check
Change-Id: I370643304c513ce993dd1b037f8b0b657341d020
Reviewed-on: https://gerrit.chromium.org/gerrit/44295
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Reviewed-by: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Chih-Chung Chang [Thu, 28 Feb 2013 01:39:40 +0000 (09:39 +0800)]
Move code that are common for all iodevs from alsa_io to iodev.
This moves the handling of plugging and selection from alsa specific
code to the general iodev code. This makes it unnecessary to duplicate
the same logic for each kind of iodev. It also makes it easier to
add more hooks when plugging and selection happens.
BUG=none
TEST=make check
Change-Id: I45bcb0d24d98c16cfc2ff09abee7e4b393532356
Reviewed-on: https://gerrit.chromium.org/gerrit/44294
Commit-Queue: Chih-Chung Chang <chihchung@chromium.org>
Reviewed-by: Chih-Chung Chang <chihchung@chromium.org>
Tested-by: Chih-Chung Chang <chihchung@chromium.org>
Vic Yang [Tue, 26 Feb 2013 07:46:31 +0000 (15:46 +0800)]
Add ucm and cras config for daisy_spring
This just uses config files from daisy. This will probably need to be
tuned.
BUG=chrome-os-partner:17878
TEST=Boot on Spring and check default volume is not 0.
Change-Id: I907491adf8ca5dee392e3e21a290da3763848590
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44024
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>