[libav-devel] [PATCH] oggenc: Set the right AVOption size for the pref_duration option

Martin Storsjö martin at martin.st
Fri Jun 6 16:38:45 CEST 2014

On Fri, 6 Jun 2014, Diego Biurrun wrote:

> On Fri, Jun 06, 2014 at 02:05:26PM +0300, Martin Storsjö wrote:
>> On big endian machines, the default value set via the faulty
>> AVOption ended up as 2^32 times too big.
>> This fixes the fate-lavf-ogg test which currently is broken on
>> big endian machines, broken since 3831362. Since that commit,
>> a final zero-sized packet is written to the ogg muxer in that test,
> by the Ogg muxer?

No, to.

The ogg muxer gets an empty packet from the calling layers (which doesn't 
actually get written into the resulting file - note how 3831362 didn't 
change the hash in the fate reference) - this is what caused the effect. 
The ogg muxer itself didn't suddenly start outputting extra empty packets.

This empty packet causes some of the ogg muxer functions to be triggered, 
which causes it to flush the currently pending page. This does not happen 
on big endian since the pref_duration setting is set wrong. The timestamp 
from the empty packet then is included in the ogg page which is flushed 
when the file is closed. (In the little endian case, no page is flushed 
since there's no more buffered data to be written.) This caused the 
granule for the single page in the file to be different in big endian.

Whether the granule for the current page should be updated by an empty 
packet or not, that's a different question I leave for others to decide.

// Martin

More information about the libav-devel mailing list