diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 97a22251aa..cc2addcc9e 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -2353,7 +2353,8 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet) int types = 0; for (i = 0; i < ts->stream->nb_streams; i++) { AVStream *st = ts->stream->streams[i]; - types |= 1<codecpar->codec_type; + if (st->codecpar->codec_type >= 0) + types |= 1<codecpar->codec_type; } if ((types & (1< 100000) { av_log(ts->stream, AV_LOG_DEBUG, "All programs have pmt, headers found\n");