Skip to content

Use thread-priority crate to set audio thread priority #158

Description

@NeuralModder

The thread-priority crate can be used to tell the OS' thread scheduler how to treat a thread. Adjusting the priority may or may not alleviate some of the crackling issues we've been having reported to us in Veloren.

I believe the relevant thread is the one spawned in crates/kira/src/backend/cpal/desktop/stream_manager.rs, so in this case we would replace the std::thread::spawn call with a thread_priority::spawn one, which takes an extra thread_priority::ThreadPriority argument.

As for what the ThreadPriority value should be, it could just be a higher than normal CrossPlatform value, or some kind of Deadline one.

See this commit for a simple example of how each value can be used in Veloren.

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