ffserver: dont just crash
With changes from ubitux.
This commit is contained in:
parent
ab1c19efc5
commit
840238b870
2
ffmpeg.c
2
ffmpeg.c
@ -713,6 +713,8 @@ static int read_ffserver_streams(AVFormatContext *s, const char *filename)
|
|||||||
// FIXME: a more elegant solution is needed
|
// FIXME: a more elegant solution is needed
|
||||||
st = av_mallocz(sizeof(AVStream));
|
st = av_mallocz(sizeof(AVStream));
|
||||||
memcpy(st, ic->streams[i], sizeof(AVStream));
|
memcpy(st, ic->streams[i], sizeof(AVStream));
|
||||||
|
st->info = av_malloc(sizeof(*st->info));
|
||||||
|
memcpy(st->info, ic->streams[i]->info, sizeof(*st->info));
|
||||||
st->codec = avcodec_alloc_context();
|
st->codec = avcodec_alloc_context();
|
||||||
if (!st->codec) {
|
if (!st->codec) {
|
||||||
print_error(filename, AVERROR(ENOMEM));
|
print_error(filename, AVERROR(ENOMEM));
|
||||||
|
@ -3386,6 +3386,9 @@ static int rtp_new_av_stream(HTTPContext *c,
|
|||||||
if (!st)
|
if (!st)
|
||||||
goto fail;
|
goto fail;
|
||||||
ctx->nb_streams = 1;
|
ctx->nb_streams = 1;
|
||||||
|
ctx->streams = av_mallocz(sizeof(*ctx->streams) * ctx->nb_streams);
|
||||||
|
if (!ctx->streams)
|
||||||
|
goto fail;
|
||||||
ctx->streams[0] = st;
|
ctx->streams[0] = st;
|
||||||
|
|
||||||
if (!c->stream->feed ||
|
if (!c->stream->feed ||
|
||||||
@ -3766,11 +3769,7 @@ static void build_feed_streams(void)
|
|||||||
}
|
}
|
||||||
s->oformat = feed->fmt;
|
s->oformat = feed->fmt;
|
||||||
s->nb_streams = feed->nb_streams;
|
s->nb_streams = feed->nb_streams;
|
||||||
for(i=0;i<s->nb_streams;i++) {
|
s->streams = feed->streams;
|
||||||
AVStream *st;
|
|
||||||
st = feed->streams[i];
|
|
||||||
s->streams[i] = st;
|
|
||||||
}
|
|
||||||
av_set_parameters(s, NULL);
|
av_set_parameters(s, NULL);
|
||||||
if (av_write_header(s) < 0) {
|
if (av_write_header(s) < 0) {
|
||||||
http_log("Container doesn't supports the required parameters\n");
|
http_log("Container doesn't supports the required parameters\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user