camerabin: don't send multiple EOS events to video pipeline

This commit is contained in:
Tommi Myöhänen 2009-08-25 09:35:07 +03:00 committed by René Stadler
parent eb648817a4
commit 99f1f4510a
2 changed files with 15 additions and 6 deletions

View file

@ -1646,11 +1646,17 @@ gst_camerabin_send_video_eos (GstCameraBin * camera)
g_return_if_fail (camera != NULL); g_return_if_fail (camera != NULL);
/* Send eos event to video bin */ if (!camera->eos_handled) {
GST_INFO_OBJECT (camera, "sending eos to videobin"); /* Send eos event to video bin */
videopad = gst_element_get_static_pad (camera->vidbin, "sink"); GST_INFO_OBJECT (camera, "sending eos to videobin");
gst_pad_send_event (videopad, gst_event_new_eos ()); videopad = gst_element_get_static_pad (camera->vidbin, "sink");
gst_object_unref (videopad); gst_pad_send_event (videopad, gst_event_new_eos ());
gst_object_unref (videopad);
camera->eos_handled = TRUE;
}
else {
GST_INFO_OBJECT (camera, "dropping duplicate EOS");
}
} }
/* /*
@ -1796,7 +1802,7 @@ gst_camerabin_have_vid_buffer (GstPad * pad, GstBuffer * buffer,
gboolean ret = TRUE; gboolean ret = TRUE;
GST_LOG ("got video buffer %p with size %d", GST_LOG ("got video buffer %p with size %d",
buffer, GST_BUFFER_SIZE (buffer)); buffer, GST_BUFFER_SIZE (buffer));
if (camera->stop_requested) { if (G_UNLIKELY (camera->stop_requested)) {
gst_camerabin_send_video_eos (camera); gst_camerabin_send_video_eos (camera);
ret = FALSE; /* Drop buffer */ ret = FALSE; /* Drop buffer */
} }
@ -1951,6 +1957,7 @@ gst_camerabin_reset_to_view_finder (GstCameraBin * camera)
/* Reset counters and flags */ /* Reset counters and flags */
camera->stop_requested = FALSE; camera->stop_requested = FALSE;
camera->paused = FALSE; camera->paused = FALSE;
camera->eos_handled = FALSE;
/* Enable view finder mode in v4l2camsrc */ /* Enable view finder mode in v4l2camsrc */
if (camera->src_vid_src && if (camera->src_vid_src &&
@ -2687,6 +2694,7 @@ gst_camerabin_init (GstCameraBin * camera, GstCameraBinClass * gclass)
camera->paused = FALSE; camera->paused = FALSE;
camera->capturing = FALSE; camera->capturing = FALSE;
camera->night_mode = FALSE; camera->night_mode = FALSE;
camera->eos_handled = FALSE;
camera->width = DEFAULT_WIDTH; camera->width = DEFAULT_WIDTH;
camera->height = DEFAULT_HEIGHT; camera->height = DEFAULT_HEIGHT;

View file

@ -94,6 +94,7 @@ struct _GstCameraBin
GMutex *capture_mutex; GMutex *capture_mutex;
GCond *cond; GCond *cond;
gboolean capturing; gboolean capturing;
gboolean eos_handled;
/* pad names for output and input selectors */ /* pad names for output and input selectors */
GstPad *pad_src_view; GstPad *pad_src_view;