Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fb99bf77 authored by Pavlin Radoslavov's avatar Pavlin Radoslavov
Browse files

Use only PCM as the media feeding format

* Removed field tA2D_AV_MEDIA_FEEDINGS.format, because we always
  use/assume the feeding format is PCM.
* Removed tA2D_AV_MEDIA_FEED_CFG_PCM, tA2D_AV_MEDIA_FEED_CFG,
  tA2D_AV_CODEC_PCM, and tA2D_AV_CODEC_NONE, because they are not
  needed/used anymore.
* Removed feeding mode:
  - tBTIF_MEDIA_INIT_AUDIO_FEEDING.feeding_mode
  - tBTIF_AV_FEEDING_MODE, BTIF_AV_FEEDING_ASYNCHRONOUS,
    BTIF_AV_FEEDING_SYNCHRONOUS
  - tBTIF_MEDIA_CB.feeding_mode
* Added new APIs and the corresponding unit tests:
  - A2D_CodecConfigMatchesCapabilities()
  - A2D_BuildSinkConfig()
  - A2D_CodecEquals()
  - A2D_CodecRequiresReconfig()

Also:
 * Removed header file btif/include/btif_av_api.h because it is not
   needed anymore.
 * Removed functions or typedefs that are unused or replaced:
   - bta_av_co_audio_codec_match() -> replaced by
     A2D_CodecConfigMatchesCapabilities()
   - bta_av_co_audio_codec_cfg_matches_caps()
   - bta_av_co_audio_peer_reset_config()
   - bta_av_co_audio_discard_config()
   - bta_av_co_get_codec_info()
   - bta_av_co_peer_cp_supported()
   - tA2D_AV_CODEC_ID
   - tBTIF_AV_CODEC_INFO
 * Increased the sampling_freq storage from uint16_t to uint32_t
 * Decreased the number of channels n_channels storage from uint16_t
   to uint8_t
 * Removed unneessary global function declarations inside btif_av_co.h
 * Changed the order of the A2D_BuildSrc2SinkConfig() arguments, so
   the order is more intuitive.
 * Misc other cleanup:
   - file bta_av_co.cc: code simplification, renamed snk -> sink,
     Removed unnecessary cast-away of a const argument: bta_av_co_cp_scmst
     Renamed/updated bta_av_co_audio_peer_supports_codec() ->
             bta_av_co_find_peer_sink_supports_codec()
     Renamed/updated bta_av_co_audio_peer_src_supports_codec() ->
             bta_av_co_find_peer_src_supports_codec()

Bug: 30958229
Test: A2DP tested manually. Unit tests included in the CL.
Change-Id: I60981c62b1a88491b5232c4f6515933c4261fac9
parent 3591fc39
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -309,7 +309,8 @@ void BTA_AvStop(bool suspend)
**
*******************************************************************************/
void BTA_AvReconfig(tBTA_AV_HNDL hndl, bool suspend, uint8_t sep_info_idx,
                    uint8_t *p_codec_info, uint8_t num_protect, uint8_t *p_protect_info)
                    uint8_t *p_codec_info, uint8_t num_protect,
                    const uint8_t *p_protect_info)
{
    tBTA_AV_API_RCFG *p_buf =
        (tBTA_AV_API_RCFG *)osi_malloc(sizeof(tBTA_AV_API_RCFG) + num_protect);
+4 −3
Original line number Diff line number Diff line
@@ -38,8 +38,8 @@ typedef struct
    uint32_t              src_sps;    /* samples per second (source audio data) */
    uint32_t              dst_sps;    /* samples per second (converted audio data) */
    tBTA_AV_SBC_ACT     *p_act;     /* the action function to do the conversion */
    uint16_t              bits;       /* number of bits per pcm sample */
    uint16_t              n_channels; /* number of channels (i.e. mono(1), stereo(2)...) */
    uint8_t               bits;       /* number of bits per pcm sample */
    uint8_t               n_channels; /* number of channels (i.e. mono(1), stereo(2)...) */
    int16_t               worker1;
    int16_t               worker2;
    uint8_t               div;
@@ -61,7 +61,8 @@ tBTA_AV_SBC_UPS_CB bta_av_sbc_ups_cb;
** Returns          none
**
*******************************************************************************/
void bta_av_sbc_init_up_sample (uint32_t src_sps, uint32_t dst_sps, uint16_t bits, uint16_t n_channels)
void bta_av_sbc_init_up_sample (uint32_t src_sps, uint32_t dst_sps,
                                uint8_t bits, uint8_t n_channels)
{
    bta_av_sbc_ups_cb.cur_pos   = -1;
    bta_av_sbc_ups_cb.src_sps   = src_sps;
+2 −1
Original line number Diff line number Diff line
@@ -632,7 +632,8 @@ void BTA_AvStop(bool suspend);
**
*******************************************************************************/
void BTA_AvReconfig(tBTA_AV_HNDL hndl, bool suspend, uint8_t sep_info_idx,
                            uint8_t *p_codec_info, uint8_t num_protect, uint8_t *p_protect_info);
                    uint8_t *p_codec_info, uint8_t num_protect,
                    const uint8_t *p_protect_info);

/*******************************************************************************
**
+1 −1
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ extern "C" {
**
*******************************************************************************/
extern void bta_av_sbc_init_up_sample (uint32_t src_sps, uint32_t dst_sps,
                                       uint16_t bits, uint16_t n_channels);
                                       uint8_t bits, uint8_t n_channels);

/*******************************************************************************
**
+240 −557

File changed.

Preview size limit exceeded, changes collapsed.

Loading