Parcourir la source

BT & AirPlay switch fix - release

philippe44 il y a 5 ans
Parent
commit
131769ff4d

+ 2 - 1
components/driver_bt/bt_app_sink.c

@@ -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;

+ 7 - 1
components/raop/rtp.c

@@ -637,6 +637,12 @@ static void *rtp_thread_func(void *arg) {
 				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;
+				}
 
 				pthread_mutex_lock(&ctx->ab_mutex);
 
@@ -646,7 +652,7 @@ static void *rtp_thread_func(void *arg) {
 				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 + (u32_t) NTP2MS(remote - ctx->timing.remote);
+				ctx->synchro.time = ctx->timing.local + remote_gap;
 
 				// now we are synced on RTP frames
 				ctx->synchro.status |= RTP_SYNC;

+ 1 - 1
components/squeezelite-ota/squeezelite-ota.c

@@ -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");