diff options
author | Greg Maxwell <gmaxwell@gmail.com> | 2010-03-16 02:04:09 +0300 |
---|---|---|
committer | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2010-03-16 02:04:09 +0300 |
commit | fbe8c56dfeb531d815dec1419624bb1c60739100 (patch) | |
tree | 464d29338b626f159192492d0818529265756f4c /libavformat/oggenc.c | |
parent | 404793f4ac57fe7615da4fd03cefe9438d1b1fbd (diff) |
Correctly write last 0 lacing value when packet size is multiple of 255, patch by Greg Maxwell, gmaxwell at gmail dot com
Originally committed as revision 22559 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/oggenc.c')
-rw-r--r-- | libavformat/oggenc.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c index 101570b177..bdf474e334 100644 --- a/libavformat/oggenc.c +++ b/libavformat/oggenc.c @@ -61,7 +61,7 @@ static int ogg_write_page(AVFormatContext *s, const uint8_t *data, int size, } else if (oggstream->eos) flags |= 4; - page_segments = FFMIN((size/255)+!!size, 255); + page_segments = FFMIN(size/255 + 1, 255); init_checksum(s->pb, ff_crc04C11DB7_update, 0); put_tag(s->pb, "OggS"); @@ -75,10 +75,9 @@ static int ogg_write_page(AVFormatContext *s, const uint8_t *data, int size, put_byte(s->pb, page_segments); for (i = 0; i < page_segments-1; i++) put_byte(s->pb, 255); - if (size) { - put_byte(s->pb, size - (page_segments-1)*255); - put_buffer(s->pb, data, size); - } + put_byte(s->pb, size - (page_segments-1)*255); + put_buffer(s->pb, data, size); + ogg_update_checksum(s, crc_offset); put_flush_packet(s->pb); return size; |