GNOME Bugzilla – Bug 740110
Memory leak in vaapisink
Last modified: 2015-06-19 12:39:00 UTC
Created attachment 290700 [details] file containing my earlier letter and a simple leaking program As I already informed you by email (sorry, did not know about this bugzilla for your project), I think there is a serious memory leak in vaapisink. I am attaching the letter with the program revealing the leak. This same program: 1. does not leak memory for days, at all, when using ximagesink 2. leaks memory when using vaapisink, filling up 16GB in a few (2-3) hours This happens on all graphics platforms with video acceleration, Intel HD IGP, NVidia (with vdpau), AMD (with XvBA). I am using Ubuntu Linux 14.04 LTS, with GStreamer v1.2.4, and vaapisink v0.5.7, both provided by Ubuntu Linux 14.04 LTS. Today I'll get a new Intel NUC and install Ubuntu 14.10, which comes with GStreamer v1.4.3 and hopefully a later version of vaapisink. My attempts to build GStreamer v1.4.4 from source and gstreamer-vaapi from yesterday's source failed. I really need a fast and reliable video acceleration. ximagesink, although rock stable, is too slow to play video clips, skipping frames. glimagesink is very unreliable: my program crashes it an a few iterations; besides it jerks the window, opening the new one for each media file. vaapisink is stable and does not jerk the window, just leaks memory, unfortunately. Do I have any other options?
I installed Ubuntu 14.10 x64, which comes with GStreamer v1.4.3 and gstreamer-vaapisink v0.5.9 vaapisink immediately fails (the same pipeline works OK with ximagesink): fl@gbx1:~/ads$ gst-launch-1.0 -v filesrc location=31.png ! decodebin ! imagefreeze ! videoconvert ! vaapisink libva info: VA-API version 0.35.1 libva info: va_getDriverName() returns 0 libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so libva info: Found init function __vaDriverInit_0_35 libva info: va_openDriver() returns 0 Setting pipeline to PAUSED ... Pipeline is PREROLLING ... /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:src: caps = image/png /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:src: caps = "NULL" /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstPngParse:pngparse0.GstPad:src: caps = "image/png\,\ width\=\(int\)768\,\ height\=\(int\)1366" /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstPngDec:pngdec0.GstPad:sink: caps = "image/png\,\ width\=\(int\)768\,\ height\=\(int\)1366" /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstPngDec:pngdec0.GstPad:src: caps = "video/x-raw\,\ format\=\(string\)RGB\,\ width\=\(int\)768\,\ height\=\(int\)1366\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ interlace-mode\=\(string\)progressive\,\ colorimetry\=\(string\)1:1:0:0\,\ framerate\=\(fraction\)0/1" /GstPipeline:pipeline0/GstImageFreeze:imagefreeze0.GstPad:src: caps = "video/x-raw\,\ format\=\(string\)RGB\,\ width\=\(int\)768\,\ height\=\(int\)1366\,\ framerate\=\(fraction\)25/1\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ interlace-mode\=\(string\)progressive\,\ colorimetry\=\(string\)1:1:0:0" /GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:src: caps = "video/x-raw\,\ format\=\(string\)RGB\,\ width\=\(int\)768\,\ height\=\(int\)1366\,\ framerate\=\(fraction\)25/1\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ interlace-mode\=\(string\)progressive\,\ colorimetry\=\(string\)1:1:0:0" ** (gst-launch-1.0:3384): CRITICAL **: gst_vaapi_mini_object_unref: assertion 'object != NULL' failed /GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:sink: caps = "video/x-raw\,\ format\=\(string\)RGB\,\ width\=\(int\)768\,\ height\=\(int\)1366\,\ framerate\=\(fraction\)25/1\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ interlace-mode\=\(string\)progressive\,\ colorimetry\=\(string\)1:1:0:0" /GstPipeline:pipeline0/GstImageFreeze:imagefreeze0.GstPad:sink: caps = "video/x-raw\,\ format\=\(string\)RGB\,\ width\=\(int\)768\,\ height\=\(int\)1366\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ interlace-mode\=\(string\)progressive\,\ colorimetry\=\(string\)1:1:0:0\,\ framerate\=\(fraction\)0/1" /GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstDecodePad:src_0.GstProxyPad:proxypad1: caps = "video/x-raw\,\ format\=\(string\)RGB\,\ width\=\(int\)768\,\ height\=\(int\)1366\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ interlace-mode\=\(string\)progressive\,\ colorimetry\=\(string\)1:1:0:0\,\ framerate\=\(fraction\)0/1" ** (gst-launch-1.0:3384): CRITICAL **: gst_vaapi_mini_object_unref: assertion 'object != NULL' failed ** (gst-launch-1.0:3384): CRITICAL **: gst_vaapi_mini_object_unref: assertion 'object != NULL' failed ** (gst-launch-1.0:3384): CRITICAL **: gst_vaapi_mini_object_unref: assertion 'object != NULL' failed ** (gst-launch-1.0:3384): CRITICAL **: gst_vaapi_mini_object_unref: assertion 'object != NULL' failed ** (gst-launch-1.0:3384): CRITICAL **: gst_vaapi_mini_object_unref: assertion 'object != NULL' failed ERROR: from element /GstPipeline:pipeline0/GstImageFreeze:imagefreeze0: Internal data stream error. ** (gst-launch-1.0:3384): CRITICAL **: gst_vaapi_mini_object_unref: assertion 'object != NULL' failed Additional debug info: gstimagefreeze.c(836): gst_image_freeze_src_loop (): /GstPipeline:pipeline0/GstImageFreeze:imagefreeze0: stream stopped, reason not-negotiated ERROR: pipeline doesn't want to preroll. Setting pipeline to NULL ... /GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:src: caps = "NULL" /GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:sink: caps = "NULL" /GstPipeline:pipeline0/GstImageFreeze:imagefreeze0.GstPad:src: caps = "NULL" /GstPipeline:pipeline0/GstImageFreeze:imagefreeze0.GstPad:sink: caps = "NULL" /GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstDecodePad:src_0.GstProxyPad:proxypad1: caps = "NULL" /GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstDecodePad:src_0: caps = "NULL" /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstPngDec:pngdec0.GstPad:src: caps = "NULL" /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstPngDec:pngdec0.GstPad:sink: caps = "NULL" /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstPngParse:pngparse0.GstPad:src: caps = "NULL" Freeing pipeline ...
Please recommend a Linux distribution and version on which you think gst-vaapisink works and does not leak memory. Should I use stock distribution packages or build from your latest sources? I tried both stock and built from source gstreamer-vaapi distributions on Ubuntu. 1. Stock in Ubuntu 14.04 works but leaks memory 2. Stock in Ubuntu 14.10 does not work (see above) 3. Built from source in Ubuntu 14.04 does not work in a similar way as above
(In reply to comment #2) > Please recommend a Linux distribution and version on which you think > gst-vaapisink works and does not leak memory. Should I use stock distribution > packages or build from your latest sources? > > I tried both stock and built from source gstreamer-vaapi distributions on > Ubuntu. > > 1. Stock in Ubuntu 14.04 works but leaks memory > 2. Stock in Ubuntu 14.10 does not work (see above) > 3. Built from source in Ubuntu 14.04 does not work in a similar way as above The following pipeline will work: gst-launch-1.0 -v filesrc location=some_file.png ! decodebin ! imagefreeze ! videoconvert ! vaapipostproc ! vaapisink My environment is: - HW: Ivybridge - SW: GStreamer 1.4-git, gstreamer-vaapi from git master branch. Note: since 24-bit RGB is not supported, you have to insert the SW converter first (videoconvert) before vaapipostproc. The latter will allow you to upload to a GPU surface and perform additional video processing, if needed.
Indeed, with the newest gstreamer-vaapi 0.5.10.pre1 I pulled and build from the master branch today, the *.png files now play OK, both with your pipeline and mine (without vaapipostproc). What is more important, the new v0.5.10.pre1 vaapisink apparently stopped leaking memory (only tested on *.png files plugged cyclicly as new locations in your and my pipeline). Need to test longer. Although the old Ubuntu 14.04 stock vaapisink starts leaking immediately. So what you are saying is that I cannot simply use decodebin, but need to reconfigure the pipeline dynamically depending on the file type: *.png, *.jpg, *.mp4, *.avi, *.wmv, *.mpg, etc. Is there any documentation/sources on how to build custom pipelines for vaapisink (i.e., without decodebin's autoplugging), to use acceleration as much as possible? Like filesrc ! jpegarse ! vaapidecode ! vaapisink for .*.jpeg files, you recommended. How would one know? I will continue testing over the weekend. Thanks!
My experimentation appeared unsuccessful, since I could not figure how to construct custom pipelines (rather than using decodebin). Indeed, as it is mentioned in bug 739322, it would be nice if decodebin could autoplug vaapi accelerated decoders > Is there any documentation/sources on how to build custom pipelines for > vaapisink (i.e., without decodebin's autoplugging), to use acceleration > as much as possible? > Like filesrc ! jpegarse ! vaapidecode ! vaapisink for .*.jpeg files, you > recommended. How would one know? The latest git gstreamer + gstreamer-vaapi appeared unstable for my purposes. Also because of tight deadlines I had to convert my computers to a stable Ubuntu-14.04 distribution packages, *without* video acceleration. Will continue experimenting next weekend, with new hardware dedicated for that purpose.
(In reply to comment #5) > My experimentation appeared unsuccessful, since I could not figure how to > construct custom pipelines (rather than using decodebin). Indeed, as it is > mentioned in bug 739322, it would be nice if decodebin could autoplug vaapi > accelerated decoders > I have provided a patch in #739322 which will allow decodebin to autoplug the HW decoder, will push it after getting some more comments.
The patch is now integrated. Furthermore, some changes were pushed to allow for decoding into a RW VA image/surface. Please note however that 24-bit RGB are still not supported.
I confirm that using gstreamer-vaapi master and gstreamer-1.5 these pipelines work OK: gst-launch-1.0 -v filesrc location=image.jpg ! decodebin ! imagefreeze ! vaapisink gst-launch-1.0 -v filesrc location=image.png ! decodebin ! imagefreeze ! vaapisink I will check with gstreamer-1.4 and 1.2 later. Sergei, does it work for you???
Closing this as fixed. Please feel free to re-open if issue persists.