Commit ab96505b authored by Andy Wingo Wingo's avatar Andy Wingo Wingo

check/elements/fakesrc.c (test_no_preroll): New check, checks that setting a...

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.
parent 46b1a61a
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>
* gst/gstghostpad.c: (gst_ghost_pad_get_internal),
......
......@@ -203,6 +203,30 @@ GST_START_TEST (test_sizetype_random)
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 *
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_fixed);
tcase_add_test (tc_chain, test_sizetype_random);
tcase_add_test (tc_chain, test_no_preroll);
return s;
}
......
......@@ -1066,8 +1066,8 @@ static GstStateChangeReturn
gst_base_src_change_state (GstElement * element, GstStateChange transition)
{
GstBaseSrc *basesrc;
GstStateChangeReturn result = GST_STATE_CHANGE_SUCCESS;
GstStateChangeReturn presult;
GstStateChangeReturn result;
gboolean no_preroll = FALSE;
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:
GST_LIVE_LOCK (element);
if (basesrc->is_live) {
result = GST_STATE_CHANGE_NO_PREROLL;
no_preroll = TRUE;
basesrc->live_running = FALSE;
}
GST_LIVE_UNLOCK (element);
......@@ -1095,7 +1095,7 @@ gst_base_src_change_state (GstElement * element, GstStateChange transition)
break;
}
if ((presult =
if ((result =
GST_ELEMENT_CLASS (parent_class)->change_state (element,
transition)) == GST_STATE_CHANGE_FAILURE)
goto failure;
......@@ -1104,7 +1104,7 @@ gst_base_src_change_state (GstElement * element, GstStateChange transition)
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
GST_LIVE_LOCK (element);
if (basesrc->is_live) {
result = GST_STATE_CHANGE_NO_PREROLL;
no_preroll = TRUE;
basesrc->live_running = FALSE;
}
GST_LIVE_UNLOCK (element);
......@@ -1119,12 +1119,15 @@ gst_base_src_change_state (GstElement * element, GstStateChange transition)
break;
}
return result;
if (no_preroll && result == GST_STATE_CHANGE_SUCCESS)
return GST_STATE_CHANGE_NO_PREROLL;
else
return result;
/* ERRORS */
failure:
{
gst_base_src_stop (basesrc);
return presult;
return result;
}
}
......@@ -1066,8 +1066,8 @@ static GstStateChangeReturn
gst_base_src_change_state (GstElement * element, GstStateChange transition)
{
GstBaseSrc *basesrc;
GstStateChangeReturn result = GST_STATE_CHANGE_SUCCESS;
GstStateChangeReturn presult;
GstStateChangeReturn result;
gboolean no_preroll = FALSE;
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:
GST_LIVE_LOCK (element);
if (basesrc->is_live) {
result = GST_STATE_CHANGE_NO_PREROLL;
no_preroll = TRUE;
basesrc->live_running = FALSE;
}
GST_LIVE_UNLOCK (element);
......@@ -1095,7 +1095,7 @@ gst_base_src_change_state (GstElement * element, GstStateChange transition)
break;
}
if ((presult =
if ((result =
GST_ELEMENT_CLASS (parent_class)->change_state (element,
transition)) == GST_STATE_CHANGE_FAILURE)
goto failure;
......@@ -1104,7 +1104,7 @@ gst_base_src_change_state (GstElement * element, GstStateChange transition)
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
GST_LIVE_LOCK (element);
if (basesrc->is_live) {
result = GST_STATE_CHANGE_NO_PREROLL;
no_preroll = TRUE;
basesrc->live_running = FALSE;
}
GST_LIVE_UNLOCK (element);
......@@ -1119,12 +1119,15 @@ gst_base_src_change_state (GstElement * element, GstStateChange transition)
break;
}
return result;
if (no_preroll && result == GST_STATE_CHANGE_SUCCESS)
return GST_STATE_CHANGE_NO_PREROLL;
else
return result;
/* ERRORS */
failure:
{
gst_base_src_stop (basesrc);
return presult;
return result;
}
}
......@@ -203,6 +203,30 @@ GST_START_TEST (test_sizetype_random)
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 *
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_fixed);
tcase_add_test (tc_chain, test_sizetype_random);
tcase_add_test (tc_chain, test_no_preroll);
return s;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment