On Fri, 17 Apr 2020, Peter Ross wrote:
is->ic is assigned by read_thread, but this may not have happened yet when stream_open fails.
I think the idea was that audio_stream/video_stream/subtitle_stream should be -1 if no stream is opened. But that is not true, because it is only initialized to -1 in read_thread.
So I prefer we move the initialization to -1 from read_thread to stream_open, and we can also init last_*_stream variables there as well.
Thanks, Marton
--- fftools/ffplay.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fftools/ffplay.c b/fftools/ffplay.c index 1beec54293..5530d2a396 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -1210,7 +1210,7 @@ static void stream_component_close(VideoState *is, int stream_index) AVFormatContext *ic = is->ic; AVCodecParameters *codecpar; - if (stream_index < 0 || stream_index >= ic->nb_streams) + if (!ic || stream_index < 0 || stream_index >= ic->nb_streams) return; codecpar = ic->streams[stream_index]->codecpar; -- 2.20.1 -- Peter (A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".