aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@ag.or.at>2013-06-06 12:09:38 +0200
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2013-06-06 12:09:38 +0200
commit75b9fb27f516f9db7995ab2c2abb83e25cae5813 (patch)
treead9d44d6b552c7e6342335e1e07bfd56070cbcca
parentb26bcd08e670b90740f7253f21adddafb9d8c478 (diff)
downloadffmpeg-75b9fb27f516f9db7995ab2c2abb83e25cae5813.tar.gz
lavf/hlsenc: fix bogus hls segment index rewrapping logic
The counter should not be reset since it detects the hls segment increasing timeframe. Fixes ticket #2643. Reviewed-by: Stefano Sabatini
-rw-r--r--libavformat/hlsenc.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index e97b4e0a5f..af04d09d2f 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -164,14 +164,12 @@ static int hls_start(AVFormatContext *s)
AVFormatContext *oc = c->avf;
int err = 0;
- if (c->wrap)
- c->number %= c->wrap;
-
if (av_get_frame_filename(oc->filename, sizeof(oc->filename),
- c->basename, c->number++) < 0) {
+ c->basename, c->wrap ? c->number % c->wrap : c->number) < 0) {
av_log(oc, AV_LOG_ERROR, "Invalid segment filename template '%s'\n", c->basename);
return AVERROR(EINVAL);
}
+ c->number++;
if ((err = avio_open2(&oc->pb, oc->filename, AVIO_FLAG_WRITE,
&s->interrupt_callback, NULL)) < 0)