fixed seek operation when not at eof#1989
Closed
tikuma-lsuhsc wants to merge 1 commit intoPyAV-Org:mainfrom
Closed
fixed seek operation when not at eof#1989tikuma-lsuhsc wants to merge 1 commit intoPyAV-Org:mainfrom
tikuma-lsuhsc wants to merge 1 commit intoPyAV-Org:mainfrom
Conversation
Contributor
Author
|
Sorry, I pulled the gun a little too early. This still doesn't fix the problem. I'll investigate further. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a PR to resolve Issue #1987 ("Seek succeeds but any frame read is all zeros [revisited]") that I posted earlier.
The problem was that the said AVI format and configuration cannot have the codec buffer flushed if not at the end of the file. I studied FFmpeg's
ffplay.cfor their handling of during-playback seeks, and the only difference is that they do not flush the codec buffers.If we simply remove:
PyAV/av/container/input.pyx
Line 279 in 0b85c60
It fails the
test_decode_halfandtest_stream_seekbecause seeking after reaching the EOF does not reinstate the codecs. To get the codecs output of the EOF, we must callflush_buffers().To satisfy these conditions, this PR adds an
eofflag toInputContainerand adopted the EOF checking mechanism from ffplay: https://github.com/FFmpeg/FFmpeg/blob/673f28b6cb6e20f5a695a90d144a6158bdf987fe/fftools/ffplay.c#L3098P.S., I've also added
InputContainer.seek2()method which wrapsavformat_seek_file()to my fork while I was investigating this issue. I'd be happy to add it to this PR (or as another PR) if you find it a reasonable addition to the class.