]> git.sesse.net Git - ffmpeg/commitdiff
avformat/hlsenc: Factor check out of loop
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sun, 15 Dec 2019 18:39:16 +0000 (19:39 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 8 May 2020 13:40:04 +0000 (15:40 +0200)
The check will be true at most once anyway.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/hlsenc.c

index 3d5b09c9634883747b6e78a8e56ac130c5ce1c90..3cc103af8561434309cde3cb8f2aafa21c9ba6f1 100644 (file)
@@ -2829,6 +2829,15 @@ static int hls_init(AVFormatContext *s)
     }
 
     hls->recording_time = (hls->init_time ? hls->init_time : hls->time) * AV_TIME_BASE;
+
+        if (hls->flags & HLS_SPLIT_BY_TIME && hls->flags & HLS_INDEPENDENT_SEGMENTS) {
+            // Independent segments cannot be guaranteed when splitting by time
+            hls->flags &= ~HLS_INDEPENDENT_SEGMENTS;
+            av_log(s, AV_LOG_WARNING,
+                   "'split_by_time' and 'independent_segments' cannot be enabled together. "
+                   "Disabling 'independent_segments' flag\n");
+        }
+
     for (i = 0; i < hls->nb_varstreams; i++) {
         vs = &hls->var_streams[i];
 
@@ -2841,14 +2850,6 @@ static int hls_init(AVFormatContext *s)
         vs->end_pts      = AV_NOPTS_VALUE;
         vs->current_segment_final_filename_fmt[0] = '\0';
 
-        if (hls->flags & HLS_SPLIT_BY_TIME && hls->flags & HLS_INDEPENDENT_SEGMENTS) {
-            // Independent segments cannot be guaranteed when splitting by time
-            hls->flags &= ~HLS_INDEPENDENT_SEGMENTS;
-            av_log(s, AV_LOG_WARNING,
-                   "'split_by_time' and 'independent_segments' cannot be enabled together. "
-                   "Disabling 'independent_segments' flag\n");
-        }
-
         if (hls->flags & HLS_PROGRAM_DATE_TIME) {
             time_t now0;
             time(&now0);