Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FFmpegFrameGrabber] improved precision of seek to audio or video frames #1559

Merged
merged 4 commits into from
Jan 12, 2021

Conversation

anotherche
Copy link
Contributor

Precision of seek to audio or video frames is improved.
Done after the discussion on issue #975.
New code of setTimestamp now seeks to the frame just containing the desired timestamp if a specific frame type (video or audio) is requested explicitly (for example, if setVideoTimestamp or setVideoTimestamp is called).
The old code mostly returned frames next to the frames which should be actually returned (the frames containing the desired timestamps).
Additionally, the new code is ~2x faster when video or audio frames are explicitly requested.
A bug is fixed in getAudioFrameRate method as well.

@saudet
Copy link
Member

saudet commented Jan 10, 2021

Can you make all the new code active only for the case when frameTypesToSeek != null?

@anotherche
Copy link
Contributor Author

All the new seek code is enclosed now within two frameTypesToSeek != null blocks.

@anotherche
Copy link
Contributor Author

There are only two variables, ts0 and early_ts, which are declared and used outside. It is because I need different start time of the stream ts0, and different timestamp for avformat_seek_file method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants