mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-09 05:38:58 +00:00
pulsesink: Allocate and free the custom clock in NULL<->READY
This commit is contained in:
parent
5332287e2d
commit
e69ba0f94f
1 changed files with 10 additions and 7 deletions
|
@ -1664,13 +1664,6 @@ gst_pulsesink_init (GstPulseSink * pulsesink, GstPulseSinkClass * klass)
|
||||||
pulsesink->probe = gst_pulseprobe_new (G_OBJECT (pulsesink),
|
pulsesink->probe = gst_pulseprobe_new (G_OBJECT (pulsesink),
|
||||||
G_OBJECT_GET_CLASS (pulsesink), PROP_DEVICE, pulsesink->device,
|
G_OBJECT_GET_CLASS (pulsesink), PROP_DEVICE, pulsesink->device,
|
||||||
TRUE, FALSE);
|
TRUE, FALSE);
|
||||||
|
|
||||||
/* override with a custom clock */
|
|
||||||
if (GST_BASE_AUDIO_SINK (pulsesink)->provided_clock)
|
|
||||||
gst_object_unref (GST_BASE_AUDIO_SINK (pulsesink)->provided_clock);
|
|
||||||
GST_BASE_AUDIO_SINK (pulsesink)->provided_clock =
|
|
||||||
gst_audio_clock_new ("GstPulseSinkClock",
|
|
||||||
(GstAudioClockGetTimeFunc) gst_pulsesink_get_time, pulsesink);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2275,6 +2268,13 @@ gst_pulsesink_change_state (GstElement * element, GstStateChange transition)
|
||||||
g_assert (pulsesink->mainloop != NULL);
|
g_assert (pulsesink->mainloop != NULL);
|
||||||
res = pa_threaded_mainloop_start (pulsesink->mainloop);
|
res = pa_threaded_mainloop_start (pulsesink->mainloop);
|
||||||
g_assert (res == 0);
|
g_assert (res == 0);
|
||||||
|
|
||||||
|
/* override with a custom clock */
|
||||||
|
if (GST_BASE_AUDIO_SINK (pulsesink)->provided_clock)
|
||||||
|
gst_object_unref (GST_BASE_AUDIO_SINK (pulsesink)->provided_clock);
|
||||||
|
GST_BASE_AUDIO_SINK (pulsesink)->provided_clock =
|
||||||
|
gst_audio_clock_new ("GstPulseSinkClock",
|
||||||
|
(GstAudioClockGetTimeFunc) gst_pulsesink_get_time, pulsesink);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -2284,6 +2284,9 @@ gst_pulsesink_change_state (GstElement * element, GstStateChange transition)
|
||||||
|
|
||||||
switch (transition) {
|
switch (transition) {
|
||||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
||||||
|
if (GST_BASE_AUDIO_SINK (pulsesink)->provided_clock)
|
||||||
|
gst_object_unref (GST_BASE_AUDIO_SINK (pulsesink)->provided_clock);
|
||||||
|
GST_BASE_AUDIO_SINK (pulsesink)->provided_clock = NULL;
|
||||||
if (pulsesink->mainloop) {
|
if (pulsesink->mainloop) {
|
||||||
pa_threaded_mainloop_stop (pulsesink->mainloop);
|
pa_threaded_mainloop_stop (pulsesink->mainloop);
|
||||||
pa_threaded_mainloop_free (pulsesink->mainloop);
|
pa_threaded_mainloop_free (pulsesink->mainloop);
|
||||||
|
|
Loading…
Reference in a new issue