mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
basevideodecoder: create new segments if missing
This commit is contained in:
parent
99a88edcc1
commit
13848cc93b
2 changed files with 25 additions and 0 deletions
|
@ -262,6 +262,7 @@ gst_base_video_decoder_sink_event (GstPad * pad, GstEvent * event)
|
|||
|
||||
gst_segment_set_newsegment_full (segment,
|
||||
update, rate, applied_rate, format, start, stop, position);
|
||||
base_video_decoder->have_segment = TRUE;
|
||||
|
||||
GST_WARNING ("new segment: format %d rate %g start %" GST_TIME_FORMAT
|
||||
" stop %" GST_TIME_FORMAT
|
||||
|
@ -791,6 +792,29 @@ gst_base_video_decoder_chain (GstPad * pad, GstBuffer * buf)
|
|||
|
||||
GST_DEBUG_OBJECT (base_video_decoder, "chain");
|
||||
|
||||
if (!base_video_decoder->have_segment) {
|
||||
GstEvent *event;
|
||||
GstFlowReturn ret;
|
||||
|
||||
GST_WARNING
|
||||
("Received buffer without a new-segment. Assuming timestamps start from 0.");
|
||||
|
||||
gst_segment_set_newsegment_full (&base_video_decoder->segment,
|
||||
FALSE, 1.0, 1.0, GST_FORMAT_TIME, 0, GST_CLOCK_TIME_NONE, 0);
|
||||
base_video_decoder->have_segment = TRUE;
|
||||
|
||||
event = gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 0,
|
||||
GST_CLOCK_TIME_NONE, 0);
|
||||
|
||||
ret =
|
||||
gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder),
|
||||
event);
|
||||
if (!ret) {
|
||||
GST_ERROR ("new segment event ret=%d", ret);
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DISCONT))) {
|
||||
GST_DEBUG_OBJECT (base_video_decoder, "received DISCONT buffer");
|
||||
gst_base_video_decoder_reset (base_video_decoder);
|
||||
|
|
|
@ -116,6 +116,7 @@ struct _GstBaseVideoDecoder
|
|||
gboolean packetized;
|
||||
|
||||
GList *timestamps;
|
||||
gboolean have_segment;
|
||||
};
|
||||
|
||||
struct _GstBaseVideoDecoderClass
|
||||
|
|
Loading…
Reference in a new issue