2e14c232763ac89fd9d2fa5e9b3fdcf6581b2db8 |
|
23-May-2017 |
Chinyue Chen <chinyue@chromium.org> |
Revert "CRAS: Deduplicate snd_pcm_open calls when opening a device." This reverts commit 70182dd089ce9646f371ce0188ce4423d7f64f6a. Reason for revert: broke the external mic on cyan and celes Original change's description: > CRAS: Deduplicate snd_pcm_open calls when opening a device. > > The current open device flow includes several functions like > cras_alsa_fill_properties and update_channel_layout. They are used only > once in the flow but each calls snd_pcm_open and then snd_pcm_close the > device. Since snd_pcm_open is one of the most time-consuming hardware > operations, the CL extracts the snd_pcm_open calls to the beginning of > the device open flow to save time. > > 1. Update cras_alsa_fill_properties and update_channel_layout to take a > handle as argument and do not invoke snd_pcm_open. > 2. Rename existing open_dev functions to configure_dev. open_dev is now > called at the beginning of the device open flow and invokes the > snd_pcm_open call. > 3. Put open_dev, cras_iodev_set_format, and configure_dev inside the > cras_iodev_open function. > > BUG=b:719812 > TEST=make check and tested on reef > Cuts time to open speakers from 78ms to 42ms > > Change-Id: I9b161217def5e87bf892f4ca8148f07bed5e71a5 > Reviewed-on: https://chromium-review.googlesource.com/505974 > Commit-Ready: Chinyue Chen <chinyue@chromium.org> > Tested-by: Chinyue Chen <chinyue@chromium.org> > Reviewed-by: Dylan Reid <dgreid@chromium.org> > BUG=b:719812 Change-Id: I22eb2fc70b4a5003a861be62d31bc2337b9918c3 Reviewed-on: https://chromium-review.googlesource.com/511982 Commit-Ready: Chinyue Chen <chinyue@chromium.org> Tested-by: Chinyue Chen <chinyue@chromium.org> Reviewed-by: Chinyue Chen <chinyue@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
70182dd089ce9646f371ce0188ce4423d7f64f6a |
|
12-May-2017 |
Chinyue Chen <chinyue@google.com> |
CRAS: Deduplicate snd_pcm_open calls when opening a device. The current open device flow includes several functions like cras_alsa_fill_properties and update_channel_layout. They are used only once in the flow but each calls snd_pcm_open and then snd_pcm_close the device. Since snd_pcm_open is one of the most time-consuming hardware operations, the CL extracts the snd_pcm_open calls to the beginning of the device open flow to save time. 1. Update cras_alsa_fill_properties and update_channel_layout to take a handle as argument and do not invoke snd_pcm_open. 2. Rename existing open_dev functions to configure_dev. open_dev is now called at the beginning of the device open flow and invokes the snd_pcm_open call. 3. Put open_dev, cras_iodev_set_format, and configure_dev inside the cras_iodev_open function. BUG=b:719812 TEST=make check and tested on reef Cuts time to open speakers from 78ms to 42ms Change-Id: I9b161217def5e87bf892f4ca8148f07bed5e71a5 Reviewed-on: https://chromium-review.googlesource.com/505974 Commit-Ready: Chinyue Chen <chinyue@chromium.org> Tested-by: Chinyue Chen <chinyue@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
5528e7442cd3b86037fa84e45ca42cf10b126bdf |
|
23-Feb-2017 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS: audio_thread - Synchronize audio thread callback removal Both A2DP and HFP iodev register an audio thread callback to read/write data from/to a file descriptor. When device is closed to remove this callback on main thread, audio thread could still accessing it and cause problem. The symptom on A2DP iodev is that BT transport has closed and set its fd to -1, but audio thread accidentally writes data to it so an error is thrown and results BT disconnection. Fix this issue by creating a separate function for main thread to remove audio thread callback in a synchronized way. TEST=Connect Powerbeats3 headset and repeatedly open and then close YouTube to verify there is no unexpected disconnection. BUG=chrome-os-partner:62623 Change-Id: If8171afc5b2462616492551b5e6c586c1c2c1342 Reviewed-on: https://chromium-review.googlesource.com/445844 Commit-Ready: Hsinyu Chao <hychao@chromium.org> Commit-Ready: Miao-chen Chou <mcchou@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Tested-by: Miao-chen Chou <mcchou@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org> Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
c84eb15a0fbd4a6b336d11438836b644fefc2679 |
|
08-Nov-2016 |
Moja Hsu <mojahsu@google.com> |
CRAS: dbus_control - Add serial number for USB device for stable id 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>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
40ec4b17c945adab7667121f50eedc57448c4eff |
|
17-Nov-2016 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS: a2dp - Don't flush too much when buffer level is low 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>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
fa4cd9766aec6eae544b1078ed835687c4e74617 |
|
31-Jul-2016 |
John Muir <muirj@google.com> |
CRAS: Use the hardware timestamp with available/used frames. The ALSA device drivers can provide a timestamp associated with the buffer read-pointer. This can be use to more accurately guage the time that the next buffer is required. Enable this functionality only when supported ALSA in the running kernel. BUG=None TEST=Unit tests pass. Verified on Samus (on kernel v3.14). Verified on new device (kernel v3.18 - htimestamp enabled). Verified a bluetooth device. Verified a USB device. Change-Id: I5bca36f7ad9a236e80b2e277ccc62ccc8c39905b Reviewed-on: https://chromium-review.googlesource.com/366961 Commit-Ready: John Muir <muirj@google.com> Tested-by: John Muir <muirj@google.com> Reviewed-by: Dylan Reid <dgreid@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
2232117de7c9542713986c95235bb088d0fa6c40 |
|
15-Aug-2016 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS: bt_device - Migrate a2dp suspend timer to bt_device This is a refactor change to move a2dp suspend timer to bt_device so it can be managed with all other timer objects. BUG=chromium:543444 TEST=Manual test A2DP audio Change-Id: If83e8ebd31de2dfe709d8663ba86e6ba0d14eb22 Reviewed-on: https://chromium-review.googlesource.com/375621 Commit-Ready: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Reviewed-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
50cf4aec95391fb7768d9a98e35e618edc7443f3 |
|
26-Jul-2016 |
Cheng-Yi Chiang <cychiang@chromium.org> |
CRAS: iodev - Add state variable in cras_iodev Reland e9e2c8e CRAS: iodev - Add state variable in cras_iodev. The bug in cras_iodev_open for input device has been fixed. Since input device start in the end of open, its state should be normal run. Also fix the unittest that failed to catch this issue. Use state variable to maintain the state of iodev. Remove no_stream_state flag in iodev. Remove is_open ops in iodev. Remove dev_running ops in iodev. Now iodev uses start ops to determine if a device can stay in open state. If start ops is not supported, device should start running right after opening. Output device will be in no_stream state, while input device will be in normal state. This is in preparation for the next patch to move state transition from write_output_samples in audio_thread into cras_iodev and cleanup iodev interface. BUG=chromium:519942 TEST=make check Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/364432 Change-Id: Ibe857665be46965c52d4b4ff6f0f84dd63574373 Reviewed-on: https://chromium-review.googlesource.com/375581 Reviewed-by: Hsinyu Chao <hychao@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
8ebc96cf4135d449b8473e191386e0f896372039 |
|
25-Aug-2016 |
Cheng-Yi Chiang <cychiang@chromium.org> |
Revert "CRAS: iodev - Add state variable in cras_iodev" This reverts commit e9e2c8e19fa28a469372bfa3e5fd942dcbb26f90. The change somehow broke recording path. Revert it now and investigate it later. BUG=chromium:640659,chromium:519942 TEST=check recording works fine on chell. Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org> Change-Id: I2f6b17fd158f4063c69154810a14ed1b4e74e1b9 Reviewed-on: https://chromium-review.googlesource.com/375659
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
e9e2c8e19fa28a469372bfa3e5fd942dcbb26f90 |
|
26-Jul-2016 |
Cheng-Yi Chiang <cychiang@chromium.org> |
CRAS: iodev - Add state variable in cras_iodev Use state variable to maintain the state of iodev. Remove no_stream_state flag in iodev. Remove is_open ops in iodev. Remove dev_running ops in iodev. Now iodev uses start ops to determine if a device can stay in open state. If start ops is not supported, device should start running right after opening. Output device will be in no_stream state, while input device will be in normal state. This is in preparation for the next patch to move state transition from write_output_samples in audio_thread into cras_iodev and cleanup iodev interface. BUG=chromium:519942 TEST=make check Change-Id: Ib393a56bfc5d8e49b65cacc6ad862e3bbaccf420 Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/364432
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
d6ba8e31ac15c1e5c5403aa790597857e3380da8 |
|
22-Jan-2016 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS: a2dp_iodev - Implement set volume callback When AVRCP is supported, CRAS will be able to adjust device's hardware volume for A2DP output through the media transport API provided by BlueZ, instead of using software volume. Implement the set_volume of a2dp_iodev, and a later commit will use this set volume path under certain condition. BUG=chromium:605035 TEST=Apply full patch set, and test with Plantronics Edge headset. Press volume up/down key on keyboard, verify the volume changes accordingly. Change-Id: I4c567a951c4e4b5f24ccf3b20f32e9b646feb747 Reviewed-on: https://chromium-review.googlesource.com/340862 Commit-Ready: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Reviewed-by: Chinyue Chen <chinyue@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
f96a10e395815823130ecc9f162b23b4bb4471f9 |
|
22-Apr-2016 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS: bt_io - Clean up the use of software_volume_needed flag Currently for bluetooth audio software volume is used, no matter what profile(HFP, A2DP) is used. In future when AVRCP is supported and remote headset supports absolute volume, we'll be able to use hardware volume on both HFP and A2DP. This change cleans up related code so that only the parent bt_iodev cares about the software_volume_needed flag, and can delegate the volume adjust task to each profile iodev when this flag is unset. BUG=chromium:605035 TEST=Playback in A2DP and record in HFP, adjust volume can work. Change-Id: I662597f8b08c100bfb4ad9539380f9e24e13952d Reviewed-on: https://chromium-review.googlesource.com/340341 Commit-Ready: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Reviewed-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
ac9a583e880d596f597c8b14a87fca9c7160b5d6 |
|
06-Apr-2016 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS: a2dp - Cancel any scheduled timer at close a2dp suspend timer is used to handle fatal error cases that are unable to stream smooth audio. When a2dp data write encounters EAGAIN error continuously for more than 5 seconds, the timer will be triggered to suspend the connection of BT headset. However this timer could be scheduled right before it switches to hfp mode, and unexpectedly suspends the connection a few seconds later. To fix that we should just cancel any scheduled timer whenever a2dp iodev is closed, since the suspend condition will never be met. BUG=chrome-os-partner:52015 TEST=Connect BT headset and play/record audio. Select audio input to BT headset and verify headset connection doesn't drop after 5 seconds. Change-Id: I4f4307a6a8e6d9c5ca6909d727a106c0c2f7f94b Reviewed-on: https://chromium-review.googlesource.com/337441 Commit-Ready: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
e91895c69bef2515b60d6e4514a5f8e8c53cb36f |
|
22-Mar-2016 |
Cheng-Yi Chiang <cychiang@chromium.org> |
CRAS: iodev - Add start function to cras_iodev In alsa_io, simplify dev_running to just check if device is running. In alsa_io, implement start function to start PCM. In audio thread, start device when sample is ready from stream and is written to the deivce. Avoid putting zeros to device when it is still waiting for the first reply from stream in these two cases: - If there is no stream on the device, only fills zeros to device when device is running. Only device in idle stage will get these zeros. - If there is no sample written, and device buffer is empty, only fills zeros to device when device is running. Add dummy start function definition to differnet iodevs. For bluetooth and loopback devices, the devices start running when they are opened. For empty device and test device, devices are always running. BUG=chromium:519942 TEST=cras_test_client --playback_f /usr/local/autotest/cros/audio/fix_440_16.raw --show_latency; check the latency is reduced from 13ms to 4ms on headphone, from 19ms to 10ms on speaker. Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org> Change-Id: I0b54e8e78d6dd64e0e92d6c140fe644385483c9b Reviewed-on: https://chromium-review.googlesource.com/333837
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
1037abe53d0bb703539faa80268bcbe0a06f7278 |
|
02-Mar-2016 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS: bt_transport - Allow transport be released in blocking mode BT transport can be released in either blocking or non-blocking mode. A case is found that when bt transport got released non-blocking, the immediate following acquire call would fail with error message 'Operation not authorized', due to that the transport state hasn't been fully released on bluetoothd side. However when fatal error of BT audio is detected, bluetoothd could take up to 6 seconds to return the release blocking call. This causes bad user experience so we have to choose non-blocking mode for this kind of scenario. In order to support all cases, add a flag to a2dp_io and set this flag in destructor, where the fatal error handling goes to, and then the close_dev callback can use this flag to decide release transport in blocking or non-blocking mode. BUG=chrome-os-partner:50540 TEST=Play audio and repeatedly pair & connect bluetooth speaker, verify that A2DP doesn't break. Use 'Classic Jam' speaker to stream audio, power it off, and verify audio shouldn't freeze more than 5 seconds. Change-Id: I79c87cfcb4459555d25b373104baab3feec73561 Reviewed-on: https://chromium-review.googlesource.com/330292 Commit-Ready: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
7e32d4dde1a7e935dc0e56d15dcca45c8c1e30f7 |
|
02-Mar-2016 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS: a2dp_iodev - Better document a2dp_io members BUT=None TEST=None Change-Id: I7c2cd4204d9100fcd63f5f22fb329e176ce24392 Reviewed-on: https://chromium-review.googlesource.com/330291 Commit-Ready: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
b94ca5c623b0e4f4661ddaf007f1189e117780e7 |
|
26-Jan-2016 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS: a2dp - Fix bug that a2dp got disconnected unexpectedly At writing a2dp data, there are two logic mixed together: 1. If write() call receives -EAGAIN error, schedule a 5 seconds timer to suspend a2dp connection. This timer should be canceled once the write() call returns non-negative code. 2. If the a2dp iodev's pcm buffer has data, and the previous write() call didn't return error, try to encode and send more to a2dp socket. When the a2dp pcm buffer got accumulated for some reason and enters the encode loop as described in (2) above, we failed to cancel the suspend timer for those iterations that encoded data written successfully. This causes a problem that we disconnect a2dp when it's only busy but not totally stucked. Fix it by rearrange the cancel check. BUG=chrome-os-partner:49533,chrome-os-partner:48906 BUG=chrome-os-partner:49386,chromium:579371 TEST=Test a2dp playback Change-Id: Ie4f7bb92879a50fb9300d196c77e794dd5fba865 Reviewed-on: https://chromium-review.googlesource.com/323974 Commit-Ready: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
5c890457a82d673cd0ab619d6b506a1fbea630eb |
|
09-Dec-2015 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS: a2dp - Suspend a2dp if receive -EAGAIN for 5 seconds Some BT devices don't send correct disconnect event when powers off, which causes audio/video to freeze 20 seconds unable to send out any data. In order to provide better user experience in this situation, schedule a timer in 5 seconds if writing data receives -EAGAIN error continuously. This change reuses and extends the force suspend function to schedule a suspend timer at given time. BUG=chrome-os-partner:45103 TEST=a2dp playback with 'Jam classic' BT speaker, power off speaker and verify audio transfer to internal speaker in 5 seconds. Change-Id: I8b5549cc7402b007923032f7e7db7df90e95b368 Reviewed-on: https://chromium-review.googlesource.com/317072 Commit-Ready: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Reviewed-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
0def72b968591065f56e88d67e5c83234184811b |
|
16-Dec-2015 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS: iodev_list - add dev_enabled to update active node Originally in CRAS, assume iodev1 and iodev2 both have only one node. Selecting between iodev1 and iodev2 will not trigger the update_active_node callback at all, for both iodev1 and iodev2. This causes a problem that any mixer settings specified for HDMI iodev in UCM config never gets set/unset. Fix this bug by explicitly call update_active_node() when the state of iodev changed. BUG=chromium:364414 TEST=unittest Change-Id: I84d535ced168932f2f91641cc157ef60b9d713d5 Reviewed-on: https://chromium-review.googlesource.com/318612 Commit-Ready: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
192f5007487e47d4b1e3ba9d2df95d11fcd01d4e |
|
08-Sep-2015 |
Vadim Kharchenko <inhandstudio@gmail.com> |
CRAS: audio thread logging macro ATLOG macro enables/disabled audio thread logging BUG=None TEST=None Change-Id: Ia3ced86caade35625b4c4f25a31475b5460be8f1 Reviewed-on: https://chromium-review.googlesource.com/297851 Commit-Ready: Vadim Kharchenko <inhandstudio@gmail.com> Tested-by: Vadim Kharchenko <inhandstudio@gmail.com> Reviewed-by: Dylan Reid <dgreid@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
538e024653d4052dbadddcde55da44c0395c3a42 |
|
01-Sep-2015 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS: a2dp - Use object_path for stable id The address property of bt_device could be NULL at the moment when a2dp iodev is created, and cause crash when calculating the SuperFastHash for stable id. Change to use object_path instead since it's assured non-NULL. BUG=chromium:527003 TEST=emerge-daisy adhd. Connect a2dp headset and play audio. Change-Id: I6f92183e21f6caa11ce61844c45c4fa421f2e6b0 Reviewed-on: https://chromium-review.googlesource.com/296204 Commit-Ready: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Reviewed-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
70c72e44ad8a2a7d8fb51cd668f36d6d8021e422 |
|
20-Aug-2015 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS: a2dp - Make frames_queued more precise Take into account of the encoded samples in a2dp buffer when reporting the total queued frames. This change has two benefits: (1) More accurate frames_queued value, CRAS will fill less data to achieve the same buffer level so the effective output latency can be decreased. (2) Make it less possible to run into the case that CRAS thinks a2dp iodev is about to underrun but a2dp socket is full, causing audio thread to wake up repeatedly. BUG=chromium:514418 TEST=Connect a2dp device, test with YouTube and drum machine app. Change-Id: Icaf132ab15e3fa03ab6127a1b64b0405058b0071 Reviewed-on: https://chromium-review.googlesource.com/294415 Reviewed-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Hsinyu Chao <hy.chao@gmail.com> Tested-by: Hsinyu Chao <hy.chao@gmail.com>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
d313f15b63753cb0324fd424ed6d2b9cac71b098 |
|
20-Aug-2015 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS: a2dp - Drain a2dp buffer after pre-fill done During the zero pre-fill of a2dp iodev, dummy audio data are encoded into the a2dp buffer until -EAGAIN err code is received. However the last chunk of zero frames will be left in a2dp buffer unwritten, this doesn't help with the original purpose of pre-filling a2dp socket and only cause extra output delay. This change drains the a2dp buffer at the end of pre-fill, which decreases the output delay by around 1K frames. BUG=chrome-os-partner:36757 TEST=Connect a2dp headset, test YouTube and drum machine app Change-Id: If2c2d50e6d3c6a8a4d6749b531766fb993a6a39b Reviewed-on: https://chromium-review.googlesource.com/294671 Reviewed-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Hsinyu Chao <hy.chao@gmail.com> Tested-by: Hsinyu Chao <hy.chao@gmail.com>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
56e4dce193b9e6de95acd59cc715d9d8aaa79761 |
|
19-Aug-2015 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS: a2dp - Remove uneccessary zero frames For a2dp iodev we fill zeros until socket write returns -EAGAIN during the first put_buffer call to make sure there's full of data before we actually start to send samples. The zero frames pre-filled are sufficient to prevent glitch sound, so there's no need to pad additional zero frames in PCM buffer. Removes the code incrementing PCM buffer wirte pointer so we can reduce the output latency some more. BUG=chrome-os-partner:36757 TEST=Connect A2DP headset, test with YouTube. Change-Id: I2b83d94f0f56611fb08a8de851e947b231f9c292 Reviewed-on: https://chromium-review.googlesource.com/294450 Reviewed-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
85137d0c83307ebbfa890e8a64446de5957fbbbc |
|
11-Aug-2015 |
Chinyue Chen <chinyue@chromium.org> |
CRAS: iodev - Add stable device ID. The stable device ID is an additional info for devices and does not change due to plug/unplug. The stable device ID is constructed from the device name plus * card index and device index for internal devices * VID and PID for USB devices * MAC address for Bluetooth devices BUG=chromium:466768 TEST=Verified on peppy with "cras_test_client --dump_s" Change-Id: Ib615dd4bf5db3cc9383c758b8bf435fe947f3a18 Reviewed-on: https://chromium-review.googlesource.com/292326 Reviewed-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Chinyue Chen <chinyue@chromium.org> Tested-by: Chinyue Chen <chinyue@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
c1cd9fc1dfc9e00240ad28571fbae2adea36c628 |
|
06-Aug-2015 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS: a2dp - Use socket depth in frames We configure a2dp socket depth to twice of write mtu, in bytes. For a2dp iodev, its min_buffer_level should be of the same level in frames. BUG=chrome-os-partner:36757 TEST=Connect a2dp headset, open YouTube. Use 'cras_test_client --dump_a' to check nim_buffer_level. Change-Id: I002e94ad3f67ef1895fb3d5f71d0a187f518b412 Reviewed-on: https://chromium-review.googlesource.com/291561 Tested-by: Hsinyu Chao <hychao@chromium.org> Reviewed-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
3f787ac37a53be6b3a065ee5d1a47427fae78100 |
|
25-Jun-2015 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS: audio_thread - Flush input buffer when 1st stream added In multiple input devices use case, two mics are opened sequentially before the first input stream attaches to read input buffers. If one of the device open call takes too long it would cause large buffer difference between input devs and cause echo. To fix this problem, flush the input buffer to discard all the buffer already captured when the first input stream is added. BUG=chromium:460515 TEST=Manual test audio record on two Jabra speakerphones. Change-Id: I78fbc719b2827ef5b05612c01df8b2fce40041c3 Reviewed-on: https://chromium-review.googlesource.com/281890 Reviewed-by: Dylan Reid <dgreid@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
bb28140f38fdf6627ec26696c943dfa4f9188450 |
|
18-May-2015 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS: iodev_list - Remove selected input/ouput This change removes the selected input/output node from server state, since now we allow multiple nodes be enalbed using extension API and it makes less sense to store the Chrome UI selected node. Note that the selected input/ouput nodes were looked up when calling update_active_node() to select different nodes on an iodev. This is changed to pass in the node index to the callback. BUG=None TEST=Plug headphone jack, select between headphone and speaker on UI, unplug headphone jack. Do the same test for mic jack and internal mic, verify everthing works as it should be. Change-Id: I5600ee775980e5bec4b314e259391da810368873 Reviewed-on: https://chromium-review.googlesource.com/272343 Reviewed-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
6fa2060737ffe7bd0364cce87bd60861222a174f |
|
22-Apr-2015 |
Chinyue Chen <chinyue@chromium.org> |
CRAS: util - Helper function to calculate frames since time. BUG=None TEST=cros_run_unit_tests --board=peppy --packages="adhd" Change-Id: I781501ed959f797b990b5f233e04c4a8bf96daa4 Reviewed-on: https://chromium-review.googlesource.com/266798 Reviewed-by: Chinyue Chen <chinyue@chromium.org> Tested-by: Chinyue Chen <chinyue@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Chinyue Chen <chinyue@chromium.org> Trybot-Ready: Chinyue Chen <chinyue@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
2509f106abb44aa2f0dca35a28c47cce8459da5d |
|
17-Apr-2015 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS: A2DP - Better handle a2dp write err The socket to pass a2dp message from audio thread to main thread could get full and the write call would block. Plus that main thread does the job to remove streams from iodev, and wait for reply from audio thread to make sure the operation is synchronous. There could be a case two threads get blocked on each other and cause CRAS to hang forever. Fix that by making the socket nonblocking and pass a2dp error code correctly so it can be handled as soon as possible. BUG=chromium:477984 TEST=Test a2dp headset, close and open stream, disconnect and connect headset again, suspend and then resume system, verify CRAS does not hang in these operations. Change-Id: I77586051d4a93bdc540d4c437cab27b5c246883e Reviewed-on: https://chromium-review.googlesource.com/266480 Reviewed-by: Dylan Reid <dgreid@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
cd23b811ccefce5cd01335c3a2c98a443bc14024 |
|
04-Mar-2015 |
Dylan Reid <dgreid@chromium.org> |
CRAS: Use CLOCK_MONOTONIC_RAW for time calculations The raw variant of the monotonic clock isn't affected by adjustments from NTP or adjtime. BUG=chromium:463756 TEST=audio still works Change-Id: I4f46c01b6887ae921f2191a9409fb3f8ae40cfd7 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/256150 Reviewed-by: Chinyue Chen <chinyue@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
08a60dcbe8a2c2f20146bab0b281c1de85bc68cc |
|
26-Feb-2015 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS: bt_device - Create bt_device when transport/profile connected Now that we store pointers in bt_device for associated a2dp and hfp iodevs, it's required to have the bt_device object exists before a2dp/hfp iodevs are enumerated. Originally CRAS creates bt_devices only when receiving notifications from bluez, but in some rare cases CRAS could receive a2dp/hfp connection earlier than that and cause problem. One guess to the scenario is a headset auto-conencts right at when device booted. This change fixes this issue by creating the bt_device if it doesn't yet exist when a2dp/hfp iodev are about to be enumerated, plus adding some error message to log these cases. Note that some of the device properties still relies on notification from bluez to be populated, for example device readable name and adapter info, a few checks are added for that. BUG=chromium:462143 TEST=unittest. It's difficult to replicate the crash, so just manually verify a2dp and hfp can work. Change-Id: I14c01fb73c3e86700c0e97faaf920cade205d16e Reviewed-on: https://chromium-review.googlesource.com/254040 Reviewed-by: Dylan Reid <dgreid@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
ddecc26b70fc359d2100c2e3e742c464b6c38226 |
|
24-Nov-2014 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS: a2dp hfp - use API to append iodev to cras_bt_device After this change, A2DP and HFP iodev will be added to a common virtual bt iodev so the profile switching will take effect. BUG=chromium:432434 TEST=Enable HFP, connect to headset which supports A2DP and HFP. 1. Play YouTube, verify it's on A2DP 2. Open AudioVisualizer(using audio input and output), verify it switches to HFP. 3. Close AudioVisualizer, verify it switches back to A2DP Change-Id: I803497942242c43f2fa2af547e906a36dcb9a2fa Reviewed-on: https://chromium-review.googlesource.com/231873 Reviewed-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
a485ac04bdfc71e374a3a5d2fbcf4699999a2939 |
|
25-Nov-2014 |
Dylan Reid <dgreid@chromium.org> |
CRAS: Allow 24 and 32 bit samples to alsa devices Some USB DACs only support 24 or 32 bit samples. Start to support this by adding checks for S24_LE and S32_LE formats. BUG=chromium:219948 TEST=updated unittests Change-Id: Ibedd27182471947741e6f62007574fb49b455e56 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/232081 Reviewed-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
a854651b825010352a05f55e720e29bdca6fb1ba |
|
01-Oct-2014 |
Dylan Reid <dgreid@chromium.org> |
CRAS: iodev - Change free_dsp into free_resources Change the name of cras_iodev_free_dsp to cras_iodev_free_resources. This will allow for freeing of another object that will be added in later changes. BUG=chromium:420589 TEST=None Change-Id: Ie69179dbd951b62efa498c340daf5ef2ddaf308a Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/221702 Reviewed-by: Chinyue Chen <chinyue@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
5342a08d8e1f5c3c6205e7c6d2d40ab47280f3a3 |
|
12-Aug-2014 |
Cheng-Yi Chiang <cychiang@chromium.org> |
CRAS: cras_iodev - Remove software_volume_scaler in cras_iodev Removes software_volume_scaler in cras_iodev. The scaler will be looked up when audio thread writes data to buffer in possibly_fill_audio. By doing this we do not need to worry which the active node is when the software_volume_scaler is set. The scaler will be determined by system volume, active node volume and software_volume_needed flag. BUG=chrome-os-partner:31101 TEST=make check TEST=On nyan_big, connect to HDMI. Change volume to around 20%. Reboot. Listen to HDMI audio and check volume is around 20%. Change-Id: Idf2c414e87f9271cc7d46dd145d69774aa87391b Reviewed-on: https://chromium-review.googlesource.com/212002 Reviewed-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Cheng-Yi Chiang <cychiang@chromium.org> Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
95bb35a0c39e45ff54983eedd61eb4c07d4ffad7 |
|
06-Jul-2014 |
Dylan Reid <dgreid@chromium.org> |
CRAS: a2dp_io - Better pre-filling of a2dp socket. Pre fill the a2dp socket until it returns EAGAIN. Only then do we set the start time for the frames_consumed estimation. BUG=chromium:244615 TEST=play youttube and web audio drum machine on jambox Change-Id: Iac68a194790d5fdc0ffe3473f053109b0d8e4470 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/206619 Reviewed-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
69bbf53c04776e80583e8d8e66edf7df261a882d |
|
02-Jul-2014 |
Dylan Reid <dgreid@chromium.org> |
CRAS: a2dp_io - set min_buffer_level for a2dp iodev Set a minimum buffer level for a2dp devices. This is needed because of how bursty the devices are, often requesting audio in chunks of > 50ms. The min_buffer level will guarantee there is audio ready when the burst is needed. BUG=chromium:244615 TEST=play youtube and drum machine to jambox overnight. Change-Id: I949180fa96b41781fcb43636f0138065bc8c3657 Reviewed-on: https://chromium-review.googlesource.com/206618 Reviewed-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Dylan Reid <dgreid@chromium.org> Tested-by: Dylan Reid <dgreid@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
b332ff7a4460cd5ab90f34fe56a1612ac4e19b35 |
|
06-Jul-2014 |
Dylan Reid <dgreid@chromium.org> |
CRAS: a2dp_io - Limit frames_queued. Make sure not to report that fewer frames are queued than are actually present. Reporting less here will tell audio_thread to fill (size - frames_queued) which is a problem if there isn't room. BUG=chromium:244615 TEST=youtube and drum machine to jambox. Change-Id: I922868eb30d67159b0cd3bce6c880d8d3f1fb70d Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/206617 Reviewed-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
433639d2a30c4a7e5cee97518426c7a3d2196dd4 |
|
02-Jul-2014 |
Dylan Reid <dgreid@chromium.org> |
CRAS: a2dp_io - Increase a2cp pcm buffer size to 16k frames Give more space for pcm samples to accumulate in the iodev. This larger buffer will allow for the min_buffer_level to be set higher and for there to be more samples available to cover bursty requests from bluetooth speakers. BUG=chromium:244615 TEST=play audio to jambox. Change-Id: I46aa2c8cdcb4f689acb6bee3369f8e4b51b965bc Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/206616 Reviewed-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
338d9ce0133769189aab3b7c0b58a8f2f5da560d |
|
01-Jul-2014 |
Dylan Reid <dgreid@chromium.org> |
CRAS: a2dp_io - Log mtu size at startup. Add the mtu size to the print when opening an A2DP iodev. BUG=chromium:244615 TEST=none Change-Id: Id5af344cc02f9d2bfeb19a10c1c3c9c29fff78dd Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/206264 Reviewed-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
c9452136e619b69333dc3bd5fb87e5168793c9c0 |
|
01-Jul-2014 |
Dylan Reid <dgreid@chromium.org> |
CRAS: a2dp_io - Log encode and write to audio thread log. Use the audio thread log to track when samples are encoded and when data is written to a2dp. BUG=none TEST=cras_test_client --dump_a Change-Id: I0f298017c18c00bf2e37aa7278dad5a2ffce5620 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/206262
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
e5c801e32174b718f7e36ba07d67753af71f2e76 |
|
26-Jun-2014 |
Dylan Reid <dgreid@chromium.org> |
CRAS: a2dp_io - Set socket depth based on MTU size. Setting this depth will allow the socket to be filled and writes to be throttled at a reasonable level. The default depth ends up being almost four seconds of audio which caused unreasonable latency. Account for the extra two MTUs of data in the delay calculation as well. BUG=chromium:244615 TEST=play A/V sync test on youtube. Change-Id: Ie0d79743977340a5fb365432f67a857b32551a15 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/206261
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
77fb304248eb69a39c0d087b2a6ab91d49d5d498 |
|
01-Jul-2014 |
Dylan Reid <dgreid@chromium.org> |
CRAS: a2dp_io - drive socket writes from fd poll Instead of writing to the A2DP socket based on a timer, write until it is full. Add the stream file descriptor to the select list in the audio thread. This will call back to write when the fd is writeable. BUG=chromium:244615 TEST=play audio to the jambox. Change-Id: I50e9e995a4f035d32a6934d6b23af2425c9dba19 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/206260 Reviewed-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
27089cd9e476fff3c1d82622f17a23a80da0fd51 |
|
30-Jun-2014 |
Dylan Reid <dgreid@chromium.org> |
CRAS: a2dp_io - Break up encode and write. Breaking up encode and write will make managing the amount of data that is queued easier. BUG=chromium:244615 TEST=play audio to jambox. Change-Id: Iaa0105a2a55520f92d477b7fca823947db6a8f19 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/206258 Reviewed-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
22443156a7c1fd2eb3e9053c5465cfafe0c36605 |
|
26-Jun-2014 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS: ionode: Clean up unused 'priority' field CRAS used to have audio device auto selection, which relies on a priority assigned to each node. Now the selection logic moved to Chrome and Chrome is using device type and plugged time to choose device instead. BUG=None TEST=plug and unplug mic jack to see device selection works as expected. Change-Id: If60e7a9967678ee87bafc782570edce32c7fe9f5 Reviewed-on: https://chromium-review.googlesource.com/205745 Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
0795e6372be99bf130ccab820777a16ae76cb8f9 |
|
30-Jun-2014 |
Dylan Reid <dgreid@chromium.org> |
CRAS: a2dp_io - Handle ENOSPC error from SBC encoder. If there isn't any space to encode samples then the SBC codec will return -ENOSPC. Handle that explicitly when encoding samples. BUG=chromium:244625 TEST=play bluetooth audio to jambox. Change-Id: If9e4fd44d5852580406e4810483893972b5530f2 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/206257 Reviewed-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
01d37ad909523378f12ecf939419829134aec32f |
|
21-Jun-2014 |
Dylan Reid <dgreid@chromium.org> |
CRAS: a2dp_io - Write as much of the buffer as possible. Loop in flush_data to write as much of the pcm buffer as possible. This will make de-coupling the pcm and a2dp buffer levels easier. Change-Id: I3a546a343d390e5defa1988e0b2cff55d94be575 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/206255 Reviewed-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
3d316d343d4e80012d2c7d6c5e7e183533e8d7d5 |
|
21-Jun-2014 |
Dylan Reid <dgreid@chromium.org> |
CRAS: a2dp_io - Use the new byte buffer for the pcm buffer. The pcm buffer will work as a circular buffer, use the new one. This change will make separating the timing of bt socket and the stream's client easier in a later change. BUG=chromium:244615 TEST=play audio to jambox Change-Id: Ibdae989b6f3cb10c8803e423bf31618ca1eef2f0 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/206254 Reviewed-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
cc32f2cfb655c1c2a39a1db448415583f8ecc2d0 |
|
09-Jun-2014 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS: iodev: Use cras_audio_area for get/put buffer Use cras_audio_area in get/put buffer interface to replace current uint8_t pointer. This will make copying channels from different source easier in a later change. BUG=chromium:370368 TEST=emerge adhd. Capture audio and play youtube to verify nothing breaks. Change-Id: I9d532da180bbfe464fc2a174788fef7ddca357b4 Reviewed-on: https://chromium-review.googlesource.com/203053 Reviewed-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
9690a3281b7167e5a38368fd8db39375bea8a1f8 |
|
12-Jun-2014 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS: iodev: add cras_audio_area pointer to iodev Add a pointer to cras_audio_area in cras_iodev, and alloc/free it at open/close callback. The audio area will be used to replace uint8_t pointer in get/put buffer in later changes. BUG=chromium:370368 TEST=emerge adhd. Capture and playback youtube to verify nothing breaks. Change-Id: I8b7d7e577c15eeea6a07cfc522666b7e08563f80 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/203611 Reviewed-by: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
97d900eef92b8c5db6e98072bb7bfe7899edc79b |
|
21-Apr-2014 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS: A2DP: Handle ENOTCONN error when writing audio We're seeing an error that ENOTCONN returned at writing audio indicating that the transport endpoint is not connected anymore, but bluez didn't notify CRAS to suspend or reconnect in this case to recover from this error state. Moving headset far away from Chrome OS device is a way to reproduce it on some platform. Currently when this issue happens, user will get no audio from BT headset, and system will be spammed by error log from unified_io(). To handle this error, add the mechanism to tell main thread to force suspend the a2dp iodev, user will see their headset gets 'unplugged' and then reconenct by themself. BUG=chrome-os-partner:27450 TEST=Add code to fake the ENOTCONN error in cras_a2dp_iodev. Verify when the fake err happens, a2dp device is removed from UI and audio gets transfers to internal speaker. Change-Id: I4c01619fe7f6dd4fb2cfa187a3f4a32a58b62f20 Reviewed-on: https://chromium-review.googlesource.com/195815 Reviewed-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
2c1e4a94b93ea1ca23ae1ab177a80ad769a7c18a |
|
17-Apr-2014 |
Dylan Reid <dgreid@chromium.org> |
CRAS: Use MIN and MAX from glibc instead of local macros. Replace all instances of min and max with the version from glibc. This prevents name collision with std::min and std::max when chrome uses libcras. BUG=chromium:364382 TEST=still builds and runs. Change-Id: Iafc200fb0de82bbfbe105551250207392cb2f42a Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/195451 Reviewed-by: Hsinyu Chao <hychao@chromium.org> Reviewed-by: Chih-Chung Chang <chihchung@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
ddc7209d6c1e4e93bbb2841b08838c465e012d19 |
|
17-Apr-2014 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS: A2DP: Silent the err log at EAGAIN Remove the log when a2dp write got error code EAGAIN. The log is not that useful anymore to help debug BT audio problem, but could spam syslog and cause system unbootable. BUG=chromium:363466 TEST=None Change-Id: I19810aa649a5d86d30244d3197e026f28da5287a Reviewed-on: https://chromium-review.googlesource.com/195373 Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
15e137c3cc39fafffc303b5612de7a4de7a27982 |
|
12-Sep-2013 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS a2dp: Don't get more then requested buffer In some cases, we got EAGAIN when write audio to a2dp socket, and that could happen due to sending samples too fast. Before this change, a2dp iodev could tell audio_thread to put more buffer then what was requested. Which will cause more samples written then what was expected to be written in one 2dp socket, and that could happen due to sending samples too fast. regular period. BUG=chromium:244615 TEST=None Change-Id: Id15ecec3cddfc544f8d30587752025331ef4c254 Reviewed-on: https://chromium-review.googlesource.com/169088 Reviewed-by: Chih-Chung Chang <chihchung@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
76d8edeed8b883d910965587549c59a766d251e6 |
|
11-Sep-2013 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS a2dp: Tweak a2dp iodev buf number In some cases, we got EAGAIN when write audio to a2dp socket, and that could happen due to sending too many frames then the buffer limit at BT headset side. We cannot query how many frames could queued at BT headset side. To prevent sending too much then it could accepts, set buffer size to just one MTU size before encode. BUG=chromium:244615 TEST=None Change-Id: I88a909a9a3b026a3d9040bb056564c25f8011e29 Reviewed-on: https://chromium-review.googlesource.com/169087 Reviewed-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
9f02b64519595d12ec2346ea699c9507b01437c9 |
|
03-Sep-2013 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS a2dp: Fix audio dropout for some headset There is missing precision when estimating the virtual buffer of remote device. When incrementally calculate the queued buffer between callbacks, the missing small amout of frames summed up and altered the frame rate a bit and cause audio dropout. The fix is to record the start time when device opened, maintain the number of all written frames since then, and calculate the queued frames from these info in each callback. BUG=chromium:265940 TEST=Manual test with Sennheiser 500-X, hear no glitch at all. Change-Id: I92e6a22e56556f31b0f9fc27011f24b9212dade3 Reviewed-on: https://chromium-review.googlesource.com/167850 Reviewed-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
fda3f9ebf4ef7e1f1acda509d382ed7bd3c48f68 |
|
01-Aug-2013 |
Adrian Li <alhli@chromium.org> |
CRAS: Separate software volume scaling from controls. This makes software volume scaling independent of the control thread. A single float value is stored by the audio thread which (if required) is used to scale audio samples in write_streams. The three situations in which the software volume needs to be set include: 1. System volume changes 2. Node volume changes 3. Stream opens for the first time BUG=chromium:264890 TEST=Ran unit tests, all tests pass. Change-Id: I975665e701c751eaf55820747938178e42245d15 Reviewed-on: https://gerrit.chromium.org/gerrit/64821 Reviewed-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Adrian Li <alhli@chromium.org> Reviewed-by: Adrian Li <alhli@chromium.org> Tested-by: Adrian Li <alhli@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
cb662443cb58291cb7c951e1bf12bea86a23d876 |
|
29-Jul-2013 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS: Modify dev_running callback Modify the logic of dev_running() to: Return 1 when device is still running (playback or capture), return 0 if not. Also modify audio_thread who calls dev_running and interprets the return code. BUG=None TEST=None Change-Id: I642e5e51d90e0b394c6fb25f77d92ed031e296ff Reviewed-on: https://gerrit.chromium.org/gerrit/63601 Reviewed-by: Chih-Chung Chang <chihchung@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
85cc54d7c2bf9a24abbc5518297bf5aacd91c47b |
|
26-Jul-2013 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS A2DP: Properly handle a2dp_write error When the a2dp connection is closed, should propagate the error so that a2dp iodev will be closed. Before this change, there is a potential bug that the a2dp iodev can keep running even the connection is closed for whatever reason. However this bug never get noticed because the iodev itself always get closed immediately when bluez sends 'ClearConfiguration' message. BUG=chromium:264336 TEST=Manually add sleep(20); to the cras_a2dp_suspend() callback. Connect a2dp device, open youtube to make audio playing, disconnect a2dp device from UI in chrome://settings/bluetooth. Before this change, a2dp device can run without problem(but no audio actually heard) for 20 seconds; after this change applied, a2dp device will be closed right after device disconnected. Change-Id: Ifd7c6f22964774277968125e4d53330779efa212 Reviewed-on: https://gerrit.chromium.org/gerrit/63467 Reviewed-by: Chih-Chung Chang <chihchung@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
dd2f666a53a1090744819bf38cd672b4548aca22 |
|
25-Jul-2013 |
Hsin-Yu Chao <hychao@chromium.org> |
CRAS A2DP: Use a2dp device's human readable name Whenever it's available use device readable name instead of address as cras iodev's name. Fixed a bug when update transport property, that the 'Device' field should be parsed as object path. BUG=chromium:264336 TEST=Connect bluetooth device. Chrome UI should display readable name in device list now. Change-Id: Ic885d5f8b57543b3a602fc871ae6b261f75368a6 Reviewed-on: https://gerrit.chromium.org/gerrit/63451 Reviewed-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
b7fb7aad1bb54683361c3beda234e01bcf455bec |
|
21-May-2013 |
Dylan Reid <dgreid@chromium.org> |
CRAS: Allow per-node volume/capture gain. Allow the volume to be set per node. This will make Chrome's life easier when setting volume levels as it already saves the volume per device. BUG=chromium:238410 TEST=updated unit test and set volume with test client. Signed-off-by: Dylan Reid <dgreid@chromium.org> Change-Id: Ida3a51d9195211bd4785c0d789af614db0edb0b9 Reviewed-on: https://gerrit.chromium.org/gerrit/55860 Reviewed-by: Chih-Chung Chang <chihchung@chromium.org>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
0b48706599ecf6372671a544ab6e3e85f5c81657 |
|
09-May-2013 |
Hsin-Yu Chao <hychao@chromium.org> |
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>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
cc6d9b913cf7e16db85d55d2adf90e4077ffab76 |
|
03-May-2013 |
Hsin-Yu Chao <hychao@chromium.org> |
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>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
a7892d9129d4cdb25dbd099aa2f5295bd53120df |
|
26-Apr-2013 |
Hsin-Yu Chao <hychao@chromium.org> |
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>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
0fc4865c82dd7a07d978c598ec7f2d108a8a3279 |
|
24-Apr-2013 |
Hsin-Yu Chao <hychao@chromium.org> |
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>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
639a342fcc14cf262e11612220079aff45f40ad5 |
|
22-Apr-2013 |
Dylan Reid <dgreid@chromium.org> |
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>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
71aa1de70c395c3648ede3eec5838ac7c64646d5 |
|
02-Apr-2013 |
Chih-Chung Chang <chihchung@chromium.org> |
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>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
f3df2ca6f9d8180969c00ec48f37b717069c8811 |
|
04-Feb-2013 |
Hsin-Yu Chao <hychao@chromium.org> |
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>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
38cc0db5a86cfc6145df903e87e866d6221407ff |
|
30-Jan-2013 |
Hsin-Yu Chao <hychao@chromium.org> |
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>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
6f71f72193bbda4d9468b579a9a3a156fe61ecdb |
|
23-Feb-2013 |
Hsin-Yu Chao <hychao@chromium.org> |
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>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
1cbde1fb3f2aad5494f33d49dacaeafebc753ac2 |
|
08-Jan-2013 |
Hsin-Yu Chao <hychao@chromium.org> |
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>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|
31635aee19f32c75657411865c4d3a4abec9dc56 |
|
08-Jan-2013 |
Hsin-Yu Chao <hychao@chromium.org> |
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>
/external/adhd/cras/src/server/cras_a2dp_iodev.c
|