History log of /external/adhd/cras/src/server/cras_loopback_iodev.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
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_loopback_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_loopback_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_loopback_iodev.c
799c76d611d945f314561965fb358eee2943b803 29-Nov-2016 Hsin-Yu Chao <hychao@chromium.org> CRAS: loopbacl_iodev - Fix get_buffer callback

Get buffer should not return frames more than requrested.

BUG=chromium:657510
TEST=cras_test_client --loopback_file /tmp/loopback

Change-Id: Ie789cbff30ede279e63e67f5822c36ab8a8c4dc7
Reviewed-on: https://chromium-review.googlesource.com/414750
Commit-Ready: Hsinyu Chao <hychao@chromium.org>
Tested-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Chinyue Chen <chinyue@chromium.org>
/external/adhd/cras/src/server/cras_loopback_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_loopback_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_loopback_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_loopback_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_loopback_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_loopback_iodev.c
194f243f86bc9147967f65a2fa550d506df7930b 16-Mar-2016 Cheng-Yi Chiang <cychiang@chromium.org> CRAS: iodev - Add fields related to software gain in cras_ionode

Reuse flag software_volume_needed to enable/disable software gain on an input
node.
Use max_software_gain to store maximum software gain.
Only enable this flag for input on ALSA ionode where UCM MaxSoftwareGain is
set.
If there are capture gain controls on this alsa_input_node, their
combined gain will be set to 0dB in set_alsa_capture_gain when software
gain is used.

BUG=chrome-os-partner:50139
TEST=make check

Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Change-Id: Ib6a2ffb5c607220f7539bbbe8c40561d7952689d
Reviewed-on: https://chromium-review.googlesource.com/332915
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Reviewed-by: Ben Zhang <benzh@chromium.org>
/external/adhd/cras/src/server/cras_loopback_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_loopback_iodev.c
10fe628c1fb07d521e21ed5f45ab75fe505b062a 16-Dec-2015 Hsin-Yu Chao <hychao@chromium.org> CRAS: iodev - Add stable id for node

Stable id of iodev isn't enough to distinguish different nodes
on one iodev. Take into account the node name to build stable id
for each node.
This change fixes the issue that Chrome UI messed up preference
of internal speaker and headphone.

BUG=chromium:570570
TEST=dbus-send --system --type=method_call --print-reply \
--dest=org.chromium.cras /org/chromium/cras \
org.chromium.cras.Control.GetNodes | grep -A 2 StableDeviceId
to verify all nodes has different stable id.

Change-Id: I66ea886b9d76152e1adf2bb99aa6d24f2a308cd4
Reviewed-on: https://chromium-review.googlesource.com/318958
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_loopback_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_loopback_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_loopback_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_loopback_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_loopback_iodev.c
179f0470c5c9c34f400136c68403225d0bc8a4c9 06-Apr-2015 Dylan Reid <dgreid@chromium.org> CRAS: Add loopback feature back.

CRAS now supports 2 types of loopback: POST_MIX_PRE_DSP and POST_DSP.

BUG=chromium:468639
TEST=cras_test_client --loopback_file /tmp/cras.wav
Tested on peppy, plug and unplug USB devices while playing youtube video.

Change-Id: I015296d617f465f117544b69e17e3f864431c820
Reviewed-on: https://chromium-review.googlesource.com/264850
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Chinyue Chen <chinyue@chromium.org>
Trybot-Ready: Chinyue Chen <chinyue@chromium.org>
Tested-by: Chinyue Chen <chinyue@chromium.org>
/external/adhd/cras/src/server/cras_loopback_iodev.c
28f811ecffbe59fd2bb582f528460306a0c71874 17-Mar-2015 Chinyue Chen <chinyue@chromium.org> CRAS: audio_thread - Fill loopback output if no playback streams.

This patch fills loopback output device when there's no playback streams.
It does so by maintaining last output timestamp and fills the required
frames.

BUG=chromium:420541
TEST=Test on peppy with the following command:
time cras_test_client --loopback_file /tmp/loop.wav

Tested situations: single loopback stream, multiple loopback streams,
loopback with and without playback streams,
loopback starts and then playback starts,
playback stops before loopback stops.

Change-Id: I33d0ef828d9e2a5deb9aced5c0f69ab0bcff2fb7
Reviewed-on: https://chromium-review.googlesource.com/260531
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Commit-Queue: Chinyue Chen <chinyue@chromium.org>
Trybot-Ready: Chinyue Chen <chinyue@chromium.org>
Tested-by: Chinyue Chen <chinyue@chromium.org>
/external/adhd/cras/src/server/cras_loopback_iodev.c
36ba5c6db6a5fb873e503b660cba8f4ce6a43db9 16-Mar-2015 Chinyue Chen <chinyue@chromium.org> CRAS: Fix playback problem when loopback starts.

