Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2019-04-20 01:03:16 +0300
committerPaul B Mahol <onemda@gmail.com>2019-07-12 15:59:58 +0300
commit24a64e0462d5dad6f6cf629243abdbe975e33015 (patch)
tree37a02a993337909ee7c65d9ad08dc370f1bdea07 /libavformat/webm_chunk.c
parent8c6ee7626bcce7c270360f33b60dc7ef99939fc3 (diff)
lavf/webm_chunk: Correct duration if start time > 0
Up until now, it was simply presumed that the first packet had a pts of zero; otherwise the duration of the first chunk was wrong. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavformat/webm_chunk.c')
-rw-r--r--libavformat/webm_chunk.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libavformat/webm_chunk.c b/libavformat/webm_chunk.c
index 8196f3d096..4e2ce21a79 100644
--- a/libavformat/webm_chunk.c
+++ b/libavformat/webm_chunk.c
@@ -52,7 +52,7 @@ typedef struct WebMChunkContext {
int chunk_index;
char *http_method;
uint64_t duration_written;
- int prev_pts;
+ int64_t prev_pts;
ff_const59 AVOutputFormat *oformat;
AVFormatContext *avf;
} WebMChunkContext;
@@ -129,6 +129,7 @@ static int webm_chunk_write_header(AVFormatContext *s)
wc->oformat = av_guess_format("webm", s->url, "video/webm");
if (!wc->oformat)
return AVERROR_MUXER_NOT_FOUND;
+ wc->prev_pts = AV_NOPTS_VALUE;
ret = chunk_mux_init(s);
if (ret < 0)
@@ -216,9 +217,10 @@ static int webm_chunk_write_packet(AVFormatContext *s, AVPacket *pkt)
int ret;
if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
- wc->duration_written += av_rescale_q(pkt->pts - wc->prev_pts,
- st->time_base,
- (AVRational) {1, 1000});
+ if (wc->prev_pts != AV_NOPTS_VALUE)
+ wc->duration_written += av_rescale_q(pkt->pts - wc->prev_pts,
+ st->time_base,
+ (AVRational) {1, 1000});
wc->prev_pts = pkt->pts;
}