mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
camerabin: Make the tests pass when the camerabin can't initialise.
The camerabin tests were throwing glib errors and hanging when gst-plugins-good elements (jpegenc, videocrop) can't found.
This commit is contained in:
parent
14a881ac05
commit
81a950ddf8
2 changed files with 35 additions and 10 deletions
|
@ -2750,13 +2750,15 @@ gst_camerabin_user_start (GstCameraBin * camera)
|
||||||
}
|
}
|
||||||
g_mutex_unlock (camera->capture_mutex);
|
g_mutex_unlock (camera->capture_mutex);
|
||||||
|
|
||||||
g_object_set (G_OBJECT (camera->active_bin), "filename",
|
if (camera->active_bin) {
|
||||||
camera->filename->str, NULL);
|
g_object_set (G_OBJECT (camera->active_bin), "filename",
|
||||||
|
camera->filename->str, NULL);
|
||||||
|
|
||||||
if (camera->active_bin == camera->imgbin) {
|
if (camera->active_bin == camera->imgbin) {
|
||||||
gst_camerabin_start_image_capture (camera);
|
gst_camerabin_start_image_capture (camera);
|
||||||
} else if (camera->active_bin == camera->vidbin) {
|
} else if (camera->active_bin == camera->vidbin) {
|
||||||
gst_camerabin_start_video_recording (camera);
|
gst_camerabin_start_video_recording (camera);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,10 +141,14 @@ setup (void)
|
||||||
|
|
||||||
gst_tag_setter_add_tags (setter, GST_TAG_MERGE_REPLACE,
|
gst_tag_setter_add_tags (setter, GST_TAG_MERGE_REPLACE,
|
||||||
GST_TAG_DESCRIPTION, desc_str, NULL);
|
GST_TAG_DESCRIPTION, desc_str, NULL);
|
||||||
|
|
||||||
gst_element_set_state (GST_ELEMENT (camera), GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
g_free (desc_str);
|
g_free (desc_str);
|
||||||
|
|
||||||
|
if (gst_element_set_state (GST_ELEMENT (camera), GST_STATE_PLAYING) !=
|
||||||
|
GST_STATE_CHANGE_SUCCESS) {
|
||||||
|
gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL);
|
||||||
|
gst_object_unref (camera);
|
||||||
|
camera = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -152,7 +156,8 @@ teardown (void)
|
||||||
{
|
{
|
||||||
g_mutex_free (cam_mutex);
|
g_mutex_free (cam_mutex);
|
||||||
g_cond_free (cam_cond);
|
g_cond_free (cam_cond);
|
||||||
gst_check_teardown_element (camera);
|
if (camera)
|
||||||
|
gst_check_teardown_element (camera);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -304,6 +309,9 @@ check_file_validity (const gchar * filename)
|
||||||
|
|
||||||
GST_START_TEST (test_single_image_capture)
|
GST_START_TEST (test_single_image_capture)
|
||||||
{
|
{
|
||||||
|
if (!camera)
|
||||||
|
return;
|
||||||
|
|
||||||
/* set still image mode */
|
/* set still image mode */
|
||||||
g_object_set (camera, "mode", 0,
|
g_object_set (camera, "mode", 0,
|
||||||
"filename", make_test_file_name (SINGLE_IMAGE_FILENAME), NULL);
|
"filename", make_test_file_name (SINGLE_IMAGE_FILENAME), NULL);
|
||||||
|
@ -322,6 +330,9 @@ GST_END_TEST;
|
||||||
|
|
||||||
GST_START_TEST (test_burst_image_capture)
|
GST_START_TEST (test_burst_image_capture)
|
||||||
{
|
{
|
||||||
|
if (!camera)
|
||||||
|
return;
|
||||||
|
|
||||||
/* set still image mode */
|
/* set still image mode */
|
||||||
g_object_set (camera, "mode", 0,
|
g_object_set (camera, "mode", 0,
|
||||||
"filename", make_test_seq_file_name (BURST_IMAGE_FILENAME), NULL);
|
"filename", make_test_seq_file_name (BURST_IMAGE_FILENAME), NULL);
|
||||||
|
@ -344,6 +355,9 @@ GST_END_TEST;
|
||||||
|
|
||||||
GST_START_TEST (test_video_recording)
|
GST_START_TEST (test_video_recording)
|
||||||
{
|
{
|
||||||
|
if (!camera)
|
||||||
|
return;
|
||||||
|
|
||||||
/* Set video recording mode */
|
/* Set video recording mode */
|
||||||
g_object_set (camera, "mode", 1,
|
g_object_set (camera, "mode", 1,
|
||||||
"filename", make_test_file_name (VIDEO_FILENAME), NULL);
|
"filename", make_test_file_name (VIDEO_FILENAME), NULL);
|
||||||
|
@ -360,6 +374,9 @@ GST_START_TEST (test_image_video_cycle)
|
||||||
{
|
{
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
|
if (!camera)
|
||||||
|
return;
|
||||||
|
|
||||||
continuous = FALSE;
|
continuous = FALSE;
|
||||||
|
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
|
@ -391,6 +408,9 @@ GST_START_TEST (validate_captured_image_files)
|
||||||
GString *filename;
|
GString *filename;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
|
if (!camera)
|
||||||
|
return;
|
||||||
|
|
||||||
/* validate single image */
|
/* validate single image */
|
||||||
check_file_validity (SINGLE_IMAGE_FILENAME);
|
check_file_validity (SINGLE_IMAGE_FILENAME);
|
||||||
|
|
||||||
|
@ -410,6 +430,9 @@ GST_END_TEST;
|
||||||
|
|
||||||
GST_START_TEST (validate_captured_video_files)
|
GST_START_TEST (validate_captured_video_files)
|
||||||
{
|
{
|
||||||
|
if (!camera)
|
||||||
|
return;
|
||||||
|
|
||||||
/* validate video recording */
|
/* validate video recording */
|
||||||
check_file_validity (VIDEO_FILENAME);
|
check_file_validity (VIDEO_FILENAME);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue