Ogg: Set granule position to -1 if no packets finish on page (#864)

This commit is contained in:
Urs Fleisch
2021-02-08 10:41:25 +01:00
parent 4c14571647
commit 83aa01c6af
2 changed files with 34 additions and 0 deletions

View File

@ -305,4 +305,10 @@ Ogg::Page::Page(const ByteVectorList &packets,
}
d->packets = packets;
d->header.setPacketSizes(packetSizes);
// https://xiph.org/ogg/doc/framing.html, absolute granule position:
// A special value of '-1' (in two's complement) indicates that no packets
// finish on this page.
if(!lastPacketCompleted && packets.size() <= 1)
d->header.setAbsoluteGranularPosition(-1);
}