Opened 6 months ago

Last modified 4 months ago

#9949 open defect

When the RTSP plays a TS stream, after the seek operation is performed, the data cached in the PES is not cleared. As a result, the data before the seek operation can be read after the seek operation.

Reported by: wujian Owned by: tanwei123
Priority: normal Component: avformat
Version: 4.4.3 Keywords: RTSP SEEK
Cc: wujian Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by wujian)

Summary of the bug:
add Log print location:
int ff_read_packet(AVFormatContext *s, AVPacket *pkt):

ret = s->iformat->read_packet(s, pkt);
if (ret < 0) {


av_log(NULL, AV_LOG_FATAL, "pkt->pts = %lld\n", pkt->pts);

static int read_thread(void *arg):

av_log(NULL, AV_LOG_WARNING, "============START============\n");
ret = avformat_seek_file(is->ic, -1, seek_min, seek_target, seek_max, is->seek_flags);
av_log(NULL, AV_LOG_WARNING, "============END==============\n");

How to reproduce:
# ffplay rtsp://

Press the right arrow key to seek once.

pkt->pts = 1620000
pkt->pts = 16166409
pkt->pts = 1618560
pkt->pts = 16162509
pkt->pts = 1627500 --The new round of seek has residual data from the previous round.
pkt->pts = 2423040
pkt->pts = 2424960
pkt->pts = 2426250

Change History (7)

comment:1 by wujian, 6 months ago

Status: newopen

handle_packets determines that the seek operation is performed based on the location to clear data in the pes.
In the RTSP scenario, however, this process is not performed. Instead, the process is directly sent to handle_packet through avpriv_mpegts_parse_packet. Therefore, after seek, residual pes data exists.

comment:2 by wujian, 6 months ago

Description: modified (diff)

comment:3 by wujian, 6 months ago

Description: modified (diff)

comment:4 by wujian, 6 months ago

Version: unspecified4.4.1

comment:5 by wujian, 6 months ago

Owner: set to tanwei123

in reply to:  description comment:6 by tanwei123, 5 months ago

Last edited 5 months ago by tanwei123 (previous) (diff)
Note: See TracTickets for help on using tickets.