mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 11:11:08 +00:00
rtmp2sink: Initialize base_ts / last_ts with the actual first observed timestamp
Initializing it with zero can falsely trigger the overflow / underflow detection code if the first observed timestamp is a big integer. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7786>
This commit is contained in:
parent
5dd2a497be
commit
5b6c76008b
1 changed files with 25 additions and 21 deletions
|
@ -533,8 +533,8 @@ gst_rtmp2_sink_start (GstBaseSink * sink)
|
||||||
self->running = TRUE;
|
self->running = TRUE;
|
||||||
self->cancellable = g_cancellable_new ();
|
self->cancellable = g_cancellable_new ();
|
||||||
self->stream_id = 0;
|
self->stream_id = 0;
|
||||||
self->last_ts = 0;
|
self->last_ts = GST_CLOCK_TIME_NONE;
|
||||||
self->base_ts = 0;
|
self->base_ts = GST_CLOCK_TIME_NONE;
|
||||||
|
|
||||||
if (async) {
|
if (async) {
|
||||||
gst_task_start (self->task);
|
gst_task_start (self->task);
|
||||||
|
@ -700,6 +700,9 @@ buffer_to_message (GstRtmp2Sink * self, GstBuffer * buffer, GstBuffer ** outbuf)
|
||||||
|
|
||||||
/* flvmux timestamps roll over after about 49 days */
|
/* flvmux timestamps roll over after about 49 days */
|
||||||
timestamp = header.timestamp;
|
timestamp = header.timestamp;
|
||||||
|
if (self->base_ts == GST_CLOCK_TIME_NONE) {
|
||||||
|
self->last_ts = self->base_ts = timestamp;
|
||||||
|
} else {
|
||||||
if (timestamp + self->base_ts + G_MAXINT32 < self->last_ts) {
|
if (timestamp + self->base_ts + G_MAXINT32 < self->last_ts) {
|
||||||
GST_WARNING_OBJECT (self, "Timestamp regression %" G_GUINT64_FORMAT
|
GST_WARNING_OBJECT (self, "Timestamp regression %" G_GUINT64_FORMAT
|
||||||
" -> %" G_GUINT64_FORMAT "; assuming overflow", self->last_ts,
|
" -> %" G_GUINT64_FORMAT "; assuming overflow", self->last_ts,
|
||||||
|
@ -721,6 +724,7 @@ buffer_to_message (GstRtmp2Sink * self, GstBuffer * buffer, GstBuffer ** outbuf)
|
||||||
}
|
}
|
||||||
timestamp += self->base_ts;
|
timestamp += self->base_ts;
|
||||||
self->last_ts = timestamp;
|
self->last_ts = timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
gst_buffer_unmap (buffer, &info);
|
gst_buffer_unmap (buffer, &info);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue