diff options
author | Aleksey Lim <alsroot@member.fsf.org> | 2010-11-18 10:58:06 -0300 |
---|---|---|
committer | Thiago Santos <thiago.sousa.santos@collabora.co.uk> | 2010-11-18 10:58:06 -0300 |
commit | d66ef4dea8d8c5bb39e445db788cb45d59a4e206 (patch) | |
tree | f882cee90114744d053fc4c6a119d3e15cea4ea8 | |
parent | 68dca2e7047639f2dcc754e2b7266db542863df1 (diff) |
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
-rw-r--r-- | gst/camerabin/camerabinvideo.c | 16 | ||||
-rw-r--r-- | 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 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) { |