From 96de71d74b3f4d2fc3c6a675dab86ac00a0c151a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Urba=C5=84ski?= Date: Tue, 16 Mar 2010 23:32:45 +0100 Subject: [PATCH] flvmux: don't put timestamps larger than G_MAXINT32 in the FLV tags For non-live input respond by pushing EOS, for live wrap the timestamps every G_MAXINT32 miliseconds. Fixes #613003. --- gst/flv/gstflvmux.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gst/flv/gstflvmux.c b/gst/flv/gstflvmux.c index efaca19..4b12715 100644 --- a/gst/flv/gstflvmux.c +++ b/gst/flv/gstflvmux.c @@ -896,6 +896,8 @@ gst_flv_mux_buffer_to_tag_internal (GstFlvMux * mux, GstBuffer * buffer, data[2] = ((size - 11 - 4) >> 8) & 0xff; data[3] = ((size - 11 - 4) >> 0) & 0xff; + /* wrap the timestamp every G_MAXINT32 miliseconds */ + timestamp &= 0x7fffffff; data[4] = (timestamp >> 16) & 0xff; data[5] = (timestamp >> 8) & 0xff; data[6] = (timestamp >> 0) & 0xff; @@ -1345,8 +1347,11 @@ gst_flv_mux_collected (GstCollectPads * pads, gpointer user_data) } } - if (GST_CLOCK_TIME_IS_VALID (best_time) - && best_time / GST_MSECOND > G_MAXUINT32) { + /* The FLV timestamp is an int32 field. For non-live streams error out if a + bigger timestamp is seen, for live the timestamp will get wrapped in + gst_flv_mux_buffer_to_tag */ + if (!mux->is_live && GST_CLOCK_TIME_IS_VALID (best_time) + && best_time / GST_MSECOND > G_MAXINT32) { GST_WARNING_OBJECT (mux, "Timestamp larger than FLV supports - EOS"); eos = TRUE; } -- 2.7.4