mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
camerabin: handle EOS on the pipeline
Make camerabin handle EOS to the pipeline to allow standard pipeline close where an EOS is sent to the whole pipeline before setting it to NULL.
This commit is contained in:
parent
29dd215649
commit
19d5be4c3a
2 changed files with 19 additions and 16 deletions
|
@ -1101,11 +1101,10 @@ gst_camera_bin_handle_message (GstBin * bin, GstMessage * message)
|
||||||
|
|
||||||
g_mutex_lock (&camerabin->video_capture_mutex);
|
g_mutex_lock (&camerabin->video_capture_mutex);
|
||||||
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);
|
if (camerabin->video_state == GST_CAMERA_BIN_VIDEO_FINISHING) {
|
||||||
|
|
||||||
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,
|
||||||
NULL)) {
|
gst_object_ref (camerabin), NULL)) {
|
||||||
GST_WARNING_OBJECT (camerabin,
|
GST_WARNING_OBJECT (camerabin,
|
||||||
"Failed to create thread to "
|
"Failed to create thread to "
|
||||||
"reset video elements' state, video recordings may not work "
|
"reset video elements' state, video recordings may not work "
|
||||||
|
@ -1113,6 +1112,14 @@ gst_camera_bin_handle_message (GstBin * bin, GstMessage * message)
|
||||||
gst_object_unref (camerabin);
|
gst_object_unref (camerabin);
|
||||||
camerabin->video_state = GST_CAMERA_BIN_VIDEO_IDLE;
|
camerabin->video_state = GST_CAMERA_BIN_VIDEO_IDLE;
|
||||||
}
|
}
|
||||||
|
} else if (camerabin->video_state == GST_CAMERA_BIN_VIDEO_IDLE) {
|
||||||
|
GST_DEBUG_OBJECT (camerabin, "Received EOS from video branch but "
|
||||||
|
"video recording is idle, ignoring");
|
||||||
|
} else {
|
||||||
|
GST_WARNING_OBJECT (camerabin, "Received EOS from video branch but "
|
||||||
|
"video is recording and stop-capture wasn't requested");
|
||||||
|
g_assert_not_reached ();
|
||||||
|
}
|
||||||
|
|
||||||
g_mutex_unlock (&camerabin->video_capture_mutex);
|
g_mutex_unlock (&camerabin->video_capture_mutex);
|
||||||
}
|
}
|
||||||
|
|
|
@ -312,10 +312,6 @@ gst_wrapper_camera_src_src_event_probe (GstPad * pad, GstPadProbeInfo * info,
|
||||||
GstEvent *evt = GST_EVENT (info->data);
|
GstEvent *evt = GST_EVENT (info->data);
|
||||||
|
|
||||||
switch (GST_EVENT_TYPE (evt)) {
|
switch (GST_EVENT_TYPE (evt)) {
|
||||||
case GST_EVENT_EOS:
|
|
||||||
/* drop */
|
|
||||||
ret = GST_PAD_PROBE_DROP;
|
|
||||||
break;
|
|
||||||
case GST_EVENT_SEGMENT:
|
case GST_EVENT_SEGMENT:
|
||||||
if (self->drop_newseg) {
|
if (self->drop_newseg) {
|
||||||
ret = GST_PAD_PROBE_DROP;
|
ret = GST_PAD_PROBE_DROP;
|
||||||
|
|
Loading…
Reference in a new issue