summaryrefslogtreecommitdiffstats
path: root/tests/examples
diff options
context:
space:
mode:
authorStefan Kost <ensonic@users.sf.net>2009-06-25 19:21:47 +0300
committerStefan Kost <ensonic@users.sf.net>2009-06-25 19:34:27 +0300
commitaaec6a730d7e4680824653cde1030754d37ac107 (patch)
tree3821a0e35ee3c88d4713ded706b12af3bb399428 /tests/examples
parent8241b05038211b1a99985678b17b827d7405d72a (diff)
downloadgst-plugins-bad-aaec6a730d7e4680824653cde1030754d37ac107.tar.gz
gst-plugins-bad-aaec6a730d7e4680824653cde1030754d37ac107.tar.bz2
gst-plugins-bad-aaec6a730d7e4680824653cde1030754d37ac107.zip
camerabin: sync first test more safely
Don't use gst_element_get_state() to wait for PLAYING, Use the bus-handler insteader and asynchronously schedule next test.
Diffstat (limited to 'tests/examples')
-rw-r--r--tests/examples/camerabin/gst-camera-perf.c41
1 files changed, 33 insertions, 8 deletions
diff --git a/tests/examples/camerabin/gst-camera-perf.c b/tests/examples/camerabin/gst-camera-perf.c
index b6424181..f923e1ce 100644
--- a/tests/examples/camerabin/gst-camera-perf.c
+++ b/tests/examples/camerabin/gst-camera-perf.c
@@ -129,14 +129,14 @@ static GstClockTime target[TEST_CASES] = {
static const gchar *test_names[TEST_CASES] = {
"Camera OFF to VF on",
- "(3A latency)",
+ "(3A latency)", /* time to get AF? */
"Shot to snapshot",
"Shot to shot",
"Serial shooting",
"(Shutter lag)",
"Image saved",
"Mode change",
- "(Video recording)"
+ "(Video recording)" /* time to get videobin to PLAYING? or first buffer reaching filesink? */
};
/*
@@ -276,6 +276,25 @@ bus_callback (GstBus * bus, GstMessage * message, gpointer data)
g_main_loop_quit (loop);
break;
}
+ case GST_MESSAGE_STATE_CHANGED:
+ if (GST_MESSAGE_SRC (message) == GST_OBJECT (camera_bin)) {
+ GstState oldstate, newstate;
+
+ gst_message_parse_state_changed (message, &oldstate, &newstate, NULL);
+ GST_INFO ("state-changed: %s -> %s",
+ gst_element_state_get_name (oldstate),
+ gst_element_state_get_name (newstate));
+ if (GST_STATE_TRANSITION (oldstate,
+ newstate) == GST_STATE_CHANGE_PAUSED_TO_PLAYING) {
+ GET_TIME (t_final[0]);
+ DIFF_TIME (t_final[0], t_initial, diff);
+
+ result.avg = result.min = result.max = diff;
+ print_result ();
+ g_idle_add ((GSourceFunc) run_test, NULL);
+ }
+ }
+ break;
case GST_MESSAGE_EOS:
/* end-of-stream */
g_main_loop_quit (loop);
@@ -466,19 +485,25 @@ error:
static gboolean
test_01 (void)
{
+ gboolean res;
+
GET_TIME (t_initial);
if (setup_pipeline ()) {
/* MAKE SURE THE PIPELINE IS IN PLAYING STATE BEFORE START TAKING PICTURES
AND SO ON (otherwise it will deadlock) */
- gst_element_get_state (camera_bin, NULL, NULL, GST_CLOCK_TIME_NONE);
- }
- GET_TIME (t_final[0]);
- DIFF_TIME (t_final[0], t_initial, diff);
+ //gst_element_get_state (camera_bin, NULL, NULL, GST_CLOCK_TIME_NONE);
+ /* the actual results are fetched in bus_callback::state-changed */
+ res = FALSE;
+ } else {
+ GET_TIME (t_final[0]);
+ DIFF_TIME (t_final[0], t_initial, diff);
- result.avg = result.min = result.max = diff;
+ result.avg = result.min = result.max = diff;
+ res = TRUE;
+ }
result.times = 1;
- return TRUE;
+ return res;
}