avformat/hlsenc: avformat/hlsenc: simplified code master
authorSteven Liu <lq@chinaffmpeg.org>
Tue, 20 Aug 2019 03:46:10 +0000 (11:46 +0800)
committerSteven Liu <lq@chinaffmpeg.org>
Wed, 21 Aug 2019 08:46:35 +0000 (16:46 +0800)
simplified code for get dirname string in hls_delete_old_segments

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
libavformat/hlsenc.c

index 9511b65..18173cd 100644 (file)
@@ -505,18 +505,13 @@ static int hls_delete_old_segments(AVFormatContext *s, HLSContext *hls,
     }
 
     if (segment && !hls->use_localtime_mkdir) {
-        if (hls->segment_filename) {
-            dirname = av_strdup(hls->segment_filename);
-        } else {
-            dirname = av_strdup(vs->avf->url);
-        }
+        dirname = hls->segment_filename ? av_strdup(hls->segment_filename): av_strdup(vs->avf->url);
         if (!dirname) {
             ret = AVERROR(ENOMEM);
             goto fail;
         }
         p = (char *)av_basename(dirname);
         *p = '\0';
-
     }
 
     /* if %v is present in the file's directory