Commit 75b9fb27 authored by Carl Eugen Hoyos's avatar Carl Eugen Hoyos

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
parent b26bcd08
...@@ -164,14 +164,12 @@ static int hls_start(AVFormatContext *s) ...@@ -164,14 +164,12 @@ static int hls_start(AVFormatContext *s)
AVFormatContext *oc = c->avf; AVFormatContext *oc = c->avf;
int err = 0; int err = 0;
if (c->wrap)
c->number %= c->wrap;
if (av_get_frame_filename(oc->filename, sizeof(oc->filename), 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); av_log(oc, AV_LOG_ERROR, "Invalid segment filename template '%s'\n", c->basename);
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
c->number++;
if ((err = avio_open2(&oc->pb, oc->filename, AVIO_FLAG_WRITE, if ((err = avio_open2(&oc->pb, oc->filename, AVIO_FLAG_WRITE,
&s->interrupt_callback, NULL)) < 0) &s->interrupt_callback, NULL)) < 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment