mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 23:36:38 +00:00
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
This commit is contained in:
parent
68dca2e704
commit
d66ef4dea8
2 changed files with 31 additions and 16 deletions
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue