summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gst/camerabin/camerabinvideo.c16
-rw-r--r--gst/camerabin/gstcamerabin.c31
2 files changed, 31 insertions, 16 deletions
diff --git a/gst/camerabin/camerabinvideo.c b/gst/camerabin/camerabinvideo.c
index f351afe97..6b0ed107b 100644
--- a/gst/camerabin/camerabinvideo.c
+++ b/gst/camerabin/camerabinvideo.c
@@ -86,7 +86,6 @@ static void gst_camerabin_video_set_property (GObject * object, guint prop_id,
static void gst_camerabin_video_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
-static GstClock *gst_camerabin_video_provide_clock (GstElement * elem);
static GstStateChangeReturn
gst_camerabin_video_change_state (GstElement * element,
GstStateChange transition);
@@ -143,8 +142,6 @@ gst_camerabin_video_class_init (GstCameraBinVideoClass * klass)
(GObjectFinalizeFunc) GST_DEBUG_FUNCPTR (gst_camerabin_video_dispose);
eklass->change_state = GST_DEBUG_FUNCPTR (gst_camerabin_video_change_state);
- eklass->provide_clock = GST_DEBUG_FUNCPTR (gst_camerabin_video_provide_clock);
-
gobject_class->set_property =
GST_DEBUG_FUNCPTR (gst_camerabin_video_set_property);
gobject_class->get_property =
@@ -286,19 +283,6 @@ gst_camerabin_video_get_property (GObject * object, guint prop_id,
}
}
-/* GstElement methods implementation */
-
-static GstClock *
-gst_camerabin_video_provide_clock (GstElement * elem)
-{
- GstElement *aud_src = GST_CAMERABIN_VIDEO (elem)->aud_src;
- if (aud_src) {
- return gst_element_provide_clock (aud_src);
- } else {
- return NULL;
- }
-}
-
static GstStateChangeReturn
gst_camerabin_video_change_state (GstElement * element,
GstStateChange transition)
diff --git a/gst/camerabin/gstcamerabin.c b/gst/camerabin/gstcamerabin.c
index bb9d122a8..550a160a1 100644
--- a/gst/camerabin/gstcamerabin.c
+++ b/gst/camerabin/gstcamerabin.c
@@ -355,6 +355,7 @@ static void gst_camerabin_get_property (GObject * object, guint prop_id,
static GstStateChangeReturn
gst_camerabin_change_state (GstElement * element, GstStateChange transition);
+static GstClock *gst_camerabin_provide_clock (GstElement * element);
/*
* GstBin function declarations
@@ -3240,6 +3241,9 @@ gst_camerabin_class_init (GstCameraBinClass * klass)
gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_camerabin_change_state);
+ gstelement_class->provide_clock =
+ GST_DEBUG_FUNCPTR (gst_camerabin_provide_clock);
+
/* gstbin */
/* override handle_message to peek when video or image bin reaches eos */
gstbin_class->handle_message =
@@ -3874,6 +3878,33 @@ done:
return ret;
}
+static GstClock *
+gst_camerabin_provide_clock (GstElement * element)
+{
+ GstClock *clock = NULL;
+ GstClock *vidbin_clock = NULL;
+ GstCameraBin *camera = GST_CAMERABIN (element);
+ GstElement *aud_src = GST_CAMERABIN_VIDEO (camera->vidbin)->aud_src;
+
+ if (aud_src)
+ vidbin_clock = gst_element_provide_clock (aud_src);
+
+ if (camera->capturing && camera->mode == MODE_VIDEO && vidbin_clock)
+ clock = vidbin_clock;
+ else {
+ clock = GST_ELEMENT_CLASS (parent_class)->provide_clock (element);
+ if (clock == vidbin_clock) {
+ /* Do not reuse vidbin_clock if it was current clock */
+ clock = gst_system_clock_obtain ();
+ }
+ }
+
+ GST_INFO_OBJECT (camera, "Reset pipeline clock to %p(%s)",
+ clock, GST_ELEMENT_NAME (clock));
+
+ return clock;
+}
+
static gboolean
gst_camerabin_imgbin_finished (gpointer u_data)
{