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

Performance: Frames are not displayed at a desired speed #1

Closed
Ayase-252 opened this issue Apr 20, 2014 · 1 comment
Closed

Performance: Frames are not displayed at a desired speed #1

Ayase-252 opened this issue Apr 20, 2014 · 1 comment

Comments

@Ayase-252
Copy link
Owner

Description:
Frames are not displayed at a designed speed (For example, the original video is played at frame rate of 30FPS. But the converted ASCII art video is played at a different frame rate (maybe 32FPS). It caused a issue that the background music is not synchronized with the video.

@Ayase-252 Ayase-252 added bug and removed help wanted labels Apr 20, 2014
@Ayase-252 Ayase-252 changed the title 播放时帧与歌曲不同步 Frames are not displayed at a certain speed Apr 21, 2014
@Ayase-252
Copy link
Owner Author

Possible Reason:
When the timer (System.Timers.Timer) is set on a very tiny interval, it would not trigger elapsed event as accurately as I set. The execution of event handler also cost time. Hence, the interval calculated by simple division is inaccurate.

Solution:
I.
I try to set another timer on the interval of 100ms to adjust the frame rate. According to the difference between the average frame rate from the last adjustment to this check and the desired frame rate, I can bring forward or delay video by several frames. It may reduce the deviation.

II.
Executing a test by refresh a frame 100 times, and calculating the average time of refreshing, then solve the correct interval for main frame control time by mathematics automatically.

Solutions seem to be working.

@Ayase-252 Ayase-252 changed the title Frames are not displayed at a certain speed Frames are not displayed at a desired speed Apr 21, 2014
@Ayase-252 Ayase-252 changed the title Frames are not displayed at a desired speed Performance: Frames are not displayed at a desired speed Apr 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant