]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
If a PTP clock isn't available, use existing timing data if it's still valid.
authorMike Brady <4265913+mikebrady@users.noreply.github.com>
Thu, 13 May 2021 19:12:12 +0000 (20:12 +0100)
committerMike Brady <4265913+mikebrady@users.noreply.github.com>
Thu, 13 May 2021 19:12:12 +0000 (20:12 +0100)
rtp.c

diff --git a/rtp.c b/rtp.c
index 2dd5f185c84929661c0eb843259d0b00b45d5b7a..ab85cc097b79b8e0b06d042d3837777a255d1391 100644 (file)
--- a/rtp.c
+++ b/rtp.c
@@ -1274,7 +1274,7 @@ int get_ptp_anchor_local_time_info(rtsp_conn_info *conn, uint32_t *anchorRTP,
   if ((clock_status_t)response != conn->clock_status) {
     switch (response) {
     case clock_ok:
-      debug(1, "Connection %d: NQPTP clock is valid and available.", conn->connection_number);
+      debug(1, "Connection %d: NQPTP clock % " PRIx64 " on line.", conn->connection_number, actual_clock_id);
       break;
     case clock_service_unavailable:
       debug(1, "Connection %d: NQPTP clock is not available.", conn->connection_number);
@@ -1311,6 +1311,14 @@ int get_ptp_anchor_local_time_info(rtsp_conn_info *conn, uint32_t *anchorRTP,
     }
     conn->clock_status = response;
   }
+  
+  if ((response != clock_ok) && (conn->last_anchor_info_is_valid != 0)) {
+    if (anchorRTP != NULL)
+      *anchorRTP = conn->anchor_rtptime;
+    if (anchorLocalTime != NULL)
+      *anchorLocalTime = conn->anchor_time - conn->last_anchor_clock_offset;
+    response = clock_ok;
+  }
   return response;
 }