Skip to content

videoio: gst: Fix gst assertion on null msg - #13988

Merged
opencv-pushbot merged 1 commit into
opencv:3.4from
raymanfx:gstreamer
Mar 6, 2019
Merged

opencv-pushbot merged 1 commit into
opencv:3.4from
raymanfx:gstreamer

Conversation

@raymanfx

@raymanfx raymanfx commented Mar 6, 2019

Copy link
Copy Markdown
Contributor

According to the gstreamer docs [1], the GstMessage pointer returned by
gst_bus_pop() is nullable, meaning NULL is a valid return value.

Previously, gst_is_missing_plugin_message would throw an assert when its
message object parameter would fail the GST_IS_MESSAGE macro check,
crashing the entire process (unless running in a try-catch block of course).

Instead of relying on valid messages, check if the message object itself is
valid before passing it to other gstreamer functions.

[1] https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBus.html#gst-bus-pop

Signed-off-by: Christopher N. Hesse [email protected]

This pullrequest changes

@raymanfx

raymanfx commented Mar 6, 2019 •

Copy link
Copy Markdown
Contributor Author

FWIW I'm still not quite sure what exactly is causing this issue - or why no one else appears to be hitting it. I have an application that reads frames from a video file using VideoCapture. OpenCV is compiled with the Gstreamer backend enabled and I am also using gstreamer-vaapi plugins.

After some time (sometimes ~3h, sometimes ~10m) the application crashes because "gst_is_missing_plugin_message" asserts on the (invalid) message object pointer.
It's not really reproducible on my side though, I tried for more than a week now.

My application builds against OpenCV 3.4, not the master branch.
By looking at the code, this bug should at least affect those two branches in the same way though (3.4 and master).

@alalek

alalek commented Mar 6, 2019

Copy link
Copy Markdown
Member

Thank you!
I believe this change doesn't not break anything.

As a "bugfix" this patch should go into 3.4 branch first. We will merge changes from 3.4 into master regularly (weekly/bi-weekly).

So, please:

  • change "base" branch of this PR: master => 3.4 (use "Edit" button near PR title)
  • rebase your commits from master onto 3.4 branch. For example:
    git rebase -i --onto upstream/3.4 upstream/master
    (check list of your commits, save and quit (Esc + "wq" + Enter)
    where upstream is configured by following this GitHub guide and fetched (git fetch upstream).
  • push rebased commits into source branch of your fork (with --force option)

Note: no needs to re-open PR, apply changes "inplace".

@raymanfx
raymanfx changed the base branch from master to 3.4 March 6, 2019 16:35
According to the gstreamer docs [1], the GstMessage pointer returned by
gst_bus_pop() is nullable, meaning NULL is a valid return value.

Previously, gst_is_missing_plugin_message would throw an assert when its
message object parameter would fail the GST_IS_MESSAGE macro check,
crashing the entire process (unless running in a try-catch block of course).

Instead of relying on valid messages, check if the message object itself is
valid before passing it to other gstreamer functions.

[1] https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBus.html#gst-bus-pop

Signed-off-by: Christopher N. Hesse <[email protected]>

@alalek alalek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done! Thank you 👍

@opencv-pushbot
opencv-pushbot merged commit 796b0fe into opencv:3.4 Mar 6, 2019
@alalek alalek mentioned this pull request Mar 11, 2019
SavyaSanchi-Sharma pushed a commit to SavyaSanchi-Sharma/opencv that referenced this pull request Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants