applehttp: Only check the discard flags if v->ctx actually is initialized

This code could be executed if the demuxer reads more than one
segment before returning from av_open_input_stream.

Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
Martin Storsjö 2011-04-12 00:19:56 +03:00
parent 4c362a5212
commit a92a7ddc25

View File

@ -309,11 +309,14 @@ reload:
c->end_of_segment = 1; c->end_of_segment = 1;
c->cur_seq_no = v->cur_seq_no; c->cur_seq_no = v->cur_seq_no;
if (v->ctx) {
v->needed = 0; v->needed = 0;
for (i = v->stream_offset; i < v->stream_offset + v->ctx->nb_streams; i++) { for (i = v->stream_offset; i < v->stream_offset + v->ctx->nb_streams;
i++) {
if (v->parent->streams[i]->discard < AVDISCARD_ALL) if (v->parent->streams[i]->discard < AVDISCARD_ALL)
v->needed = 1; v->needed = 1;
} }
}
if (!v->needed) { if (!v->needed) {
av_log(v->parent, AV_LOG_INFO, "No longer receiving variant %d\n", av_log(v->parent, AV_LOG_INFO, "No longer receiving variant %d\n",
v->index); v->index);