mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 20:05:38 +00:00
basesrc-test: Fix race testing segment update
As this test is using a short sleep (GST_USECOND, which is 10ms in microsecond), sometimes that EOS event is received before the loop in basesrc have run _do_seek() and pushed the update segment. To solve this issue, we wait for the initial segment (and flush it) then we wait for the second segment before sending EOS. https://bugzilla.gnome.org/show_bug.cgi?id=753365
This commit is contained in:
parent
ef3286e0f5
commit
900110c6dc
1 changed files with 18 additions and 4 deletions
|
@ -510,9 +510,11 @@ segment_event_catcher (GstObject * pad, GstPadProbeInfo * info,
|
|||
fail_unless (user_data != NULL);
|
||||
|
||||
if (GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT) {
|
||||
if (*last_event)
|
||||
gst_event_unref (*last_event);
|
||||
g_mutex_lock (&check_mutex);
|
||||
fail_unless (*last_event == NULL);
|
||||
*last_event = gst_event_copy (event);
|
||||
g_cond_signal (&check_cond);
|
||||
g_mutex_unlock (&check_mutex);
|
||||
}
|
||||
|
||||
return GST_PAD_PROBE_OK;
|
||||
|
@ -568,14 +570,26 @@ GST_START_TEST (basesrc_seek_events_rate_update)
|
|||
state_ret = gst_element_get_state (pipe, NULL, NULL, -1);
|
||||
fail_unless (state_ret == GST_STATE_CHANGE_SUCCESS);
|
||||
|
||||
/* wait for the first segment to be posted, and flush it ... */
|
||||
g_mutex_lock (&check_mutex);
|
||||
while (seg_event == NULL)
|
||||
g_cond_wait (&check_cond, &check_mutex);
|
||||
gst_event_unref (seg_event);
|
||||
seg_event = NULL;
|
||||
g_mutex_unlock (&check_mutex);
|
||||
|
||||
GST_INFO ("seeking");
|
||||
|
||||
/* seek */
|
||||
event_ret = gst_element_send_event (pipe, rate_seek);
|
||||
fail_unless (event_ret == TRUE);
|
||||
|
||||
/* wait a second, then do controlled shutdown */
|
||||
g_usleep (GST_USECOND * 1);
|
||||
/* wait for the updated segment to be posted, posting EOS make the loop
|
||||
* thread exit before the updated segment is posted ... */
|
||||
g_mutex_lock (&check_mutex);
|
||||
while (seg_event == NULL)
|
||||
g_cond_wait (&check_cond, &check_mutex);
|
||||
g_mutex_unlock (&check_mutex);
|
||||
|
||||
/* shut down pipeline only (should send EOS message) ... */
|
||||
gst_element_send_event (pipe, gst_event_new_eos ());
|
||||
|
|
Loading…
Reference in a new issue