This patch correctly schedules loopback device to wake up and consume
samples, otherwise the output buffer is full and playback becomes
slow-motion.

BUG=chromium:465657
TEST=time cras_test_client --loopback_file /tmp/loop.wav --duration 10

Change-Id: I2e5b6d06f93c6b8b32bcfbe81d369dd34d868722
Reviewed-on: https://chromium-review.googlesource.com/260184
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Commit-Queue: Chinyue Chen <chinyue@chromium.org>
Trybot-Ready: Chinyue Chen <chinyue@chromium.org>
Tested-by: Chinyue Chen <chinyue@chromium.org>
/external/adhd/cras/src/server/cras_loopback_iodev.c
58b88900b8e3efa60e468daf0e5f5e1bc0b717aa 20-Jan-2015 Chinyue Chen <chinyue@chromium.org> CRAS: Re-implement loopback using pinned streams.

One loopback playback device and one loopback capture device are created
as CRAS startup. When a capture stream is pinned to the loopback capture
device, the loopback playback device is activated and routes output
streams for loopback capture. When the last capture stream is disconnected,
the loopback playback device is de-activated.

BUG=chromium:420541
TEST=Tested on peppy. While playing YouTube video, execute
"cras_test_client --loopback_file /tmp/loop.wav"
and verify audio is recorded.

Change-Id: I46bef9f7f70ddf3c3ddf472d4b69a2515a1409bf
Reviewed-on: https://chromium-review.googlesource.com/241921
Commit-Queue: Chinyue Chen <chinyue@chromium.org>
Trybot-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_loopback_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_loopback_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_loopback_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_loopback_iodev.c
761ee83077f05599176288c34b10544d881ae769 30-May-2014 Owen Lin <owenlin@chromium.org> CRAS: Don't add an iodev before it is fully initialized.

We may access some functions, e.g., is_open, before the function pointer
is set.

BUG=None
Test=Run cras on peach-pit and play audio

Change-Id: I9411811c9e57303996ec67e57ced8e290e76f428
Reviewed-on: https://chromium-review.googlesource.com/202210
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Owen Lin <owenlin@chromium.org>
Tested-by: Owen Lin <owenlin@chromium.org>
/external/adhd/cras/src/server/cras_loopback_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_loopback_iodev.c
03aeee9616635e7fb20b6e2bd00a2bc5b0e7a221 08-Oct-2013 Dylan Reid <dgreid@chromium.org> CRAS: loopback - Rework system loopback path

Change the loopback path to keep a buffer instead of sending output data
directly to the loopback client. This allows for playback streams with
higher latency than the loopback stream. Currently YouTube has a higher
latency than is used for loopback. This method adds 4096 samples of
latency to the loopback path. This could be optimized by making the
buffer size dynamic depending on the latency of all the currently
playing output streams, but that optimization hasn't proven necessary
yet.

BUG=chromium:304346
TEST=record system audio with loopback.

Change-Id: I32a119c1be175333fe788dbd0875cbe45d61387e
Reviewed-on: https://chromium-review.googlesource.com/172302
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
Tested-by: Dylan Reid <dgreid@chromium.org>
/external/adhd/cras/src/server/cras_loopback_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_loopback_iodev.c
0160d05bcc37548beb7619cfb4c0f74057cea2ee 07-Aug-2013 Dylan Reid <dgreid@chromium.org> CRAS: loopback - Allow zeros to be added.

Instead of poling into the shm area of the stream from two different
places (one was broken), allow add_audio to be told to zero the buffer
instead of copying from the passed pointer. This fixes the issue of
the loopback clicking after all output streams are closed.

BUG=chromium:266136
TEST=Play to ChromeCast, stop stream listen to silence.

Change-Id: Ieef49c5393cf24f2850af200362920da1b055d32
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64856
/external/adhd/cras/src/server/cras_loopback_iodev.c
b9fc23aa09bac1a8c97ab7f441448b273f195483 21-Jun-2013 Dylan Reid <dgreid@chromium.org> CRAS: Add loopback iodev.

The loopback iodev doesn't represent a hardware device, instead it
will be used to feed samples back for loopback testing and for whole
system audio capture, such as cast.

BUG=chromium:247160
TEST=new loopback_iodev unittest.

Change-Id: I7676e596c47c60b35fc53a41b2e59b5569661207
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/60237
Reviewed-by: Chih-Chung Chang <chihchung@chromium.org>
/external/adhd/cras/src/server/cras_loopback_iodev.c