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 786442 - segfault encoding rawvideo since omxvideoenc: ensure enough buffers are allocated in the pool
segfault encoding rawvideo since omxvideoenc: ensure enough buffers are alloc...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-omx
git master
Other Linux
: Normal normal
: 1.13.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-08-17 19:55 UTC by Andy Furniss
Modified: 2017-09-06 13:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
command + gdb bt (2.58 KB, text/plain)
2017-08-17 19:55 UTC, Andy Furniss
  Details
omxvideoenc: fix crash in propose_allocation if input not defined (1.04 KB, patch)
2017-08-28 11:57 UTC, Guillaume Desmottes
none Details | Review
omxvideoenc: use caps from query in propose_allocation (1.68 KB, patch)
2017-08-30 12:59 UTC, Guillaume Desmottes
committed Details | Review

Description Andy Furniss 2017-08-17 19:55:03 UTC
Created attachment 357836 [details]
command + gdb bt

Testing AMD VCE via omxh264enc bellagio since gst-omx commit -

commit 3f5d98a360d657e904fadedb4804b03952204f63
Author: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Date:   Mon Jul 10 15:00:58 2017 +0200

    omxvideoenc: ensure enough buffers are allocated in the pool
    
    Handle allocation query and ensure enough buffers are allocated in
    the negotiated pool. This help preventing buffer starvation in the pipeline.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=785122

I segfault when trying to encode rawvideo.

The same command replacing rawvideo file input with videotestsrc does not segfault.

Attached example command and gdb bt
Comment 1 Guillaume Desmottes 2017-08-28 11:57:59 UTC
Created attachment 358585 [details] [review]
omxvideoenc: fix crash in propose_allocation if input not defined

Early return rather than deferencing a NULL pointer if self->input_state
isn't defined when propose_allocation() is called.
Comment 2 Nicolas Dufresne (ndufresne) 2017-08-29 14:34:09 UTC
Review of attachment 358585 [details] [review]:

::: omx/gstomxvideoenc.c
@@ +1911,3 @@
+    return FALSE;
+
+  size = self->input_state->info.size;

I think you could read the caps from the query, tranform to VideoInfo and get the size from there.
Comment 3 Guillaume Desmottes 2017-08-30 12:59:12 UTC
Created attachment 358758 [details] [review]
omxvideoenc: use caps from query in propose_allocation

Prevent crash by not deferencing a NULL pointer if self->input_state
isn't defined when propose_allocation() is called.
Comment 4 Guillaume Desmottes 2017-08-30 13:00:09 UTC
Review of attachment 358585 [details] [review]:

::: omx/gstomxvideoenc.c
@@ +1911,3 @@
+    return FALSE;
+
+  size = self->input_state->info.size;

Done. But in this specific case that doesn't help as the caps from the query is NULL as well. Is that another bug?
Comment 5 Nicolas Dufresne (ndufresne) 2017-09-06 13:13:18 UTC
Review of attachment 358758 [details] [review]:

This is common pattern, just look at most video sinks in general. Not sure why the caps may endup NULL though.
Comment 6 Nicolas Dufresne (ndufresne) 2017-09-06 13:15:53 UTC
Attachment 358758 [details] pushed as 79df3b0 - omxvideoenc: use caps from query in propose_allocation