ad_spdif: check return value of av_parser_parse2

This commit is contained in:
Kacper Michajłow 2024-05-20 20:44:33 +02:00
parent 82ce07d640
commit 7923a633a0
1 changed files with 5 additions and 4 deletions

View File

@ -118,10 +118,11 @@ static void determine_codec_params(struct mp_filter *da, AVPacket *pkt,
uint8_t *d = NULL;
int s = 0;
av_parser_parse2(parser, ctx, &d, &s, pkt->data, pkt->size, 0, 0, 0);
*out_profile = profile = ctx->profile;
*out_rate = ctx->sample_rate;
spdif_ctx->codec->codec_profile = avcodec_profile_name(spdif_ctx->codec_id, profile);
if (av_parser_parse2(parser, ctx, &d, &s, pkt->data, pkt->size, 0, 0, 0) > 0) {
*out_profile = profile = ctx->profile;
*out_rate = ctx->sample_rate;
spdif_ctx->codec->codec_profile = avcodec_profile_name(spdif_ctx->codec_id, profile);
}
avcodec_free_context(&ctx);
av_parser_close(parser);