flacdec: don't use pad_alloc when decoding while seeking. Fixes #579422

This commit is contained in:
Thomas Vander Stichele 2009-04-18 18:00:54 +02:00 committed by Edward Hervey
parent 99efbfcf4d
commit 71acf2e900

View file

@ -908,10 +908,12 @@ gst_flac_dec_write (GstFlacDec * flacdec, const FLAC__Frame * frame,
} }
if (flacdec->close_segment) { if (flacdec->close_segment) {
GST_DEBUG_OBJECT (flacdec, "pushing close segment");
gst_pad_push_event (flacdec->srcpad, flacdec->close_segment); gst_pad_push_event (flacdec->srcpad, flacdec->close_segment);
flacdec->close_segment = NULL; flacdec->close_segment = NULL;
} }
if (flacdec->start_segment) { if (flacdec->start_segment) {
GST_DEBUG_OBJECT (flacdec, "pushing start segment");
gst_pad_push_event (flacdec->srcpad, flacdec->start_segment); gst_pad_push_event (flacdec->srcpad, flacdec->start_segment);
flacdec->start_segment = NULL; flacdec->start_segment = NULL;
} }
@ -935,6 +937,12 @@ gst_flac_dec_write (GstFlacDec * flacdec, const FLAC__Frame * frame,
flacdec->pending_samples = 0; flacdec->pending_samples = 0;
} }
if (flacdec->seeking) {
GST_DEBUG_OBJECT (flacdec, "a pad_alloc would block here, do normal alloc");
outbuf = gst_buffer_new_and_alloc (samples * channels * (width / 8));
outbuf->offset = flacdec->segment.last_stop;
} else {
GST_LOG_OBJECT (flacdec, "alloc_buffer_and_set_caps");
ret = gst_pad_alloc_buffer_and_set_caps (flacdec->srcpad, ret = gst_pad_alloc_buffer_and_set_caps (flacdec->srcpad,
flacdec->segment.last_stop, samples * channels * (width / 8), flacdec->segment.last_stop, samples * channels * (width / 8),
GST_PAD_CAPS (flacdec->srcpad), &outbuf); GST_PAD_CAPS (flacdec->srcpad), &outbuf);
@ -944,6 +952,7 @@ gst_flac_dec_write (GstFlacDec * flacdec, const FLAC__Frame * frame,
gst_flow_get_name (ret)); gst_flow_get_name (ret));
goto done; goto done;
} }
}
if (flacdec->cur_granulepos != GST_BUFFER_OFFSET_NONE) { if (flacdec->cur_granulepos != GST_BUFFER_OFFSET_NONE) {
/* this should be fine since it should be one flac frame per ogg packet */ /* this should be fine since it should be one flac frame per ogg packet */