mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
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.
This commit is contained in:
parent
515d623dcc
commit
73fac6e4ea
1 changed files with 7 additions and 4 deletions
|
@ -1410,7 +1410,7 @@ gst_flac_dec_sink_event (GstPad * pad, GstEvent * event)
|
||||||
|
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
case GST_EVENT_FLUSH_STOP:{
|
case GST_EVENT_FLUSH_STOP:{
|
||||||
if (dec->stream_decoder) {
|
if (dec->init == FALSE) {
|
||||||
FLAC__stream_decoder_flush (dec->stream_decoder);
|
FLAC__stream_decoder_flush (dec->stream_decoder);
|
||||||
gst_adapter_clear (dec->adapter);
|
gst_adapter_clear (dec->adapter);
|
||||||
}
|
}
|
||||||
|
@ -1459,10 +1459,13 @@ gst_flac_dec_sink_event (GstPad * pad, GstEvent * event)
|
||||||
case GST_EVENT_EOS:{
|
case GST_EVENT_EOS:{
|
||||||
GST_LOG_OBJECT (dec, "EOS, with %u bytes available in adapter",
|
GST_LOG_OBJECT (dec, "EOS, with %u bytes available in adapter",
|
||||||
gst_adapter_available (dec->adapter));
|
gst_adapter_available (dec->adapter));
|
||||||
if (gst_adapter_available (dec->adapter) > 0) {
|
if (dec->init == FALSE) {
|
||||||
FLAC__stream_decoder_process_until_end_of_stream (dec->stream_decoder);
|
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);
|
gst_adapter_clear (dec->adapter);
|
||||||
res = gst_pad_push_event (dec->srcpad, event);
|
res = gst_pad_push_event (dec->srcpad, event);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue