flactag: fix adapter assertion when used directly after flacenc

Unlike filesrc, flacenc outputs the flac blocks neatly aligned one in
each buffer. This means that when we switch from metadata mode to
audio data passthrough mode, there's no data left in the adapter to
push out at this point, so check if there's data in the adapter
before requesting buffers from it (also needed in case we get input
buffers of 0 size).

Fixes #615793.
This commit is contained in:
Tim-Philipp Müller 2010-04-14 23:46:06 +01:00
parent 1349d5d765
commit 1351af141d

View file

@ -430,11 +430,14 @@ gst_flac_tag_chain (GstPad * pad, GstBuffer * buffer)
/* The metadata blocks have been read, now we are reading audio data */
if (tag->state == GST_FLAC_TAG_STATE_AUDIO_DATA) {
GstBuffer *buffer;
buffer =
gst_adapter_take_buffer (tag->adapter,
gst_adapter_available (tag->adapter));
gst_buffer_set_caps (buffer, GST_PAD_CAPS (tag->srcpad));
ret = gst_pad_push (tag->srcpad, buffer);
guint avail;
avail = gst_adapter_available (tag->adapter);
if (avail > 0) {
buffer = gst_adapter_take_buffer (tag->adapter, avail);
gst_buffer_set_caps (buffer, GST_PAD_CAPS (tag->srcpad));
ret = gst_pad_push (tag->srcpad, buffer);
}
}
cleanup: