diff mbox series

[FFmpeg-devel,v2,6/7] avformat/hlsenc: Factor check out of loop

Message ID 20200228095321.7222-6-andreas.rheinhardt@gmail.com
State New
Headers show
Series [FFmpeg-devel,v2,1/7] avformat/hlsenc: Avoid setting unused variables
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Andreas Rheinhardt Feb. 28, 2020, 9:53 a.m. UTC
The check will be true at most once anyway.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavformat/hlsenc.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index e3a310dbc1..317b1a6f5e 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -2749,6 +2749,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];
 
@@ -2761,14 +2770,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);