mirror of
https://mirror.skon.top/https://github.com/FFmpeg/FFmpeg
synced 2026-04-20 12:50:49 +08:00
avformat/lcevc: return error when no valid NAL units are found
ff_lcvec_parse_config_record() returns success before this patch when no IDR or NON_IDR NAL units are found. Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
This commit is contained in:
@@ -183,6 +183,7 @@ int ff_lcvec_parse_config_record(LCEVCDecoderConfigurationRecord *lvcc,
|
||||
H2645Packet h2645_pkt = { 0 };
|
||||
AVIOContext *pb;
|
||||
int ret;
|
||||
int found;
|
||||
|
||||
if (size <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -221,6 +222,7 @@ int ff_lcvec_parse_config_record(LCEVCDecoderConfigurationRecord *lvcc,
|
||||
goto fail;
|
||||
|
||||
/* look for IDR or NON_IDR */
|
||||
found = 0;
|
||||
for (int i = 0; i < h2645_pkt.nb_nals; i++) {
|
||||
const H2645NAL *nal = &h2645_pkt.nals[i];
|
||||
|
||||
@@ -229,9 +231,15 @@ int ff_lcvec_parse_config_record(LCEVCDecoderConfigurationRecord *lvcc,
|
||||
ret = write_nalu(lvcc, pb, nal);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
found = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
fail:
|
||||
ffio_close_null_buf(pb);
|
||||
|
||||
Reference in New Issue
Block a user