check: Update tests for new STREAM_START message

This commit is contained in:
Edward Hervey 2012-07-09 20:29:29 +02:00
parent e2326ac506
commit e219ede527
4 changed files with 40 additions and 23 deletions

View file

@ -418,7 +418,12 @@ GST_START_TEST (test_message_state_changed_children)
ASSERT_OBJECT_REFCOUNT (sink, "sink", 1);
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline", 1);
/* change state to PAUSED, spawning three messages */
/* change state to PAUSED, spawning four messages */
/* STATE_CHANGED (NULL => READY)
* STREAM_START
* ASYNC_DONE
* STATE_CHANGED (READY => PAUSED)
*/
GST_DEBUG ("setting pipeline to PAUSED");
ret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED);
fail_unless (ret == GST_STATE_CHANGE_ASYNC);
@ -431,9 +436,9 @@ GST_START_TEST (test_message_state_changed_children)
/* wait for async thread to settle down */
GST_DEBUG ("waiting for refcount");
while (GST_OBJECT_REFCOUNT_VALUE (pipeline) > 3)
while (GST_OBJECT_REFCOUNT_VALUE (pipeline) > 4)
THREAD_SWITCH ();
GST_DEBUG ("refcount <= 3 now");
GST_DEBUG ("refcount <= 4 now");
/* each object is referenced by a message;
* base_src is blocked in the push and has an extra refcount.
@ -444,9 +449,9 @@ GST_START_TEST (test_message_state_changed_children)
/* refcount can be 4 if the bin is still processing the async_done message of
* the sink. */
ASSERT_OBJECT_REFCOUNT_BETWEEN (sink, "sink", 2, 3);
/* 2 or 3 is valid, because the pipeline might still be posting
/* 3 or 4 is valid, because the pipeline might still be posting
* its state_change message */
ASSERT_OBJECT_REFCOUNT_BETWEEN (pipeline, "pipeline", 2, 3);
ASSERT_OBJECT_REFCOUNT_BETWEEN (pipeline, "pipeline", 3, 4);
pop_messages (bus, 3);
pop_async_done (bus);

View file

@ -54,7 +54,8 @@ gst_dummy_obj_class_init (GstDummyObjClass * klass)
/* default value is out of bounds, should print a warning */
g_object_class_install_property (gobject_class, 1,
gst_param_spec_fraction ("ratio", "ratio", "ratio", 0, 1, 2, 1,
16, 4, G_PARAM_READWRITE)););
16, 4, G_PARAM_READWRITE));
);
/* should be within bounds */
g_object_class_install_property (gobject_class, 2,

View file

@ -91,7 +91,8 @@ GST_START_TEST (test_pipeline_unref)
run_pipeline (pipeline, s,
GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED |
GST_MESSAGE_STREAM_STATUS | GST_MESSAGE_ASYNC_DONE, GST_MESSAGE_EOS);
GST_MESSAGE_STREAM_STATUS | GST_MESSAGE_ASYNC_DONE |
GST_MESSAGE_STREAM_START, GST_MESSAGE_EOS);
while (GST_OBJECT_REFCOUNT_VALUE (src) > 1)
THREAD_SWITCH ();
ASSERT_OBJECT_REFCOUNT (src, "src", 1);

View file

