提交 d22eb3b8 编写于 作者: Z Zhang Rui

ff_ffplay: merge ce928d7d2b3bd68a222cfbc19a44805ac4cdaf14

ffplay: dont leave swresampler in half initialized state

On init failure, let's just free it, so next time it will be recreated from
start.

Also fixes Coverity CID 1241515.
上级 b4d9693e
......@@ -1651,6 +1651,7 @@ static int audio_decode_frame(FFPlayer *ffp)
"Cannot create sample rate converter for conversion of %d Hz %s %d channels to %d Hz %s %d channels!\n",
is->frame->sample_rate, av_get_sample_fmt_name(is->frame->format), av_frame_get_channels(is->frame),
is->audio_tgt.freq, av_get_sample_fmt_name(is->audio_tgt.fmt), is->audio_tgt.channels);
swr_free(&is->swr_ctx);
break;
}
is->audio_src.channel_layout = dec_channel_layout;
......@@ -1686,7 +1687,8 @@ static int audio_decode_frame(FFPlayer *ffp)
}
if (len2 == out_count) {
av_log(NULL, AV_LOG_WARNING, "audio buffer is probably too small\n");
swr_init(is->swr_ctx);
if (swr_init(is->swr_ctx) < 0)
swr_free(&is->swr_ctx);
}
is->audio_buf = is->audio_buf1;
resampled_data_size = len2 * is->audio_tgt.channels * av_get_bytes_per_sample(is->audio_tgt.fmt);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册