#708297 [libsdl-sound1.2] fails to play mp3 files

Package:
libsdl-sound1.2
Source:
sdl-sound1.2
Description:
Sound library for Simple DirectMedia Layer 1.2, libraries
Submitter:
Vincent Prat
Date:
2013-12-21 19:06:05 UTC
Severity:
normal
#708297#5
Date:
2013-05-14 21:29:03 UTC
From:
To:
--- Please enter the report below this line. ---
I compiled playsound/playsound_simple.c from the source tree and used it
to play mp3 audio files.
Only a small part of them were played correctly. The others (including
the attached file) produce a very short sound and abort with "Error
decoding file: (null)".

Debian Release: 7.0
997 stable security.debian.org
995 proposed-updates ftp.fr.debian.org
994 stable ftp.fr.debian.org
980 stable www.deb-multimedia.org
500 wheezy-backports mozilla.debian.net
--- Package information. ---
Depends (Version) | Installed
====================================-+-=================
libc6 (>= 2.4) | 2.13-38
libflac8 (>= 1.2.1) | 1.2.1-6
libmikmod2 (>= 3.1.10) | 3.1.12-5
libogg0 (>= 1.0rc3) | 1.3.0-4
libsdl1.2debian (>= 1.2.11) | 1.2.15-5
libspeex1 (>= 1.2~beta3-1) | 1.2~rc1-7
libvorbis0a (>= 1.1.2) | 1.3.2-1.3
libvorbisfile3 (>= 1.1.2) | 1.3.2-1.3


Package's Recommends field is empty.

Package's Suggests field is empty.

#708297#10
Date:
2013-05-15 14:06:33 UTC
From:
To:
2013/5/15 Vincent Prat <vinceprat@free.fr>:

Adding mailing list thread to bug report:
http://lists.alioth.debian.org/pipermail/pkg-sdl-maintainers/2013-May/001650.html

I don't really know what's happening, just suggestions below.

Were you using the same Debian architecture in the past, or did you
switch from i386->amd64 between working and failing?

And by the way, did you also try other format types (ogg, flac, wav)
and observe any anomaly?

We didn't change the upstream version (there has been none in years),
and despite the packaging changes, we have not changed the build
dependencies (AFAICT).

The major things that changed between releases are the hardened build
options, and the changes in the toolchains (compiler, libraries like
libc [1], etc).

At least in some cases, and according to the build logs, the library
(including mpglib part) is somewhat sloppy when it comes to handling
types correctly.  For example treats equal char* and uint8_t*, signed
and unsigned, in a few places.  Maybe the new build-hardening options,
compiler or library changes are now exposing bugs due to these
underlying problems.

  mpglib.c:164:21: warning: pointer targets in passing argument 2 of
'decodeMP3' differ in signedness [-Wpointer-sign]
  mpglib/mpglib_sdlsound.h:53:5: note: expected 'char *' but argument
is of type 'Uint8 *'


Cheers.

[1] "Legit" changes to underlying libraries can change make programs
fail: http://lwn.net/Articles/414467/

#708297#15
Date:
2013-12-21 19:03:29 UTC
From:
To:
2013/5/15 Vincent Prat <vinceprat@free.fr>:

After compiling the binaries (had to use -fpermissive [1]), this is what I get:

$ ./playsound ../scream.mp3
Now playing [../scream.mp3]...
Error in decoding sound file!
  reason: [MPGLIB: Free format not supported.].
------------------

So it seems that the .mp3 that you are playing is not supported by the
library.  From this reply of the author in the support mailing list
(from 2007, but the code does not seem to have changed much since
then, and indeed the code seems very fragile):
------------------
http://icculus.org/pipermail/sdlsound/2007-January/000655.html

mpglib is deeply unforgiving about file corruption...it gives up
immediately when it sees data it doesn't expect, which is a problem with
a lot of mp3s out there.

Also, unfortunately, one of the things it doesn't expect is ID3v2 tags,
so that excludes the vast majority of mp3s created in the past few
years. This is fairly easy to fix, just no one ever has (for ID3v1, we
just look for the struct in the last 128 bytes of the mp3, and don't
pass it to mpglib if we see it. ID3v2's layout is somewhat more
complicated, but something similar can still be done). In a more ideal
world, someone would take the time to understand the mpglib code and
make it recover from bad data. Or replace it with a different mp3
decoder, but I haven't found one that isn't GPL'd.

SDL_sound's SMPEG backend is more forgiving of strange data, but has its
own problems too. Use Ogg files if you control your content.  :)

As you can tell by my long apology here, we're sort of at the mercy of a
  disproportionate amount of third-party code here.
------------------


Cheers.
-- 
Manuel A. Fernandez Montecelo <manuel.montezelo@gmail.com>


[1]

g++ -fpermissive -I/usr/include/SDL -lSDL -lSDL_sound
playsound_simple.c -o playsound_simple

g++ -fpermissive -I/usr/include/SDL -lSDL -lSDL_sound -DHAVE_SIGNAL_H
playsound.c -o playsound