audiobuffersplit: Don't try to output anything if samples_per_buffer == 0

This happens if we had no CAPS event yet but e.g. got an EOS event. We
would then try to output a 0-sized buffer, but getting that from the
adapter will give an assertion, return NULL and then crash.
This commit is contained in:
Sebastian Dröge 2016-12-23 13:27:42 +02:00
parent 4523cff147
commit 5cff156f2c

View file

@ -220,6 +220,7 @@ gst_audio_buffer_split_change_state (GstElement * element,
self->resync_time = GST_CLOCK_TIME_NONE;
self->current_offset = -1;
self->accumulated_error = 0;
self->samples_per_buffer = 0;
break;
default:
break;
@ -252,6 +253,9 @@ gst_audio_buffer_split_output (GstAudioBufferSplit * self, gboolean force)
rate = GST_AUDIO_INFO_RATE (&self->info);
bpf = GST_AUDIO_INFO_BPF (&self->info);
if (self->samples_per_buffer == 0)
return GST_FLOW_NOT_NEGOTIATED;
size = self->samples_per_buffer * bpf;
/* If we accumulated enough error for one sample, include one