Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2014-10-09 01:36:11 +0400
committerMarton Balint <cus@passwd.hu>2014-10-10 01:18:37 +0400
commitce928d7d2b3bd68a222cfbc19a44805ac4cdaf14 (patch)
tree8786db6e610abb2c45d0bcff6d3e912bdc88a07f /ffplay.c
parent8c6992bf0cc24542a5ae245cd037a23638b76d75 (diff)
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. Reviewed-by: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'ffplay.c')
-rw-r--r--ffplay.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ffplay.c b/ffplay.c
index 8fa5ca3677..37983e9f0f 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -2419,6 +2419,7 @@ static int audio_decode_frame(VideoState *is)
"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;
@@ -2454,7 +2455,8 @@ static int audio_decode_frame(VideoState *is)
}
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);