summaryrefslogtreecommitdiff
path: root/ext/faad
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2012-06-12 09:10:54 +0200
committerWim Taymans <wim.taymans@collabora.co.uk>2012-06-12 09:13:24 +0200
commit62b66c1316c45700037e6193425212b124287f11 (patch)
tree4c3d78c3fa286237393676c5ae01a6417c1b2c30 /ext/faad
parent40760117b1be907b5d0f3f43862ac1ec0a8b67f3 (diff)
downloadgstreamer-plugins-bad-62b66c1316c45700037e6193425212b124287f11.tar.gz
faad: don't access buffer after _finish_frame
Unmap the buffer before calling _finish_frame because we are not allowed to access it after.
Diffstat (limited to 'ext/faad')
-rw-r--r--ext/faad/gstfaad.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/ext/faad/gstfaad.c b/ext/faad/gstfaad.c
index c6f1e42e8..736bb8723 100644
--- a/ext/faad/gstfaad.c
+++ b/ext/faad/gstfaad.c
@@ -732,7 +732,7 @@ init:
info.error = 0;
do {
- GstMapInfo map;
+ GstMapInfo omap;
if (!faad->packetised) {
/* faad only really parses ADTS header at Init time, not when decoding,
@@ -775,11 +775,11 @@ init:
/* FIXME, add bufferpool and allocator support to the base class */
outbuf = gst_buffer_new_allocate (NULL, info.samples * faad->bps, NULL);
- gst_buffer_map (outbuf, &map, GST_MAP_READWRITE);
+ gst_buffer_map (outbuf, &omap, GST_MAP_READWRITE);
if (faad->need_reorder) {
gint16 *dest, *src, i, j;
- dest = (gint16 *) map.data;
+ dest = (gint16 *) omap.data;
src = (gint16 *) out;
for (i = 0; i < samples; i++) {
@@ -789,16 +789,19 @@ init:
dest += channels;
}
} else {
- memcpy (map.data, out, map.size);
+ memcpy (omap.data, out, omap.size);
}
- gst_buffer_unmap (outbuf, &map);
+ gst_buffer_unmap (outbuf, &omap);
+ gst_buffer_unmap (buffer, &map);
+ buffer = NULL;
ret = gst_audio_decoder_finish_frame (dec, outbuf, 1);
}
} while (FALSE);
out:
- gst_buffer_unmap (buffer, &map);
+ if (buffer)
+ gst_buffer_unmap (buffer, &map);
return ret;