瀏覽代碼

more airplay saga - release

Philippe G 5 年之前
父節點
當前提交
1ab183335e
共有 2 個文件被更改,包括 3 次插入3 次删除
  1. 2 2
      components/raop/rtp.c
  2. 1 1
      components/squeezelite/decode_external.c

+ 2 - 2
components/raop/rtp.c

@@ -434,7 +434,7 @@ static void buffer_put_packet(rtp_t *ctx, seq_t seqno, unsigned rtptime, bool fi
 			ctx->flush_seqno = -1;
 			ctx->playing = true;
 			ctx->resent_req = ctx->resent_rec = ctx->silent_frames = ctx->discarded = 0;
-			playtime = ctx->synchro.time + (((s32_t)(rtptime - ctx->synchro.rtp)) * 1000) / RAOP_SAMPLE_RATE;
+			playtime = ctx->synchro.time + ((rtptime - ctx->synchro.rtp) * 10) / (RAOP_SAMPLE_RATE / 100);
 			ctx->cmd_cb(RAOP_PLAY, playtime);
 		} else {
 			pthread_mutex_unlock(&ctx->ab_mutex);
@@ -517,7 +517,7 @@ static void buffer_push_packet(rtp_t *ctx) {
 
 		// try to manage playtime so that we overflow as late as possible if we miss NTP (2^31 / 10 / 44100)
 		curframe = ctx->audio_buffer + BUFIDX(ctx->ab_read);
-		playtime = ctx->synchro.time + (((s32_t)(curframe->rtptime - ctx->synchro.rtp)) * 10) / (RAOP_SAMPLE_RATE / 100);
+		playtime = ctx->synchro.time + ((curframe->rtptime - ctx->synchro.rtp) * 10) / (RAOP_SAMPLE_RATE / 100);
 
 		if (now > playtime) {
 			LOG_DEBUG("[%p]: discarded frame now:%u missed by:%d (W:%hu R:%hu)", ctx, now, now - playtime, ctx->ab_write, ctx->ab_read);

+ 1 - 1
components/squeezelite/decode_external.c

@@ -210,7 +210,7 @@ static bool raop_sink_cmd_handler(raop_event_t event, va_list args)
 				ms = now - output.updated + ((output.frames_played_dmp - output.device_frames) * 10) / (RAOP_SAMPLE_RATE / 100);
 				error = ms - (now - raop_sync.start_time);
 				
-				LOG_INFO("backend played %u, desired %u, (delta:%d)", ms, now - raop_sync.start_time, ms - (now - raop_sync.start_time));
+				LOG_INFO("backend played %u, desired %u, (delta:%d)", ms, now - raop_sync.start_time, error);
 			} else {	
 				u32_t level = _buf_used(outputbuf);