summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2019-12-15 19:39:16 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-05-08 15:40:04 +0200
commit4effcc399a816689e396b64568beb9a90e83408d (patch)
tree886470269629a82c34749b98dd747ddbf4e322fe /libavformat
parente1dfb5128b90f7a3253465599eeb6d6718359da8 (diff)
avformat/hlsenc: Factor check out of loop
The check will be true at most once anyway. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/hlsenc.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 3d5b09c963..3cc103af85 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -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);