mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-24 01:24:20 +00:00
camerabin: Make sure video-done is post only when file is closed
Force filesink to null before posting video-done to make sure the file was closed. Had to do it from a separate thread to avoid calling state_change from a sync message handler. https://bugzilla.gnome.org/show_bug.cgi?id=709373
This commit is contained in:
parent
f199399eb2
commit
e7e7417523
1 changed files with 12 additions and 3 deletions
|
@ -955,6 +955,16 @@ gst_camera_bin_skip_next_preview (GstCameraBin2 * camerabin)
|
||||||
g_mutex_unlock (&camerabin->preview_list_mutex);
|
g_mutex_unlock (&camerabin->preview_list_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_camera_bin_finish_video_file (GstCameraBin2 * camerabin)
|
||||||
|
{
|
||||||
|
/* make sure the file is closed */
|
||||||
|
gst_element_set_state (camerabin->videosink, GST_STATE_NULL);
|
||||||
|
|
||||||
|
gst_video_capture_bin_post_video_done (camerabin);
|
||||||
|
GST_CAMERA_BIN2_PROCESSING_DEC (camerabin);
|
||||||
|
}
|
||||||
|
|
||||||
static gpointer
|
static gpointer
|
||||||
gst_camera_bin_video_reset_elements (gpointer u_data)
|
gst_camera_bin_video_reset_elements (gpointer u_data)
|
||||||
{
|
{
|
||||||
|
@ -963,6 +973,8 @@ gst_camera_bin_video_reset_elements (gpointer u_data)
|
||||||
GST_DEBUG_OBJECT (camerabin, "Resetting video elements state");
|
GST_DEBUG_OBJECT (camerabin, "Resetting video elements state");
|
||||||
g_mutex_lock (&camerabin->video_capture_mutex);
|
g_mutex_lock (&camerabin->video_capture_mutex);
|
||||||
|
|
||||||
|
gst_camera_bin_finish_video_file (camerabin);
|
||||||
|
|
||||||
/* reset element states to clear eos/flushing pads */
|
/* reset element states to clear eos/flushing pads */
|
||||||
gst_element_set_state (camerabin->video_encodebin, GST_STATE_READY);
|
gst_element_set_state (camerabin->video_encodebin, GST_STATE_READY);
|
||||||
gst_element_set_state (camerabin->videobin_capsfilter, GST_STATE_READY);
|
gst_element_set_state (camerabin->videobin_capsfilter, GST_STATE_READY);
|
||||||
|
@ -1082,9 +1094,6 @@ gst_camera_bin_handle_message (GstBin * bin, GstMessage * message)
|
||||||
GST_DEBUG_OBJECT (bin, "EOS from video branch");
|
GST_DEBUG_OBJECT (bin, "EOS from video branch");
|
||||||
g_assert (camerabin->video_state == GST_CAMERA_BIN_VIDEO_FINISHING);
|
g_assert (camerabin->video_state == GST_CAMERA_BIN_VIDEO_FINISHING);
|
||||||
|
|
||||||
gst_video_capture_bin_post_video_done (GST_CAMERA_BIN2_CAST (bin));
|
|
||||||
dec_counter = TRUE;
|
|
||||||
|
|
||||||
if (!g_thread_try_new ("reset-element-thread",
|
if (!g_thread_try_new ("reset-element-thread",
|
||||||
gst_camera_bin_video_reset_elements, gst_object_ref (camerabin),
|
gst_camera_bin_video_reset_elements, gst_object_ref (camerabin),
|
||||||
NULL)) {
|
NULL)) {
|
||||||
|
|
Loading…
Reference in a new issue