X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Foggparsespeex.c;h=14d2b38131be9540b9dadfabd3d2cf27670f3068;hb=ae2c69438881ecd9f3ff7dffaf66e62379279820;hp=f6174749f24a693608cfe2f712386e5ffeeae749;hpb=15299b3821bff66ab89895c95cc06d0908f8ec7b;p=ffmpeg diff --git a/libavformat/oggparsespeex.c b/libavformat/oggparsespeex.c index f6174749f24..14d2b38131b 100644 --- a/libavformat/oggparsespeex.c +++ b/libavformat/oggparsespeex.c @@ -95,15 +95,16 @@ static int speex_packet(AVFormatContext *s, int idx) os->private = spxp; } - if (os->flags & OGG_FLAG_EOS && os->lastgp != -1 && os->granule > 0) { + if (os->flags & OGG_FLAG_EOS && os->lastpts != AV_NOPTS_VALUE && + os->granule > 0) { /* first packet of final page. we have to calculate the final packet duration here because it is the only place we know the next-to-last granule position. */ - spxp->final_packet_duration = os->granule - os->lastgp - + spxp->final_packet_duration = os->granule - os->lastpts - packet_size * (ogg_page_packets(os) - 1); } - if (!os->lastgp && os->granule > 0) + if (!os->lastpts && os->granule > 0) /* first packet */ os->pduration = os->granule - packet_size * (ogg_page_packets(os) - 1); else if (os->flags & OGG_FLAG_EOS && os->segp == os->nsegs &&