For DRC (container) streams H264parse is not providing updated caps(width/resolution)
For container streams, H264parse overrides width/height values from upstream as per sink_caps, but for DRC streams it provides old resolutions even after resolution changed (Basically upstream is not updating the value in sink_caps), Due to that DRC container streams are failing. Check below code snippet of H264parse:
/* sps should give this but upstream overrides */
if (s && gst_structure_has_field (s, "width"))
gst_structure_get_int (s, "width", &width);
else
width = h264parse->width;
if (s && gst_structure_has_field (s, "height"))
gst_structure_get_int (s, "height", &height);
else
height = h264parse->height;
For DRC elementary streams sink_caps will be NULL, so "if (s && gst_structure_has_field (s, "width"))" and "if (s && gst_structure_has_field (s, "height"))" will be false and H264parse will use SPS parsed resolution and that is why it works.
If I take SPS parsed resolution, then it works fine for both DRC container and elementary streams. Below code works fine for both the cases:
#if 0
/* sps should give this but upstream overrides */
if (s && gst_structure_has_field (s, "width"))
gst_structure_get_int (s, "width", &width);
else
width = h264parse->width;
if (s && gst_structure_has_field (s, "height"))
gst_structure_get_int (s, "height", &height);
else
height = h264parse->height;
#else
/* do not override with upstream caps, use sps parsed resolution */
width = h264parse->width;
height = h264parse->height;
#endif
I am using GStreamer 1.16.3 on Ubuntu 20.04.5