mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-09 17:05:52 +00:00
gst-camerabin2-test: Fix premature shutdown
We must wait for camerabin2's stop-capture procedures to finish before quitting the main loop or firing off the next capture. If we get stuck waiting for camerabin2 to become idle, this is a bug that needs fixing.
This commit is contained in:
parent
d2e1f1bdc6
commit
4b18a73332
1 changed files with 21 additions and 5 deletions
|
@ -135,6 +135,7 @@ static gint zoom = 100;
|
||||||
static gint capture_time = 10;
|
static gint capture_time = 10;
|
||||||
static gint capture_count = 0;
|
static gint capture_count = 0;
|
||||||
static gint capture_total = 1;
|
static gint capture_total = 1;
|
||||||
|
static gulong stop_capture_cb_id = 0;
|
||||||
|
|
||||||
/* photography interface command line options */
|
/* photography interface command line options */
|
||||||
#define EV_COMPENSATION_NONE -G_MAXFLOAT
|
#define EV_COMPENSATION_NONE -G_MAXFLOAT
|
||||||
|
@ -569,15 +570,30 @@ error:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static void
|
||||||
stop_capture (gpointer user_data)
|
stop_capture_cb (GObject * self, GParamSpec * pspec, gpointer user_data)
|
||||||
{
|
{
|
||||||
g_signal_emit_by_name (camerabin, "stop-capture", 0);
|
gboolean idle = FALSE;
|
||||||
|
|
||||||
|
g_object_get (camerabin, "idle", &idle, NULL);
|
||||||
|
|
||||||
|
if (idle) {
|
||||||
if (capture_count < capture_total) {
|
if (capture_count < capture_total) {
|
||||||
g_idle_add ((GSourceFunc) run_pipeline, NULL);
|
g_idle_add ((GSourceFunc) run_pipeline, NULL);
|
||||||
} else {
|
} else {
|
||||||
g_main_loop_quit (loop);
|
g_main_loop_quit (loop);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g_signal_handler_disconnect (camerabin, stop_capture_cb_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
stop_capture (gpointer user_data)
|
||||||
|
{
|
||||||
|
stop_capture_cb_id = g_signal_connect (camerabin, "notify::idle",
|
||||||
|
(GCallback) stop_capture_cb, camerabin);
|
||||||
|
g_signal_emit_by_name (camerabin, "stop-capture", 0);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue