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 704918 - gst_base_src_negotiate() might not be called
gst_base_src_negotiate() might not be called
Status: RESOLVED DUPLICATE of bug 695981
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Reported: 2013-07-26 07:58 UTC by Paul HENRYS
Modified: 2013-07-26 10:03 UTC
See Also:
GNOME target: ---
GNOME version: ---

Patch (1.00 KB, patch)
2013-07-26 07:58 UTC, Paul HENRYS
none Details | Review

Description Paul HENRYS 2013-07-26 07:58:12 UTC
Created attachment 250183 [details] [review]

gst_base_src_negotiate() might not be called before pushing the first buffer in gstbasesrc.c. In gst_base_src_loop(), the buffer pool allocation is done when calling gst_base_src_negotiate(). Using GST_PAD_FLAG_NEED_RECONFIGURE as a marker to know that buffer pool allocation should be done seems not enough.
Indeed, in the case of an element with fixed caps (e.g.: v4l2src), the element will unset GST_PAD_FLAG_NEED_RECONFIGURE flag calling gst_pad_check_reconfigure() when receiving a reconfigure event. This means that if a reconfigure event is received between the call of gst_pad_mark_reconfigure() in gst_base_src_start_complete() and the start of the task that will call gst_base_src_loop(), the flag might be unset and the buffer pool will not be allocated, leading to a segmentation fault.
I think another condition should be added in gst_base_src_loop() to prevent such a case from happening. Checking that src->priv->pool is a not NULL pointer should make it as done in the patch in attachment.
Comment 1 Olivier Crête 2013-07-26 08:05:01 UTC
This was fixed in git master, I'll import the patches to the 1.0 branch.

*** This bug has been marked as a duplicate of bug 695981 ***
Comment 2 Paul HENRYS 2013-07-26 09:13:31 UTC
Indeed this is duplicate, but is this patch not relevant in the sense that gst_base_src_negotiate() should be called if the buffer pool is not allocated to avoid segmentation fault. There is maybe no other cases where it might happen but that's maybe safer.
Comment 3 Olivier Crête 2013-07-26 09:54:35 UTC
Do you have other cases than v4l2 in mind ? No one else than this call to gst_pad_check_reconfigure() should be clearing the flag. We may want a g_assert(priv->pool != NULL); after this block instead. I'm afraid your proposed patch would just hide other bugs.
Comment 4 Paul HENRYS 2013-07-26 10:03:20 UTC
Yes indeed your proposition g_assert(priv->pool != NULL); is better that would directly point the problem if something is badly implemented.