[Bug 705630] directcontrolbinding: Wrong behaviour of control bindings with properties that span +-INT_MAX

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Thu Aug 8 03:32:41 PDT 2013


https://bugzilla.gnome.org/show_bug.cgi?id=705630
  GStreamer | gstreamer (core) | git

Sebastian Dröge (slomo) <slomo> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |slomo at circular-chaos.org
         Resolution|                            |FIXED
   Target Milestone|HEAD                        |1.1.4
            Summary|Wrong behaviour of control  |directcontrolbinding: Wrong
                   |bindings with properties    |behaviour of control
                   |that span +-INT_MAX         |bindings with properties
                   |                            |that span +-INT_MAX

--- Comment #1 from Sebastian Dröge (slomo) <slomo at circular-chaos.org> 2013-08-08 10:32:39 UTC ---
commit d4f6c8e0e69c5f581ab7fefd1b592f5b4701205c
Author: Adrian Pardini <publico at tangopardo.com.ar>
Date:   Wed Aug 7 14:17:28 2013 -0300

    controller: fixes int overflow with properties that span +-INT_MAX

    When the range for a property is defined as -INT_MAX-1 .. INT_MAX, like
    the xpos in a videomixer the following expression in the macro
    definitions of convert_g_value_to_##type (and the equivalent in
    convert_value_to_##type)

    v = pspec->minimum + (g##type) ROUNDING_OP ((pspec->maximum -
pspec->minimum) * s);

    are converted to:

    v = -2147483648 + (g##type) ROUNDING_OP ((2147483647 - -2147483648) * s);

    (2147483647 - -2147483648) overflows to -1 and the net result is:

    v = -2147483648 + (g##type) ROUNDING_OP (-1 * s);

    so v only takes the values -2147483648 for s == 0 and 2147483647
    for s == 1.

    Rewriting the expression as minimum*(1-s) + maximum*s gives the correct
    result in this case.

    https://bugzilla.gnome.org//show_bug.cgi?id=705630

-- 
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