[Bug 796539] New: Vaapi encoding randomly fails with error: failed to allocate coded buffer

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Fri Jun 8 07:48:15 UTC 2018


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

            Bug ID: 796539
           Summary: Vaapi encoding randomly fails with error: failed to
                    allocate coded buffer
    Classification: Platform
           Product: GStreamer
           Version: 1.x
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: gstreamer-vaapi
          Assignee: gstreamer-bugs at lists.freedesktop.org
          Reporter: ametrix.bg at live.com
        QA Contact: gstreamer-bugs at lists.freedesktop.org
                CC: bsreerenj at gmail.com, vjaquez at igalia.com
     GNOME version: ---

Created attachment 372602
  --> https://bugzilla.gnome.org/attachment.cgi?id=372602&action=edit
Screenshot of gstreamer's log

I developed streaming application with gstreamer-1.10.4 and used vaapi to
accelerate decoding/encoding. It streams video encoded to ts stream with h264
format. 

But streaming stops after random period of time when it is started. 
Constantly I get error gst_vaapi_encoder_put_frame: failed to allocate coded
buffer and gst_vaapiencode_handle_frame: failed to encode frame xxx (status
-2).

After some debugging I found the reason for this. It seems that problem is in 
gst_vaapi_encoder_create_coded_buffer function in gstvaapiencoder.c. 
In this line g_cond_wait (&encoder->codedbuf_free, &encoder->mutex); should be
placed in loop as spurious wakeup can occur. This is explained in glib
documentation:
https://developer.gnome.org/glib/stable/glib-Threads.html#g-cond-wait .

I putted g_cond_wait with codedbuf_proxy check in a loop and forced it to retry
and wait for the buffer to be available. Then I recompilled gstreamer-vaapi.
Now it works perfectly without stopping.

I can submit a patch on request.

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