History log of /external/bluetooth/bluedroid/btif/src/btif_media_task.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
01d102b3b187ab0d24050c1e12f96e6ee1ce50be 17-Oct-2014 Andre Eisenbach <eisenbach@google.com> A2DP: Lowering maximum PCM frame limit to avoid audio breaks

Some car kits (notably Renesas car kits used in Nissan/Infiniti models)
will throttle incoming A2DP frames if too many frames are sent at once.
This patch lowers the maximum number of frames sent per tick to not
overwhelm the remote device.

Bug: 17880920
Change-Id: I7bfbba625405c96159d1c94eebd8dc498f100daa
/external/bluetooth/bluedroid/btif/src/btif_media_task.c
f061e74b81863771b174d1717a6165034dbad8e5 09-Oct-2014 Mattias Agren <magren@broadcom.com> Added missing A2DP priority on java alarm service

Running GKI timer engine via JAVA alarm service was causing severe
timer preemption at times which affects A2DP media task timer. This in
turn was stressing the compensation logic towards UIPC resulting in
very bursty reads of up to 40 UIPC frames at a time. This led to
instabilities on the UIPC pipe and trickled upwards in audio framework.
Inclusion of java alarm thread in A2DP high priority thread list results
in a much smoother data flow for entire A2DP data path and improved
audio quality.

Bug: 17520043
Change-Id: I7cea6ec64aa5b973b5fff767389a8827e681619e
/external/bluetooth/bluedroid/btif/src/btif_media_task.c
ae13ec986e188d66eaad3c69bb916ea18c142fef 03-Sep-2014 Andre Eisenbach <eisenbach@google.com> Avoid race condition in SBC encoder initialization

In the A2DP media task, btif_a2dp_encoder_update() relies on the fact
that btif_a2dp_encoder_init() is called beforehand. Otherwise division
by zero errors will occur.

Since _init() called after the audio stream is opened, and _update() is
called in resonse the the audio stream being opened, a race condition
could ensue where _update() was called before open.

This patch changes the A2DP stream start sequence to ensure the SBC
encoder is initialized before the updated parameters are calculated.

Bug: 17339248
Change-Id: I6ed36a7fff0e4aa672a8866727030681eb4b3dfc
/external/bluetooth/bluedroid/btif/src/btif_media_task.c
a391bf1d4f4250e27b6f157a1a8d2493c36934dc 09-Aug-2014 Andre Eisenbach <eisenbach@google.com> A2DP: Protect against division-by-zero error in bitpool calculation

If the encoder parameters have not been configured correctly before the
SBC encoder is initialized, a division-by-zero can occur resulting in a
SIGFPE.

Bug: 16902125
Change-Id: Ie4c6715b6b374a2d62fcfa0a1a99d40c689d0e2a
/external/bluetooth/bluedroid/btif/src/btif_media_task.c
25067c0afc4d3ed95181b91801d3d638d9aa3f8f 22-Jul-2014 Andre Eisenbach <eisenbach@google.com> Fix integer overflow in GKI timer calculation

Fix an integer overflow in the GKI timer elapsed time calculation that
would cause Bluetooth Stereo Audio (A2DP) playback to stop suddenly
after a period of INT32_MAX microseconds (about 35 minutes) of
continuous uptime of the phone/tablet.

Bug: 16412377
Change-Id: I28cd3155a23444e41b26b3f3b8424cc2a3c5bf91
/external/bluetooth/bluedroid/btif/src/btif_media_task.c
f13db8a534adf5281ee915c4b73b3141957ed17b 12-Jul-2014 Andre Eisenbach <eisenbach@google.com> Calculate A2DP frames to send based on elapsed time

This patch is aimed at improving A2DP audio quality by sending the
correct number of frames based on the actual time elapes between "ticks"
in order to account for timer drift.

Change-Id: If5b7cde90f5eb10b926ad247f51cff0eb60bbff7
/external/bluetooth/bluedroid/btif/src/btif_media_task.c
0317a401142e927be82a0259f54cfa10a686e0fe 09-Jul-2014 Andre Eisenbach <eisenbach@google.com> Merge "Prevent A2DP bit pool calculation endless loops."
4e3593a9a1c596904a844286fbe704e969e7230e 08-Jul-2014 Andre Eisenbach <eisenbach@google.com> Prevent A2DP bit pool calculation endless loops.

This prevents log spam and endless loops in the A2DP bit pool
calculation. Protecting against the endless loop with prevent battery
draining issues and phone unresponsiveness.

