Commit 5950fc1a authored by Thibault Saunier's avatar Thibault Saunier 🌵 Committed by GStreamer Merge Bot

encodebasebin: Ensure that parsers are compatible with selected encoders

See #845

Part-of: <!963>
parent f573d912
Pipeline #252763 waiting for manual action with stages
in 40 seconds
......@@ -815,14 +815,25 @@ no_stream_group:
/* Create a parser for the given stream profile */
static inline GstElement *
_get_parser (GstEncodeBaseBin * ebin, GstEncodingProfile * sprof)
_get_parser (GstEncodeBaseBin * ebin, GstEncodingProfile * sprof,
GstElement * encoder)
{
GList *parsers1, *parsers, *tmp;
GstElement *parser = NULL;
GstElementFactory *parserfact = NULL;
GstCaps *format;
GstCaps *format = NULL;
format = gst_encoding_profile_get_format (sprof);
if (encoder) {
GstPadTemplate *template = gst_element_get_pad_template (encoder, "src");
if (template)
format = gst_pad_template_get_caps (template);
}
if (!format || gst_caps_is_any (format)) {
gst_clear_caps (&format);
format = gst_encoding_profile_get_format (sprof);
}
GST_DEBUG ("Getting list of parsers for format %" GST_PTR_FORMAT, format);
......@@ -1227,7 +1238,7 @@ setup_smart_encoder (GstEncodeBaseBin * ebin, GstEncodingProfile * sprof,
goto err;
}
parser = _get_parser (ebin, sprof);
parser = _get_parser (ebin, sprof, encoder);
sgroup->smart_capsfilter = gst_element_factory_make ("capsfilter", NULL);
reencoder_bin = gst_bin_new (NULL);
g_object_set (sgroup->smart_capsfilter, "caps", format, NULL);
......@@ -1412,9 +1423,8 @@ _create_stream_group (GstEncodeBaseBin * ebin, GstEncodingProfile * sprof,
goto outfilter_link_failure;
last = sgroup->outfilter;
sgroup->parser = _get_parser (ebin, sprof);
sgroup->encoder = _get_encoder (ebin, sprof);
sgroup->parser = _get_parser (ebin, sgroup->profile, sgroup->encoder);
if (sgroup->parser != NULL) {
GST_DEBUG ("Got a parser %s", GST_ELEMENT_NAME (sgroup->parser));
gst_bin_add (GST_BIN (ebin), sgroup->parser);
......@@ -1523,8 +1533,7 @@ _create_stream_group (GstEncodeBaseBin * ebin, GstEncodingProfile * sprof,
/* 1. Create the encoder */
GST_LOG ("Adding encoder");
sgroup->encoder = _get_encoder (ebin, sprof);
if (sgroup->encoder != NULL) {
if (sgroup->encoder) {
gst_bin_add ((GstBin *) ebin, sgroup->encoder);
tosync = g_list_append (tosync, sgroup->encoder);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment