From e11568c5b8c01195d049473f786f62a5dc3c1a44 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 3 Jun 2015 15:22:31 +0200 Subject: [PATCH] ptpclock: fix compilation Don't put code between declarations. Fix use of uninitialized variables --- libs/gst/net/gstptpclock.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/libs/gst/net/gstptpclock.c b/libs/gst/net/gstptpclock.c index 4755f08..59f516b 100644 --- a/libs/gst/net/gstptpclock.c +++ b/libs/gst/net/gstptpclock.c @@ -1039,19 +1039,26 @@ update_ptp_time (PtpDomainData * domain, PtpPendingSync * sync) gboolean synced; GstClockTimeDiff discont = 0; GstClockTime estimated_ptp_time = GST_CLOCK_TIME_NONE; - -#ifdef USE_ONLY_SYNC_WITH_DELAY - if (sync->delay_req_send_time_local == GST_CLOCK_TIME_NONE) - return; -#endif - #ifdef USE_MEASUREMENT_FILTERING GstClockTime orig_internal_time, orig_external_time, orig_rate_num, orig_rate_den; GstClockTime new_estimated_ptp_time; GstClockTime max_discont, estimated_ptp_time_min, estimated_ptp_time_max; gboolean now_synced; +#endif +#ifdef USE_ONLY_SYNC_WITH_DELAY + if (sync->delay_req_send_time_local == GST_CLOCK_TIME_NONE) + return; +#endif + + /* IEEE 1588 11.2 */ + corrected_ptp_time = + sync->sync_send_time_remote + + (sync->correction_field_sync + 32768) / 65536; + corrected_local_time = sync->sync_recv_time_local - domain->mean_path_delay; + +#ifdef USE_MEASUREMENT_FILTERING /* We check this here and when updating the mean path delay, because * we can get here without a delay response too */ if (sync->follow_up_recv_time_local != GST_CLOCK_TIME_NONE @@ -1061,16 +1068,11 @@ update_ptp_time (PtpDomainData * domain, PtpPendingSync * sync) " > 2 * %" GST_TIME_FORMAT, domain->domain, GST_TIME_ARGS (sync->follow_up_recv_time_local), GST_TIME_ARGS (domain->mean_path_delay)); + synced = FALSE; goto out; } #endif - /* IEEE 1588 11.2 */ - corrected_ptp_time = - sync->sync_send_time_remote + - (sync->correction_field_sync + 32768) / 65536; - corrected_local_time = sync->sync_recv_time_local - domain->mean_path_delay; - /* Set an initial local-remote relation */ if (domain->last_ptp_time == 0) gst_clock_set_calibration (domain->domain_clock, corrected_local_time, @@ -1263,7 +1265,7 @@ update_mean_path_delay (PtpDomainData * domain, PtpPendingSync * sync) gint i; #endif - GstClockTime mean_path_delay, delay_req_delay; + GstClockTime mean_path_delay, delay_req_delay = 0; gboolean ret; /* IEEE 1588 11.3 */ -- 2.7.4