diff options
author | Thiago Santos <ts.santos@partner.samsung.com> | 2013-11-06 22:13:13 -0300 |
---|---|---|
committer | Thiago Santos <ts.santos@partner.samsung.com> | 2013-11-06 22:13:54 -0300 |
commit | e7e741752371cb593ade69bf47363efb48324904 (patch) | |
tree | 44902a36f7f1f991f0dd7997c6862f95c8f116b0 /gst/camerabin2 | |
parent | f199399eb246a9506375e499e71841c3deeb1982 (diff) | |
download | gstreamer-plugins-bad-e7e741752371cb593ade69bf47363efb48324904.tar.gz |
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
Diffstat (limited to 'gst/camerabin2')
-rw-r--r-- | gst/camerabin2/gstcamerabin2.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/gst/camerabin2/gstcamerabin2.c b/gst/camerabin2/gstcamerabin2.c index 829ab0d16..f64ce2b74 100644 --- a/gst/camerabin2/gstcamerabin2.c +++ b/gst/camerabin2/gstcamerabin2.c @@ -955,6 +955,16 @@ gst_camera_bin_skip_next_preview (GstCameraBin2 * camerabin) 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 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"); g_mutex_lock (&camerabin->video_capture_mutex); + gst_camera_bin_finish_video_file (camerabin); + /* reset element states to clear eos/flushing pads */ gst_element_set_state (camerabin->video_encodebin, 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"); 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", gst_camera_bin_video_reset_elements, gst_object_ref (camerabin), NULL)) { |