mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
[MOVED FROM GST-P-FARSIGHT] Create generic segment is none received and refuse non-time segments
20080501182554-3e2dc-ace5ca000414428d6d94478adc5927c9f91975df.gz
This commit is contained in:
parent
c6df5201b0
commit
312b4156c1
1 changed files with 25 additions and 0 deletions
|
@ -806,6 +806,18 @@ gst_live_live_adder_chain (GstPad *pad, GstBuffer *buffer)
|
|||
if (!GST_BUFFER_TIMESTAMP_IS_VALID(buffer))
|
||||
goto invalid_timestamp;
|
||||
|
||||
if (padprivate->segment.format == GST_FORMAT_UNDEFINED)
|
||||
{
|
||||
GST_WARNING_OBJECT (adder, "No new-segment received,"
|
||||
" initializing segment with time 0..-1");
|
||||
gst_segment_init (&padprivate->segment, GST_FORMAT_TIME);
|
||||
gst_segment_set_newsegment (&padprivate->segment,
|
||||
FALSE, 1.0, GST_FORMAT_TIME, 0, -1, 0);
|
||||
}
|
||||
|
||||
if (padprivate->segment.format == GST_FORMAT_TIME)
|
||||
goto invalid_segment;
|
||||
|
||||
/* Just see if we receive invalid timestamp/durations */
|
||||
if (GST_CLOCK_TIME_IS_VALID (padprivate->expected_timestamp) &&
|
||||
!GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_DISCONT) &&
|
||||
|
@ -983,6 +995,19 @@ gst_live_live_adder_chain (GstPad *pad, GstBuffer *buffer)
|
|||
("Invalid timestamp received on buffer"));
|
||||
|
||||
return GST_FLOW_ERROR;
|
||||
|
||||
invalid_segment:
|
||||
{
|
||||
const gchar *format = gst_format_get_name (padprivate->segment.format);
|
||||
GST_OBJECT_UNLOCK (adder);
|
||||
gst_buffer_unref (buffer);
|
||||
GST_ELEMENT_ERROR (adder, STREAM, FAILED,
|
||||
("This element only supports TIME segments, received other type"),
|
||||
("Received a segment of type %s, only support time segment", format));
|
||||
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue