Defer buffered AirPlay 2 latency offset conversion
This commit is contained in:
@@ -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 (anchorRTP != NULL)
|
||||
*anchorRTP = conn->last_anchor_rtptime;
|
||||
if (anchorRTP != NULL) {
|
||||
// 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)
|
||||
*anchorLocalTime = conn->last_anchor_local_time;
|
||||
}
|
||||
|
||||
@@ -1453,11 +1453,8 @@ void handle_setrateanchori(rtsp_conn_info *conn, rtsp_message *req, rtsp_message
|
||||
// debug(1, "anchor rtpTime is %" PRId64 ".", rtpTime);
|
||||
uint32_t anchorRTPTime = rtpTime;
|
||||
|
||||
int32_t added_latency = (int32_t)(config.audio_backend_latency_offset * conn->input_rate);
|
||||
// debug(1,"anchorRTPTime: %" PRIu32 ", added latency: %" PRId32 ".", anchorRTPTime,
|
||||
// added_latency);
|
||||
set_ptp_anchor_info(conn, conn->networkTimeTimelineID, anchorRTPTime - added_latency,
|
||||
anchorTimeNanoseconds);
|
||||
// Store the raw anchor; apply the latency offset when it is used.
|
||||
set_ptp_anchor_info(conn, conn->networkTimeTimelineID, anchorRTPTime, anchorTimeNanoseconds);
|
||||
}
|
||||
|
||||
item = plist_dict_get_item(messagePlist, "rate");
|
||||
|
||||
Reference in New Issue
Block a user