jpegenc: Don't round up size of encoded buffers
authorDavid Schleef <ds@schleef.org>
Wed, 29 Jun 2011 21:39:52 +0000 (14:39 -0700)
committerDavid Schleef <ds@schleef.org>
Thu, 30 Jun 2011 06:55:33 +0000 (23:55 -0700)
For some reason, in code dating to 2001, encoded jpeg buffers were
rounded up to multiples of 4 bytes.  With the added bonus that the
extra bytes are unwritten, causing valgrind issues.  Oops.  I can't
think of any reason why JPEG buffers need to be multiples of 4 bytes,
so I removed the padding.  There might be some code somewhere that
depends on this behavior, so if this needs to be reverted, please fix
the valgrind issues.

ext/jpeg/gstjpegenc.c

index 8708a70..e631be6 100644 (file)
@@ -246,8 +246,7 @@ gst_jpegenc_term_destination (j_compress_ptr cinfo)
 
   /* Trim the buffer size and push it. */
   GST_BUFFER_SIZE (jpegenc->output_buffer) =
-      GST_ROUND_UP_4 (GST_BUFFER_SIZE (jpegenc->output_buffer) -
-      jpegenc->jdest.free_in_buffer);
+      GST_BUFFER_SIZE (jpegenc->output_buffer) - jpegenc->jdest.free_in_buffer;
 
   g_signal_emit (G_OBJECT (jpegenc), gst_jpegenc_signals[FRAME_ENCODED], 0);