From 0d8cc7a3b223fe23db87189f2410e624e672b66e Mon Sep 17 00:00:00 2001 From: Kanglin Date: Sat, 29 Dec 2012 11:44:33 +0100 Subject: hlsenc: use the correct AV_TIME_BASE macro recording_time is in AV_TIME_BASE units. --- libavformat/hlsenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libavformat/hlsenc.c') diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 39e8df9..71c0c34 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -187,7 +187,7 @@ static int hls_write_header(AVFormatContext *s) hls->number = 0; - hls->recording_time = hls->time * 1000000; + hls->recording_time = hls->time * AV_TIME_BASE; hls->start_pts = AV_NOPTS_VALUE; for (i = 0; i < s->nb_streams; i++) -- cgit v1.1 From 9b1370aced385698bc783747917544ab69ecb373 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sat, 29 Dec 2012 11:46:01 +0100 Subject: hlsenc: do not add timestamps in different timebases start_time is in stream timebase units while end_time is in AV_TIME_BASE ones. --- libavformat/hlsenc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libavformat/hlsenc.c') diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 71c0c34..43b3505 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -253,10 +253,10 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt) hls->start_pts = pkt->pts; hls->end_pts = pkt->pts; } - end_pts += hls->start_pts; if ((hls->has_video && st->codec->codec_type == AVMEDIA_TYPE_VIDEO) && - av_compare_ts(pkt->pts, st->time_base, end_pts, AV_TIME_BASE_Q) >= 0 && + av_compare_ts(pkt->pts - hls->start_pts, st->time_base, + end_pts, AV_TIME_BASE_Q) >= 0 && pkt->flags & AV_PKT_FLAG_KEY) { ret = append_entry(hls, av_rescale(pkt->pts - hls->end_pts, -- cgit v1.1