X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Foggparsetheora.c;h=b0c0edc7a545f109e1a54aeed0139571bc0069d6;hb=9b22417de680fcae289eb4d0e036bc09912902eb;hp=b14f9f0669c1addc191b42b42411bdef7fd3dd05;hpb=1146a7a363ab7169a7713d774571b63287508cc8;p=ffmpeg diff --git a/libavformat/oggparsetheora.c b/libavformat/oggparsetheora.c index b14f9f0669c..b0c0edc7a54 100644 --- a/libavformat/oggparsetheora.c +++ b/libavformat/oggparsetheora.c @@ -181,6 +181,7 @@ static int theora_packet(AVFormatContext *s, int idx) if ((!os->lastpts || os->lastpts == AV_NOPTS_VALUE) && !(os->flags & OGG_FLAG_EOS)) { int seg; + int64_t pts; duration = 1; for (seg = os->segp; seg < os->nsegs; seg++) { @@ -188,7 +189,10 @@ static int theora_packet(AVFormatContext *s, int idx) duration ++; } - os->lastpts = os->lastdts = theora_gptopts(s, idx, os->granule, NULL) - duration; + pts = theora_gptopts(s, idx, os->granule, NULL); + if (pts != AV_NOPTS_VALUE) + pts -= duration; + os->lastpts = os->lastdts = pts; if(s->streams[idx]->start_time == AV_NOPTS_VALUE) { s->streams[idx]->start_time = os->lastpts; if (s->streams[idx]->duration > 0)