Skip to content

a seek in a playback is not taken for drift - #2248

Open
nickakt wants to merge 1 commit into
sipwise:masterfrom
nickakt:fix/playback-seek-drift
Open

nickakt wants to merge 1 commit into
sipwise:masterfrom
nickakt:fix/playback-seek-drift

Conversation

@nickakt

@nickakt nickakt commented Nov 17, 2026

Copy link
Copy Markdown

The reader of a playback adds to each packet's duration the difference between its PTS and the PTS the previous packet ended at, to make up for rounding. next_pts is never reset, so after a seek that difference is the whole jump: the packet after the seek gets a duration wrong by it, and the adjustment of every later packet carries the error on.

A new player started at a start-pos sends its first packet and is then silent for about as long as its start position. After the seek back to the start of a repeated file the reader runs in bursts; an audio player mixes what it is given as it comes, so from the second time round only part of each frame is mixed with the other sources.

A reader that seeks now forgets the PTS it expected, so the packet after the seek is taken at its own duration. auto-daemon-tests-inject.pl plays a file from a start position and repeats one into an injection, and checks what the receiver gets.

The reader of a playback adds to each packet's duration the difference
between its PTS and the PTS the previous packet ended at, to make up for
rounding. next_pts is never reset, so after a seek that difference is the
whole jump: the packet after the seek gets a duration wrong by it, and the
adjustment of every later packet carries the error on.

A new player started at a start-pos sends its first packet and is then
silent for about as long as its start position. After the seek back to
the start of a repeated file the reader runs in bursts; an audio player
mixes what it is given as it comes, so from the second time round only
part of each frame is mixed with the other sources.

A reader that seeks now forgets the PTS it expected, so the packet after
the seek is taken at its own duration. auto-daemon-tests-inject.pl plays
a file from a start position and repeats one into an injection, and
checks what the receiver gets.
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.

1 participant