h26xparse: bypass check for length_size_minus_one

fix playback fail, when some file with length_size_minus_one == 2

According to the spec 2 cannot be a valid value, so that stream has a
bad config record. but breaking the decoding because of that, perhaps is too much.
and ffmpeg seem not check this

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7213>
This commit is contained in:
Qian Hu (胡骞) 2024-07-22 21:29:38 +08:00 committed by GStreamer Marge Bot
parent 734f1b47a2
commit 104dcc90f1
3 changed files with 5 additions and 7 deletions

View file

@ -3781,8 +3781,6 @@ gst_h264_parser_parse_decoder_config_record (GstH264NalParser * nalparser,
if (ret->length_size_minus_one == 2) {
/* "length_size_minus_one + 1" should be 1, 2, or 4 */
GST_WARNING ("Wrong nal-length-size");
result = GST_H264_PARSER_ERROR;
goto error;
}
/* reserved 3bits */

View file

@ -5093,8 +5093,6 @@ gst_h265_parser_parse_decoder_config_record (GstH265Parser * parser,
if (ret->length_size_minus_one == 2) {
/* "length_size_minus_one + 1" should be 1, 2, or 4 */
GST_WARNING ("Wrong nal-length-size");
result = GST_H265_PARSER_ERROR;
goto error;
}
READ_CONFIG_UINT8 (num_of_arrays, 8);

View file

@ -845,12 +845,14 @@ GST_START_TEST (test_h264_decoder_config_record)
assert_equals_int (ret, GST_H264_PARSER_ERROR);
fail_unless (config == NULL);
/* wrong length size, return error with null config data */
/* wrong length size, since we still try to use it. so return ok */
ret = gst_h264_parser_parse_decoder_config_record (parser,
h264_wrong_length_size_codec_data,
sizeof (h264_wrong_length_size_codec_data), &config);
assert_equals_int (ret, GST_H264_PARSER_ERROR);
fail_unless (config == NULL);
assert_equals_int (ret, GST_H264_PARSER_OK);
fail_unless (config != NULL);
assert_equals_int (config->length_size_minus_one, 2);
g_clear_pointer (&config, gst_h264_decoder_config_record_free);
gst_h264_nal_parser_free (parser);
}