Commit e8e7eb15 authored by Nicolas George's avatar Nicolas George

ffmpeg_filter: check encoder before using it to set frame size.

Fix a segfault when no encoder is found for a default codec
with a complex filter graph.
parent b38e685c
...@@ -1046,6 +1046,13 @@ int configure_filtergraph(FilterGraph *fg) ...@@ -1046,6 +1046,13 @@ int configure_filtergraph(FilterGraph *fg)
for (i = 0; i < fg->nb_outputs; i++) { for (i = 0; i < fg->nb_outputs; i++) {
OutputStream *ost = fg->outputs[i]->ost; OutputStream *ost = fg->outputs[i]->ost;
if (!ost->enc) {
/* identical to the same check in ffmpeg.c, needed because
complex filter graphs are initialized earlier */
av_log(NULL, AV_LOG_ERROR, "Encoder (codec %s) not found for output stream #%d:%d\n",
avcodec_get_name(ost->st->codec->codec_id), ost->file_index, ost->index);
return AVERROR(EINVAL);
}
if (ost && if (ost &&
ost->enc->type == AVMEDIA_TYPE_AUDIO && ost->enc->type == AVMEDIA_TYPE_AUDIO &&
!(ost->enc->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE)) !(ost->enc->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment