mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
baseaudio: avoid taking extra ref on sink/src
Don't take an extra ref on the sink and source because that creates a reference cycle. Instead, use the invalidate method of the clock when the sink and source are freed. This way, we don't call into the time function anymore after the objects are disposed.
This commit is contained in:
parent
c7972692d3
commit
24226284b8
2 changed files with 12 additions and 10 deletions
|
@ -272,9 +272,8 @@ gst_base_audio_sink_init (GstBaseAudioSink * baseaudiosink,
|
||||||
baseaudiosink->provide_clock = DEFAULT_PROVIDE_CLOCK;
|
baseaudiosink->provide_clock = DEFAULT_PROVIDE_CLOCK;
|
||||||
baseaudiosink->priv->slave_method = DEFAULT_SLAVE_METHOD;
|
baseaudiosink->priv->slave_method = DEFAULT_SLAVE_METHOD;
|
||||||
|
|
||||||
baseaudiosink->provided_clock = gst_audio_clock_new_full ("GstAudioSinkClock",
|
baseaudiosink->provided_clock = gst_audio_clock_new ("GstAudioSinkClock",
|
||||||
(GstAudioClockGetTimeFunc) gst_base_audio_sink_get_time,
|
(GstAudioClockGetTimeFunc) gst_base_audio_sink_get_time, baseaudiosink);
|
||||||
gst_object_ref (baseaudiosink), (GDestroyNotify) gst_object_unref);
|
|
||||||
|
|
||||||
GST_BASE_SINK (baseaudiosink)->can_activate_push = TRUE;
|
GST_BASE_SINK (baseaudiosink)->can_activate_push = TRUE;
|
||||||
GST_BASE_SINK (baseaudiosink)->can_activate_pull = DEFAULT_CAN_ACTIVATE_PULL;
|
GST_BASE_SINK (baseaudiosink)->can_activate_pull = DEFAULT_CAN_ACTIVATE_PULL;
|
||||||
|
@ -311,9 +310,11 @@ gst_base_audio_sink_dispose (GObject * object)
|
||||||
|
|
||||||
sink = GST_BASE_AUDIO_SINK (object);
|
sink = GST_BASE_AUDIO_SINK (object);
|
||||||
|
|
||||||
if (sink->provided_clock)
|
if (sink->provided_clock) {
|
||||||
|
gst_audio_clock_invalidate (sink->provided_clock);
|
||||||
gst_object_unref (sink->provided_clock);
|
gst_object_unref (sink->provided_clock);
|
||||||
sink->provided_clock = NULL;
|
sink->provided_clock = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (sink->ringbuffer) {
|
if (sink->ringbuffer) {
|
||||||
gst_object_unparent (GST_OBJECT_CAST (sink->ringbuffer));
|
gst_object_unparent (GST_OBJECT_CAST (sink->ringbuffer));
|
||||||
|
|
|
@ -250,9 +250,8 @@ gst_base_audio_src_init (GstBaseAudioSrc * baseaudiosrc,
|
||||||
* value based on negotiated format. */
|
* value based on negotiated format. */
|
||||||
GST_BASE_SRC (baseaudiosrc)->blocksize = 0;
|
GST_BASE_SRC (baseaudiosrc)->blocksize = 0;
|
||||||
|
|
||||||
baseaudiosrc->clock = gst_audio_clock_new_full ("GstAudioSrcClock",
|
baseaudiosrc->clock = gst_audio_clock_new ("GstAudioSrcClock",
|
||||||
(GstAudioClockGetTimeFunc) gst_base_audio_src_get_time,
|
(GstAudioClockGetTimeFunc) gst_base_audio_src_get_time, baseaudiosrc);
|
||||||
gst_object_ref (baseaudiosrc), (GDestroyNotify) gst_object_unref);
|
|
||||||
|
|
||||||
/* we are always a live source */
|
/* we are always a live source */
|
||||||
gst_base_src_set_live (GST_BASE_SRC (baseaudiosrc), TRUE);
|
gst_base_src_set_live (GST_BASE_SRC (baseaudiosrc), TRUE);
|
||||||
|
@ -268,9 +267,11 @@ gst_base_audio_src_dispose (GObject * object)
|
||||||
src = GST_BASE_AUDIO_SRC (object);
|
src = GST_BASE_AUDIO_SRC (object);
|
||||||
|
|
||||||
GST_OBJECT_LOCK (src);
|
GST_OBJECT_LOCK (src);
|
||||||
if (src->clock)
|
if (src->clock) {
|
||||||
|
gst_audio_clock_invalidate (src->clock);
|
||||||
gst_object_unref (src->clock);
|
gst_object_unref (src->clock);
|
||||||
src->clock = NULL;
|
src->clock = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (src->ringbuffer) {
|
if (src->ringbuffer) {
|
||||||
gst_object_unparent (GST_OBJECT_CAST (src->ringbuffer));
|
gst_object_unparent (GST_OBJECT_CAST (src->ringbuffer));
|
||||||
|
|
Loading…
Reference in a new issue