mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
camerabin2: On capture error, skip previews
When the camera source fails to do some capture, skip the next preview and decrement processing counter.
This commit is contained in:
parent
37aa6a9c71
commit
d4105d4b56
1 changed files with 23 additions and 0 deletions
|
@ -933,6 +933,26 @@ gst_video_capture_bin_post_video_done (GstCameraBin2 * camera)
|
|||
GST_WARNING_OBJECT (camera, "Failed to post video-done message");
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue