summaryrefslogtreecommitdiffstats
path: root/ext/flac
diff options
context:
space:
mode:
authorLaszlo Pandy <laszlok2@gmail.com>2009-03-12 16:10:25 +0100
committerEdward Hervey <bilboed@bilboed.com>2009-03-12 16:10:25 +0100
commit73fac6e4ea5df98afc5a04cc267b0a89b1b10ad4 (patch)
tree1a5cd524c36f0cf9696406b76f145d34ca1fbe1f /ext/flac
parent515d623dccf13c700caa4736b2713044bc19a3ee (diff)
Don't call FLAC__ methods before it's initialized. Fixes #516031
In the event handler, gst_flac_dec_sink_event(), two functions are called on the FLAC stream without checking if it has been initialized: FLAC__stream_decoder_flush() FLAC__stream_decoder_process_until_end_of_stream() Both these FLAC__*() functions modify the internal state of the FLAC stream. Later, when the buffers start flowing, gst_flac_dec_chain() tries to initialize the stream. the FLAC__stream_decoder_init_stream() call will fail because the previous calls to FLAC__*() changed the stream state so it is no longer in the initialized state.
Diffstat (limited to 'ext/flac')
-rw-r--r--ext/flac/gstflacdec.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/ext/flac/gstflacdec.c b/ext/flac/gstflacdec.c
index adc4f355..408301f5 100644
--- a/ext/flac/gstflacdec.c
+++ b/ext/flac/gstflacdec.c
@@ -1410,7 +1410,7 @@ gst_flac_dec_sink_event (GstPad * pad, GstEvent * event)
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_FLUSH_STOP:{
- if (dec->stream_decoder) {
+ if (dec->init == FALSE) {
FLAC__stream_decoder_flush (dec->stream_decoder);
gst_adapter_clear (dec->adapter);
}
@@ -1459,10 +1459,13 @@ gst_flac_dec_sink_event (GstPad * pad, GstEvent * event)
case GST_EVENT_EOS:{
GST_LOG_OBJECT (dec, "EOS, with %u bytes available in adapter",
gst_adapter_available (dec->adapter));
- if (gst_adapter_available (dec->adapter) > 0) {
- FLAC__stream_decoder_process_until_end_of_stream (dec->stream_decoder);
+ if (dec->init == FALSE) {
+ if (gst_adapter_available (dec->adapter) > 0) {
+ FLAC__stream_decoder_process_until_end_of_stream (dec->
+ stream_decoder);
+ }
+ FLAC__stream_decoder_flush (dec->stream_decoder);
}
- FLAC__stream_decoder_flush (dec->stream_decoder);
gst_adapter_clear (dec->adapter);
res = gst_pad_push_event (dec->srcpad, event);
break;