[FFmpeg-trac] #8686(avformat:new): mpegts unexpected "Unable to seek back to the start"

FFmpeg trac at avcodec.org
Wed May 27 10:26:52 EEST 2020

#8686: mpegts unexpected "Unable to seek back to the start"
             Reporter:  dista     |                     Type:  defect
               Status:  new       |                 Priority:  normal
            Component:  avformat  |                  Version:  git-master
             Keywords:            |               Blocked By:
             Blocking:            |  Reproduced by developer:  0
Analyzed by developer:  0         |
 Input is mpegts over srt stream,  sometimes it logs "Unable to seek back
 to the start" in the beginning.
 After debugging, I think it is caused by mpegts.c's get_packet_size()

 here is what happend:
 1. it call avio_read_partial(), and get 1316 bytes
 2. it calculate score=7, dvhs=2(maybe some 0x47 in middle),fec_score=2
 3. because score(7) == margin(2+5), it need to go to next round
 4. it call avio_read_partial(), but in that function "len=s->buf_end -
 s->buf_ptr" just equals 0, so it run "s->buf_end = s->buf_ptr =
 s->buffer", after that the data in buffer is dropped.
 5. after that, it will call seek_back(), and because we dropped data in
 buffer, we can not seek back.

 I can remove "s->buf_end = s->buf_ptr = s->buffer" in avio_read_partial()
 to fix this problem, but it may break other things.

Ticket URL: <https://trac.ffmpeg.org/ticket/8686>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list