OSDN Git Service

BTIF A2DP Source and Sink refactor and cleanup
authorPavlin Radoslavov <pavlin@google.com>
Mon, 3 Oct 2016 01:34:46 +0000 (18:34 -0700)
committerPavlin Radoslavov <pavlin@google.com>
Thu, 13 Oct 2016 23:27:10 +0000 (16:27 -0700)
commit1394c197027c0907932a814a786cc033870eb1c9
treeca819292a3ac8ef49fc73a9261d5784387e2ea86
parentcc8d3abf78202551eab0c57486002b1cacd1da7e
BTIF A2DP Source and Sink refactor and cleanup

* Moved bta/av/bta_av_sbc.c to stack/a2dp/a2d_sbc_up_sample.c
  and renamed the corresponding bta_av_sbc_up_sample_* functions to
  a2d_sbc_up_sample_*
  Also, renamed bta_av_sbc_init_up_sample() to a2d_sbc_init_up_sample()
* Moved A2DP SBC Encoder-related tasks, state and constants from
  btif_a2dp_source.cc to a2d_sbc_encoder.c
* Introduced A2DP encoder callbacks interface tA2D_ENCODER_INTERFACE,
  and added A2D_GetEncoderInterface() to acccess the interface for a codec.
* Updated a2d_sbc_encoder_init() to specify callbacks:
  - a2d_source_read_callback_t - a callback to read audio data for encoding
  - a2d_source_enqueue_callback_t - a callback to enqueue A2DP source
    packets for transmission
* Removed BTIF_MEDIA_TRSCD_* - the encoding is always PCM
* Removed conditionally defined constants and replaced them by
  local definitions:
  - BTIF_MEDIA_BITRATE_STEP -> A2D_SBC_BITRATE_STEP
  - BTIF_A2DP_DEFAULT_BITRATE -> A2D_SBC_DEFAULT_BITRATE
  - BTIF_A2DP_NON_EDR_MAX_RATE -> A2D_SBC_NON_EDR_MAX_RATE
* Hard-coded the read data timeout period A2DP_DATA_READ_POLL_MS to 10ms
* Merged the UNDERRUN read errors into the UNDERFLOW errors.
* Removed the following statistics, because they are not very useful:
  - media_read_total_limited_frames
  - media_read_max_limited_frames
  - media_read_limited_count
  - media_read_total_expected_frames
  - media_read_max_expected_frames
  - media_read_expected_count
* Updated the implementation of buffer_overruns_max_count to
  use the (new) counter tx_queue_max_dropped_messages instead of
  media_read_max_expected_frames
* Replaced usage of LOG_DEBUG() in stack/a2d/ with LOG_VERBOSE():
  the former is enabled by default on some of the builds.
* Renamed:
  - btif_a2dp_sink_audio_focus_state_t -> btif_a2dp_sink_focus_state_t
  - btif_a2dp_sink_set_audio_focus_state_req() ->
    btif_a2dp_sink_set_focus_state_req()
  - tBTIF_A2DP_SINK_CB.RxSbcQ -> rx_audio_queue
  - btif_a2dp_source_start_aa_req() -> btif_a2dp_source_start_audio_req()
  - btif_a2dp_source_stop_aa_req() -> btif_a2dp_source_stop_audio_req()
  - btif_a2dp_source_aa_readbuf() -> btif_a2dp_source_audio_readbuf()
  - tBTIF_A2DP_SOURCE_CB.TxAaQ -> tx_audio_queue
  - BTIF_A2DP_SOURCE_MEDIA_TIMER_MS -> A2D_SBC_ENCODER_INTERVAL_MS
  - tA2D_AV_MEDIA_FEEDINGS -> tA2D_FEEDING_PARAMS
  - tBTIF_A2DP_SOURCE_INIT_AUDIO -> tA2D_ENCODER_INIT_PARAMS
  - tBTIF_A2DP_SOURCE_UPDATE_AUDIO -> tA2D_ENCODER_UPDATE_PARAMS
  - tBTIF_A2DP_SOURCE_INIT_AUDIO_FEEDING -> tBTIF_A2DP_SOURCE_INIT_FEEDING

Bug: 30958229
Test: TestTracker/65192
Change-Id: Iba0a9694bda3dba73f211f1bde25821497fa6a06
24 files changed:
bta/Android.mk
bta/BUILD.gn
btif/co/bta_av_co.cc
btif/include/btif_a2dp.h
btif/include/btif_a2dp_sink.h
btif/include/btif_a2dp_source.h
btif/include/btif_av_co.h
btif/src/btif_a2dp_control.cc
btif/src/btif_a2dp_sink.cc
btif/src/btif_a2dp_source.cc
btif/src/btif_av.cc
stack/Android.mk
stack/BUILD.gn
stack/a2dp/a2d_api.c
stack/a2dp/a2d_sbc.c
stack/a2dp/a2d_sbc_encoder.c [new file with mode: 0644]
stack/a2dp/a2d_sbc_up_sample.c [moved from bta/av/bta_av_sbc.c with 65% similarity]
stack/a2dp/a2d_vendor.c
stack/include/a2d_api.h
stack/include/a2d_sbc.h
stack/include/a2d_sbc_encoder.h [new file with mode: 0644]
stack/include/a2d_sbc_up_sample.h [moved from bta/include/bta_av_sbc.h with 79% similarity]
stack/include/a2d_vendor.h
stack/test/stack_a2d_test.cc