mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-22 15:18:21 +00:00
faad: don't access buffer after _finish_frame
Unmap the buffer before calling _finish_frame because we are not allowed to access it after.
This commit is contained in:
parent
40760117b1
commit
62b66c1316
1 changed files with 9 additions and 6 deletions
|
@ -732,7 +732,7 @@ init:
|
||||||
info.error = 0;
|
info.error = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
GstMapInfo map;
|
GstMapInfo omap;
|
||||||
|
|
||||||
if (!faad->packetised) {
|
if (!faad->packetised) {
|
||||||
/* faad only really parses ADTS header at Init time, not when decoding,
|
/* 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 */
|
/* FIXME, add bufferpool and allocator support to the base class */
|
||||||
outbuf = gst_buffer_new_allocate (NULL, info.samples * faad->bps, NULL);
|
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) {
|
if (faad->need_reorder) {
|
||||||
gint16 *dest, *src, i, j;
|
gint16 *dest, *src, i, j;
|
||||||
|
|
||||||
dest = (gint16 *) map.data;
|
dest = (gint16 *) omap.data;
|
||||||
src = (gint16 *) out;
|
src = (gint16 *) out;
|
||||||
|
|
||||||
for (i = 0; i < samples; i++) {
|
for (i = 0; i < samples; i++) {
|
||||||
|
@ -789,16 +789,19 @@ init:
|
||||||
dest += channels;
|
dest += channels;
|
||||||
}
|
}
|
||||||
} else {
|
} 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);
|
ret = gst_audio_decoder_finish_frame (dec, outbuf, 1);
|
||||||
}
|
}
|
||||||
} while (FALSE);
|
} while (FALSE);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
gst_buffer_unmap (buffer, &map);
|
if (buffer)
|
||||||
|
gst_buffer_unmap (buffer, &map);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue