mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
tests/check/pipelines/simple-launch-lines.c
Original commit message from CVS: 2007-06-19 Andy Wingo <wingo@pobox.com> * tests/check/pipelines/simple-launch-lines.c (test_state_change_returns): Enable pull-mode tests now that basesink has been fixed. * libs/gst/base/gstbasesink.c (gst_base_sink_needs_preroll): Changed from gst_base_sink_is_prerolled, reversing the sense of the return value. Returns FALSE also if the sink is in pull mode, in which case it needs no preroll. (gst_base_sink_query, gst_base_sink_change_state): Update for needs_preroll change. (gst_base_sink_change_state): Add a case for READY_TO_PAUSED after chaining up, in which we return SUCCESS directly if we activated in pull mode instead of ASYNC. Involves countering an async_start message sent before chaining up; not sure if this is correct, in an ideal world we only send async-start when activating in push mode.
This commit is contained in:
parent
b0c2d05640
commit
4e1c9c226a
3 changed files with 45 additions and 11 deletions
17
ChangeLog
17
ChangeLog
|
@ -1,5 +1,22 @@
|
|||
2007-06-19 Andy Wingo <wingo@pobox.com>
|
||||
|
||||
* tests/check/pipelines/simple-launch-lines.c
|
||||
(test_state_change_returns): Enable pull-mode tests now that
|
||||
basesink has been fixed.
|
||||
|
||||
* libs/gst/base/gstbasesink.c (gst_base_sink_needs_preroll):
|
||||
Changed from gst_base_sink_is_prerolled, reversing the sense of
|
||||
the return value. Returns FALSE also if the sink is in pull mode,
|
||||
in which case it needs no preroll.
|
||||
(gst_base_sink_query, gst_base_sink_change_state): Update for
|
||||
needs_preroll change.
|
||||
(gst_base_sink_change_state): Add a case for READY_TO_PAUSED after
|
||||
chaining up, in which we return SUCCESS directly if we activated
|
||||
in pull mode instead of ASYNC. Involves countering an async_start
|
||||
message sent before chaining up; not sure if this is correct, in
|
||||
an ideal world we only send async-start when activating in push
|
||||
mode.
|
||||
|
||||
* tests/check/pipelines/simple-launch-lines.c
|
||||
(test_state_change_returns): New test, partially disabled until
|
||||
basesink is fixed.
|
||||
|
|
|
@ -2083,12 +2083,13 @@ gst_base_sink_get_times (GstBaseSink * basesink, GstBuffer * buffer,
|
|||
|
||||
/* must be called with PREROLL_LOCK */
|
||||
static gboolean
|
||||
gst_base_sink_is_prerolled (GstBaseSink * basesink)
|
||||
gst_base_sink_needs_preroll (GstBaseSink * basesink)
|
||||
{
|
||||
gboolean res;
|
||||
gboolean is_prerolled, res;
|
||||
|
||||
res = basesink->have_preroll || basesink->eos;
|
||||
GST_DEBUG_OBJECT (basesink, "have_preroll: %d, EOS: %d => prerolled: %d",
|
||||
is_prerolled = basesink->have_preroll || basesink->eos;
|
||||
res = !is_prerolled && basesink->pad_mode != GST_ACTIVATE_PULL;
|
||||
GST_DEBUG_OBJECT (basesink, "have_preroll: %d, EOS: %d => needs preroll: %d",
|
||||
basesink->have_preroll, basesink->eos, res);
|
||||
return res;
|
||||
}
|
||||
|
@ -2763,7 +2764,7 @@ gst_base_sink_query (GstElement * element, GstQuery * query)
|
|||
GstClockTime min, max;
|
||||
|
||||
GST_PAD_PREROLL_LOCK (basesink->sinkpad);
|
||||
if (!gst_base_sink_is_prerolled (basesink)) {
|
||||
if (gst_base_sink_needs_preroll (basesink)) {
|
||||
GST_DEBUG_OBJECT (basesink, "not prerolled yet, can't report latency");
|
||||
res = FALSE;
|
||||
goto done;
|
||||
|
@ -2852,7 +2853,7 @@ gst_base_sink_change_state (GstElement * element, GstStateChange transition)
|
|||
break;
|
||||
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
||||
GST_PAD_PREROLL_LOCK (basesink->sinkpad);
|
||||
if (gst_base_sink_is_prerolled (basesink)) {
|
||||
if (!gst_base_sink_needs_preroll (basesink)) {
|
||||
/* no preroll needed anymore now. */
|
||||
GST_DEBUG_OBJECT (basesink, "PAUSED to PLAYING, don't need preroll");
|
||||
basesink->playing_async = FALSE;
|
||||
|
@ -2890,6 +2891,19 @@ gst_base_sink_change_state (GstElement * element, GstStateChange transition)
|
|||
}
|
||||
|
||||
switch (transition) {
|
||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||
/* note that this is the upward case, which doesn't follow most
|
||||
patterns */
|
||||
if (basesink->pad_mode == GST_ACTIVATE_PULL) {
|
||||
GST_DEBUG_OBJECT (basesink, "basesink activated in pull mode, "
|
||||
"returning SUCCESS directly");
|
||||
GST_PAD_PREROLL_LOCK (basesink->sinkpad);
|
||||
gst_element_post_message (GST_ELEMENT_CAST (basesink),
|
||||
gst_message_new_async_done (GST_OBJECT_CAST (basesink)));
|
||||
GST_PAD_PREROLL_UNLOCK (basesink->sinkpad);
|
||||
ret = GST_STATE_CHANGE_SUCCESS;
|
||||
}
|
||||
break;
|
||||
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
||||
GST_DEBUG_OBJECT (basesink, "PLAYING to PAUSED");
|
||||
/* FIXME, make sure we cannot enter _render first */
|
||||
|
@ -2911,7 +2925,7 @@ gst_base_sink_change_state (GstElement * element, GstStateChange transition)
|
|||
|
||||
/* if we don't have a preroll buffer we need to wait for a preroll and
|
||||
* return ASYNC. */
|
||||
if (gst_base_sink_is_prerolled (basesink)) {
|
||||
if (!gst_base_sink_needs_preroll (basesink)) {
|
||||
GST_DEBUG_OBJECT (basesink, "PLAYING to PAUSED, we are prerolled");
|
||||
basesink->playing_async = FALSE;
|
||||
} else {
|
||||
|
|
|
@ -154,6 +154,9 @@ GST_START_TEST (test_state_change_returns)
|
|||
GST_STATE_CHANGE_SUCCESS);
|
||||
check_state_change_return (pipeline, GST_STATE_PLAYING,
|
||||
GST_STATE_CHANGE_SUCCESS, GST_STATE_CHANGE_SUCCESS);
|
||||
/* can't check PAUSED, it's not deterministic */
|
||||
check_state_change_return (pipeline, GST_STATE_READY,
|
||||
GST_STATE_CHANGE_SUCCESS, GST_STATE_CHANGE_SUCCESS);
|
||||
check_state_change_return (pipeline, GST_STATE_NULL, GST_STATE_CHANGE_SUCCESS,
|
||||
GST_STATE_CHANGE_SUCCESS);
|
||||
gst_object_unref (pipeline);
|
||||
|
@ -163,14 +166,14 @@ GST_START_TEST (test_state_change_returns)
|
|||
fail_unless (GST_IS_PIPELINE (pipeline));
|
||||
check_state_change_return (pipeline, GST_STATE_READY,
|
||||
GST_STATE_CHANGE_SUCCESS, GST_STATE_CHANGE_SUCCESS);
|
||||
#if 0
|
||||
/* FIXME, there is no need to preroll in pull-mode pipelines. However the
|
||||
* current basesink code returns ASYNC always when going to PAUSED */
|
||||
check_state_change_return (pipeline, GST_STATE_PAUSED,
|
||||
GST_STATE_CHANGE_SUCCESS, GST_STATE_CHANGE_SUCCESS);
|
||||
check_state_change_return (pipeline, GST_STATE_PLAYING,
|
||||
GST_STATE_CHANGE_SUCCESS, GST_STATE_CHANGE_SUCCESS);
|
||||
#endif
|
||||
check_state_change_return (pipeline, GST_STATE_PAUSED,
|
||||
GST_STATE_CHANGE_SUCCESS, GST_STATE_CHANGE_SUCCESS);
|
||||
check_state_change_return (pipeline, GST_STATE_READY,
|
||||
GST_STATE_CHANGE_SUCCESS, GST_STATE_CHANGE_SUCCESS);
|
||||
check_state_change_return (pipeline, GST_STATE_NULL, GST_STATE_CHANGE_SUCCESS,
|
||||
GST_STATE_CHANGE_SUCCESS);
|
||||
gst_object_unref (pipeline);
|
||||
|
|
Loading…
Reference in a new issue