aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/hlsenc.c
diff options
context:
space:
mode:
authorSteven Liu <lq@chinaffmpeg.org>2020-05-12 17:59:23 +0800
committerSteven Liu <lq@chinaffmpeg.org>2020-05-12 22:31:57 +0800
commite684d07ac69fff2d5d638ce50637b58583df1a44 (patch)
tree94b83a6da9f26bc47c99d1f3a6ca9c2e41a73343 /libavformat/hlsenc.c
parentffae62d96c75d4a476eb3890357c4f3e4f8bd4f5 (diff)
downloadffmpeg-e684d07ac69fff2d5d638ce50637b58583df1a44.tar.gz
avformat/hlsenc: move number out of hls_start
Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
Diffstat (limited to 'libavformat/hlsenc.c')
-rw-r--r--libavformat/hlsenc.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index be54957e9d..74cc220cd9 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1675,7 +1675,6 @@ static int hls_start(AVFormatContext *s, VariantStream *vs)
ff_format_set_url(vtt_oc, filename);
}
}
- vs->number++;
proto = avio_find_protocol_name(oc->url);
use_temp_file = proto && !strcmp(proto, "file") && (c->flags & HLS_TEMP_FILE);
@@ -2509,7 +2508,6 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
}
if (hls->flags & HLS_SINGLE_FILE) {
- vs->number++;
vs->start_pos += vs->size;
} else if (hls->max_seg_size > 0) {
vs->start_pos = new_start_pos;
@@ -2520,14 +2518,13 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
vs->start_pos = 0;
/* When split segment by byte, the duration is short than hls_time,
* so it is not enough one segment duration as hls_time, */
- vs->number--;
}
- vs->number++;
} else {
vs->start_pos = new_start_pos;
sls_flag_file_rename(hls, vs, old_filename);
ret = hls_start(s, vs);
}
+ vs->number++;
av_freep(&old_filename);
if (ret < 0) {
@@ -2975,6 +2972,7 @@ static int hls_init(AVFormatContext *s)
if ((ret = hls_start(s, vs)) < 0)
return ret;
+ vs->number++;
}
return ret;