Merge pull request #2253 from prhodey/fix/deferred-airplay2-latency [skip ci]

Defer buffered AirPlay 2 latency offset conversion. (It needs a further little adjustment to handle Realtime streams, but that will be done in the next commit.)
This commit is contained in:
Mike Brady
2026-08-20 10:48:35 +01:00
committed by GitHub
2 changed files with 7 additions and 7 deletions
+5 -2
View File
@@ -1488,8 +1488,11 @@ int get_ptp_anchor_local_time_info(rtsp_conn_info *conn, uint32_t *anchorRTP,
} }
if (conn->last_anchor_info_is_valid != 0) { if (conn->last_anchor_info_is_valid != 0) {
if (anchorRTP != NULL) if (anchorRTP != NULL) {
*anchorRTP = conn->last_anchor_rtptime; // Use the current rate in case the stream format has changed.
int32_t added_latency = (int32_t)(config.audio_backend_latency_offset * conn->input_rate);
*anchorRTP = conn->last_anchor_rtptime - added_latency;
}
if (anchorLocalTime != NULL) if (anchorLocalTime != NULL)
*anchorLocalTime = conn->last_anchor_local_time; *anchorLocalTime = conn->last_anchor_local_time;
} }
+2 -5
View File
@@ -1453,11 +1453,8 @@ void handle_setrateanchori(rtsp_conn_info *conn, rtsp_message *req, rtsp_message
// debug(1, "anchor rtpTime is %" PRId64 ".", rtpTime); // debug(1, "anchor rtpTime is %" PRId64 ".", rtpTime);
uint32_t anchorRTPTime = rtpTime; uint32_t anchorRTPTime = rtpTime;
int32_t added_latency = (int32_t)(config.audio_backend_latency_offset * conn->input_rate); // Store the raw anchor; apply the latency offset when it is used.
// debug(1,"anchorRTPTime: %" PRIu32 ", added latency: %" PRId32 ".", anchorRTPTime, set_ptp_anchor_info(conn, conn->networkTimeTimelineID, anchorRTPTime, anchorTimeNanoseconds);
// added_latency);
set_ptp_anchor_info(conn, conn->networkTimeTimelineID, anchorRTPTime - added_latency,
anchorTimeNanoseconds);
} }
item = plist_dict_get_item(messagePlist, "rate"); item = plist_dict_get_item(messagePlist, "rate");