audiomixer: Release pad object lock before dropping buffer

Otherwise, the locking order is violated and deadlocks happen.

https://bugzilla.gnome.org/show_bug.cgi?id=745768
This commit is contained in:
Olivier Crête 2015-03-07 22:08:40 -05:00 committed by Olivier Crête
parent 2d553d1b25
commit ff9be3ba34

View file

@ -1141,6 +1141,7 @@ gst_audio_mixer_mix_buffer (GstAudioMixer * audiomixer, GstAudioMixerPad * pad,
GstMapInfo inmap; GstMapInfo inmap;
gint bpf; gint bpf;
guint blocksize; guint blocksize;
gboolean drop_buf = FALSE;
GstAggregatorPad *aggpad = GST_AGGREGATOR_PAD (pad); GstAggregatorPad *aggpad = GST_AGGREGATOR_PAD (pad);
@ -1176,9 +1177,11 @@ gst_audio_mixer_mix_buffer (GstAudioMixer * audiomixer, GstAudioMixerPad * pad,
if (pad->position >= pad->size) { if (pad->position >= pad->size) {
/* Buffer done, drop it */ /* Buffer done, drop it */
gst_buffer_replace (&pad->buffer, NULL); gst_buffer_replace (&pad->buffer, NULL);
gst_aggregator_pad_drop_buffer (aggpad); drop_buf = TRUE;
} }
GST_OBJECT_UNLOCK (pad); GST_OBJECT_UNLOCK (pad);
if (drop_buf)
gst_aggregator_pad_drop_buffer (aggpad);
return; return;
} }
@ -1189,8 +1192,8 @@ gst_audio_mixer_mix_buffer (GstAudioMixer * audiomixer, GstAudioMixerPad * pad,
pad->output_offset += pad->size / bpf; pad->output_offset += pad->size / bpf;
/* Buffer done, drop it */ /* Buffer done, drop it */
gst_buffer_replace (&pad->buffer, NULL); gst_buffer_replace (&pad->buffer, NULL);
gst_aggregator_pad_drop_buffer (aggpad);
GST_OBJECT_UNLOCK (pad); GST_OBJECT_UNLOCK (pad);
gst_aggregator_pad_drop_buffer (aggpad);
return; return;
} }
@ -1300,11 +1303,14 @@ gst_audio_mixer_mix_buffer (GstAudioMixer * audiomixer, GstAudioMixerPad * pad,
if (pad->position == pad->size) { if (pad->position == pad->size) {
/* Buffer done, drop it */ /* Buffer done, drop it */
gst_buffer_replace (&pad->buffer, NULL); gst_buffer_replace (&pad->buffer, NULL);
gst_aggregator_pad_drop_buffer (aggpad);
GST_DEBUG_OBJECT (pad, "Finished mixing buffer, waiting for next"); GST_DEBUG_OBJECT (pad, "Finished mixing buffer, waiting for next");
drop_buf = TRUE;
} }
GST_OBJECT_UNLOCK (pad); GST_OBJECT_UNLOCK (pad);
if (drop_buf)
gst_aggregator_pad_drop_buffer (aggpad);
} }
static GstFlowReturn static GstFlowReturn