This patch addresses the symptom. A separate patch will be submitted
once root cause is determined to address the problem.

Change-Id: I045b724c1c1638551b9333249f39eee109fa9ba1
/external/bluetooth/bluedroid/btif/src/btif_media_task.c
6718c6d9fcfe373a679a529aca003d32062f81dc 02-Jul-2014 lungtsai_lin <lungtsai_lin@htc.com> Bluetooth: Rename BTA_AVK_INCLUDED flag to BTA_AV_SINK_INCLUDED (bt_target.h)

Now OEM could enable/disable A2DP SINK role

Change-Id: I62cf17b0397a86c5f886a2c1ca724ca77a7f9bd4
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
/external/bluetooth/bluedroid/btif/src/btif_media_task.c
afa6e1abbedaad8fe854b0f43999b8aeb801af91 28-Jun-2014 Matthew Xie <mattx@google.com> resolved conflicts for merge of e8c3d75b to master

Change-Id: I78ef69c4d54a36243620ae14296d3507e3339567
8e50f047de2999e89b6a19ec9bf513017fcde3f9 28-Jun-2014 Matthew Xie <mattx@google.com> resolved conflicts for merge of 6449e497 to master

Change-Id: I01ef7ea6c4ce49c9d775b355fb5b082b25ffbc39
e8c3d75b75493911ebf0f99c83676359657178f7 04-May-2014 Sharvil Nanavati <sharvil@google.com> Logging cleanup: BTIF and APPL.

Change-Id: I5b1214642bbb4b9aecc0fd2c899a6ec2c9793286
/external/bluetooth/bluedroid/btif/src/btif_media_task.c
3e8a242fcbeebea2857fa964ca48624d8433333e 23-May-2014 Mike Lockwood <lockwood@google.com> More work on A2DP Sink:

Output audio data through A2DP audio HAL rather than playing directly
to native AudioTrack API.

Add separate HAL interface for A2DP sink

Change-Id: I6c6cb6088c350e104b4a7354f328b29c7178e295
/external/bluetooth/bluedroid/btif/src/btif_media_task.c
ce24765fe7620c34e8d88ed4f826c8a6917582b2 20-Mar-2014 Hemant Gupta <hemantg@codeaurora.org> SBC Decoder for A2DP SINK

Change-Id: Ic8d1dd81d1788324ec140fe0d1379dfff33deb54
/external/bluetooth/bluedroid/btif/src/btif_media_task.c
f7dd9f5779680da37dc89e5df2b26d436487818c 24-Oct-2013 Hemant Gupta <hemantg@codeaurora.org> Add A2DP Sink Support

Change-Id: I9affefdd2d00597545e49c593ef3bddb110d4c9c
/external/bluetooth/bluedroid/btif/src/btif_media_task.c
1a3006f317b1b493dde1b80c4debbcf1bf5f6727 04-May-2014 Sharvil Nanavati <sharvil@google.com> Eliminate dead code (helped by compiler warnings).

I've removed all functions that the compiler decided were unused.

Change-Id: I0cbddf874ebd1586abe29b80e8d6390680679542
/external/bluetooth/bluedroid/btif/src/btif_media_task.c
e7c4f99f1ca3da0ac46aa7425a37b383177c699f 05-Sep-2013 Hemant Gupta <hemantg@codeaurora.org> Bluetooth: On Suspend ignore media task timer event

On Recieving Suspend confirmation from remote device,
Media task timer reload and tx_timer is made false,
hence media task will not be stopped at that instant.
Media task timer expires causing buffer to be allocated.
Changes done to ensure buffer is allocated only if tx_timer
is true.

Change-Id: I971a82cccc64ba033475ad532b096862968de942
/external/bluetooth/bluedroid/btif/src/btif_media_task.c
309243751678f395e6f7323e45433e5476dc17ef 23-May-2014 Mike Lockwood <lockwood@google.com> More work on A2DP Sink:

Output audio data through A2DP audio HAL rather than playing directly
to native AudioTrack API.

Add separate HAL interface for A2DP sink

Change-Id: I6c6cb6088c350e104b4a7354f328b29c7178e295
/external/bluetooth/bluedroid/btif/src/btif_media_task.c
8e08ad12eae66877f9725ca2d66fc69fe6762340 20-Mar-2014 Hemant Gupta <hemantg@codeaurora.org> SBC Decoder for A2DP SINK

Change-Id: Ic8d1dd81d1788324ec140fe0d1379dfff33deb54
/external/bluetooth/bluedroid/btif/src/btif_media_task.c
cc35559160745c60b42ae182002a59337d844d09 24-Oct-2013 Hemant Gupta <hemantg@codeaurora.org> Add A2DP Sink Support

