diff --git a/go-ogg/ogg-codec.go b/go-ogg/ogg-codec.go index 3510f97..6b8febe 100644 --- a/go-ogg/ogg-codec.go +++ b/go-ogg/ogg-codec.go @@ -213,7 +213,7 @@ func (vp8 *vp8Demuxer) packet(stream *oggStream, packet []byte) (frame []byte, p vp8.granule = stream.currentPage.granulePos } var duration uint64 = 0 - for i := int(vp8.pktIdx); i < len(stream.currentPage.packets); i++ { + if len(stream.currentPage.packets[i]) > 0 { duration += uint64((stream.currentPage.packets[i][0] >> 4) & 1) } vp8.lastpts = vp8.gptopts(stream.currentPage.granulePos) - duration