Skip to content

Track position not respecting time scale DSP #94

Description

@SKProCH

Since lavaplayer now maintained by lavalink team I thought that reopen this issue on this repo is a good idea.

Problem description

Lavalink is a standalone audio sending node based on Lavaplayer and JDA-Audio. Bot developers can play audio using distributed lavalink nodes across different programming languages and bot frameworks.

Lavalink reports a state for each player about every five seconds, containing the current UNIX timestamp when the player update was created and a relative track position. Based on this information, the track's position can be computed. As lavaplayer now has a timescale filter, it is possible to alter the track speed and rate. The position of the track reported by lavaplayer does not respect the actual speed of the track. Calculating the position of the track on the client-side would be possible but would come with a higher error rate because of network latencies, filter jitter (the client does not know the exact time when the filter becomes active), ... (There are some times where the client has to interpolate the position of the track, which corresponds to the time difference between the current host machine time and the time of the last update, which error rate should be ignorable [e.g., errors because of different clock times due to NTP synchronization errors]).

The client state is generated in Lavalink, which you can see at the following: https://github.com/freyacodes/Lavalink/blob/85a54966218094bc06a4f1506003c55523462b04/LavalinkServer/src/main/java/lavalink/server/player/Player.java#L131
There you can see a call to lavaplayer, which requests the current track position.

When using the timescale filter, lavaplayer reports a wrong track position (it uses the position as if the timescale filter has not been applied).

Proposal

I would propose that the code for calculating/tracking the track position should be fitted to report a correct track position.

Additional info

All additional info can be found here: sedmelluq/lavaplayer#667

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions