swr_free() already checks for nullness, no need to add the check in
calling code.
... | ... |
@@ -1963,8 +1963,7 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr) |
1963 | 1963 |
dec_channel_layout != is->audio_src.channel_layout || |
1964 | 1964 |
dec->sample_rate != is->audio_src.freq || |
1965 | 1965 |
(wanted_nb_samples != is->frame->nb_samples && !is->swr_ctx)) { |
1966 |
- if (is->swr_ctx) |
|
1967 |
- swr_free(&is->swr_ctx); |
|
1966 |
+ swr_free(&is->swr_ctx); |
|
1968 | 1967 |
is->swr_ctx = swr_alloc_set_opts(NULL, |
1969 | 1968 |
is->audio_tgt.channel_layout, is->audio_tgt.fmt, is->audio_tgt.freq, |
1970 | 1969 |
dec_channel_layout, dec->sample_fmt, dec->sample_rate, |
... | ... |
@@ -2268,8 +2267,7 @@ static void stream_component_close(VideoState *is, int stream_index) |
2268 | 2268 |
|
2269 | 2269 |
packet_queue_flush(&is->audioq); |
2270 | 2270 |
av_free_packet(&is->audio_pkt); |
2271 |
- if (is->swr_ctx) |
|
2272 |
- swr_free(&is->swr_ctx); |
|
2271 |
+ swr_free(&is->swr_ctx); |
|
2273 | 2272 |
av_freep(&is->audio_buf1); |
2274 | 2273 |
is->audio_buf = NULL; |
2275 | 2274 |
av_freep(&is->frame); |