summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2024-03-13 19:12:48 +0200
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2024-03-14 04:14:47 +0000
commit861af55188242a9eb7432f9131bbdd1a4c2e2f8d (patch)
treee522632ea9d2aceeed9d4f4a25f771b5b155adf2
parent6e9249b078e450621a7140c9bb78e53c1973e038 (diff)
ptp: Initialize expected DELAY_REQ seqnum to an invalid value
This allows distinguishing pending syncs that didn't have a DELAY_REQ sent from ones that did but used a seqnum of 0, like the very first one. Specifically, if the first one or more syncs are still pending and we send the first DELAY_REQ for a later pending sync, then the DELAY_RESP would've been wrongly associated to the very first pending sync because of the seqnum. Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3383 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6368>
-rw-r--r--subprojects/gstreamer/libs/gst/net/gstptpclock.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/subprojects/gstreamer/libs/gst/net/gstptpclock.c b/subprojects/gstreamer/libs/gst/net/gstptpclock.c
index 5a664cae5b..9a29c8868e 100644
--- a/subprojects/gstreamer/libs/gst/net/gstptpclock.c
+++ b/subprojects/gstreamer/libs/gst/net/gstptpclock.c
@@ -279,13 +279,13 @@ typedef struct
guint domain;
PtpClockIdentity master_clock_identity;
- guint16 sync_seqnum;
+ guint32 sync_seqnum;
GstClockTime sync_recv_time_local; /* t2 */
GstClockTime sync_send_time_remote; /* t1, might be -1 if FOLLOW_UP pending */
GstClockTime follow_up_recv_time_local;
GSource *timeout_source;
- guint16 delay_req_seqnum;
+ guint32 delay_req_seqnum;
GstClockTime delay_req_send_time_local; /* t3, -1 if we wait for FOLLOW_UP */
GstClockTime delay_req_recv_time_remote; /* t4, -1 if we wait */
GstClockTime delay_resp_recv_time_local;
@@ -1564,6 +1564,7 @@ handle_sync_message (PtpMessage * msg, GstClockTime receive_time)
sync->delay_req_send_time_local = GST_CLOCK_TIME_NONE;
sync->delay_req_recv_time_remote = GST_CLOCK_TIME_NONE;
sync->delay_resp_recv_time_local = GST_CLOCK_TIME_NONE;
+ sync->delay_req_seqnum = G_MAXUINT32;
/* 0.5 correction factor for division later */
sync->correction_field_sync = msg->correction_field;