@ -102,28 +102,32 @@ GST_START_TEST (test_2_elements)
s = "fakesrc can-activate-push=false ! fakesink can-activate-pull=true";
run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED |
GST_MESSAGE_STREAM_STATUS | GST_MESSAGE_ASYNC_DONE, GST_MESSAGE_UNKNOWN);
GST_MESSAGE_STREAM_STATUS | GST_MESSAGE_ASYNC_DONE |
GST_MESSAGE_STREAM_START, GST_MESSAGE_UNKNOWN);
s = "fakesrc can-activate-push=true ! fakesink can-activate-pull=false";
run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED |
GST_MESSAGE_STREAM_STATUS | GST_MESSAGE_ASYNC_DONE, GST_MESSAGE_UNKNOWN);
GST_MESSAGE_STREAM_STATUS | GST_MESSAGE_ASYNC_DONE |
GST_MESSAGE_STREAM_START, GST_MESSAGE_UNKNOWN);
s = "fakesrc can-activate-push=false num-buffers=10 ! fakesink can-activate-pull=true";
run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED |
GST_MESSAGE_STREAM_STATUS | GST_MESSAGE_ASYNC_DONE, GST_MESSAGE_EOS);
GST_MESSAGE_STREAM_STATUS | GST_MESSAGE_ASYNC_DONE |
GST_MESSAGE_STREAM_START, GST_MESSAGE_EOS);
s = "fakesrc can-activate-push=true num-buffers=10 ! fakesink can-activate-pull=false";
run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED |
GST_MESSAGE_STREAM_STATUS | GST_MESSAGE_ASYNC_DONE, GST_MESSAGE_EOS);
GST_MESSAGE_STREAM_STATUS | GST_MESSAGE_ASYNC_DONE |
GST_MESSAGE_STREAM_START, GST_MESSAGE_EOS);
s = "fakesrc can-activate-push=false ! fakesink can-activate-pull=false";
ASSERT_CRITICAL (run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED |
GST_MESSAGE_STREAM_STATUS | GST_MESSAGE_ASYNC_DONE,
GST_MESSAGE_UNKNOWN));
GST_MESSAGE_STREAM_STATUS | GST_MESSAGE_ASYNC_DONE |
GST_MESSAGE_STREAM_START, GST_MESSAGE_UNKNOWN));
}
GST_END_TEST;
@ -192,45 +196,51 @@ GST_START_TEST (test_tee)
s = "fakesrc can-activate-push=true ! tee ! fakesink can-activate-push=true";
run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED, GST_MESSAGE_UNKNOWN);
GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED |
GST_MESSAGE_STREAM_START, GST_MESSAGE_UNKNOWN);
s = "fakesrc can-activate-push=true num-buffers=10 ! tee ! fakesink can-activate-push=true";
run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED, GST_MESSAGE_EOS);
GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED |
GST_MESSAGE_STREAM_START, GST_MESSAGE_EOS);
s = "fakesrc can-activate-push=false can-activate-pull=true ! tee ! fakesink can-activate-pull=true";
ASSERT_CRITICAL (run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED,
GST_MESSAGE_UNKNOWN));
GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED |
GST_MESSAGE_STREAM_START, GST_MESSAGE_UNKNOWN));
s = "fakesrc can-activate-push=false can-activate-pull=true "
"! tee pull-mode=single ! fakesink can-activate-pull=true";
run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED, GST_MESSAGE_UNKNOWN);
GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED |
GST_MESSAGE_STREAM_START, GST_MESSAGE_UNKNOWN);
s = "fakesrc can-activate-push=false can-activate-pull=true num-buffers=10 "
"! tee pull-mode=single ! fakesink can-activate-pull=true";
run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED, GST_MESSAGE_EOS);
GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED |
GST_MESSAGE_STREAM_START, GST_MESSAGE_EOS);
s = "fakesrc can-activate-push=false can-activate-pull=true "
"! tee name=t pull-mode=single ! fakesink can-activate-pull=true "
"t. ! queue ! fakesink can-activate-pull=true can-activate-push=false";
ASSERT_CRITICAL (run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED,
GST_MESSAGE_UNKNOWN));
GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED |
GST_MESSAGE_STREAM_START, GST_MESSAGE_UNKNOWN));
s = "fakesrc can-activate-push=false can-activate-pull=true "
"! tee name=t pull-mode=single ! fakesink can-activate-pull=true "
"t. ! queue ! fakesink";
run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED, GST_MESSAGE_UNKNOWN);
GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED |
GST_MESSAGE_STREAM_START, GST_MESSAGE_UNKNOWN);
s = "fakesrc can-activate-push=false can-activate-pull=true num-buffers=10 "
"! tee name=t pull-mode=single ! fakesink can-activate-pull=true "
"t. ! queue ! fakesink";
run_pipeline (setup_pipeline (s), s,
GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED, GST_MESSAGE_EOS);
GST_MESSAGE_NEW_CLOCK | GST_MESSAGE_STATE_CHANGED |
GST_MESSAGE_STREAM_START, GST_MESSAGE_EOS);
}
GST_END_TEST;