diff options
author | Lukasz Marek <lukasz.m.luki2@gmail.com> | 2014-11-22 02:33:29 +0100 |
---|---|---|
committer | Lukasz Marek <lukasz.m.luki2@gmail.com> | 2014-12-02 21:58:34 +0100 |
commit | 8b0226f2a6d71d47c7578681e2580cb6b337adb9 (patch) | |
tree | a23b399ce9ec2573640b886c7f1817a7200a3838 | |
parent | d0b0fe6691fc67a95f985cad10d7e66c9bc23587 (diff) | |
download | ffmpeg-8b0226f2a6d71d47c7578681e2580cb6b337adb9.tar.gz |
ffserver: use avcodec_copy_context to copy context
Copying context using dedicated function is safer that raw memcpy
which creates shallow copy.
Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
-rw-r--r-- | ffserver.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/ffserver.c b/ffserver.c index 8ef51a1f9c..ab3e6e94ee 100644 --- a/ffserver.c +++ b/ffserver.c @@ -3297,13 +3297,8 @@ static AVStream *add_av_stream1(FFServerStream *stream, AVCodecContext *codec, i if (!fst) return NULL; if (copy) { - fst->codec = avcodec_alloc_context3(NULL); - memcpy(fst->codec, codec, sizeof(AVCodecContext)); - if (codec->extradata_size) { - fst->codec->extradata = av_mallocz(codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); - memcpy(fst->codec->extradata, codec->extradata, - codec->extradata_size); - } + fst->codec = avcodec_alloc_context3(codec->codec); + avcodec_copy_context(fst->codec, codec); } else { /* live streams must use the actual feed's codec since it may be * updated later to carry extradata needed by them. |