interaudiosink: fix leak when not connected

This commit is contained in:
David Schleef 2013-04-01 20:03:59 -07:00
parent edbc7d2ac4
commit 9fd00c01a3

View file

@ -235,9 +235,10 @@ gst_inter_audio_sink_render (GstBaseSink * sink, GstBuffer * buffer)
n = gst_adapter_available (interaudiosink->surface->audio_adapter) / 4; n = gst_adapter_available (interaudiosink->surface->audio_adapter) / 4;
#define SIZE 1600 #define SIZE 1600
if (n > (SIZE * 3)) { if (n > (SIZE * 3)) {
GST_WARNING ("flushing 800 samples"); int n_chunks = (n / (SIZE / 2)) - 4;
gst_adapter_flush (interaudiosink->surface->audio_adapter, (SIZE / 2) * 4); GST_WARNING ("flushing %d samples", n_chunks * 800);
n -= (SIZE / 2); gst_adapter_flush (interaudiosink->surface->audio_adapter,
n_chunks * (SIZE / 2) * 4);
} }
gst_adapter_push (interaudiosink->surface->audio_adapter, gst_adapter_push (interaudiosink->surface->audio_adapter,
gst_buffer_ref (buffer)); gst_buffer_ref (buffer));