From: Josh Coalson Date: Wed, 6 Feb 2002 07:50:19 +0000 (+0000) Subject: fix bug where the metadata packet and first audio packet were getting the same packet... X-Git-Tag: 1.2.0~2020 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6188feb8bbaf809d70cfe636525376b7e9e167b5;p=platform%2Fupstream%2Fflac.git fix bug where the metadata packet and first audio packet were getting the same packet number in ogg --- diff --git a/src/flac/encode.c b/src/flac/encode.c index 74ba83b..3215daf 100644 --- a/src/flac/encode.c +++ b/src/flac/encode.c @@ -1019,7 +1019,14 @@ FLAC__StreamEncoderWriteStatus write_callback(const FLAC__StreamEncoder *encoder memset(&op, 0, sizeof(op)); op.packet = (unsigned char *)buffer; op.granulepos = encoder_wrapper->samples_written - 1; - op.packetno = encoder_wrapper->current_frame; + /*@@@ WATCHOUT: + * this depends on the behavior of libFLAC that we will get one + * write_callback first with all the metadata (and 'samples' + * will be 0), then one for each frame, hence the +1 so that the + * metadata packet is packet 0, the first audio frame is 1, and + * so on. + */ + op.packetno = (samples == 0? 0 : encoder_wrapper->current_frame + 1); op.bytes = bytes; if (encoder_wrapper->bytes_written == bytes)