Loading system/btif/include/btif_a2dp_sink.h +10 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,16 @@ bool btif_a2dp_sink_init(void); // streaming. bool btif_a2dp_sink_startup(void); // Start the A2DP Sink session. // This function should be called by the BTIF state machine after // btif_a2dp_sink_startup() to start the streaming session for |peer_address|. bool btif_a2dp_sink_start_session(const RawAddress& peer_address); // End the A2DP Sink session. // This function should be called by the BTIF state machine to end the // streaming session for |peer_address|. bool btif_a2dp_sink_end_session(const RawAddress& peer_address); // Shutdown the A2DP Sink module. // This function should be called by the BTIF state machine before // btif_a2dp_sink_cleanup() to shutdown the processing of the audio streaming. Loading system/btif/include/btif_a2dp_source.h +10 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,16 @@ bool btif_a2dp_source_init(void); // btif_a2dp_source_init() to prepare to start streaming. bool btif_a2dp_source_startup(void); // Start the A2DP Source session. // This function should be called by the BTIF state machine after // btif_a2dp_source_startup() to start the streaming session for |peer_address|. bool btif_a2dp_source_start_session(const RawAddress& peer_address); // End the A2DP Source session. // This function should be called by the BTIF state machine to end the // streaming session for |peer_address|. bool btif_a2dp_source_end_session(const RawAddress& peer_address); // Shutdown the A2DP Source module. // This function should be called by the BTIF state machine to stop streaming. void btif_a2dp_source_shutdown(void); Loading system/btif/src/btif_a2dp.cc +1 −4 Original line number Diff line number Diff line Loading @@ -83,10 +83,7 @@ bool btif_a2dp_on_started(const RawAddress& peer_addr, ack = true; } } else { /* We were remotely started, make sure codec * is setup before datapath is started. */ btif_a2dp_source_setup_codec(peer_addr); // We were started remotely if (btif_av_is_a2dp_offload_enabled()) { btif_av_stream_start_offload(); } Loading system/btif/src/btif_a2dp_sink.cc +30 −2 Original line number Diff line number Diff line Loading @@ -95,6 +95,8 @@ static std::atomic<int> btif_a2dp_sink_state{BTIF_A2DP_SINK_STATE_OFF}; static void btif_a2dp_sink_init_delayed(void* context); static void btif_a2dp_sink_startup_delayed(void* context); static void btif_a2dp_sink_start_session_delayed(void* context); static void btif_a2dp_sink_end_session_delayed(void* context); static void btif_a2dp_sink_shutdown_delayed(void* context); static void btif_a2dp_sink_cleanup_delayed(void* context); static void btif_a2dp_sink_command_ready(fixed_queue_t* queue, void* context); Loading Loading @@ -170,7 +172,6 @@ static void btif_a2dp_sink_init_delayed(UNUSED_ATTR void* context) { bool btif_a2dp_sink_startup(void) { LOG_INFO(LOG_TAG, "%s", __func__); LockGuard lock(g_mutex); thread_post(btif_a2dp_sink_cb.worker_thread, btif_a2dp_sink_startup_delayed, NULL); return true; Loading @@ -182,9 +183,36 @@ static void btif_a2dp_sink_startup_delayed(UNUSED_ATTR void* context) { // Nothing to do } void btif_a2dp_sink_shutdown(void) { bool btif_a2dp_sink_start_session(const RawAddress& peer_address) { LOG_INFO(LOG_TAG, "%s: peer_address=%s", __func__, peer_address.ToString().c_str()); thread_post(btif_a2dp_sink_cb.worker_thread, btif_a2dp_sink_start_session_delayed, NULL); return true; } static void btif_a2dp_sink_start_session_delayed(UNUSED_ATTR void* context) { LOG_INFO(LOG_TAG, "%s", __func__); LockGuard lock(g_mutex); // Nothing to do } bool btif_a2dp_sink_end_session(const RawAddress& peer_address) { LOG_INFO(LOG_TAG, "%s: peer_address=%s", __func__, peer_address.ToString().c_str()); thread_post(btif_a2dp_sink_cb.worker_thread, btif_a2dp_sink_end_session_delayed, NULL); return true; } static void btif_a2dp_sink_end_session_delayed(UNUSED_ATTR void* context) { LOG_INFO(LOG_TAG, "%s", __func__); LockGuard lock(g_mutex); // Nothing to do } void btif_a2dp_sink_shutdown(void) { LOG_INFO(LOG_TAG, "%s", __func__); thread_post(btif_a2dp_sink_cb.worker_thread, btif_a2dp_sink_shutdown_delayed, NULL); } Loading system/btif/src/btif_a2dp_source.cc +44 −0 Original line number Diff line number Diff line Loading @@ -301,6 +301,10 @@ static BtifA2dpSource btif_a2dp_source_cb; static void btif_a2dp_source_init_delayed(void); static void btif_a2dp_source_startup_delayed(void); static void btif_a2dp_source_start_session_delayed( const RawAddress& peer_address); static void btif_a2dp_source_end_session_delayed( const RawAddress& peer_address); static void btif_a2dp_source_shutdown_delayed(void); static void btif_a2dp_source_cleanup_delayed(void); static void btif_a2dp_source_audio_tx_start_event(void); Loading Loading @@ -421,6 +425,45 @@ static void btif_a2dp_source_startup_delayed(void) { system_bt_osi::CONNECTION_TECHNOLOGY_TYPE_BREDR, 0); } bool btif_a2dp_source_start_session(const RawAddress& peer_address) { LOG_INFO(LOG_TAG, "%s: peer_address=%s", __func__, peer_address.ToString().c_str()); btif_a2dp_source_setup_codec(peer_address); btif_a2dp_source_thread.DoInThread( FROM_HERE, base::Bind(&btif_a2dp_source_start_session_delayed, peer_address)); return true; } static void btif_a2dp_source_start_session_delayed( const RawAddress& peer_address) { LOG_INFO(LOG_TAG, "%s: peer_address=%s", __func__, peer_address.ToString().c_str()); if (btif_a2dp_source_cb.State() != BtifA2dpSource::kStateRunning) { LOG_ERROR(LOG_TAG, "%s: A2DP Source media task is not running", __func__); return; } } bool btif_a2dp_source_end_session(const RawAddress& peer_address) { LOG_INFO(LOG_TAG, "%s: peer_address=%s", __func__, peer_address.ToString().c_str()); btif_a2dp_source_thread.DoInThread( FROM_HERE, base::Bind(&btif_a2dp_source_end_session_delayed, peer_address)); return true; } static void btif_a2dp_source_end_session_delayed( const RawAddress& peer_address) { LOG_INFO(LOG_TAG, "%s: peer_address=%s", __func__, peer_address.ToString().c_str()); if (btif_a2dp_source_cb.State() != BtifA2dpSource::kStateRunning) { LOG_ERROR(LOG_TAG, "%s: A2DP Source media task is not running", __func__); return; } } void btif_a2dp_source_shutdown(void) { LOG_INFO(LOG_TAG, "%s", __func__); Loading Loading @@ -491,6 +534,7 @@ void btif_a2dp_source_setup_codec(const RawAddress& peer_address) { // we're using that in frame size calculations now. CHECK(CHAR_BIT == 8); btif_a2dp_source_audio_tx_flush_req(); btif_a2dp_source_thread.DoInThread( FROM_HERE, base::Bind(&btif_a2dp_source_setup_codec_delayed, peer_address)); Loading Loading
system/btif/include/btif_a2dp_sink.h +10 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,16 @@ bool btif_a2dp_sink_init(void); // streaming. bool btif_a2dp_sink_startup(void); // Start the A2DP Sink session. // This function should be called by the BTIF state machine after // btif_a2dp_sink_startup() to start the streaming session for |peer_address|. bool btif_a2dp_sink_start_session(const RawAddress& peer_address); // End the A2DP Sink session. // This function should be called by the BTIF state machine to end the // streaming session for |peer_address|. bool btif_a2dp_sink_end_session(const RawAddress& peer_address); // Shutdown the A2DP Sink module. // This function should be called by the BTIF state machine before // btif_a2dp_sink_cleanup() to shutdown the processing of the audio streaming. Loading
system/btif/include/btif_a2dp_source.h +10 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,16 @@ bool btif_a2dp_source_init(void); // btif_a2dp_source_init() to prepare to start streaming. bool btif_a2dp_source_startup(void); // Start the A2DP Source session. // This function should be called by the BTIF state machine after // btif_a2dp_source_startup() to start the streaming session for |peer_address|. bool btif_a2dp_source_start_session(const RawAddress& peer_address); // End the A2DP Source session. // This function should be called by the BTIF state machine to end the // streaming session for |peer_address|. bool btif_a2dp_source_end_session(const RawAddress& peer_address); // Shutdown the A2DP Source module. // This function should be called by the BTIF state machine to stop streaming. void btif_a2dp_source_shutdown(void); Loading
system/btif/src/btif_a2dp.cc +1 −4 Original line number Diff line number Diff line Loading @@ -83,10 +83,7 @@ bool btif_a2dp_on_started(const RawAddress& peer_addr, ack = true; } } else { /* We were remotely started, make sure codec * is setup before datapath is started. */ btif_a2dp_source_setup_codec(peer_addr); // We were started remotely if (btif_av_is_a2dp_offload_enabled()) { btif_av_stream_start_offload(); } Loading
system/btif/src/btif_a2dp_sink.cc +30 −2 Original line number Diff line number Diff line Loading @@ -95,6 +95,8 @@ static std::atomic<int> btif_a2dp_sink_state{BTIF_A2DP_SINK_STATE_OFF}; static void btif_a2dp_sink_init_delayed(void* context); static void btif_a2dp_sink_startup_delayed(void* context); static void btif_a2dp_sink_start_session_delayed(void* context); static void btif_a2dp_sink_end_session_delayed(void* context); static void btif_a2dp_sink_shutdown_delayed(void* context); static void btif_a2dp_sink_cleanup_delayed(void* context); static void btif_a2dp_sink_command_ready(fixed_queue_t* queue, void* context); Loading Loading @@ -170,7 +172,6 @@ static void btif_a2dp_sink_init_delayed(UNUSED_ATTR void* context) { bool btif_a2dp_sink_startup(void) { LOG_INFO(LOG_TAG, "%s", __func__); LockGuard lock(g_mutex); thread_post(btif_a2dp_sink_cb.worker_thread, btif_a2dp_sink_startup_delayed, NULL); return true; Loading @@ -182,9 +183,36 @@ static void btif_a2dp_sink_startup_delayed(UNUSED_ATTR void* context) { // Nothing to do } void btif_a2dp_sink_shutdown(void) { bool btif_a2dp_sink_start_session(const RawAddress& peer_address) { LOG_INFO(LOG_TAG, "%s: peer_address=%s", __func__, peer_address.ToString().c_str()); thread_post(btif_a2dp_sink_cb.worker_thread, btif_a2dp_sink_start_session_delayed, NULL); return true; } static void btif_a2dp_sink_start_session_delayed(UNUSED_ATTR void* context) { LOG_INFO(LOG_TAG, "%s", __func__); LockGuard lock(g_mutex); // Nothing to do } bool btif_a2dp_sink_end_session(const RawAddress& peer_address) { LOG_INFO(LOG_TAG, "%s: peer_address=%s", __func__, peer_address.ToString().c_str()); thread_post(btif_a2dp_sink_cb.worker_thread, btif_a2dp_sink_end_session_delayed, NULL); return true; } static void btif_a2dp_sink_end_session_delayed(UNUSED_ATTR void* context) { LOG_INFO(LOG_TAG, "%s", __func__); LockGuard lock(g_mutex); // Nothing to do } void btif_a2dp_sink_shutdown(void) { LOG_INFO(LOG_TAG, "%s", __func__); thread_post(btif_a2dp_sink_cb.worker_thread, btif_a2dp_sink_shutdown_delayed, NULL); } Loading
system/btif/src/btif_a2dp_source.cc +44 −0 Original line number Diff line number Diff line Loading @@ -301,6 +301,10 @@ static BtifA2dpSource btif_a2dp_source_cb; static void btif_a2dp_source_init_delayed(void); static void btif_a2dp_source_startup_delayed(void); static void btif_a2dp_source_start_session_delayed( const RawAddress& peer_address); static void btif_a2dp_source_end_session_delayed( const RawAddress& peer_address); static void btif_a2dp_source_shutdown_delayed(void); static void btif_a2dp_source_cleanup_delayed(void); static void btif_a2dp_source_audio_tx_start_event(void); Loading Loading @@ -421,6 +425,45 @@ static void btif_a2dp_source_startup_delayed(void) { system_bt_osi::CONNECTION_TECHNOLOGY_TYPE_BREDR, 0); } bool btif_a2dp_source_start_session(const RawAddress& peer_address) { LOG_INFO(LOG_TAG, "%s: peer_address=%s", __func__, peer_address.ToString().c_str()); btif_a2dp_source_setup_codec(peer_address); btif_a2dp_source_thread.DoInThread( FROM_HERE, base::Bind(&btif_a2dp_source_start_session_delayed, peer_address)); return true; } static void btif_a2dp_source_start_session_delayed( const RawAddress& peer_address) { LOG_INFO(LOG_TAG, "%s: peer_address=%s", __func__, peer_address.ToString().c_str()); if (btif_a2dp_source_cb.State() != BtifA2dpSource::kStateRunning) { LOG_ERROR(LOG_TAG, "%s: A2DP Source media task is not running", __func__); return; } } bool btif_a2dp_source_end_session(const RawAddress& peer_address) { LOG_INFO(LOG_TAG, "%s: peer_address=%s", __func__, peer_address.ToString().c_str()); btif_a2dp_source_thread.DoInThread( FROM_HERE, base::Bind(&btif_a2dp_source_end_session_delayed, peer_address)); return true; } static void btif_a2dp_source_end_session_delayed( const RawAddress& peer_address) { LOG_INFO(LOG_TAG, "%s: peer_address=%s", __func__, peer_address.ToString().c_str()); if (btif_a2dp_source_cb.State() != BtifA2dpSource::kStateRunning) { LOG_ERROR(LOG_TAG, "%s: A2DP Source media task is not running", __func__); return; } } void btif_a2dp_source_shutdown(void) { LOG_INFO(LOG_TAG, "%s", __func__); Loading Loading @@ -491,6 +534,7 @@ void btif_a2dp_source_setup_codec(const RawAddress& peer_address) { // we're using that in frame size calculations now. CHECK(CHAR_BIT == 8); btif_a2dp_source_audio_tx_flush_req(); btif_a2dp_source_thread.DoInThread( FROM_HERE, base::Bind(&btif_a2dp_source_setup_codec_delayed, peer_address)); Loading