Skip to content

Incorrect averager updates at start #390

@pavhofman

Description

@pavhofman

If target_level is larger than chunk, then playback will initially sleep for several chunk times (corresponding to the target_level time). Meanwhile the chunks queue up between Processing and Playback. When playback wakes up, it will correctly write several of the queued chunks to the device buffer without sleeping in between, because there is enough avail. However, every write the averager gets updated with the momentary delays which are not relevant at that moment yet. As a result the initial values in the averager distort the average, IMO. Here is a relevant trace log, grepped for the trace message:

2025-01-16 12:48:52.488090 TRACE [src/countertimer.rs:153] Averager: added value 2048, nb. 1
2025-01-16 12:48:52.488458 TRACE [src/countertimer.rs:153] Averager: added value 4096, nb. 2
2025-01-16 12:48:52.489908 TRACE [src/countertimer.rs:153] Averager: added value 6144, nb. 3
2025-01-16 12:48:52.529865 TRACE [src/countertimer.rs:153] Averager: added value 6144, nb. 4
2025-01-16 12:48:52.571786 TRACE [src/countertimer.rs:153] Averager: added value 6144, nb. 5

Perhaps values should start being added to the averager after the incoming queue is empty, i.e. after the initial "flood" of chunks is written somehow? Thanks for considering.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions