mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
h264parse: init pps and sps structures before parsing
... which arranges for a valid fallback id, and allows to continue best effort processing even when sps/pps parsing fails.
This commit is contained in:
parent
a0d88d5ff5
commit
f2191d403c
1 changed files with 12 additions and 6 deletions
|
@ -435,10 +435,11 @@ static void
|
||||||
gst_h264_parse_process_nal (GstH264Parse * h264parse, GstH264NalUnit * nalu)
|
gst_h264_parse_process_nal (GstH264Parse * h264parse, GstH264NalUnit * nalu)
|
||||||
{
|
{
|
||||||
guint nal_type;
|
guint nal_type;
|
||||||
GstH264PPS pps;
|
GstH264PPS pps = { 0, };
|
||||||
GstH264SPS sps;
|
GstH264SPS sps = { 0, };
|
||||||
GstH264SEIMessage sei;
|
GstH264SEIMessage sei;
|
||||||
GstH264NalParser *nalparser = h264parse->nalparser;
|
GstH264NalParser *nalparser = h264parse->nalparser;
|
||||||
|
GstH264ParserResult pres;
|
||||||
|
|
||||||
/* nothing to do for broken input */
|
/* nothing to do for broken input */
|
||||||
if (G_UNLIKELY (nalu->size < 2)) {
|
if (G_UNLIKELY (nalu->size < 2)) {
|
||||||
|
@ -455,8 +456,10 @@ gst_h264_parse_process_nal (GstH264Parse * h264parse, GstH264NalUnit * nalu)
|
||||||
|
|
||||||
switch (nal_type) {
|
switch (nal_type) {
|
||||||
case GST_H264_NAL_SPS:
|
case GST_H264_NAL_SPS:
|
||||||
gst_h264_parser_parse_sps (nalparser, nalu, &sps, TRUE);
|
pres = gst_h264_parser_parse_sps (nalparser, nalu, &sps, TRUE);
|
||||||
/* TODO: check for failure (sps.id not set) */
|
/* arranged for a fallback sps.id, so use that one and only warn */
|
||||||
|
if (pres != GST_H264_PARSER_OK)
|
||||||
|
GST_WARNING_OBJECT (h264parse, "failed to parse SPS:");
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (h264parse, "triggering src caps check");
|
GST_DEBUG_OBJECT (h264parse, "triggering src caps check");
|
||||||
h264parse->update_caps = TRUE;
|
h264parse->update_caps = TRUE;
|
||||||
|
@ -473,8 +476,11 @@ gst_h264_parse_process_nal (GstH264Parse * h264parse, GstH264NalUnit * nalu)
|
||||||
gst_h264_parser_store_nal (h264parse, sps.id, nal_type, nalu);
|
gst_h264_parser_store_nal (h264parse, sps.id, nal_type, nalu);
|
||||||
break;
|
break;
|
||||||
case GST_H264_NAL_PPS:
|
case GST_H264_NAL_PPS:
|
||||||
gst_h264_parser_parse_pps (nalparser, nalu, &pps);
|
pres = gst_h264_parser_parse_pps (nalparser, nalu, &pps);
|
||||||
/* TODO: check for failure (pps.id not set) */
|
/* arranged for a fallback pps.id, so use that one and only warn */
|
||||||
|
if (pres != GST_H264_PARSER_OK)
|
||||||
|
GST_WARNING_OBJECT (h264parse, "failed to parse PPS:");
|
||||||
|
|
||||||
/* parameters might have changed, force caps check */
|
/* parameters might have changed, force caps check */
|
||||||
GST_DEBUG_OBJECT (h264parse, "triggering src caps check");
|
GST_DEBUG_OBJECT (h264parse, "triggering src caps check");
|
||||||
h264parse->update_caps = TRUE;
|
h264parse->update_caps = TRUE;
|
||||||
|
|
Loading…
Reference in a new issue