mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 05:31:15 +00:00
queue/queue2: Use GST_BUFFER_DTS_OR_PTS
The input of queue/queue2 might have DTS set, in which cas we want to take that into account (instead of the PTS) to calculate position and queue levels. https://bugzilla.gnome.org/show_bug.cgi?id=756507
This commit is contained in:
parent
692c0dc060
commit
a9c923d585
2 changed files with 17 additions and 12 deletions
|
@ -601,7 +601,7 @@ apply_buffer (GstQueue * queue, GstBuffer * buffer, GstSegment * segment,
|
|||
{
|
||||
GstClockTime duration, timestamp;
|
||||
|
||||
timestamp = GST_BUFFER_TIMESTAMP (buffer);
|
||||
timestamp = GST_BUFFER_DTS_OR_PTS (buffer);
|
||||
duration = GST_BUFFER_DURATION (buffer);
|
||||
|
||||
/* if no timestamp is set, assume it's continuous with the previous
|
||||
|
@ -631,14 +631,16 @@ static gboolean
|
|||
buffer_list_apply_time (GstBuffer ** buf, guint idx, gpointer user_data)
|
||||
{
|
||||
GstClockTime *timestamp = user_data;
|
||||
GstClockTime btime;
|
||||
|
||||
GST_TRACE ("buffer %u has ts %" GST_TIME_FORMAT
|
||||
" duration %" GST_TIME_FORMAT, idx,
|
||||
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (*buf)),
|
||||
GST_TRACE ("buffer %u has pts %" GST_TIME_FORMAT " dts %" GST_TIME_FORMAT
|
||||
" duration %" GST_TIME_FORMAT, idx, GST_TIME_ARGS (GST_BUFFER_DTS (*buf)),
|
||||
GST_TIME_ARGS (GST_BUFFER_PTS (*buf)),
|
||||
GST_TIME_ARGS (GST_BUFFER_DURATION (*buf)));
|
||||
|
||||
if (GST_BUFFER_TIMESTAMP_IS_VALID (*buf))
|
||||
*timestamp = GST_BUFFER_TIMESTAMP (*buf);
|
||||
btime = GST_BUFFER_DTS_OR_PTS (*buf);
|
||||
if (GST_CLOCK_TIME_IS_VALID (btime))
|
||||
*timestamp = btime;
|
||||
|
||||
if (GST_BUFFER_DURATION_IS_VALID (*buf))
|
||||
*timestamp += GST_BUFFER_DURATION (*buf);
|
||||
|
@ -1146,7 +1148,7 @@ gst_queue_chain_buffer_or_list (GstPad * pad, GstObject * parent,
|
|||
GstClockTime duration, timestamp;
|
||||
GstBuffer *buffer = GST_BUFFER_CAST (obj);
|
||||
|
||||
timestamp = GST_BUFFER_TIMESTAMP (buffer);
|
||||
timestamp = GST_BUFFER_DTS_OR_PTS (buffer);
|
||||
duration = GST_BUFFER_DURATION (buffer);
|
||||
|
||||
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "received buffer %p of size %"
|
||||
|
|
|
@ -750,7 +750,7 @@ apply_buffer (GstQueue2 * queue, GstBuffer * buffer, GstSegment * segment,
|
|||
{
|
||||
GstClockTime duration, timestamp;
|
||||
|
||||
timestamp = GST_BUFFER_TIMESTAMP (buffer);
|
||||
timestamp = GST_BUFFER_DTS_OR_PTS (buffer);
|
||||
duration = GST_BUFFER_DURATION (buffer);
|
||||
|
||||
/* if no timestamp is set, assume it's continuous with the previous
|
||||
|
@ -780,14 +780,17 @@ static gboolean
|
|||
buffer_list_apply_time (GstBuffer ** buf, guint idx, gpointer data)
|
||||
{
|
||||
GstClockTime *timestamp = data;
|
||||
GstClockTime btime;
|
||||
|
||||
GST_TRACE ("buffer %u has ts %" GST_TIME_FORMAT
|
||||
GST_TRACE ("buffer %u has pts %" GST_TIME_FORMAT " dts %" GST_TIME_FORMAT
|
||||
" duration %" GST_TIME_FORMAT, idx,
|
||||
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (*buf)),
|
||||
GST_TIME_ARGS (GST_BUFFER_PTS (*buf)),
|
||||
GST_TIME_ARGS (GST_BUFFER_DTS (*buf)),
|
||||
GST_TIME_ARGS (GST_BUFFER_DURATION (*buf)));
|
||||
|
||||
if (GST_BUFFER_TIMESTAMP_IS_VALID (*buf))
|
||||
*timestamp = GST_BUFFER_TIMESTAMP (*buf);
|
||||
btime = GST_BUFFER_DTS_OR_PTS (*buf);
|
||||
if (GST_CLOCK_TIME_IS_VALID (btime))
|
||||
*timestamp = btime;
|
||||
|
||||
if (GST_BUFFER_DURATION_IS_VALID (*buf))
|
||||
*timestamp += GST_BUFFER_DURATION (*buf);
|
||||
|
|
Loading…
Reference in a new issue