[gst-cvs] gst-plugins-bad: camerabin: Do not use audio clock after stopping video capture
Thiago Sousa Santos
thiagoss at kemper.freedesktop.org
Thu Nov 18 06:01:26 PST 2010
Module: gst-plugins-bad
Branch: master
Commit: d66ef4dea8d8c5bb39e445db788cb45d59a4e206
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=d66ef4dea8d8c5bb39e445db788cb45d59a4e206
Author: Aleksey Lim <alsroot at member.fsf.org>
Date: Thu Nov 18 10:58:06 2010 -0300
camerabin: Do not use audio clock after stopping video capture
Adda provide clock function to camerabin to make it not
provide the audio clock of the record bin when no video
recording is happening
Fixes #613379
---
gst/camerabin/camerabinvideo.c | 16 ----------------
gst/camerabin/gstcamerabin.c | 31 +++++++++++++++++++++++++++++++
2 files changed, 31 insertions(+), 16 deletions(-)
diff --git a/gst/camerabin/camerabinvideo.c b/gst/camerabin/camerabinvideo.c
index f351afe..6b0ed10 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 bb9d122..550a160 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)
{
More information about the Gstreamer-commits
mailing list