Conversation
Following the discussion in mozilla/cubeb-pulse-rs#54 and elsewhere, document the interaction between cubeb_stream_init parameters and cubeb's intended device switching policy.
| CUBEB_STREAM_PREF_DISABLE_DEVICE_SWITCHING on @ref | ||
| cubeb_stream_params.prefs. | ||
|
|
||
| @note If @p output_device or @p input_device is a valid non-NULL @ref |
There was a problem hiding this comment.
Ah, it seems we do support output_device selection, but I never tested it.
If the stream needs to be reinitialize to default output device when the specified output_device is no longer available, then we do need to listen kAudioDevicePropertyDeviceIsAlive for output device like what we do for the input side.
On the other hand, if the stream using the specified output_device doesn't need to be reinitialized when the specified output_device is no longer available, it seems audiounit-rust meets the spec here.
Anyway, my problem is: what is the intended behavior when the specified output_device or input_device is unplugged while they are being used by some active streams?
There was a problem hiding this comment.
Anyway, my problem is: what is the intended behavior when the specified
output_deviceorinput_deviceis unplugged while they are being used by some active streams?
This is in flux at the minute. The current behaviour we want in gecko:
- If a output device has been opened with an explicit device or a default device, and is no longer available, switch to the new default device
- If an input device has been opened, it's always with an explicit ID. It it is not available anymore, turn this stream into a output-only stream
When @achronop finishes setSinkId, we'll reevaluate this (or as part of his effort).
I had a design a long time ago that would allow enough flexibility to implement whatever we need: https://github.com/kinetiknz/cubeb/issues/167. I think it still works
There was a problem hiding this comment.
I think in general the behaviour @kinetiknz documents here is simpler and works just as well.
There was a problem hiding this comment.
If a output device has been opened with an explicit device or a default device, and is no longer available, switch to the new default device
If I am not missing something the output device is always non-explicit at the moment in Gecko so @kinetiknz 's document covers our needs. This will be changed when sinkId is in place but we can re-evaluate then. I have already some thoughts about it.
There was a problem hiding this comment.
I think my question is here:
If @p output_device or @p input_device is a valid non-NULL @ref cubeb_devid, cubeb will only ever use the specified device and never follow device changes automatically
We do change the output device if the specified output device is no longer available but the document states: cubeb never follow device changes automatically.
I am ok to reword these once setSinkId is done. Just want to make sure this issue is one someone's radar.
|
|
||
| @note If @p output_device or @p input_device is a valid non-NULL @ref | ||
| cubeb_devid, cubeb will only ever use the specified device and never | ||
| follow device changes automatically. In this case, the application may |
There was a problem hiding this comment.
audiounit-rust backend will automatically change the input device when the specified input_device is unplugged (cannot be used anymore). So this behavior need to be changed? Should we just return error instead when the specified input_device is gone?
|
In addition to the above, we need to document what happens when an explicit-defined device is not available anymore. In rust PA this situation results in a state change to |
ChunMinChang
left a comment
There was a problem hiding this comment.
The current behavior is slightly different from the updated descriptions. I am ok to reword these after setSinkId is done or update our code to meet the descriptions.
| CUBEB_STREAM_PREF_DISABLE_DEVICE_SWITCHING on @ref | ||
| cubeb_stream_params.prefs. | ||
|
|
||
| @note If @p output_device or @p input_device is a valid non-NULL @ref |
There was a problem hiding this comment.
I think my question is here:
If @p output_device or @p input_device is a valid non-NULL @ref cubeb_devid, cubeb will only ever use the specified device and never follow device changes automatically
We do change the output device if the specified output device is no longer available but the document states: cubeb never follow device changes automatically.
I am ok to reword these once setSinkId is done. Just want to make sure this issue is one someone's radar.
|
Any thoughts regarding the state change (to error) when the explicit device goes unplug? PA exhibits this behavior, at the moment, and I would like to change it if it is something that we don't want. |
Following the discussion in mozilla/cubeb-pulse-rs#54
and elsewhere, document the interaction between cubeb_stream_init parameters
and cubeb's intended device switching policy.