summaryrefslogtreecommitdiffstats
path: root/ext/flac
diff options
context:
space:
mode:
authorThomas Vander Stichele <thomas@apestaart.org>2009-04-18 18:00:54 +0200
committerEdward Hervey <bilboed@bilboed.com>2009-05-06 15:28:46 +0200
commit71acf2e900877d21485d384fd01892d1dca88ea1 (patch)
tree50fa4fdfcd87024c6e4be910803fba906cee6005 /ext/flac
parent99efbfcf4d52cf8a44d521e6942ada4fc4bbf2ea (diff)
flacdec: don't use pad_alloc when decoding while seeking. Fixes #579422
Diffstat (limited to 'ext/flac')
-rw-r--r--ext/flac/gstflacdec.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/ext/flac/gstflacdec.c b/ext/flac/gstflacdec.c
index ff3da8b7..5f6c82c7 100644
--- a/ext/flac/gstflacdec.c
+++ b/ext/flac/gstflacdec.c
@@ -908,10 +908,12 @@ gst_flac_dec_write (GstFlacDec * flacdec, const FLAC__Frame * frame,
}
if (flacdec->close_segment) {
+ GST_DEBUG_OBJECT (flacdec, "pushing close segment");
gst_pad_push_event (flacdec->srcpad, flacdec->close_segment);
flacdec->close_segment = NULL;
}
if (flacdec->start_segment) {
+ GST_DEBUG_OBJECT (flacdec, "pushing start segment");
gst_pad_push_event (flacdec->srcpad, flacdec->start_segment);
flacdec->start_segment = NULL;
}
@@ -935,14 +937,21 @@ gst_flac_dec_write (GstFlacDec * flacdec, const FLAC__Frame * frame,
flacdec->pending_samples = 0;
}
- ret = gst_pad_alloc_buffer_and_set_caps (flacdec->srcpad,
- flacdec->segment.last_stop, samples * channels * (width / 8),
- GST_PAD_CAPS (flacdec->srcpad), &outbuf);
-
- if (ret != GST_FLOW_OK) {
- GST_DEBUG_OBJECT (flacdec, "gst_pad_alloc_buffer() returned %s",
- gst_flow_get_name (ret));
- goto done;
+ 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,
+ flacdec->segment.last_stop, samples * channels * (width / 8),
+ GST_PAD_CAPS (flacdec->srcpad), &outbuf);
+
+ if (ret != GST_FLOW_OK) {
+ GST_DEBUG_OBJECT (flacdec, "gst_pad_alloc_buffer() returned %s",
+ gst_flow_get_name (ret));
+ goto done;
+ }
}
if (flacdec->cur_granulepos != GST_BUFFER_OFFSET_NONE) {