summaryrefslogtreecommitdiff
path: root/gst/camerabin2
diff options
context:
space:
mode:
authorThiago Santos <thiago.sousa.santos@collabora.com>2011-11-01 11:47:46 -0300
committerThiago Santos <thiago.sousa.santos@collabora.com>2011-11-01 11:49:17 -0300
commitd4105d4b56b0b07d8994abf92db620ba1f533ab0 (patch)
tree43091caa4d5a876329054772c8b6f72d70107b3e /gst/camerabin2
parent37aa6a9c718eb78731bd2427470db678fb5fe7cc (diff)
downloadgstreamer-plugins-bad-d4105d4b56b0b07d8994abf92db620ba1f533ab0.tar.gz
camerabin2: On capture error, skip previews
When the camera source fails to do some capture, skip the next preview and decrement processing counter.
Diffstat (limited to 'gst/camerabin2')
-rw-r--r--gst/camerabin2/gstcamerabin2.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/gst/camerabin2/gstcamerabin2.c b/gst/camerabin2/gstcamerabin2.c
index 4c68a3f77..eebf12041 100644
--- a/gst/camerabin2/gstcamerabin2.c
+++ b/gst/camerabin2/gstcamerabin2.c
@@ -934,6 +934,26 @@ gst_video_capture_bin_post_video_done (GstCameraBin2 * camera)
}
static void
+gst_camera_bin_skip_next_preview (GstCameraBin2 * camerabin)
+{
+ gchar *location;
+
+ g_mutex_lock (camerabin->preview_list_mutex);
+ if (camerabin->preview_location_list) {
+ location = camerabin->preview_location_list->data;
+ GST_DEBUG_OBJECT (camerabin, "Skipping preview for %s", location);
+ g_free (location);
+ camerabin->preview_location_list =
+ g_slist_delete_link (camerabin->preview_location_list,
+ camerabin->preview_location_list);
+ GST_CAMERA_BIN2_PROCESSING_DEC (camerabin);
+ } else {
+ GST_WARNING_OBJECT (camerabin, "No previews to skip");
+ }
+ g_mutex_unlock (camerabin->preview_list_mutex);
+}
+
+static void
gst_camera_bin_handle_message (GstBin * bin, GstMessage * message)
{
GstCameraBin2 *camerabin = GST_CAMERA_BIN2_CAST (bin);
@@ -995,6 +1015,9 @@ gst_camera_bin_handle_message (GstBin * bin, GstMessage * message)
GST_WARNING_OBJECT (bin, "Capture failed, reason: %s - %s",
err->message, debug);
GST_CAMERA_BIN2_PROCESSING_DEC (GST_CAMERA_BIN2_CAST (bin));
+ if (camerabin->post_previews) {
+ gst_camera_bin_skip_next_preview (camerabin);
+ }
}
}
break;