Repository navigation
Conversation
aravissrc gst element switch test
6bcdd47 to
f34367a
Compare
This test crashes as soon as the new source element is put in PLAYING mode. But that is probably due to a mishandling of the pipeline. Doing this sort of pipeline manipulation seems not trivial: <https://gstreamer.freedesktop.org/documentation/application-development/advanced/pipeline-manipulation.html?gi-language=c>
95d6118 to
89f7342
Compare
There was a problem hiding this comment.
Pull request overview
Adds a GStreamer-based test program intended to reproduce/debug a crash when switching the aravissrc element in a running pipeline, and updates the Meson build so this test is built when the GStreamer plugin is enabled.
Changes:
- Move
subdir('tests')after the GStreamer plugin configuration so tests can depend ongst_enabled. - Add a new
arv-gst-testexecutable (built only whengst_enabledis true). - Introduce
tests/arvgsttest.c, a small pipeline-manipulation program that removes and re-adds anaravissrcelement.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
meson.build |
Reorders tests subdir inclusion to occur after GStreamer plugin setup. |
tests/meson.build |
Builds arv-gst-test when gst_enabled is true. |
tests/arvgsttest.c |
New GStreamer pipeline manipulation test for switching aravissrc. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| printf ("Stop the source\n"); | ||
| g_assert_cmpint (gst_element_set_state(source, GST_STATE_NULL), ==, GST_STATE_CHANGE_SUCCESS); | ||
|
|
There was a problem hiding this comment.
gst_element_set_state(source, GST_STATE_NULL) can return GST_STATE_CHANGE_ASYNC for live/streaming elements; asserting GST_STATE_CHANGE_SUCCESS can fail even when the transition is correct. Prefer checking for failure and then waiting for the element to actually reach NULL with gst_element_get_state() using a non-zero timeout before proceeding with unlink/remove.
| gst_element_get_state (source, ¤t_state, &pending_state, 0); | ||
| printf ("source current state:%d - pending state:%d\n", current_state, pending_state); | ||
|
|
||
| sleep (1); | ||
|
|
||
| gst_element_unlink(source, sink); | ||
| g_assert (gst_bin_remove(GST_BIN(pipeline), source)); | ||
|
|
There was a problem hiding this comment.
The pipeline is modified (unlink + gst_bin_remove) while it is still in PLAYING and without waiting for the source to fully complete its NULL transition (gst_element_get_state(..., 0) returns immediately). This makes the manipulation timing-dependent and can trigger crashes. Wait for the NULL state transition to complete (non-zero timeout) before unlinking/removing, or pause/block the data flow per GStreamer pipeline manipulation guidance.
There was a problem hiding this comment.
Paused the pipeline and waited for the source to reach NULL before unlinking/removing it, then resumed playback after adding the replacement. Commit: 0f07e39.
Co-authored-by: EmmanuelP <136864+EmmanuelP@users.noreply.github.com>
Co-authored-by: EmmanuelP <136864+EmmanuelP@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: EmmanuelP <136864+EmmanuelP@users.noreply.github.com>
This test crashes as soon as the new source element is put in PLAYING mode. But that is probably due to a mishandling of the pipeline. Doing this sort of pipeline manipulation seems not trivial: https://gstreamer.freedesktop.org/documentation/application-development/advanced/pipeline-manipulation.html?gi-language=c
PLAYING