[FFmpeg-trac] #2450(avdevice:new): Xorg resource leakage

FFmpeg trac at avcodec.org
Tue Apr 9 09:52:03 CEST 2013


#2450: Xorg resource leakage
-------------------------------------+-------------------------------------
             Reporter:  raimund      |                    Owner:
                 Type:  defect       |                   Status:  new
             Priority:  important    |                Component:  avdevice
              Version:  1.1.4        |               Resolution:
             Keywords:  x11grab      |               Blocked By:
  regression                         |  Reproduced by developer:  0
             Blocking:               |
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------

Comment (by raimund):

 Is reproducible with current git head:

 $ ./ffmpeg -f x11grab -s cif -r 25 -i :0.0   /tmp/out.mpg

 ffmpeg version N-51680-ge82f562 Copyright (c) 2000-2013 the FFmpeg
 developers
   built on Apr  8 2013 21:24:02 with gcc 4.4.6 (GCC) 20110731 (Red Hat
 4.4.6-3)
   configuration: --disable-yasm --enable-gpl --enable-x11grab --enable-
 version3 --enable-libvo-aacenc
   libavutil      52. 25.100 / 52. 25.100
   libavcodec     55.  2.100 / 55.  2.100
   libavformat    55.  1.100 / 55.  1.100
   libavdevice    55.  0.100 / 55.  0.100
   libavfilter     3. 49.100 /  3. 49.100
   libswscale      2.  2.100 /  2.  2.100
   libswresample   0. 17.102 /  0. 17.102
   libpostproc    52.  2.100 / 52.  2.100
 [x11grab @ 0x9410540] device: :0.0 -> display: :0.0 x: 0 y: 0 width: 352
 height: 288
 [x11grab @ 0x9410540] shared memory extension found
 Input #0, x11grab, from ':0.0':
   Duration: N/A, start: 1365491257.958856, bitrate: 81100 kb/s
     Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 352x288, 81100
 kb/s, 25 tbr, 1000k tbn, 25 tbc
 File '/tmp/out.mpg' already exists. Overwrite ? [y/N] y
 VBV buffer size not set, muxing may fail
 Output #0, mpeg, to '/tmp/out.mpg':
   Metadata:
     encoder         : Lavf55.1.100
     Stream #0:0: Video: mpeg1video, yuv420p, 352x288, q=2-31, 200 kb/s,
 90k tbn, 25 tbc
 Stream mapping:
   Stream #0:0 -> #0:0 (rawvideo -> mpeg1video)
 Press [q] to stop, [?] for help
 [swscaler @ 0x9404c00] Warning: data is not aligned! This can lead to a
 speedloss
 frame= 1101 fps= 25 q=31.0 Lsize=    2336kB time=00:00:44.00 bitrate=
 434.9kbits/s
 video:2322kB audio:0kB subtitle:0 global headers:0kB muxing overhead
 0.615708%


 While ffmpeg is running execute
 $ xrestop -b -m 1

 I got for the ffmpeg X11 client after ~500 frames:
      cursors       : 531
 and after ~1000 frames:
      cursors       : 1040

 Leak disappers when patching this way:

 diff --git a/libavdevice/x11grab.c b/libavdevice/x11grab.c
 index 6124006..bf88e88 100644
 --- a/libavdevice/x11grab.c
 +++ b/libavdevice/x11grab.c
 @@ -361,10 +361,12 @@ paint_mouse_pointer(XImage *image, struct x11grab
 *s)
      if (image->bits_per_pixel != 24 && image->bits_per_pixel != 32)
          return;

 +/*
      c = XCreateFontCursor(dpy, XC_left_ptr);
      w = DefaultRootWindow(dpy);
      attr.cursor = c;
      XChangeWindowAttributes(dpy, w, CWCursor, &attr);
 +*/

 => Revise bugfix #1738.

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/2450#comment:2>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list