Skip to content
Snippets Groups Projects
Commit 8b0226f2 authored by Lukasz Marek's avatar Lukasz Marek
Browse files

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: default avatarLukasz Marek <lukasz.m.luki2@gmail.com>
parent d0b0fe66
No related branches found
No related tags found
No related merge requests found
...@@ -3297,13 +3297,8 @@ static AVStream *add_av_stream1(FFServerStream *stream, AVCodecContext *codec, i ...@@ -3297,13 +3297,8 @@ static AVStream *add_av_stream1(FFServerStream *stream, AVCodecContext *codec, i
if (!fst) if (!fst)
return NULL; return NULL;
if (copy) { if (copy) {
fst->codec = avcodec_alloc_context3(NULL); fst->codec = avcodec_alloc_context3(codec->codec);
memcpy(fst->codec, codec, sizeof(AVCodecContext)); avcodec_copy_context(fst->codec, codec);
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);
}
} else { } else {
/* live streams must use the actual feed's codec since it may be /* live streams must use the actual feed's codec since it may be
* updated later to carry extradata needed by them. * updated later to carry extradata needed by them.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment