summaryrefslogtreecommitdiffstats
path: root/ext/flac
diff options
context:
space:
mode:
authorJan Schmidt <thaytan@noraisin.net>2009-04-20 18:33:09 +0100
committerJan Schmidt <thaytan@noraisin.net>2009-05-06 14:24:20 +0100
commitc41d3d87fa975a9a6829766d60e7553c0cd28a1c (patch)
tree5995fa30a122be23621d641cb96da622230b33b6 /ext/flac
parent71acf2e900877d21485d384fd01892d1dca88ea1 (diff)
flac: Make buffers created during seek act like normal buffers.
Store the offset and caps when allocating a buffer during seeking, and then allocate a new buffer with buffer_alloc before we push it out. This ensures that in all respects the first buffer decoded during seeking behaves like all other buffers, including allowing downstream re-negotiation.
Diffstat (limited to 'ext/flac')
-rw-r--r--ext/flac/gstflacdec.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/ext/flac/gstflacdec.c b/ext/flac/gstflacdec.c
index 5f6c82c7..f8eb818c 100644
--- a/ext/flac/gstflacdec.c
+++ b/ext/flac/gstflacdec.c
@@ -931,8 +931,18 @@ gst_flac_dec_write (GstFlacDec * flacdec, const FLAC__Frame * frame,
GST_BUFFER_OFFSET (flacdec->pending),
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (flacdec->pending)),
GST_TIME_ARGS (GST_BUFFER_DURATION (flacdec->pending)));
- gst_pad_push (flacdec->srcpad, flacdec->pending);
- flacdec->pending = NULL;
+ /* Pending buffer was always allocated from the seeking thread,
+ * which means it wasn't gst_buffer_alloc'd. Do so now to let
+ * downstream negotiation work on older basetransform */
+ ret = gst_pad_alloc_buffer_and_set_caps (flacdec->srcpad,
+ GST_BUFFER_OFFSET (flacdec->pending),
+ GST_BUFFER_SIZE (flacdec->pending),
+ GST_BUFFER_CAPS (flacdec->pending), &outbuf);
+ if (ret == GST_FLOW_OK)
+ gst_pad_push (flacdec->srcpad, outbuf);
+
+ gst_buffer_unref (flacdec->pending);
+ outbuf = flacdec->pending = NULL;
flacdec->segment.last_stop += flacdec->pending_samples;
flacdec->pending_samples = 0;
}
@@ -940,7 +950,8 @@ gst_flac_dec_write (GstFlacDec * flacdec, const FLAC__Frame * frame,
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;
+ gst_buffer_set_caps (outbuf, GST_PAD_CAPS (flacdec->srcpad));
+ GST_BUFFER_OFFSET (outbuf) = flacdec->segment.last_stop;
} else {
GST_LOG_OBJECT (flacdec, "alloc_buffer_and_set_caps");
ret = gst_pad_alloc_buffer_and_set_caps (flacdec->srcpad,