Change-Id: I9affefdd2d00597545e49c593ef3bddb110d4c9c
/external/bluetooth/bluedroid/btif/src/btif_media_task.c
6449e497dfe4d500810c3e7b4d7d056027c33a0e 06-Jun-2014 Sharvil Nanavati <sharvil@google.com> Eliminate more dead code in GKI.

Change-Id: I4c0000445535e5300b83a18f5f6ca45f1ef797da
/external/bluetooth/bluedroid/btif/src/btif_media_task.c
740def526e757f5ea8f30d9d28d1e7a668dadc42 04-May-2014 Sharvil Nanavati <sharvil@google.com> Eliminate dead code (helped by compiler warnings).

I've removed all functions that the compiler decided were unused.

Change-Id: I0cbddf874ebd1586abe29b80e8d6390680679542
/external/bluetooth/bluedroid/btif/src/btif_media_task.c
7e4c60ce7757d935901f53d1f21ecc696aa89979 05-Sep-2013 Hemant Gupta <hemantg@codeaurora.org> Bluetooth: On Suspend ignore media task timer event

On Recieving Suspend confirmation from remote device,
Media task timer reload and tx_timer is made false,
hence media task will not be stopped at that instant.
Media task timer expires causing buffer to be allocated.
Changes done to ensure buffer is allocated only if tx_timer
is true.

Change-Id: I971a82cccc64ba033475ad532b096862968de942
/external/bluetooth/bluedroid/btif/src/btif_media_task.c
54db2c249efa91082c5a167a924a527ec73ff38d 13-Apr-2014 Sharvil Nanavati <sharvil@google.com> Remove executable bit on source files.

Change-Id: Id456478aea626f57fed3479346e8fb4dbd0fafa6
/external/bluetooth/bluedroid/btif/src/btif_media_task.c
d2ccbbb73c7851d2fa28dc212d2fffc0ad4e5d50 13-Apr-2014 Sharvil Nanavati <sharvil@google.com> Remove executable bit on source files.

Change-Id: Id456478aea626f57fed3479346e8fb4dbd0fafa6
/external/bluetooth/bluedroid/btif/src/btif_media_task.c
5cd8bff2dd0337cb52bf48f312e3d2d55a8882fb 01-Feb-2014 Mike J. Chen <mjchen@google.com> Major warnings cleanup

Mostly fixing unused parameter warnings.
A few other warnings also fixed like possible use of
unitialized variables (no real issue found, just compiler couldn't
follow the path), signed vs unsigned warning.

Also fixed some typos, indent issues, removal of dead code, etc.

Change-Id: I95eb887aefc4d559d7921f71a0af5f3bfb01ac01
Signed-off-by: Mike J. Chen <mjchen@google.com>
/external/bluetooth/bluedroid/btif/src/btif_media_task.c
4aebca4662c280fdc32e0ad3705cae064bfa068d 19-Sep-2013 Zhihai Xu <zhihaixu@google.com> implement flow control to avoid dropping packets in btif_media_task.

implment flow conrol to save CPU usage and avoid dropping
packet in btif_media_task when overflow and cpu preemption happen.
when the packet count in the queue is above high watermark, we will
stopping adding packets, when the packet count in the queue is below
low watermark, we will start adding packets again.

bug:8252054
Change-Id: I3b7795dffbe5f2ae455e239a0234533f6cbb4403
/external/bluetooth/bluedroid/btif/src/btif_media_task.c
01c686ce0051433d75605ff9ca4c3b7388ce3b6b 16-Sep-2013 Zhihai Xu <zhihaixu@google.com> should return correct length and use shorter poll time for ad2p data

the default poll timeout(100ms) is too long for a2dp data read,
because the a2dp timer pertiod to read data is 20ms. The poll timeout
should be far less than a2dp timer pertiod. also when poll timeout happen
for read, we should return the data length which we already read instead of 0.

bug:8252054
Change-Id: Ifa8587c6b7d127cbbbff76d9e20b630303b6379f
/external/bluetooth/bluedroid/btif/src/btif_media_task.c
379743beded881127703334e1dda2cd327ec651d 29-Sep-2013 Zhihai Xu <zhihaixu@google.com> Failure to start playback on A2DP sink after connection

