mpegts unexpected "Unable to seek back to the start"
|Reported by:||dista||Owned by:|
|Blocking:||Reproduced by developer:||no|
|Analyzed by developer:||no|
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() function.
here is what happend:
- it call avio_read_partial(), and get 1316 bytes
- it calculate score=7, dvhs=2(maybe some 0x47 in middle),fec_score=2
- because score(7) == margin(2+5), it need to go to next round
- 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.
- 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.