]> git.sesse.net Git - ffmpeg/commitdiff
ffmpeg_filter: check encoder before using it to set frame size.
authorNicolas George <george@nsup.org>
Sun, 25 Oct 2015 18:48:10 +0000 (19:48 +0100)
committerNicolas George <george@nsup.org>
Fri, 30 Oct 2015 09:55:10 +0000 (10:55 +0100)
Fix a segfault when no encoder is found for a default codec
with a complex filter graph.

ffmpeg_filter.c

index 10b2f5f72208f8c32d942f45561849c55eb2e791..9142a97e8f5ce459c82dba7510016303cd29804a 100644 (file)
@@ -1046,6 +1046,13 @@ int configure_filtergraph(FilterGraph *fg)
 
     for (i = 0; i < fg->nb_outputs; i++) {
         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 &&
             ost->enc->type == AVMEDIA_TYPE_AUDIO &&
             !(ost->enc->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE))