Skip to content

audioutilsprivate: restore thread priority before ending on Windows

silvio lazzeretti requested to merge jusizela/gst-plugins-base:master into master

The priority of the thread that executes audioringbuffer_thread_func is incremented on Windows by the usage of the AvSetMmThreadCharacteristics API. This change has to be restored, as described on the documentation of the API (https://docs.microsoft.com/en-us/windows/win32/api/avrt/nf-avrt-avsetmmthreadcharacteristicsw#remarks), with a call to the AvRevertMmThreadCharacteristics. If this is not done, a handle will be leaked.

The leaked handle is a file handle to "\Device\MMCSS".

The issue can be reproduced by creating a simple app that does the following

loop {
    create a pipeline like this: "wasapisrc name=audiosrc ! fakesink"
    change state to playing
    change state to null
    destroy the pipeline
}
Edited by Seungha Yang

Merge request reports

Loading