mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
flvmux: Ensure Timestamp starts at 0
FLV documentation stipulates that timestamp must start at zero. In order to respect this rule, keep the first timestamp around and offset the timestamp from this value. This allow for longer recording time in presence of timestamp that does not start at 0 already. https://bugzilla.gnome.org/show_bug.cgi?id=731352
This commit is contained in:
parent
ff2bce7b26
commit
c1e7bec616
2 changed files with 8 additions and 0 deletions
|
@ -529,6 +529,7 @@ gst_flv_mux_reset_pad (GstFlvMux * mux, GstFlvPad * cpad, gboolean video)
|
|||
gst_buffer_unref (cpad->video_codec_data);
|
||||
cpad->video_codec_data = NULL;
|
||||
cpad->video_codec = G_MAXUINT;
|
||||
cpad->first_timestamp = GST_CLOCK_TIME_NONE;
|
||||
cpad->last_timestamp = 0;
|
||||
}
|
||||
|
||||
|
@ -1020,6 +1021,12 @@ gst_flv_mux_buffer_to_tag_internal (GstFlvMux * mux, GstBuffer * buffer,
|
|||
else
|
||||
cts = 0;
|
||||
|
||||
if (!GST_CLOCK_TIME_IS_VALID (cpad->first_timestamp))
|
||||
cpad->first_timestamp = dts;
|
||||
|
||||
/* Timestamp must start at zero */
|
||||
dts -= cpad->first_timestamp;
|
||||
|
||||
GST_LOG_OBJECT (mux, "got pts %i dts %i cts %i\n", pts, dts, cts);
|
||||
|
||||
gst_buffer_map (buffer, &map, GST_MAP_READ);
|
||||
|
|
|
@ -53,6 +53,7 @@ typedef struct
|
|||
GstBuffer *video_codec_data;
|
||||
|
||||
GstClockTime last_timestamp;
|
||||
GstClockTime first_timestamp;
|
||||
} GstFlvPad;
|
||||
|
||||
typedef enum
|
||||
|
|
Loading…
Reference in a new issue