[FFmpeg-trac] #2282(avformat:open): Failed seeks lead to undefined behavior

FFmpeg trac at avcodec.org
Sat Mar 16 11:16:22 CET 2013


#2282: Failed seeks lead to undefined behavior
------------------------------------+------------------------------------
             Reporter:  gjdfgh      |                    Owner:
                 Type:  defect      |                   Status:  open
             Priority:  normal      |                Component:  avformat
              Version:  git-master  |               Resolution:
             Keywords:  flac        |               Blocked By:
             Blocking:              |  Reproduced by developer:  1
Analyzed by developer:  0           |
------------------------------------+------------------------------------

Comment (by gjdfgh):

 MiNi said himself that the state after seeking failure is undefined. That
 was a month ago.

 By the way, I suggest the following semantics for seeking failure:
 - If the seek is to a position before the start of a file, do not return
 failure, and seek to the start of the file. The new (defined) state is
 that the demuxer returns packets from begin of the file normally. Note
 that seeks can be quite imprecise, and the new position you get is not
 always the position you requested, so this won't be an API change.
 - If the seek is to a position past the end of the file, do not return
 failure. Instead, behave as if the end of the file has been reached. I
 think this simply means returning no packets for the next av_read_frame().
 - If the seek actually fails (seek index broken, I/O errors), return
 failure, but do not change the state. Continue to demux from the old
 position. This means the application won't resets its decoders and can
 continue to play the file normally.
 - This means the application has to reset its decoders if seeking returns
 success, but shouldn't do it if seeking fails.

 Alternatively, return exact error codes that identify all these cases. But
 only if it actually works with all demuxers.

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/2282#comment:12>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list