obs-studio icon indicating copy to clipboard operation
obs-studio copied to clipboard

frontend: Increase media source playback slider update rate

Open Warchamp7 opened this issue 7 months ago • 0 comments

Description

Increases the update rate of the Media source context bar playback slider to 60~ times per second instead of 1.

OBS v31.0.3

https://github.com/user-attachments/assets/92b53819-0468-431c-863b-01a34116ccc6

This PR

https://github.com/user-attachments/assets/79b8e030-6272-4da5-926d-871eb1d5974a

Motivation and Context

Looks smoother and feels more responsive, especially with files that have shorter playback durations.

I experimented with other update rates. 250ms (4/second) felt acceptable for both long and short duration videos. Anything from 200ms(8/second) and faster felt too choppy visually for shorter duration videos up until around 20ms(50/second) at which point, it seemed reasonable to do 16ms to get 60 fps-ish.

This also indirectly improves the accuracy of the elapsed timer as it could be off by up to 999ms after seeking depending on where in the update tick the timer was prior to clicking. Though that could also be fixed via other, more direct means.

OBS v31.0.3

https://github.com/user-attachments/assets/355f1a04-c2ae-4b1b-a99e-63d3f3d9d75d

This PR

https://github.com/user-attachments/assets/4e08ec6c-f29c-40d7-b180-dc89b9595c89

There are slightly more efficient ways to accomplish this by simply caching the time at which playback started from and calculating time elapsed since then but I don't have enough knowledge of the performance implications of calling obs_source_media_get_time and obs_source_media_get_duration to know if it's actually worth the effort.

How Has This Been Tested?

Eyeballs

Types of changes

  • Tweak (non-breaking change to improve existing functionality)

Checklist:

  • [x] My code has been run through clang-format.
  • [x] I have read the contributing document.
  • [x] My code is not on the master branch.
  • [x] The code has been tested.
  • [x] All commit messages are properly formatted and commits squashed where appropriate.
  • [x] I have included updates to all appropriate documentation.

Warchamp7 avatar May 21 '25 23:05 Warchamp7