GNOME Bugzilla – Bug 742595
Memory/surfaces not freed if video playback stopped before completion
Last modified: 2015-04-20 08:46:03 UTC
There appears to be a memory issue when using playbin to play video files with gstreamer-vaapi that are stopped prior to GST_MESSAGE_EOS but does not occur if the video completes with GST_MESSAGE_EOS. As reported by top/atop... Free memory decreases while cached memory increases until system hangs. If the process is stopped all memory used is freed. We have an application that will repeatedly play videos at a set duration, if the duration is set to a time less then the duration of the video gstreamer-vaapi will allocate but not free surfaces when playbin is paused and released. With the GST_DEBUG=*vaapi*:6 set, debug shows those surface... 0:00:26.531035254 15283 0x2684aa0 DEBUG vaapi gstvaapiimage.c:116:gst_vaapi_image_destroy: image 0xa000000 0:00:26.606165943 15283 0x2684aa0 DEBUG vaapi gstvaapicontext.c:88:context_destroy: context 0x02000000 0:00:26.606206460 15283 0x2684aa0 DEBUG vaapi gstvaapisurface.c:83:gst_vaapi_surface_destroy: surface 0x4000001 0:00:26.606218670 15283 0x2684aa0 DEBUG vaapi gstvaapisurface.c:83:gst_vaapi_surface_destroy: surface 0x4000002 0:00:26.606227249 15283 0x2684aa0 DEBUG vaapi gstvaapisurface.c:83:gst_vaapi_surface_destroy: surface 0x4000003 0:00:26.606235214 15283 0x2684aa0 DEBUG vaapi gstvaapisurface.c:83:gst_vaapi_surface_destroy: surface 0x4000004 0:00:26.606243251 15283 0x2684aa0 DEBUG vaapi gstvaapisurface.c:83:gst_vaapi_surface_destroy: surface 0x4000005 0:00:26.606251145 15283 0x2684aa0 DEBUG vaapi gstvaapisurface.c:83:gst_vaapi_surface_destroy: surface 0x4000000 ...being destroyed when the video completes on it's own. The surfaces are not destroyed (the gst_vaapi_surface_destroy messages are never printed) if the video is stopped before GST_MESSAGE_EOS is received. The debug continues to show gstreamer-vaapi processing those videos for a short time longer after the gst_vaapi_image_destroy and context_destroy messages are printed. The surface references (0x4000000 in this case) increment with each video played but when the videos complete on their own, the references get reused. I'm guessing that the threads for processing the video are not being stopped (or stopped immediately) when playbin is paused and destroyed so it's references to the surfaces are not being released and possibly more but I don't know about the inner workings of gstreamer-vaapi. Please let me know what more is needed.
Thanks for your report and your patience. This issue seems to the same that's is fixed in bug #747999. I'll mark this bug as dup of that one. If you think it is a different issue, please reopen the bug. *** This bug has been marked as a duplicate of bug 747999 ***