Skip to content

Commit 440cc16

Browse files
authored
Enhance AVRC deinitialization process (#762)
Deinitialize AVRC TG and CT properly during shutdown.
1 parent 3ad3365 commit 440cc16

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/BluetoothA2DPSource.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,20 @@ void BluetoothA2DPSource::end(bool release_memory) {
154154
xTimerDelete(s_tmr, portMAX_DELAY);
155155
s_tmr = nullptr;
156156
}
157+
158+
// Properly deinitialize AVRC to allow reinitialization on next start()
159+
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)
160+
if (is_passthru_active) {
161+
ESP_LOGD(BT_APP_TAG, "Deinitializing AVRC TG");
162+
esp_avrc_tg_deinit();
163+
}
164+
#endif
165+
ESP_LOGD(BT_APP_TAG, "Deinitializing AVRC CT");
166+
esp_avrc_ct_deinit();
167+
168+
// Reset the bluedroid initialization flag so it can be reinitialized
169+
is_bluedroid_initialized = false;
170+
157171
// standard end
158172
BluetoothA2DPCommon::end(release_memory);
159173
}

0 commit comments

Comments
 (0)