Skip to content

Commit

Permalink
ad_spdif: check return value of av_parser_parse2
Browse files Browse the repository at this point in the history
  • Loading branch information
kasper93 committed May 22, 2024
1 parent 82ce07d commit 7923a63
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions audio/decode/ad_spdif.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7923a63

Please sign in to comment.