From e6ffc828d2d1746f737308d5956b748dc73d2678 Mon Sep 17 00:00:00 2001 From: fduncanh Date: Tue, 3 May 2022 16:29:08 -0400 Subject: [PATCH] place more complete timing data in audio_decode_struct --- lib/raop_rtp.c | 4 +++- lib/stream.h | 5 ++++- uxplay.cpp | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/raop_rtp.c b/lib/raop_rtp.c index 3ba7f78..f618ac9 100644 --- a/lib/raop_rtp.c +++ b/lib/raop_rtp.c @@ -613,7 +613,9 @@ raop_rtp_thread_udp(void *arg) audio_decode_struct audio_data; audio_data.data_len = payload_size; audio_data.data = payload; - audio_data.pts = (uint64_t) ntp_timestamp; + audio_data.ntp_time = (uint64_t) ntp_timestamp; + audio_data.rtp_time = (uint64_t) rtp_time; + audio_data.have_synced = have_synced; raop_rtp->callbacks.audio_process(raop_rtp->callbacks.cls, raop_rtp->ntp, &audio_data); free(payload); uint64_t ntp_now = raop_ntp_get_local_time(raop_rtp->ntp); diff --git a/lib/stream.h b/lib/stream.h index fdc20ac..1f56774 100644 --- a/lib/stream.h +++ b/lib/stream.h @@ -16,6 +16,7 @@ #define AIRPLAYSERVER_STREAM_H #include +#include typedef struct { int nal_count; @@ -27,7 +28,9 @@ typedef struct { typedef struct { unsigned char *data; int data_len; - uint64_t pts; + uint64_t ntp_time; + uint64_t rtp_time; + bool have_synced; } audio_decode_struct; #endif //AIRPLAYSERVER_STREAM_H diff --git a/uxplay.cpp b/uxplay.cpp index d5b2b61..abc795f 100644 --- a/uxplay.cpp +++ b/uxplay.cpp @@ -811,7 +811,7 @@ extern "C" void audio_process (void *cls, raop_ntp_t *ntp, audio_decode_struct * dump_audio_to_file(data->data, data->data_len, (data->data)[0] & 0xf0); } if (use_audio) { - audio_renderer_render_buffer(ntp, data->data, data->data_len, data->pts); + audio_renderer_render_buffer(ntp, data->data, data->data_len, data->ntp_time); } }