mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-07 12:07:09 +03:00
BT & AirPlay switch fix - release
This commit is contained in:
@@ -156,7 +156,8 @@ static void bt_av_hdl_a2d_evt(uint16_t event, void *p_param)
|
||||
s_audio_state = a2d->audio_stat.state;
|
||||
if (ESP_A2D_AUDIO_STATE_STARTED == a2d->audio_stat.state) {
|
||||
(*bt_app_a2d_cmd_cb)(BT_SINK_PLAY);
|
||||
} else if (ESP_A2D_AUDIO_STATE_STOPPED == a2d->audio_stat.state) {
|
||||
} else if (ESP_A2D_AUDIO_STATE_STOPPED == a2d->audio_stat.state ||
|
||||
ESP_A2D_AUDIO_STATE_REMOTE_SUSPEND == a2d->audio_stat.state) {
|
||||
(*bt_app_a2d_cmd_cb)(BT_SINK_STOP);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -637,6 +637,12 @@ static void *rtp_thread_func(void *arg) {
|
||||
// sync packet
|
||||
case 0x54: {
|
||||
u32_t rtp_now_latency = ntohl(*(u32_t*)(pktp+4));
|
||||
u64_t remote = (((u64_t) ntohl(*(u32_t*)(pktp+8))) << 32) + ntohl(*(u32_t*)(pktp+12));
|
||||
u32_t rtp_now = ntohl(*(u32_t*)(pktp+16));
|
||||
u16_t flags = ntohs(*(u16_t*)(pktp+2));
|
||||
u32_t remote_gap = NTP2MS(remote - ctx->timing.remote);
|
||||
|
||||
if (remote_gap > 10000) {
|
||||
LOG_WARN("discarding remote timing information %u", remote_gap);
|
||||
break;
|
||||
}
|
||||
@@ -646,7 +652,7 @@ static void *rtp_thread_func(void *arg) {
|
||||
// re-align timestamp and expected local playback time (and magic 11025 latency)
|
||||
ctx->latency = rtp_now - rtp_now_latency;
|
||||
if (flags == 7 || flags == 4) ctx->latency += 11025;
|
||||
if (ctx->latency < MIN_LATENCY) ctx->latency = MIN_LATENCY;
|
||||
if (ctx->latency < MIN_LATENCY) ctx->latency = MIN_LATENCY;
|
||||
else if (ctx->latency > MAX_LATENCY) ctx->latency = MAX_LATENCY;
|
||||
ctx->synchro.rtp = rtp_now - ctx->latency;
|
||||
ctx->synchro.time = ctx->timing.local + remote_gap;
|
||||
|
||||
@@ -298,7 +298,7 @@ static esp_err_t _http_handle_response_code(esp_http_client_handle_t http_client
|
||||
}
|
||||
ESP_LOGD(TAG, "Redirection done, checking if we need to read the data. ");
|
||||
if (process_again(status_code)) {
|
||||
//char * local_buff = heap_caps_malloc(ota_config.buffer_size, MALLOC_CAP_INTERNAL);
|
||||
//char * local_buff = heap_caps_malloc(ota_config.buffer_size+1, MALLOC_CAP_INTERNAL);
|
||||
char * local_buff = malloc(ota_config.buffer_size+1);
|
||||
if(local_buff==NULL){
|
||||
ESP_LOGE(TAG,"Failed to allocate internal memory buffer for http processing");
|
||||
|
||||
Reference in New Issue
Block a user