mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-29 05:01:23 +00:00
tests: compositor: Fix race in buffer unref
Don't assume that compositor will output only single buffer for single input buffer. If buffer's running time is not completly aligned to output buffer running time or duration, compositor can generate multiple buffers. If that happens, two threads, one is aggregator output thread and main thread were trying to modify buffer in this test. Clear the buffer after shutting down pipeline to avoid the race. Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2836 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5081>
This commit is contained in:
parent
3a5978def1
commit
792eb0cf48
1 changed files with 2 additions and 2 deletions
|
@ -2627,12 +2627,12 @@ GST_START_TEST (test_stream_start_after_eos)
|
||||||
while (!test_data.buf)
|
while (!test_data.buf)
|
||||||
g_cond_wait (&test_data.cond, &test_data.lock);
|
g_cond_wait (&test_data.cond, &test_data.lock);
|
||||||
g_mutex_unlock (&test_data.lock);
|
g_mutex_unlock (&test_data.lock);
|
||||||
gst_buffer_unref (test_data.buf);
|
|
||||||
|
|
||||||
state_res = gst_element_set_state (bin, GST_STATE_NULL);
|
state_res = gst_element_set_state (bin, GST_STATE_NULL);
|
||||||
ck_assert_int_ne (state_res, GST_STATE_CHANGE_FAILURE);
|
ck_assert_int_ne (state_res, GST_STATE_CHANGE_FAILURE);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
|
gst_buffer_unref (test_data.buf);
|
||||||
g_main_loop_unref (main_loop);
|
g_main_loop_unref (main_loop);
|
||||||
gst_bus_remove_signal_watch (bus);
|
gst_bus_remove_signal_watch (bus);
|
||||||
gst_object_unref (bus);
|
gst_object_unref (bus);
|
||||||
|
@ -2728,12 +2728,12 @@ GST_START_TEST (test_new_pad_after_eos)
|
||||||
while (!test_data.buf)
|
while (!test_data.buf)
|
||||||
g_cond_wait (&test_data.cond, &test_data.lock);
|
g_cond_wait (&test_data.cond, &test_data.lock);
|
||||||
g_mutex_unlock (&test_data.lock);
|
g_mutex_unlock (&test_data.lock);
|
||||||
gst_buffer_unref (test_data.buf);
|
|
||||||
|
|
||||||
state_res = gst_element_set_state (bin, GST_STATE_NULL);
|
state_res = gst_element_set_state (bin, GST_STATE_NULL);
|
||||||
ck_assert_int_ne (state_res, GST_STATE_CHANGE_FAILURE);
|
ck_assert_int_ne (state_res, GST_STATE_CHANGE_FAILURE);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
|
gst_buffer_unref (test_data.buf);
|
||||||
g_main_loop_unref (main_loop);
|
g_main_loop_unref (main_loop);
|
||||||
gst_bus_remove_signal_watch (bus);
|
gst_bus_remove_signal_watch (bus);
|
||||||
gst_object_unref (bus);
|
gst_object_unref (bus);
|
||||||
|
|
Loading…
Reference in a new issue