@@ -2536,6 +2536,7 @@ struct CoreStreamData<'ctx> {
2536
2536
// Info of the I/O devices.
2537
2537
input_device : device_info ,
2538
2538
output_device : device_info ,
2539
+ input_processing_params : InputProcessingParams ,
2539
2540
input_buffer_manager : Option < BufferManager > ,
2540
2541
// Listeners indicating what system events are monitored.
2541
2542
default_input_listener : Option < device_property_listener > ,
@@ -2574,6 +2575,7 @@ impl<'ctx> Default for CoreStreamData<'ctx> {
2574
2575
output_unit : ptr:: null_mut ( ) ,
2575
2576
input_device : device_info:: default ( ) ,
2576
2577
output_device : device_info:: default ( ) ,
2578
+ input_processing_params : InputProcessingParams :: NONE ,
2577
2579
input_buffer_manager : None ,
2578
2580
default_input_listener : None ,
2579
2581
default_output_listener : None ,
@@ -2618,6 +2620,7 @@ impl<'ctx> CoreStreamData<'ctx> {
2618
2620
output_unit : ptr:: null_mut ( ) ,
2619
2621
input_device : in_dev,
2620
2622
output_device : out_dev,
2623
+ input_processing_params : InputProcessingParams :: NONE ,
2621
2624
input_buffer_manager : None ,
2622
2625
default_input_listener : None ,
2623
2626
default_output_listener : None ,
@@ -3439,12 +3442,14 @@ impl<'ctx> CoreStreamData<'ctx> {
3439
3442
) ;
3440
3443
}
3441
3444
3442
- // Always initiate to not use input processing.
3445
+ // Always try to remember the applied input processing params. If they cannot
3446
+ // be applied in the new device pair, we notify the client of an error and it
3447
+ // will have to open a new stream.
3443
3448
if let Err ( r) =
3444
- set_input_processing_params ( self . input_unit , InputProcessingParams :: NONE )
3449
+ set_input_processing_params ( self . input_unit , self . input_processing_params )
3445
3450
{
3446
3451
cubeb_log ! (
3447
- "({:p}) Failed to enable bypass of voiceprocessing. Error: {}" ,
3452
+ "({:p}) Failed to set params of voiceprocessing. Error: {}" ,
3448
3453
self . stm_ptr,
3449
3454
r
3450
3455
) ;
@@ -4323,6 +4328,7 @@ impl<'ctx> StreamOps for AudioUnitStream<'ctx> {
4323
4328
self as * const AudioUnitStream ,
4324
4329
params
4325
4330
) ;
4331
+ self . core_stream_data . input_processing_params = params;
4326
4332
Ok ( ( ) )
4327
4333
}
4328
4334
#[ cfg( target_os = "ios" ) ]
0 commit comments