[FFmpeg-cvslog] ffplay: avoid useless NULL checks in swr_free()

Stefano Sabatini git at videolan.org
Fri Jun 29 13:25:54 CEST 2012


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Thu Jun 28 23:52:28 2012 +0200| [4fd07b9366fb2f74b6af0dea8092d6bafa38f131] | committer: Stefano Sabatini

ffplay: avoid useless NULL checks in swr_free()

swr_free() already checks for nullness, no need to add the check in
calling code.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4fd07b9366fb2f74b6af0dea8092d6bafa38f131
---

 ffplay.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/ffplay.c b/ffplay.c
index 6d7d289..91d1d8e 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -1963,8 +1963,7 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr)
                 dec_channel_layout != is->audio_src.channel_layout ||
                 dec->sample_rate != is->audio_src.freq ||
                 (wanted_nb_samples != is->frame->nb_samples && !is->swr_ctx)) {
-                if (is->swr_ctx)
-                    swr_free(&is->swr_ctx);
+                swr_free(&is->swr_ctx);
                 is->swr_ctx = swr_alloc_set_opts(NULL,
                                                  is->audio_tgt.channel_layout, is->audio_tgt.fmt, is->audio_tgt.freq,
                                                  dec_channel_layout,           dec->sample_fmt,   dec->sample_rate,
@@ -2268,8 +2267,7 @@ static void stream_component_close(VideoState *is, int stream_index)
 
         packet_queue_flush(&is->audioq);
         av_free_packet(&is->audio_pkt);
-        if (is->swr_ctx)
-            swr_free(&is->swr_ctx);
+        swr_free(&is->swr_ctx);
         av_freep(&is->audio_buf1);
         is->audio_buf = NULL;
         av_freep(&is->frame);



More information about the ffmpeg-cvslog mailing list