After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 635878 - [qtmux] gst_qtmux_check_difference subtract 2 unsigned numbers without taking care of the result sign
[qtmux] gst_qtmux_check_difference subtract 2 unsigned numbers without taking...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
0.10.20
Other All
: Normal major
: 0.10.21
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-11-26 20:25 UTC by agonzalez
Modified: 2010-11-29 12:27 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch for verifying order of operands in the subtraction (769 bytes, patch)
2010-11-26 22:18 UTC, agonzalez
committed Details | Review

Description agonzalez 2010-11-26 20:25:32 UTC
When 'gst_qtmux_check_difference' does the subtraction of the arguments it does not take care of the sign of the result, but since its arguments 'GstClockTime' is defined as an unsigned int:

typedef guint64 GstClockTime;

When the bigger number is subtracted from the smallest number, it will generate a 'negative' value but it will be read as positive, taking the 2's complement of the result, making the comparison always return TRUE. 

From traces:

0:00:01.899719239  3441   0x4d5fd0 ERROR                  qtmux ../../../gst/qtmux/gstqtmux.c:1553:gst_qtmux_check_difference:<mux> (a-b):18446744073705551616>=10000000 =TRUE
0:00:01.899749756  3441   0x4d5fd0 ERROR                  qtmux ../../../gst/qtmux/gstqtmux.c:1554:gst_qtmux_check_difference:<mux> (b-a):4000000>=10000000 =FALSE

Regards, 

Alejandro
Comment 1 Thiago Sousa Santos 2010-11-26 20:26:47 UTC
Do you have an specific input/file that triggers this?
Comment 2 agonzalez 2010-11-26 22:18:15 UTC
Created attachment 175328 [details] [review]
Patch for verifying order of operands in the subtraction 

This is a patch for verifying order of operands before doing the subtraction.
Comment 3 agonzalez 2010-11-26 22:21:54 UTC
Regarding the (In reply to comment #1)
> Do you have an specific input/file that triggers this?

I'm using the next pipelines:
 gst-auto-launch \
  qtmux name=mux mux.src ! \
  filesink location=/home/ubuntu/MPEG4ENC_FUNCTIONAL_00001.mov \
  omx_camera mode=1 vstab=false vnf=off exposure=1 awb=3 ldc=true zoom=200 focus=3 output-buffers=4 device=secondary name=cam \
  cam.src ! \
      "video/x-raw-yuv-strided, format=(fourcc)NV12, width=176, height=144, framerate=30/1, buffer-count-requested=4" ! \
  queue name=q3 ! \
  v4l2sink device=/dev/video2 min-queued-bufs=2 sync=false crop-top=0 crop-left=0 crop-width=176 crop-height=144 \
  cam.vidsrc ! \
      "video/x-raw-yuv-strided, format=(fourcc)NV12, width=176, height=144, framerate=30/1" ! \
  queue name=q1 ! omx_mpeg4enc \
      profile=1 level=level-2 input-buffers=2 output-buffers=2 bitrate=128000 ! \
  queue name=q2 ! mux.video_0 \
 pulsesrc ! amrnbenc ! queue ! mux.audio_0 0:play  20:eos

or:
gst-auto-launch qtmux name=mux mux.src ! filesink location=/home/ubuntu/L_SC.CAM2_00029_C.mov omx_camera mode=1 exposure=1 awb=3 ldc=true device=secondary output-buffers=4 name=cam cam.src ! "video/x-raw-yuv-strided, format=(fourcc)NV12, width=176, height=144, framerate=30/1, buffer-count-requested=4" ! tee name=t t. ! queue name=qenc_in ! omx_mpeg4enc profile=1 level=4 input-buffers=2 output-buffers=2 bitrate=4000000 ! queue name=qenc_out ! queue name=q_v_mux ! mux.video_0 t. ! queue name=q_v4l2 ! v4l2sink device=/dev/video2 min-queued-bufs=2 sync=false pulsesrc device=input ! audio/x-raw-int,rate=8000,channels=1,width=16 ! faac profile=2 ! queue ! mux.audio_0 0:play 20:eos

But the real trigger of the issue is that the camera I am using is not giving me the 30 fps that I am asking for.
Comment 4 Thiago Sousa Santos 2010-11-29 12:26:40 UTC
Pushed, thanks for the fix.

commit 0930f0645f03f7bd59537bbb4550f62d5fe58a6a
Author: Alejandro Gonzalez <agonzalez@dextratech.com>
Date:   Sat Nov 27 16:07:19 2010 -0600

    qtmux: gst_qtmux_check_difference verify before subtract
    
    Avoid negative overflow by checking the order of operands
    on subtraction of unsigned integers.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=635878