mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
ext/ffmpeg/gstffmpegenc.c: Fix segmentation fault and memleak.
Original commit message from CVS: Reviewed by : Edward Hervey <edward@fluendo.com> * ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_chain_audio): Fix segmentation fault and memleak. Fixes #332995 and #333001
This commit is contained in:
parent
2f6def3134
commit
a96a9ed0c5
2 changed files with 11 additions and 5 deletions
|
@ -1,3 +1,11 @@
|
|||
2006-03-01 Josef Zlomek <josef dot zlomek at itonis dot tv>
|
||||
|
||||
Reviewed by : Edward Hervey <edward@fluendo.com>
|
||||
|
||||
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_chain_audio):
|
||||
Fix segmentation fault and memleak.
|
||||
Fixes #332995 and #333001
|
||||
|
||||
2006-02-24 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_frame):
|
||||
|
|
|
@ -578,8 +578,7 @@ gst_ffmpegenc_chain_audio (GstPad * pad, GstBuffer * inbuf)
|
|||
if (in_size > size) {
|
||||
/* this is panic! we got a buffer, but still don't have enough
|
||||
* data. Merge them and retry in the next cycle... */
|
||||
ffmpegenc->cache = gst_buffer_span (ffmpegenc->cache, 0, inbuf,
|
||||
GST_BUFFER_SIZE (ffmpegenc->cache) + GST_BUFFER_SIZE (inbuf));
|
||||
ffmpegenc->cache = gst_buffer_join (ffmpegenc->cache, inbuf);
|
||||
} else if (in_size == size) {
|
||||
/* exactly the same! how wonderful */
|
||||
ffmpegenc->cache = inbuf;
|
||||
|
@ -605,8 +604,7 @@ gst_ffmpegenc_chain_audio (GstPad * pad, GstBuffer * inbuf)
|
|||
subbuf = gst_buffer_create_sub (inbuf, 0, frame_size - (in_size - size));
|
||||
GST_BUFFER_DURATION (subbuf) =
|
||||
GST_BUFFER_DURATION (inbuf) * GST_BUFFER_SIZE (subbuf) / size;
|
||||
subbuf = gst_buffer_span (ffmpegenc->cache, 0, subbuf,
|
||||
GST_BUFFER_SIZE (ffmpegenc->cache) + GST_BUFFER_SIZE (subbuf));
|
||||
subbuf = gst_buffer_join (ffmpegenc->cache, subbuf);
|
||||
ffmpegenc->cache = NULL;
|
||||
} else {
|
||||
subbuf = gst_buffer_create_sub (inbuf, size - in_size, frame_size);
|
||||
|
@ -617,7 +615,7 @@ gst_ffmpegenc_chain_audio (GstPad * pad, GstBuffer * inbuf)
|
|||
(size - in_size) / size);
|
||||
}
|
||||
|
||||
outbuf = gst_buffer_new_and_alloc (GST_BUFFER_SIZE (inbuf));
|
||||
outbuf = gst_buffer_new_and_alloc (GST_BUFFER_SIZE (subbuf));
|
||||
ret_size = avcodec_encode_audio (ffmpegenc->context,
|
||||
GST_BUFFER_DATA (outbuf),
|
||||
GST_BUFFER_SIZE (outbuf), (const short int *)
|
||||
|
|
Loading…
Reference in a new issue