mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-06 15:49:50 +08:00
ffmpeg: Fix memory corruption with ffserver
Bug has been introduced by: commit 1cede1d0112b5b26e6d023846729662b7cf1853f Author: Anton Khirnov <anton@khirnov.net> Date: Sat Jun 25 07:43:49 2011 +0200 ffmpeg: factor common code from new_a/v/s/d_stream to new_output_stream()
This commit is contained in:
3
ffmpeg.c
3
ffmpeg.c
@ -3636,15 +3636,18 @@ static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const ch
|
|||||||
AVStream *st;
|
AVStream *st;
|
||||||
OutputStream *ost;
|
OutputStream *ost;
|
||||||
AVCodec *codec;
|
AVCodec *codec;
|
||||||
|
AVCodecContext *avctx;
|
||||||
|
|
||||||
codec = avcodec_find_encoder(ic->streams[i]->codec->codec_id);
|
codec = avcodec_find_encoder(ic->streams[i]->codec->codec_id);
|
||||||
ost = new_output_stream(o, s, codec->type);
|
ost = new_output_stream(o, s, codec->type);
|
||||||
st = ost->st;
|
st = ost->st;
|
||||||
|
avctx = st->codec;
|
||||||
|
|
||||||
// FIXME: a more elegant solution is needed
|
// FIXME: a more elegant solution is needed
|
||||||
memcpy(st, ic->streams[i], sizeof(AVStream));
|
memcpy(st, ic->streams[i], sizeof(AVStream));
|
||||||
st->info = av_malloc(sizeof(*st->info));
|
st->info = av_malloc(sizeof(*st->info));
|
||||||
memcpy(st->info, ic->streams[i]->info, sizeof(*st->info));
|
memcpy(st->info, ic->streams[i]->info, sizeof(*st->info));
|
||||||
|
st->codec= avctx;
|
||||||
avcodec_copy_context(st->codec, ic->streams[i]->codec);
|
avcodec_copy_context(st->codec, ic->streams[i]->codec);
|
||||||
|
|
||||||
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && !ost->stream_copy)
|
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && !ost->stream_copy)
|
||||||
|
Reference in New Issue
Block a user