avtp: crf: Properly handling one timestamp per PDU

The average_period should always represent the time between two
events. The specification defines the event time as the time
between audio samples, video frame sync, video line sync, etc.
In case of one timestamp per PDU the timestamp_interval identifies
the amount of events between the timestamp of one PDU and the
timestamp of the next PDU.
As described in IEEE 1722-2016 chapter
"10.4.12 timestamp_interval field" timestamp_interval shall be
nonzero.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1076>
This commit is contained in:
Timo Wischer 2020-09-16 17:12:32 +02:00
parent 49449dfa41
commit 5a9e9895ab
2 changed files with 5 additions and 1 deletions

View file

@ -451,7 +451,8 @@ calculate_average_period (GstAvtpCrfBase * avtpcrfbase,
} }
data->past_periods[past_periods_iter] = data->past_periods[past_periods_iter] =
first_pkt_tstamp - data->last_received_tstamp; (first_pkt_tstamp - data->last_received_tstamp) /
data->timestamp_interval;
data->last_received_tstamp = first_pkt_tstamp; data->last_received_tstamp = first_pkt_tstamp;
data->last_seqnum = seqnum; data->last_seqnum = seqnum;
} else { } else {

View file

@ -54,6 +54,9 @@ struct _GstAvtpCrfThreadData
GstClockTime *past_periods; GstClockTime *past_periods;
int past_periods_iter; int past_periods_iter;
int periods_stored; int periods_stored;
/** The time in ns between two events. The type of the event is depending on
* the CRF type: Audio sample, video frame sync, video line sync, ...
*/
GstClockTime average_period; GstClockTime average_period;
GstClockTime current_ts; GstClockTime current_ts;
GstClockTime last_received_tstamp; GstClockTime last_received_tstamp;