summaryrefslogtreecommitdiff
path: root/cras/src/tests/audio_thread_unittest.cc
AgeCommit message (Collapse)Author
2014-12-10CRAS: iodev - Move rm stream task into iodevHsin-Yu Chao
This refactors the remove stream task to make code cleaner at places where we need to remove single stream from an active device when error occurs. BUG=chromium:438998 TEST=None Change-Id: Idda810a36bc83612f1796e3710708586af557050 Reviewed-on: https://chromium-review.googlesource.com/234075 Reviewed-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Dylan Reid <dgreid@chromium.org> Tested-by: Dylan Reid <dgreid@chromium.org>
2014-12-03CRAS: audio_thread - Keep active streams on fallback device.Chinyue Chen
Have fallback device also keep active streams. This simplifies logic when adding/removing devices and looking-up streams. BUG=None TEST=Remove/Add active device while playing Youtube videos on peppy. Change-Id: I573057c646e96f9983c7ee1805ca0ae38eea3f57 Reviewed-on: https://chromium-review.googlesource.com/231644 Commit-Queue: Chinyue Chen <chinyue@chromium.org> Tested-by: Chinyue Chen <chinyue@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>
2014-11-27CRAS: dev_stream - Mix proper format.Dylan Reid
Mix the format that matches the device. This adds a format parameter to dev_stream_mix so the correct format can be used when mixing. BUG=chromium:219948 TEST=play through USB DAC that supports 32 bit samples only. Change-Id: I21863395b5c07284a95fdb93dcfbb7045d223aa6 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/232085 Reviewed-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org>
2014-11-26CRAS: audio_thread UT - Remove more unused functions.Dylan Reid
These has been moved to iodev. BUG=none TEST=this is a test. Change-Id: I3b463ffe413b664a152b6fd3a845cbe4812a740d Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/231713 Reviewed-by: Hsinyu Chao <hychao@chromium.org>
2014-11-26CRAS: Add external format to iodev.Dylan Reid
This changes iodev to track the format visible to the audio thread separately from the format the hardware is actually configured to. This will allow for a DSP module top change the format for use cases such as beam forming. BUG=none TEST=none Change-Id: Iee1652976c695ecd06030df013a8723ac74f8e77 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/231574 Reviewed-by: Hsinyu Chao <hychao@chromium.org>
2014-11-26CRAS: remove DSP stubs from audio_thread UTDylan Reid
The DSP code has been moved to iodev, not needed in the audio thread unit test. BUG=none TEST=none Change-Id: I9757371cdad50d279d3cc02d0c05ffcee8a1a1f2 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/231573 Reviewed-by: Hsinyu Chao <hychao@chromium.org>
2014-11-26CRAS: Allow DSP pipeline to change number of channels.Dylan Reid
Some new input processing, such as beamforming will reduce the number of input channels. Change the DSP pipeline to support this. BUG=none TEST=play/record audio on Panther. Change-Id: I22b7f76aeb29ee314a2ca988336170434ef52ae1 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/231572 Reviewed-by: Hsinyu Chao <hychao@chromium.org>
2014-11-26CRAS: Move get_dsp_delay to cras_iodev.cDylan Reid
This will allow the audio_thread to be free of direct dsp access. BUG=none TEST=play audio on panther and samus Change-Id: I47cd7ff5cff9038e570d9906c23ae363a6689212 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/231571 Reviewed-by: Hsinyu Chao <hychao@chromium.org>
2014-11-26CRAS: iodev - add buffer pointer to put bufferDylan Reid
Passing the buffer pointer back to iodev will allow the DSP application to be moved here. BUG=none TEST=play/record audio on Panther and Samus Change-Id: I69f5b6894e364bc89e06444e79bc016f0b722e2d Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/231569 Reviewed-by: Hsinyu Chao <hychao@chromium.org>
2014-11-24CRAS: audio_thread_unittest - testing stream and device manipulation.Chinyue Chen
This testing suite verifies the basic handling of adding and removing streams on multiple devices. This is a base for adding tests for pinned-streams API. BUG=None TEST=make && make check Change-Id: I4aa311536911533237478ff63d6935377a254588 Reviewed-on: https://chromium-review.googlesource.com/229742 Reviewed-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Chinyue Chen <chinyue@chromium.org> Tested-by: Chinyue Chen <chinyue@chromium.org>
2014-09-27CRAS: audio_thread - Foundations of new timing.Dylan Reid
This change removes a lot of cruft that will no longer be needed by the new timing system. No longer does the audio thread wait for playback streams to reply, it now wakes back up when they do. This will free up the audio thread to handle other devices and streams while waiting. Change-Id: Icb7ab398463c45d853dce6efcaf99526f8ae3f49 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/219952
2014-09-27CRAS: audio_thread - Prefill shm for output streams.Dylan Reid
Instead of dumping zeros into the output device, mark a buffer as ready in the shared memory region. This way it works for streams that aren't the first ones added to a device. Change-Id: I103858a54f588e62cff1116087df09fcfa74e7ac Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/218379 Reviewed-by: Hsinyu Chao <hychao@chromium.org>
2014-09-19CRAS: Move rstream request to dev_stream.Dylan Reid
Move requesting playback samples to a function in dev_stream. This removes one more dependency on rstream from audio_thread and will make a good place to update stream-specific timers in a future change. Change-Id: I3ccf49b17135ab44050be7cecc132021d2ead2c5 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/217533
2014-09-19CRAS: audio_thread - pre-fill the odev when opening it.Dylan Reid
Filling the odev with one cb_threshold of data will prevent the client from seeing two quick requests when adding the first stream. BUG=none TEST=unittest and play audio on Yoshi. Change-Id: Id98aaaf18164e684ba07185f9ae11e9264a219c0 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/217491 Reviewed-by: Hsinyu Chao <hychao@chromium.org>
2014-09-19CRAS: Only set dev format from the audio thread.Dylan Reid
Since the format converter now lives in the audio thread, there is no need to update the format of the rstream based on the device format. Now set the device format when adding the first stream in the audio thread. BUG=none TEST=unittest, plus play and record audio with multiple test clients. Change-Id: I7288529e73a27b78a60c9076442577018e4aa47e Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/217174 Reviewed-by: Hsinyu Chao <hychao@chromium.org>
2014-09-19CRAS: Account for SRC when reporting delay.Dylan Reid
The delay reported by the device need to go through sample rate conversion to the remote sample rate before being reported to the client. Change-Id: I2e9b9d5f8b0dfedf5a14a99bc946053fccecaaa6 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/217180 Reviewed-by: Hsinyu Chao <hychao@chromium.org> Reviewed-by: Chinyue Chen <chinyue@chromium.org>
2014-09-19CRAS: move timestamp setting to dev_streamDylan Reid
This ins't really related to iodev, move it to devstream. Change-Id: I8683eeba2b765ca59b5a8370d5927138158ede0b Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/217179 Reviewed-by: Hsinyu Chao <hychao@chromium.org>
2014-09-19CRAS: Implement format conversion for the capture path.Dylan Reid
Add format conversion for capture samples on the server side. Change-Id: I056b5ae4362ded6e2be1cebbc4cef8ab3ed80ac0 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/217178
2014-09-19CRAS: audio_thread - Use helper to check capture frames.Dylan Reid
Add a new helper to dev_stream that returns how many frames are writable in the stream for capture samples. This will be useful in later commits as sample rate conversion can make determining this non-trivial. Change-Id: I060a349021e0fcde269133dd7c5e51569cafbd62 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/217173 Reviewed-by: Chinyue Chen <chinyue@chromium.org>
2014-09-19CRAS: audio_thread - Handle dev_stream with a format converter.Dylan Reid
If a dev_stream has a format converter, update the amount of frames available and use the format converter when rendering samples. BUG=none TEST=none, not used yet. Change-Id: Id1929b1cf8677a57852c4a873c19373bda3303a4 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/217159 Reviewed-by: Hsinyu Chao <hychao@chromium.org>
2014-09-18CRAS: mix - Clean up unused function declarationHsin-Yu Chao
Remove cras_mix_add_stream declaration and rename the related variables in unittest. BUG=None TEST=make check Change-Id: I4d79c893d2ef8c129b3887ad8612cf642cb0a628 Reviewed-on: https://chromium-review.googlesource.com/217739 Reviewed-by: Chinyue Chen <chinyue@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org>
2014-09-17CRAS: audio_thread - set format to active device when append streamHsin-Yu Chao
The format of additional active devices stays NULL until it's initialized. Since now dev_stream is introduced, we need to have device's format set earlier in append_stream_to_dev() to configure the format converter when a stream is appended. Also changes the unittest to reflect the change. BUG=None TEST=unittest. Activate keyboard mic on Pixel then capture a stream won't crash. Change-Id: I45fde87f1c9bca182bb1bec2fdfaf9feda14e4dd Reviewed-on: https://chromium-review.googlesource.com/218097 Reviewed-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Dylan Reid <dgreid@chromium.org> Tested-by: Dylan Reid <dgreid@chromium.org>
2014-09-12CRAS: dev_stream - Add format rate converter.Dylan Reid
Add a format rate converted to dev stream. This adds an argument to the constructor indicating the format of the device the stream will play on. If this format doesn't match the stream a sample rate converter will be created. A later change will modify audio_thread and rclient to use this functionality. For now rclient ensures that the formats match. BUG=none TEST=new unittest, the code doesn't run yet. Change-Id: Id71e593cbed05abc1771e5232c0e181f862053f4 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/217158
2014-09-12CRAS: move stream mixing to dev_stream.Dylan Reid
Move the shm interaction and some decision making to dev_stream as this is a property of the stream. cras_mix no longer needs to know about shm and its unit test is now much cleaner. This paves the way to add sample rate conversion logic to dev_stream in a later commit. BUG=none TEST=make check, play a few simultaneous streams. Change-Id: I5fbb3c670e86393a0c8d3454e29c4bf587a5015c Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/217157 Reviewed-by: Hsinyu Chao <hychao@chromium.org>
2014-09-12CRAS: audio_thread - Factor cras_io_stream to its own file.Dylan Reid
Rename cras_io_stream to dev_stream and move it to its own source file. In later commits this struct will take on additional responsibilities keeping sample rate converters and tracking how much of a stream has been written to each device. BUG=none TEST=make check Change-Id: Ifa19e8f1bb3557ca7c7ff4546ad445729bc3ddfb Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/217156 Reviewed-by: Hsinyu Chao <hychao@chromium.org>
2014-09-12CRAS: audio_thread - Keep list of attached streams per device.Dylan Reid
Instead of keeping a list of attached streams in the audio thread struct, keep a list per device. This will allow for different streams to be routed to different or multiple devices in later commits. Change-Id: I7d3d8437c96f3496375864575c36dab0b7c45c81 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/217152
2014-08-23CRAS: unittest - Test write two streams with one emptyHsin-Yu Chao
This commit re-uploads commit c37222, which has been reverted. In possibly_fill_audio there are two cases which we should handle empty output stream differently: 1. When we fetch a stream and it returns zero frames, we should skip and don't mix it. 2. When an empty stream has smaller cb_threshold so hasn't yet meet the condition to fetch it, should just proceed mix it although there's no sample in shm. BUG=None TEST=make check Change-Id: Ibb724da6ced2060d9e83307f1ae76b316afaea51 Reviewed-on: https://chromium-review.googlesource.com/213059 Reviewed-by: Chinyue Chen <chinyue@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org>
2014-08-20Revert "CRAS: unittest - write two streams one empty one full"Hsin-Yu Chao
This reverts commit c3722294fb9d1775839d753e53c563512847d512. This unittest was added to test that when two streams added, should skip mix the empty stream. This turns out wrong and cause problem on two output streams of different cb_threshold, the correct solution is to skip write an empty stream only when it's empty after fetch. Correct unittest will be added in later change. BUG=chromium:404885 TEST=make check Change-Id: I34542cf9c96426719829bd3a12d65eee3b0726b4 Reviewed-on: https://chromium-review.googlesource.com/213043 Reviewed-by: Chinyue Chen <chinyue@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org>
2014-08-15CRAS: unittest - write two streams one empty one fullHsin-Yu Chao
Add test case to cover that when writing two streams, if one stream becomes empty for some reason, it should be skipped and proceed write the streams which have samples. BUG=None TEST=make check Change-Id: If4960b63245cd79940e5e832d94220d9f3deb9a9 Reviewed-on: https://chromium-review.googlesource.com/212289 Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org>
2014-08-14CRAS: cras_iodev - Remove software_volume_scaler in cras_iodevCheng-Yi Chiang
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>
2014-07-25CRAS: audio_thread - Remove draining streams from fetch.Dylan Reid
Remove the function "remove_empty_streams". All streams are already looped through each wakeup in "fetch_and_set_timestamp", remove the empty ones during that loop. This will cause one extra wakeup before the stream is removed after being emptied, but that is worth saving the extra loop and the extra code. This will also help make pending timing changes easier by making sure streams are set to draining before sleep time calculations occur. BUG=none TEST=cras_test_client --playback_file, let go to completion. Change-Id: I328db7bc661a91dd6ab52c83a21f0884ec96d071 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/209276 Reviewed-by: Hsinyu Chao <hychao@chromium.org> Reviewed-by: Owen Lin <owenlin@chromium.org>
2014-07-21CRAS: audio thread - Modify behavior of set_active_iodevHsin-Yu Chao
Before exposing the Add/Remove ActiveInput/Output APIs to Chrome, we need to make each function in CRAS simple enough so Chrome can have full control to manipulate active devices. There was an assumption in CRAS that at the point a new active device is set, the existing active device list is cleared. Now change it to preserve the active device list across set active device calls. Together with later changes to expose the RemoveActiveInput/Output API, we'll let Chrome or other applications do the job to manipulate additional active devices. BUG=chromium:388628 TEST=unittest Change-Id: Ie90fabb4dbdee38f965b029be6f882267721215f Reviewed-on: https://chromium-review.googlesource.com/205395 Reviewed-by: Chih-Chung Chang <chihchung@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org>
2014-07-14CRAS: Remove unified streams.Dylan Reid
These are no longer used by chrome, remove them. Some remnants are left as chrome still uses them, but the stream type is no longer handled. BUG=none TEST=make check, rebuild chome, check sound still works. Change-Id: I9f53bcae6ae924a5cce3d819e37ed7794b1d2da4 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/207739 Reviewed-by: Hsinyu Chao <hychao@chromium.org>
2014-07-14CRAS: audio_thread_ut - Fix audio_area_copy for idx == 0 case.Dylan Reid
Make the stub behave the same as the implementation. This probably should be tested differently now, but fix what we have for now. BUG=none TEST=none Change-Id: Id76797150ee75dce0542b0da4a2dbb3424ef3406 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/207736 Reviewed-by: Hsinyu Chao <hychao@chromium.org>
2014-07-14CRAS: audio_thread_ut - Call audio_thread_create always.Dylan Reid
Just a memset on a region doesn't work now that the audio thread log is allocated from the create funciton. Change-Id: Id3ca65c6f344e580a8d0a8d81f083bffbc91f996 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/207735 Reviewed-by: Hsinyu Chao <hychao@chromium.org>
2014-07-08CRAS: audio area: Move copy function to audio areaHsin-Yu Chao
Unittest added to cover copy area between mono and stereo, and copy to keyboard mic 3-channel layout. BUG=chromium:370368 TEST=unittest Change-Id: Iee4dba491b6290c1647883c868c71ee0154ce93a Reviewed-on: https://chromium-review.googlesource.com/204678 Tested-by: Hsinyu Chao <hychao@chromium.org> Reviewed-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org>
2014-07-03CRAS: audio_thread - Base request size on available space.Dylan Reid
Don't limit the number of frames to request based on the thread's buffer size. This is configured based on the lowest latency stream and can cause trouble for high latency streams playing concurrently with lower latency streams. This will need modification for multiple outputs, where each dev will have to be checked for available space. BUG=none TEST=play audio to USB and A2DP, check for dropouts. Change-Id: I90029632c3bbaad7a9a087a4ba675a76f37a8ab0 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/206450
2014-07-03CRAS: audio_thread - Copy channels separately from capture devs.Dylan Reid
When capturing audio copy each stream separately. This will allow for different channels to come from different devices. However, this is a big slowdown and needs to be accelerated in the common case of one stream and one device with matching channel maps. BUG=chromium:370368 TEST=cras_test_client to test input and output streams. Change-Id: I6458664da454885c36a8617f7199d804852842ea Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/204672 Tested-by: Hsinyu Chao <hychao@chromium.org> Reviewed-by: Hsinyu Chao <hychao@chromium.org>
2014-07-03CRAS: iodev: Use cras_audio_area for get/put bufferHsin-Yu Chao
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>
2014-07-03CRAS: audio_thread - unittest - Check resulting buffer for multi dev.Dylan Reid
This will allow for a future change to remove the use of mix_add_clip while maintaining the test. BUG=none TEST=this is a test. Change-Id: I365e403b0ffa76ceb9426194031e31f048286c25 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/204519 Tested-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org>
2014-07-03CRAS: audio_thread - DSP capture buffer in place.Dylan Reid
Instead of making a copy of the captured samples to DSP them before mixing. DSP them directly in the buffer they are received, then mix them into the stream's buffer. BUG=none TEST=record audio with vocaroo.com Change-Id: Ie3f7d6cad930384c2242ccf0799e561c33aefdc0 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/204518 Tested-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org>
2014-06-07CRAS: Drain the audio data in the hardware buffer.Owen Lin
Ensure the remaining audio is played before closing the device. BUG=chromium:304259 TEST=Run the unittest and chrome on cros device. Change-Id: I7f5b71f11c5b122e02f6c984b9f4661a21b06fe0 Reviewed-on: https://chromium-review.googlesource.com/196463 Reviewed-by: Owen Lin <owenlin@chromium.org> Commit-Queue: Owen Lin <owenlin@chromium.org> Tested-by: Owen Lin <owenlin@chromium.org>
2014-06-05CRAS: Include the source in the audio_thread_unittest.Owen Lin
So that we can keep static function static. BUG=None Test=Run the unittest Change-Id: I4b79401ae3e91df7998cbfb6ad4d4098d827909e Reviewed-on: https://chromium-review.googlesource.com/202473 Reviewed-by: Owen Lin <owenlin@chromium.org> Commit-Queue: Owen Lin <owenlin@chromium.org> Tested-by: Owen Lin <owenlin@chromium.org>
2014-05-23CRAS: audio_thread: Min queued buffer for multiple active input devsHsin-Yu Chao
When multiple input devices run at the same time, use the minimum queued frames across all devices, and then get buffer from all devices by that buffer level. BUG=chromium:360338 TEST=unittest. Plug two USB speaker phones, manually config them as active using dbus API. Execute cras_test_client --capture_file to verify audio is recorded and mixed from two devices. Change-Id: Iabd33b4fc4d1f7a452d982a27d570ebf9725b926 Reviewed-on: https://chromium-review.googlesource.com/196833 Reviewed-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org>
2014-05-23CRAS: audio_thread: DSP before mix when read from multiple inputsHsin-Yu Chao
BUG=chromium:360338 TEST=unittest Change-Id: Iba9776be3640ccdcf01fd52ff7d8fad1006d80d9 Reviewed-on: https://chromium-review.googlesource.com/200050 Reviewed-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org>
2014-05-23CRAS: audio_thread - read from multiple devices.Dylan Reid
When reading from input devices, read from all active devices and mix them together before copying the result to the client's shm. BUG=chromium:360383 TEST=make check, and run some audio on nyan. Change-Id: Ic0e163bfd5f4bd4397b987eeac6c9700ef50c6ac Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/199937 Reviewed-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org>
2014-05-23CRAS: audio_thread: Refactor functionsHsin-Yu Chao
Due to the structure change to support multiple active devices of a direction, refactor some function arguments to use direction instead of pointer to cras_iodev. Note that, future changes will actually remove the use of cras_iodev and replace by stream direction. BUG=chromium:360338 TEST=None Change-Id: I5266469d1c2ccde6cd56d3216c3c9ed77aa35b89 Reviewed-on: https://chromium-review.googlesource.com/198200 Reviewed-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org>
2014-05-23CRAS: iodev: Move cb_threshold, used_size to threadHsin-Yu Chao
When multiple devices are running, they are configured to the same used buffer size and callback threshold. To not duplicate this information in too many places, move these fields from cras_iodev to audio_thread. BUG=chromium:360338 TEST=unittest Change-Id: Iccf0c0413db254596051f6a7de608f91748a1c82 Reviewed-on: https://chromium-review.googlesource.com/199048 Reviewed-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org>
2014-05-23CRAS: audio_thread: Config min latency for all active devicesHsin-Yu Chao
Reconfig all active devices for min latency stream when a stream added and removed. BUG=chromium:360338 TEST=unittest Change-Id: I62f15747c763a48e24e78a17eb64815f8d59e646 Reviewed-on: https://chromium-review.googlesource.com/198179 Reviewed-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org>
2014-05-22CRAS: audio_thread: Open and close multiple active devicesHsin-Yu Chao
When multiple active devices present, open and close them simulteneously. BUG=chromium:360338 TEST=unittest Change-Id: I2493f79227fc99c7a62ced533fd283810d7330bc Reviewed-on: https://chromium-review.googlesource.com/196831 Reviewed-by: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org>