Message ID | 20220508011722.4072-1-lq@chinaffmpeg.org |
---|---|
State | Accepted |
Commit | ea6ed838c3fe0e2462163d35cbbed772f4bcff9f |
Headers | show |
Series | [FFmpeg-devel,v2,1/2] avformat/hlsenc: check discont_program_date_time before use it in parse_playlist | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
> On May 8, 2022, at 9:17 AM, Steven Liu <lq@chinaffmpeg.org> wrote: > > In parse_playlist, the discont_program_date_time should be used after > EXT-X-PROGRAM-DATE-TIME tag parsed. > > Signed-off-by: Steven Liu <lq@chinaffmpeg.org> > --- > libavformat/hlsenc.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c > index d2b8215dff..b9f79e30d8 100644 > --- a/libavformat/hlsenc.c > +++ b/libavformat/hlsenc.c > @@ -1288,8 +1288,10 @@ static int parse_playlist(AVFormatContext *s, const char *url, VariantStream *vs > new_start_pos = avio_tell(vs->avf->pb); > vs->size = new_start_pos - vs->start_pos; > ret = hls_append_segment(s, hls, vs, vs->duration, vs->start_pos, vs->size); > - vs->last_segment->discont_program_date_time = discont_program_date_time; > - discont_program_date_time += vs->duration; > + if (discont_program_date_time) { > + vs->last_segment->discont_program_date_time = discont_program_date_time; > + discont_program_date_time += vs->duration; > + } Looks good to me, although it doesn’t work if EXT-X-PROGRAM-DATE-TIME is 1970-01-01 :) > if (ret < 0) > goto fail; > vs->start_pos = new_start_pos; > -- > 2.34.1 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index d2b8215dff..b9f79e30d8 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -1288,8 +1288,10 @@ static int parse_playlist(AVFormatContext *s, const char *url, VariantStream *vs new_start_pos = avio_tell(vs->avf->pb); vs->size = new_start_pos - vs->start_pos; ret = hls_append_segment(s, hls, vs, vs->duration, vs->start_pos, vs->size); - vs->last_segment->discont_program_date_time = discont_program_date_time; - discont_program_date_time += vs->duration; + if (discont_program_date_time) { + vs->last_segment->discont_program_date_time = discont_program_date_time; + discont_program_date_time += vs->duration; + } if (ret < 0) goto fail; vs->start_pos = new_start_pos;
In parse_playlist, the discont_program_date_time should be used after EXT-X-PROGRAM-DATE-TIME tag parsed. Signed-off-by: Steven Liu <lq@chinaffmpeg.org> --- libavformat/hlsenc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)