[Bug 657904] New: audio conversion error from 32bits float to 16bit int

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Thu Sep 1 01:55:27 PDT 2011

  GStreamer | gst-plugins-base | 0.10.35

           Summary: audio conversion error from 32bits float to 16bit int
    Classification: Platform
           Product: GStreamer
           Version: 0.10.35
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: gst-plugins-base
        AssignedTo: gstreamer-bugs at lists.freedesktop.org
        ReportedBy: fan.su at plmhinc.com
         QAContact: gstreamer-bugs at lists.freedesktop.org
     GNOME version: ---

In function orc_audio_convert_unpack_float_s32 of
gst-plugins-base/gst/audioconvert/gstaudioconvertorc-dist.c, current source
code as following:

    /* 5: convfl */
      int tmp;
      tmp = (int) var38.f;            // wrong!!!
      if (tmp == 0x80000000 && !(var38.i & 0x80000000))
        tmp = 0x7fffffff;
      var35.i = tmp;

If var38.f is in float and it may be out of 32bit integer's range. So it's
unexpected to cast float to integer.

In my case, var38.f is -2179590144.000000 and tmp is 7FFFFFFF after that wrong
line was executed. Obviously, it doesn't make sense that a negative value was
converted to a positive value. I think we should clamp var38.f in 32bit
integer's range before type cast.

BTW, so much unreasonable type casts as above were in this file.

Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the gstreamer-bugs mailing list