C has pointers, Python does not. Python has garbage collection,
C does not. The function pa_channel_map_init_auto returns, on
success, a pointer to the same pa_channel_map object that was
passed to the function as a parameter.
Apparently this confuses Pyton/CFFI, which can sometimes garbage
collect that old (now properly initialized) object, resulting in
pa_stream_new getting a pa_channel_map object that is not properly
initialized, and throwing an error.
Using separate variable names for the pa_channel_map object passed
to pa_channel_map_init_auto and the one returned seems to avoid
that issue, even though they are the same structure.
C has pointers, Python does not. Python has garbage collection, C does not. The function pa_channel_map_init_auto returns, on success, a pointer to the same pa_channel_map object that was passed to the function as a parameter.
Apparently this confuses Pyton/CFFI, which can sometimes garbage collect that old (now properly initialized) object, resulting in pa_stream_new getting a pa_channel_map object that is not properly initialized, and throwing an error.
Using separate variable names for the pa_channel_map object passed to pa_channel_map_init_auto and the one returned seems to avoid that issue, even though they are the same structure.
Signed-off-by: Rik van Riel riel@surriel.com