From 7e069060b3699429bac1134bf053e8b8dc462090 Mon Sep 17 00:00:00 2001 From: Teemu Katajisto Date: Thu, 28 Jul 2011 13:18:57 -0300 Subject: [PATCH] camerabin2: Synchronize clock and base time to audiosrc When audio source goes to READY it loses its clock and base time, this patch sets them back after bringing the audio source back to PAUSED. --- gst/camerabin2/gstcamerabin2.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gst/camerabin2/gstcamerabin2.c b/gst/camerabin2/gstcamerabin2.c index 8d56efb6af..522d974aa6 100644 --- a/gst/camerabin2/gstcamerabin2.c +++ b/gst/camerabin2/gstcamerabin2.c @@ -270,6 +270,8 @@ gst_camera_bin_start_capture (GstCameraBin2 * camerabin) if (camerabin->mode == MODE_VIDEO) { if (camerabin->audio_src) { + GstClock *clock = gst_pipeline_get_clock (GST_PIPELINE_CAST (camerabin)); + gst_element_set_state (camerabin->audio_src, GST_STATE_READY); /* need to reset eos status (pads could be flushing) */ gst_element_set_state (camerabin->audio_capsfilter, GST_STATE_READY); @@ -278,6 +280,13 @@ gst_camera_bin_start_capture (GstCameraBin2 * camerabin) gst_element_sync_state_with_parent (camerabin->audio_capsfilter); gst_element_sync_state_with_parent (camerabin->audio_volume); gst_element_set_state (camerabin->audio_src, GST_STATE_PAUSED); + + gst_element_set_base_time (camerabin->audio_src, + gst_element_get_base_time (GST_ELEMENT_CAST (camerabin))); + if (clock) { + gst_element_set_clock (camerabin->audio_src, clock); + gst_object_unref (clock); + } } } else { gchar *location = NULL;