Bug#772877: oggenc fails when using '--advanced-encode-option disable_coupling' switch and CBR encoding

Petter Reinholdtsen pere at hungry.com
Tue Aug 16 09:14:14 UTC 2016


I had a closer look at this, trying to reproduce it and pinpoint exactly
what is wrong.  When using this patch:

diff --git a/lib/vorbisenc.c b/lib/vorbisenc.c
index b5d621e..18a35d1 100644
--- a/lib/vorbisenc.c
+++ b/lib/vorbisenc.c
@@ -15,6 +15,7 @@
 
  ********************************************************************/
 
+#include <assert.h>
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
@@ -879,10 +880,13 @@ static void vorbis_encode_setup_setting(vorbis_info *vi,
 
   hi->stereo_point_setting=hi->base_setting;
 
-  if(!hi->lowpass_altered)
+  if(!hi->lowpass_altered) {
+    assert(setup);
+    assert(is < setup->mappings);
+    assert(setup->psy_lowpass);
     hi->lowpass_kHz=
       setup->psy_lowpass[is]*(1.-ds)+setup->psy_lowpass[is+1]*ds;
-
+  }
   hi->ath_floating_dB=setup->psy_ath_float[is]*(1.-ds)+
     setup->psy_ath_float[is+1]*ds;
   hi->ath_absolute_dB=setup->psy_ath_abs[is]*(1.-ds)+

I get this failure from valgrind:

==10694== Memcheck, a memory error detector
==10694== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==10694== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==10694== Command: oggenc -b 80 -m 80 -M 80 --advanced-encode-option disable_coupling -o out.ogg in.wav
==10694== 
Enabling bitrate management engine
Opening with wav module: WAV file reader
Encoding "in.wav" to 
         "out.ogg" 
at average bitrate 80 kbps (min 80 kbps, max 80 kbps), 
using full bitrate management engine
Setting advanced encoder option "disable_coupling"
oggenc: vorbisenc.c:884: vorbis_encode_setup_setting: Assertion `setup' failed.
==10694== 
==10694== HEAP SUMMARY:
==10694==     in use at exit: 7,037 bytes in 10 blocks
==10694==   total heap usage: 83 allocs, 73 frees, 20,899 bytes allocated
==10694== 
==10694== LEAK SUMMARY:
==10694==    definitely lost: 0 bytes in 0 blocks
==10694==    indirectly lost: 0 bytes in 0 blocks
==10694==      possibly lost: 0 bytes in 0 blocks
==10694==    still reachable: 7,037 bytes in 10 blocks
==10694==         suppressed: 0 bytes in 0 blocks
==10694== Rerun with --leak-check=full to see details of leaked memory
==10694== 
==10694== For counts of detected and suppressed errors, rerun with: -v
==10694== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Aborted

But I have no idea why setup is NULL.

-- 
Happy hacking
Petter Reinholdtsen



More information about the pkg-xiph-maint mailing list