vaapidecode: Skip unparsable units from adapter

If the unit could not be parsed, just skip this nal and keep parsing
what is left in the adapter. We need to flush the broken unit in the
decoder specific parser because the generic code does not know about
units boundary. This increases error resilliance.

Before this, the broken unit would stay in the adapter and EOS would be
returned. Which stopped the streaming. Just removing the EOS would have
lead to the adapter size growing indefinitely.

https://bugzilla.gnome.org/show_bug.cgi?id=796863
This commit is contained in:
Nicolas Dufresne 2018-07-25 13:50:23 -04:00
parent d07bffb578
commit 06aa82f989
3 changed files with 4 additions and 1 deletions

View file

@ -4640,6 +4640,7 @@ gst_vaapi_decoder_h264_parse (GstVaapiDecoder * base_decoder,
exit: exit:
{ {
gst_adapter_flush (adapter, unit->size);
gst_vaapi_parser_info_h264_unref (pi); gst_vaapi_parser_info_h264_unref (pi);
return status; return status;
} }

View file

@ -2984,6 +2984,7 @@ gst_vaapi_decoder_h265_parse (GstVaapiDecoder * base_decoder,
return GST_VAAPI_DECODER_STATUS_SUCCESS; return GST_VAAPI_DECODER_STATUS_SUCCESS;
exit: exit:
gst_adapter_flush (adapter, unit->size);
gst_vaapi_parser_info_h265_unref (pi); gst_vaapi_parser_info_h265_unref (pi);
return status; return status;
} }

View file

@ -1179,7 +1179,8 @@ gst_vaapidecode_parse_frame (GstVideoDecoder * vdec,
break; break;
default: default:
GST_ERROR ("parse error %d", status); GST_ERROR ("parse error %d", status);
ret = GST_FLOW_EOS; /* just keep parsing, the decoder should have flushed the broken unit */
ret = GST_VAAPI_DECODE_FLOW_PARSE_DATA;
decode->current_frame_size = 0; decode->current_frame_size = 0;
break; break;
} }