mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 07:16:55 +00:00
legacyh264parse: Delay pushing buffers until we have width/height
This commit is contained in:
parent
45e87e8cce
commit
219c90ce34
1 changed files with 33 additions and 1 deletions
|
@ -1602,6 +1602,8 @@ gst_h264_parse_push_codec_buffer (GstH264Parse * h264parse, GstBuffer * nal,
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_h264_parse_push_buffer (GstH264Parse * h264parse, GstBuffer * buf)
|
gst_h264_parse_push_buffer (GstH264Parse * h264parse, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
|
GstFlowReturn res = GST_FLOW_OK;
|
||||||
|
|
||||||
/* We can send pending events if this is the first call, since we now have
|
/* We can send pending events if this is the first call, since we now have
|
||||||
* caps for the srcpad */
|
* caps for the srcpad */
|
||||||
if (G_UNLIKELY (h264parse->pending_segment != NULL)) {
|
if (G_UNLIKELY (h264parse->pending_segment != NULL)) {
|
||||||
|
@ -1619,6 +1621,33 @@ gst_h264_parse_push_buffer (GstH264Parse * h264parse, GstBuffer * buf)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (G_UNLIKELY (h264parse->width == 0 || h264parse->height == 0)) {
|
||||||
|
GST_DEBUG ("Delaying actual push until we are configured");
|
||||||
|
h264parse->gather = g_list_append (h264parse->gather, buf);
|
||||||
|
goto beach;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (G_UNLIKELY (h264parse->gather)) {
|
||||||
|
GList *pendingbuffers = h264parse->gather;
|
||||||
|
GList *tmp;
|
||||||
|
|
||||||
|
GST_DEBUG ("Pushing out pending buffers");
|
||||||
|
|
||||||
|
/* Yes, we're recursively calling in... */
|
||||||
|
h264parse->gather = NULL;
|
||||||
|
for (tmp = pendingbuffers; tmp; tmp = tmp->next) {
|
||||||
|
res = gst_h264_parse_push_buffer (h264parse, (GstBuffer *) tmp->data);
|
||||||
|
if (res != GST_FLOW_OK && res != GST_FLOW_NOT_LINKED)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
g_list_free (pendingbuffers);
|
||||||
|
|
||||||
|
if (res != GST_FLOW_OK && res != GST_FLOW_NOT_LINKED) {
|
||||||
|
gst_buffer_unref (buf);
|
||||||
|
goto beach;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* start of picture is good time to slip in codec_data NALUs
|
/* start of picture is good time to slip in codec_data NALUs
|
||||||
* (when outputting NALS and transforming to bytestream) */
|
* (when outputting NALS and transforming to bytestream) */
|
||||||
if (G_UNLIKELY (h264parse->codec_nals && h264parse->picture_start)) {
|
if (G_UNLIKELY (h264parse->codec_nals && h264parse->picture_start)) {
|
||||||
|
@ -1740,7 +1769,10 @@ gst_h264_parse_push_buffer (GstH264Parse * h264parse, GstBuffer * buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_buffer_set_caps (buf, h264parse->src_caps);
|
gst_buffer_set_caps (buf, h264parse->src_caps);
|
||||||
return gst_pad_push (h264parse->srcpad, buf);
|
res = gst_pad_push (h264parse->srcpad, buf);
|
||||||
|
|
||||||
|
beach:
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* takes over ownership of nal and returns fresh buffer */
|
/* takes over ownership of nal and returns fresh buffer */
|
||||||
|
|
Loading…
Reference in a new issue