-
Notifications
You must be signed in to change notification settings - Fork 137
Remove cubeb_stream_get_current_device
#822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
This is very edge-casey. The only caller that I know of is in Firefox, and this is used to pan the audio to the right speaker if using the buildint speakers, on macbook pre-2016, to avoid feedback into the microphone. We might be able to remove everything at this point and we'll deal with it using enumaration API. |
|
The only other caller I know is RPCS3 where it is used to get the name of the default device that supports given stream params. If we want to delete it we should also accommodate for their usecase.
Is this workaround even functional given that this function is not supported by the current macOS backend? |
We can send a patch there (same fix, enumerate, find the default device, get the name).
No it hasn't worked for a long time, and it doesn't matter anymore (Firefox generally uses macOS's system noise suppression and echo cancellation, and Apple have fixed their hardware). We simply didn't remove the code. We can probably just remove everything then. |
They are doing that in the GetDevice function, not sure why they implemented the stream fallback. |
Signed-off-by: Marcin Serwin <marcin@serwin.dev>
6f86b69 to
2b369ae
Compare
cubeb_stream_get_current_devicecubeb_stream_get_current_device
|
RPCS3 devs are fine with just using enumeration so I guess we can proceed with removal. |
Following mozilla/cubeb#822 Signed-off-by: Marcin Serwin <marcin@serwin.dev>
|
@padenot Any updates regarding this? |
While looking into
cubeb_stream_get_current_deviceI've noticed some issues:src/cubeb_audiounit.cppreturns non-native endian integers. This could crashcubeb-rssince it asserts that the returned value is a valid UTF-8 string.src/cubeb_audiounit.cpp, the function does not free resources in case of errors, e.g., if the call toaudiounit_get_default_device_namefails then*deviceis not freed causing leak.device_destroyfunction incubeb-pulse-rsdoes not free the allocated strings, it only frees thecubeb_deviceso it always causes memory leaks.Instead of fixing this issues one by one I figured that it may be beneficial to simplify the API usage and avoid the leaks by not allocating memory in the first place.
audiounit_stream_get_current_deviceis removed, it's not implemented in the Rust version so I assume it's not super necessary. Strings and thecubeb_deviceare returned directly instead of being allocated on the heap. This causes the destroying function to become unnecessary and it is removed in the last commit.This is an API and ABI break but code changes for clients should be minor, comparable to the ones present in
test/test_devices.cpp.I'm a bit unsure about the removal of the destroying function. It would be a noop in the current backends, however, in the future it may be actually necessary to allocate something for a backend. What do you think?