mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
decode: delay NEWSEGMENT event if vaapidecode element was not linked.
Rationale: playbin2 links all elements at run-time. Once vaapidecode is created and a NEWSEGMENT event arrives, downstream element may not be ready yet. So, delay this event until next element is chained in, otherwise basesink could output "Received buffer without a new-segment. Assuming timestamps start from 0". Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
parent
baa80d9753
commit
d43f3dc50a
2 changed files with 31 additions and 1 deletions
|
@ -457,6 +457,11 @@ gst_vaapidecode_finalize(GObject *object)
|
|||
decode->allowed_caps = NULL;
|
||||
}
|
||||
|
||||
if (decode->delayed_new_seg) {
|
||||
gst_event_unref(decode->delayed_new_seg);
|
||||
decode->delayed_new_seg = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS(parent_class)->finalize(object);
|
||||
}
|
||||
|
||||
|
@ -654,7 +659,16 @@ gst_vaapidecode_set_caps(GstPad *pad, GstCaps *caps)
|
|||
return FALSE;
|
||||
if (!gst_vaapidecode_update_src_caps(decode, caps))
|
||||
return FALSE;
|
||||
return gst_vaapidecode_reset(decode, decode->sinkpad_caps);
|
||||
if (!gst_vaapidecode_reset(decode, decode->sinkpad_caps))
|
||||
return FALSE;
|
||||
|
||||
/* Propagate NEWSEGMENT event downstream, now that pads are linked */
|
||||
if (decode->delayed_new_seg) {
|
||||
if (gst_pad_push_event(decode->srcpad, decode->delayed_new_seg))
|
||||
gst_event_unref(decode->delayed_new_seg);
|
||||
decode->delayed_new_seg = NULL;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
|
@ -685,6 +699,20 @@ gst_vaapidecode_sink_event(GstPad *pad, GstEvent *event)
|
|||
GST_DEBUG("handle sink event '%s'", GST_EVENT_TYPE_NAME(event));
|
||||
|
||||
/* Propagate event downstream */
|
||||
switch (GST_EVENT_TYPE(event)) {
|
||||
case GST_EVENT_NEWSEGMENT:
|
||||
if (decode->delayed_new_seg) {
|
||||
gst_event_unref(decode->delayed_new_seg);
|
||||
decode->delayed_new_seg = NULL;
|
||||
}
|
||||
if (!GST_PAD_PEER(decode->srcpad)) {
|
||||
decode->delayed_new_seg = gst_event_ref(event);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return gst_pad_push_event(decode->srcpad, event);
|
||||
}
|
||||
|
||||
|
@ -726,6 +754,7 @@ gst_vaapidecode_init(GstVaapiDecode *decode, GstVaapiDecodeClass *klass)
|
|||
decode->decoder_ready = NULL;
|
||||
decode->decoder_caps = NULL;
|
||||
decode->allowed_caps = NULL;
|
||||
decode->delayed_new_seg = NULL;
|
||||
decode->use_ffmpeg = USE_FFMPEG_DEFAULT;
|
||||
decode->is_ready = FALSE;
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ struct _GstVaapiDecode {
|
|||
GCond *decoder_ready;
|
||||
GstCaps *decoder_caps;
|
||||
GstCaps *allowed_caps;
|
||||
GstEvent *delayed_new_seg;
|
||||
unsigned int use_ffmpeg : 1;
|
||||
unsigned int is_ready : 1;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue