<div dir="ltr"><div><div><div><div>Hi,<br><br></div>I have a code when packets is cached using a separately working thread. It reads a number of packets in advance and gives them to decoder when it needed them. I made sure that seek operations and av_read_frame are mutually exclusive and basically everything worked. For testing purposes I also sometimes use another object that always reads packet in the main decoding thread (sequential). <br><br>But once threading failed when I needed seeking to the end of an mp3 file (avformat_seek_file with a very big requested timestamp). Sequential one always worked (allowed reading at least one packet after this operation) while the threading one sometimes allowed, sometimes not. Incidentally, a trick with calling avio_flush after the seek operation helped this particular problem (the threading one now always allows reading at least one packet after the big seek), but I started notice visual artifacts with some videos, so looks like avio_flush is not a correct call after all. <br><br></div>So, is there universal (with any demuxer) approach with making packet reader working in a thread while keeping the the stream/seek state in correct state? <br><br></div>Thanks in advance<br><br></div>Max<br></div>