It's not valid to call avio_close() on context that has not been open with avio_open(). This fixes use of custom IO. (io_open / io_close2 callbacks) Note that by default io_close2 is set to io_close2_default() which calls avio_close(), so default case will work the same as before.
Unified · Split
| @@ -383,11 +383,10 @@ void avformat_close_input(AVFormatContext **ps) · 382 unmodified lines | |||
| 383 | if (ffifmt(s->iformat)->read_close) | 383 | if (ffifmt(s->iformat)->read_close) |
| 384 | ffifmt(s->iformat)->read_close(s); | 384 | ffifmt(s->iformat)->read_close(s); |
| 385 | 385 | ||
| 386 | ff_format_io_close(s, &pb); | ||
| 386 | avformat_free_context(s); | 387 | avformat_free_context(s); |
| 387 | 388 | ||
| 388 | *ps = NULL; | 389 | *ps = NULL; |
| 389 | |||
| 390 | avio_close(pb); | ||
| 391 | } | 390 | } |
| 392 | 391 | ||
| 393 | static void force_codec_ids(AVFormatContext *s, AVStream *st) | 392 | static void force_codec_ids(AVFormatContext *s, AVStream *st) |