nyan: Increase mic gain by a net of 5dB.

Add 6dB of boost and -1dB of volume, as provided by the OEM.  This
will make the amount of playback audio that leaks through the mic
input higher, but makes the more common mic use cases work better.

BUG=chrome-os-partner:30454
TEST=record audio through headset and dmic on Big and Blaze

Change-Id: Idded576b1fe98341b15d6a18d7d83f23b292cafd
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/207571
Reviewed-by: Andrew Bresticker <abrestic@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>
CRAS: audio_thread - log delay when filling output

Add the delay to the audio thread log.

BUG=none
TEST=cras_test_client --dump_a

Change-Id: I3dea9b453446378bb77edbca37ff855a55dddf29
Signed-off-by: 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>
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>
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>
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>
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>
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>
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
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>
CRAS: test_client - Add parsing of output log.

Printing the parsed log directly will make it more useful than a bunch
of numbers that you need to find a decoder ring for.

BUG=none
TEST=cras_test_client --dump_a

Change-Id: I78ae9f81fc3ce2298569b9a0ac5e800125fcfc43
Signed-off-by: Dylan Reid <dgreid@chromium.org>
wip: find beginning of audio log

Change-Id: I844edad5cb18404e8fe6d293548864feae4a1844