This is what happen:
after Headset is connected, we call start_audio_datapath which will send AVDTP_Start command to Headset,
Headset reject it with bad state. Bluedroid stack will ack failure to start_audio_datapath.
The next time we write audio data to bluetooth, we will call start_audio_datapath again to send AVDTP_Start command to Headset
Headset reject it with bad state again. Bluedroid stack will ack failure to start_audio_datapath.
When the third time we call start_audio_datapath, right at that time we receive AVDTP_Start command from Headset.
Handle AVDTP_Start command and Handle start_audio_datapath are in two different threads.
Handle AVDTP_Start command is in btu_task thread.
Handle start_audio_datapath() is in btif_task thread.
We have race condition in this case
Because when btif_task processed BTIF_AV_START_STREAM_REQ_EVT(triggered by start_audio_datapath),
it don't know we receive AVDTP_Start command which is processed in btu_task.
btif_task will send a message BTA_AV_API_START_EVT to btu_task, which will be handled by bta_av_do_start.
AVDTP_start command from headset is handled by bta_av_start_ok.
bta_av_start_ok will send BTA_AV_START_EVT with suspending true to btif_task and send AVDTP_Suspend command
to headset to suspend the AVDTP for reconfiguration purpose.

in bta_av_do_start, we will check whether the AVDTP is already started, we will know the AVDTP is already start at this time because
bta_av_do_start is also running in btu_task. We will send BTA_AV_START_EVT with success to btif_task.

In the btif_task, BTA_AV_START_EVT will be processed by btif_av_state_opened_handler:
For the first BTA_AV_START_EVT with suspending true sent by bta_av_start_ok, it will ignore it:
if ((p_av->start.status == BTA_SUCCESS) && (p_av->start.suspending == TRUE))
return TRUE;
For the second BTA_AV_START_EVT with success sent by bta_av_do_start , it will ack success to start_audio_datapath, and change to
BTIF_AV_STATE_STARTED/BTAV_AUDIO_STATE_STARTED, after receive success ack from bluedroid stack, we will start send Audio data to bluetooth.

At last we received AVDTP_Suspend response accept from Headset, we will send BTA_AV_SUSPEND_EVT to btif_task, which will be
handled by btif_av_state_started_handler. It will call btif_a2dp_on_suspended and call audio_state_cb with new audio state
BTAV_AUDIO_STATE_STOPPED.
so The state between bluedroid stack and audio data path is out of sync.
The fix is to send failure message if we know we suspend AVDTP in bta_av_do_start,
also make sure we won't miss acknowledgement for pending start if we exit opened state,
to avoid audio data path dead lock.

bug:10953908
Change-Id: I1704839977324b7c4e234eb843cddf3719e10d2c
/external/bluetooth/bluedroid/btif/src/btif_media_task.c
b8ceaa484a09be14263d5f10d022a272f9602378 05-Apr-2013 Mattias Agren <magren@broadcom.com> Set default a2dp sbc encoding quality to high

* Increased bitpool to high quality setting (53). * Added rate quality
reduction to medium quality for basic rate connections * Enhanced
a2dp frame calculation ratio to smooth out frame distrubution * Removed
iop scaling patch.

Bug 8252054

Change-Id: I20725d0decfe5f820e1c03407889b6272e830aca
/external/bluetooth/bluedroid/btif/src/btif_media_task.c
5fd74f06caab4324d0ba69df86ad5170c072ec64 05-Apr-2013 Mattias Agren <magren@broadcom.com> Stability fixes for a2dp hal control path

Ensure av statemachine is preventing a2dp hal to restart the stream
when not ready. This prevents ending up in a scenario where a2dp hal
locks up. Code cleanup.
bug 7002859

Change-Id: I3f3eeaab4ca185733b8b0042ed2cfa701f76a203
/external/bluetooth/bluedroid/btif/src/btif_media_task.c
45f5f9077c773b9d4533fef13045b5ff77e32e46 08-Feb-2013 Ganesh Ganapathi Batta <ganeshg@broadcom.com> Resolved partial uipc channel read issue

When partial data is read the previously read size wasn't
compensated for. Ensure we don't transmit empty a2dp frames in case
of underrun
Bug 8026551

Change-Id: I4195ed798008378b93343bf7cd266c6e2f11b094
/external/bluetooth/bluedroid/btif/src/btif_media_task.c
5738f83aeb59361a0a2eda2460113f6dc9194271 13-Dec-2012 The Android Open Source Project <initial-contribution@android.com> Snapshot cdeccf6fdd8c2d494ea2867cb37a025bf8879baf

Change-Id: Ia2de32ccb97a9641462c72363b0a8c4288f4f36d
/external/bluetooth/bluedroid/btif/src/btif_media_task.c