diff options
author | David Conrad | 2010-04-16 12:21:35 +0000 |
---|---|---|
committer | David Conrad | 2010-04-16 12:21:35 +0000 |
commit | 44a088eab7f223e0b79ae5296cdb07d6f165c91d (patch) | |
tree | 9f0f48140d723e42d1e13491d1a38abadf165104 /libavformat | |
parent | 49c2d290898ebafab0bb7424e53a79d4daf5b028 (diff) |
oggdec: Fix duration calculation if the last page in a file has no granule
Originally committed as revision 22890 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/oggdec.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index ff000e7a79..3b59e002ee 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -431,7 +431,7 @@ static int ogg_get_length (AVFormatContext * s) { struct ogg *ogg = s->priv_data; - int idx = -1, i; + int i; int64_t size, end; if(url_is_streamed(s->pb)) @@ -451,15 +451,12 @@ ogg_get_length (AVFormatContext * s) while (!ogg_read_page (s, &i)){ if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 && - ogg->streams[i].codec) - idx = i; - } - - if (idx != -1){ - s->streams[idx]->duration = - ogg_gptopts (s, idx, ogg->streams[idx].granule, NULL); - if (s->streams[idx]->start_time != AV_NOPTS_VALUE) - s->streams[idx]->duration -= s->streams[idx]->start_time; + ogg->streams[i].codec) { + s->streams[i]->duration = + ogg_gptopts (s, i, ogg->streams[i].granule, NULL); + if (s->streams[i]->start_time != AV_NOPTS_VALUE) + s->streams[i]->duration -= s->streams[i]->start_time; + } } ogg_restore (s, 0); |