diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 37bb5d8d82..67e94fb39e 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1862,8 +1862,10 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet) return 0; pos = avio_tell(ts->stream->pb); - av_assert0(pos >= TS_PACKET_SIZE); - ts->pos47_full = pos - TS_PACKET_SIZE; + if (pos >= 0) { + av_assert0(pos >= TS_PACKET_SIZE); + ts->pos47_full = pos - TS_PACKET_SIZE; + } if (tss->type == MPEGTS_SECTION) { if (is_start) {