changeset 5851:d88fc4640994 libavformat

Correctly write last 0 lacing value when packet size is multiple of 255, patch by Greg Maxwell, gmaxwell at gmail dot com
author bcoudurier
date Mon, 15 Mar 2010 23:04:09 +0000
parents a9a36b4f83a2
children 36b46032fad5
files oggenc.c
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/oggenc.c	Mon Mar 15 22:54:22 2010 +0000
+++ b/oggenc.c	Mon Mar 15 23:04:09 2010 +0000
@@ -61,7 +61,7 @@
     } 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 @@
     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;