[SCM] lame packaging branch, karmic, updated. debian/3.98.2+debian-0ubuntu2

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sat Oct 24 16:11:33 UTC 2009


The following commit has been merged in the karmic branch:
commit 3c0e39bf23ca1c0baf79ecda92f42d280bb328c6
Author: Reinhard Tartler <siretart at tauware.de>
Date:   Thu Oct 22 22:08:59 2009 +0200

    fix the ffmpeg 'buffer too small' bug.
    
    From the Marillat package:
    
    lame (3.98.2-0.5) unstable; urgency=low
    
      * Apply patch from Martin Storsjö to fix the ffmpeg 'buffer too small' bug.
    
     -- Christian Marillat <marillat at debian.org>  Tue, 07 Jul 2009 10:53:43 +0200

diff --git a/debian/patches/03-buffer-too-small.patch b/debian/patches/03-buffer-too-small.patch
new file mode 100644
index 0000000..661fd81
--- /dev/null
+++ b/debian/patches/03-buffer-too-small.patch
@@ -0,0 +1,80 @@
+From: Martin Storsjö <email at unknown>
+Subject: fix the ffmpeg 'buffer too small' bug.
+
+Found in the marillat lame package.
+
+
+diff --git a/libmp3lame/lame.c b/libmp3lame/lame.c
+index 5f93307..b1c89f1 100644
+--- a/libmp3lame/lame.c
++++ b/libmp3lame/lame.c
+@@ -1602,6 +1602,13 @@ lame_encode_buffer_sample_t(lame_global_flags * gfp,
+         /* update mfbuf[] counters */
+         gfc->mf_size += n_out;
+         assert(gfc->mf_size <= MFSIZE);
++
++        /* lame_encode_flush may have set gfc->mf_sample_to_encode to 0
++         * so we have to reinitialize it here when that happened.
++         */
++        if (gfc->mf_samples_to_encode < 1) {
++            gfc->mf_samples_to_encode = ENCDELAY + POSTDELAY;
++        }
+         gfc->mf_samples_to_encode += n_out;
+ 
+ 
+@@ -1931,6 +1938,10 @@ lame_encode_flush(lame_global_flags * gfp, unsigned char *mp3buffer, int mp3buff
+     int     frames_left;
+     int     samples_to_encode = gfc->mf_samples_to_encode;
+ 
++    /* Was flush already called? */
++    if (gfc->mf_samples_to_encode < 1) {
++        return 0;
++    }
+     memset(buffer, 0, sizeof(buffer));
+     mp3count = 0;
+     
+@@ -1942,7 +1953,9 @@ lame_encode_flush(lame_global_flags * gfp, unsigned char *mp3buffer, int mp3buff
+     end_padding += pad_out_samples;
+ 
+     frames_left = (samples_to_encode + pad_out_samples) / gfp->framesize;
+-    while (frames_left > 0) {
++
++    /* send in a frame of 0 padding until all internal sample buffers are flushed */
++    while (frames_left > 0 && imp3 >= 0) {
+         int frame_num = gfp->frameNum;
+ 
+         mp3buffer_size_remaining = mp3buffer_size - mp3count;
+@@ -1951,22 +1964,23 @@ lame_encode_flush(lame_global_flags * gfp, unsigned char *mp3buffer, int mp3buff
+         if (mp3buffer_size == 0)
+             mp3buffer_size_remaining = 0;
+ 
+-        /* send in a frame of 0 padding until all internal sample buffers
+-         * are flushed
+-         */
+         imp3 = lame_encode_buffer(gfp, buffer[0], buffer[1], 32,
+                                   mp3buffer, mp3buffer_size_remaining);
+         
+-        if (frame_num != gfp->frameNum) {
+-            --frames_left;
+-        }
+-        if (imp3 < 0) {
+-            /* some type of fatal error */
+-            return imp3;
+-        }
+         mp3buffer += imp3;
+         mp3count += imp3;
++        frames_left -= (frame_num != gfp->frameNum) ? 1 : 0;
+     }
++    /* Set gfc->mf_samples_to_encode to 0, so we may detect
++     * and break loops calling it more than once in a row.
++     */
++    gfc->mf_samples_to_encode = 0;
++
++    if (imp3 < 0) {
++        /* some type of fatal error */
++        return imp3;
++    }
++
+     mp3buffer_size_remaining = mp3buffer_size - mp3count;
+     /* if user specifed buffer size = 0, dont check size */
+     if (mp3buffer_size == 0)
diff --git a/debian/patches/series b/debian/patches/series
index 2c74df2..2584814 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 01-debian-directory.patch
 02-dynamic-frontends.patch
+03-buffer-too-small.patch

-- 
lame packaging



More information about the pkg-multimedia-commits mailing list