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

Membrane timers are running late #670

Closed
varsill opened this issue Nov 6, 2023 · 1 comment
Closed

Membrane timers are running late #670

varsill opened this issue Nov 6, 2023 · 1 comment
Assignees

Comments

@varsill
Copy link
Contributor

varsill commented Nov 6, 2023

I have implemented an element that acts similarly to the membrane_realtimer:

  • the elements starts a timer on handle_playing with :no_interval
  • on handle_buffer timer's interval is calculated and set with the use of :timer_interval action
  • on handle_tick, the buffer is output, and the timer's interval is set to :no_interval

I have noticed, that the timer starts running late (with latency in respect to walltime equal to ~100ms) and the compensation mechanism does not seem to take that under consideration, as the latency persists over time.
I have also experimented with using :start_timer and :stop_timer (with no luck).
It's possible that the problem would occur also with the membrane_realtimer, but I haven't checked it.
After rewriting the element so that it directly uses Process.send_after (with a similar compensation mechanism as the one introduced in membrane_core), the problem has been solved.

@mat-hek mat-hek added this to Smackore Nov 6, 2023
@mat-hek mat-hek moved this to Backlog in Smackore Nov 6, 2023
@varsill varsill self-assigned this Nov 24, 2023
@varsill varsill moved this from Backlog to In Progress in Smackore Nov 24, 2023
@varsill
Copy link
Contributor Author

varsill commented Nov 27, 2023

It turns out that the problem was with the handle_tick returning timer_interval: :no_interval action and then demand: ... action. The demand action was then calling handle_buffer synchronously (since there were some buffers already waiting in the input queue) and that handle_buffer was overwriting timer_interval with a particular interval. When such a chain of actions was returned by the CallbackHandler.exec_and_handle_callback in the TimerController, the Timer.tick was called unaware of the fact, that there was :no_interval in between of the actions.
It should be solved with this PR: #685

@varsill varsill moved this from In Progress to Done in Smackore Nov 29, 2023
@varsill varsill closed this as completed Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

1 participant