mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
check/elements/fakesrc.c (test_no_preroll): New check, checks that setting a live fakesrc to PAUSED returns NO_PREROL...
Original commit message from CVS: 2005-10-07 Andy Wingo <wingo@pobox.com> * check/elements/fakesrc.c (test_no_preroll): New check, checks that setting a live fakesrc to PAUSED returns NO_PREROLL both times. * gst/base/gstbasesrc.c (gst_base_src_change_state): Allow a NO_PREROLL from gst_element_change_state to fall through.
This commit is contained in:
parent
46b1a61af4
commit
ab96505bce
5 changed files with 79 additions and 14 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2005-10-07 Andy Wingo <wingo@pobox.com>
|
||||||
|
|
||||||
|
* check/elements/fakesrc.c (test_no_preroll): New check, checks
|
||||||
|
that setting a live fakesrc to PAUSED returns NO_PREROLL both
|
||||||
|
times.
|
||||||
|
|
||||||
|
* gst/base/gstbasesrc.c (gst_base_src_change_state): Allow a
|
||||||
|
NO_PREROLL from gst_element_change_state to fall through.
|
||||||
|
|
||||||
2005-10-07 Wim Taymans <wim@fluendo.com>
|
2005-10-07 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
* gst/gstghostpad.c: (gst_ghost_pad_get_internal),
|
* gst/gstghostpad.c: (gst_ghost_pad_get_internal),
|
||||||
|
|
|
@ -203,6 +203,30 @@ GST_START_TEST (test_sizetype_random)
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
|
GST_START_TEST (test_no_preroll)
|
||||||
|
{
|
||||||
|
GstElement *src;
|
||||||
|
GstStateChangeReturn ret;
|
||||||
|
|
||||||
|
src = setup_fakesrc ();
|
||||||
|
|
||||||
|
g_object_set (G_OBJECT (src), "is-live", TRUE, NULL);
|
||||||
|
|
||||||
|
ret = gst_element_set_state (src, GST_STATE_PAUSED);
|
||||||
|
|
||||||
|
fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL,
|
||||||
|
"error going to paused the first time");
|
||||||
|
|
||||||
|
ret = gst_element_set_state (src, GST_STATE_PAUSED);
|
||||||
|
|
||||||
|
fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL,
|
||||||
|
"error going to paused the second time");
|
||||||
|
|
||||||
|
/* cleanup */
|
||||||
|
cleanup_fakesrc (src);
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_END_TEST;
|
||||||
|
|
||||||
Suite *
|
Suite *
|
||||||
fakesrc_suite (void)
|
fakesrc_suite (void)
|
||||||
|
@ -215,6 +239,7 @@ fakesrc_suite (void)
|
||||||
tcase_add_test (tc_chain, test_sizetype_empty);
|
tcase_add_test (tc_chain, test_sizetype_empty);
|
||||||
tcase_add_test (tc_chain, test_sizetype_fixed);
|
tcase_add_test (tc_chain, test_sizetype_fixed);
|
||||||
tcase_add_test (tc_chain, test_sizetype_random);
|
tcase_add_test (tc_chain, test_sizetype_random);
|
||||||
|
tcase_add_test (tc_chain, test_no_preroll);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1066,8 +1066,8 @@ static GstStateChangeReturn
|
||||||
gst_base_src_change_state (GstElement * element, GstStateChange transition)
|
gst_base_src_change_state (GstElement * element, GstStateChange transition)
|
||||||
{
|
{
|
||||||
GstBaseSrc *basesrc;
|
GstBaseSrc *basesrc;
|
||||||
GstStateChangeReturn result = GST_STATE_CHANGE_SUCCESS;
|
GstStateChangeReturn result;
|
||||||
GstStateChangeReturn presult;
|
gboolean no_preroll = FALSE;
|
||||||
|
|
||||||
basesrc = GST_BASE_SRC (element);
|
basesrc = GST_BASE_SRC (element);
|
||||||
|
|
||||||
|
@ -1078,7 +1078,7 @@ gst_base_src_change_state (GstElement * element, GstStateChange transition)
|
||||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||||
GST_LIVE_LOCK (element);
|
GST_LIVE_LOCK (element);
|
||||||
if (basesrc->is_live) {
|
if (basesrc->is_live) {
|
||||||
result = GST_STATE_CHANGE_NO_PREROLL;
|
no_preroll = TRUE;
|
||||||
basesrc->live_running = FALSE;
|
basesrc->live_running = FALSE;
|
||||||
}
|
}
|
||||||
GST_LIVE_UNLOCK (element);
|
GST_LIVE_UNLOCK (element);
|
||||||
|
@ -1095,7 +1095,7 @@ gst_base_src_change_state (GstElement * element, GstStateChange transition)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((presult =
|
if ((result =
|
||||||
GST_ELEMENT_CLASS (parent_class)->change_state (element,
|
GST_ELEMENT_CLASS (parent_class)->change_state (element,
|
||||||
transition)) == GST_STATE_CHANGE_FAILURE)
|
transition)) == GST_STATE_CHANGE_FAILURE)
|
||||||
goto failure;
|
goto failure;
|
||||||
|
@ -1104,7 +1104,7 @@ gst_base_src_change_state (GstElement * element, GstStateChange transition)
|
||||||
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
||||||
GST_LIVE_LOCK (element);
|
GST_LIVE_LOCK (element);
|
||||||
if (basesrc->is_live) {
|
if (basesrc->is_live) {
|
||||||
result = GST_STATE_CHANGE_NO_PREROLL;
|
no_preroll = TRUE;
|
||||||
basesrc->live_running = FALSE;
|
basesrc->live_running = FALSE;
|
||||||
}
|
}
|
||||||
GST_LIVE_UNLOCK (element);
|
GST_LIVE_UNLOCK (element);
|
||||||
|
@ -1119,12 +1119,15 @@ gst_base_src_change_state (GstElement * element, GstStateChange transition)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
if (no_preroll && result == GST_STATE_CHANGE_SUCCESS)
|
||||||
|
return GST_STATE_CHANGE_NO_PREROLL;
|
||||||
|
else
|
||||||
|
return result;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
failure:
|
failure:
|
||||||
{
|
{
|
||||||
gst_base_src_stop (basesrc);
|
gst_base_src_stop (basesrc);
|
||||||
return presult;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1066,8 +1066,8 @@ static GstStateChangeReturn
|
||||||
gst_base_src_change_state (GstElement * element, GstStateChange transition)
|
gst_base_src_change_state (GstElement * element, GstStateChange transition)
|
||||||
{
|
{
|
||||||
GstBaseSrc *basesrc;
|
GstBaseSrc *basesrc;
|
||||||
GstStateChangeReturn result = GST_STATE_CHANGE_SUCCESS;
|
GstStateChangeReturn result;
|
||||||
GstStateChangeReturn presult;
|
gboolean no_preroll = FALSE;
|
||||||
|
|
||||||
basesrc = GST_BASE_SRC (element);
|
basesrc = GST_BASE_SRC (element);
|
||||||
|
|
||||||
|
@ -1078,7 +1078,7 @@ gst_base_src_change_state (GstElement * element, GstStateChange transition)
|
||||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||||
GST_LIVE_LOCK (element);
|
GST_LIVE_LOCK (element);
|
||||||
if (basesrc->is_live) {
|
if (basesrc->is_live) {
|
||||||
result = GST_STATE_CHANGE_NO_PREROLL;
|
no_preroll = TRUE;
|
||||||
basesrc->live_running = FALSE;
|
basesrc->live_running = FALSE;
|
||||||
}
|
}
|
||||||
GST_LIVE_UNLOCK (element);
|
GST_LIVE_UNLOCK (element);
|
||||||
|
@ -1095,7 +1095,7 @@ gst_base_src_change_state (GstElement * element, GstStateChange transition)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((presult =
|
if ((result =
|
||||||
GST_ELEMENT_CLASS (parent_class)->change_state (element,
|
GST_ELEMENT_CLASS (parent_class)->change_state (element,
|
||||||
transition)) == GST_STATE_CHANGE_FAILURE)
|
transition)) == GST_STATE_CHANGE_FAILURE)
|
||||||
goto failure;
|
goto failure;
|
||||||
|
@ -1104,7 +1104,7 @@ gst_base_src_change_state (GstElement * element, GstStateChange transition)
|
||||||
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
||||||
GST_LIVE_LOCK (element);
|
GST_LIVE_LOCK (element);
|
||||||
if (basesrc->is_live) {
|
if (basesrc->is_live) {
|
||||||
result = GST_STATE_CHANGE_NO_PREROLL;
|
no_preroll = TRUE;
|
||||||
basesrc->live_running = FALSE;
|
basesrc->live_running = FALSE;
|
||||||
}
|
}
|
||||||
GST_LIVE_UNLOCK (element);
|
GST_LIVE_UNLOCK (element);
|
||||||
|
@ -1119,12 +1119,15 @@ gst_base_src_change_state (GstElement * element, GstStateChange transition)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
if (no_preroll && result == GST_STATE_CHANGE_SUCCESS)
|
||||||
|
return GST_STATE_CHANGE_NO_PREROLL;
|
||||||
|
else
|
||||||
|
return result;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
failure:
|
failure:
|
||||||
{
|
{
|
||||||
gst_base_src_stop (basesrc);
|
gst_base_src_stop (basesrc);
|
||||||
return presult;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,6 +203,30 @@ GST_START_TEST (test_sizetype_random)
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
|
GST_START_TEST (test_no_preroll)
|
||||||
|
{
|
||||||
|
GstElement *src;
|
||||||
|
GstStateChangeReturn ret;
|
||||||
|
|
||||||
|
src = setup_fakesrc ();
|
||||||
|
|
||||||
|
g_object_set (G_OBJECT (src), "is-live", TRUE, NULL);
|
||||||
|
|
||||||
|
ret = gst_element_set_state (src, GST_STATE_PAUSED);
|
||||||
|
|
||||||
|
fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL,
|
||||||
|
"error going to paused the first time");
|
||||||
|
|
||||||
|
ret = gst_element_set_state (src, GST_STATE_PAUSED);
|
||||||
|
|
||||||
|
fail_unless (ret == GST_STATE_CHANGE_NO_PREROLL,
|
||||||
|
"error going to paused the second time");
|
||||||
|
|
||||||
|
/* cleanup */
|
||||||
|
cleanup_fakesrc (src);
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_END_TEST;
|
||||||
|
|
||||||
Suite *
|
Suite *
|
||||||
fakesrc_suite (void)
|
fakesrc_suite (void)
|
||||||
|
@ -215,6 +239,7 @@ fakesrc_suite (void)
|
||||||
tcase_add_test (tc_chain, test_sizetype_empty);
|
tcase_add_test (tc_chain, test_sizetype_empty);
|
||||||
tcase_add_test (tc_chain, test_sizetype_fixed);
|
tcase_add_test (tc_chain, test_sizetype_fixed);
|
||||||
tcase_add_test (tc_chain, test_sizetype_random);
|
tcase_add_test (tc_chain, test_sizetype_random);
|
||||||
|
tcase_add_test (tc_chain, test_no_preroll);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue