hoene / libmysofa

Reader for AES SOFA files to get better HRTFs
Other
137 stars 73 forks source link

Fix uninitialized error code in mysofa_open_cached #197

Closed dsseng closed 1 year ago

dsseng commented 1 year ago

Fixes #196

Example of workaround currently in place (from pipewire):

    int ret = MYSOFA_OK; // <- if this is not previously set to MYSOFA_OK...

    pthread_mutex_lock(&libmysofa_mutex);
    impl->sofa = mysofa_open_cached(filename, SampleRate, &impl->n_samples, &ret);
    pthread_mutex_unlock(&libmysofa_mutex);

    if (ret != MYSOFA_OK) { // <- this will fail
        pw_log_error("Unable to load HRTF from %s: %d %m", filename, ret);
        errno = ENOENT;
        return NULL;
    }