Receive: Config of decode sample rate/channels (#265)
* Receive: Config of decode sample rate/channels This PR allows for dynamic configuration of the output sample rate and channel count of received Opus audio. Users who rely on supported formats should no longer need to manually resample & downmix audio decoded from SSRCs in a call. Opus exposes tuples of (Mono, Stereo) x (8, 12, 16, 24, 48)kHz. Changing this at runtime (mid-call) may cause some audio glitches, as decoder state must be reconstructed from scratch for all affected SSRCs. * Fix doc typo, consistent naming with MixMode.
This commit is contained in:
@@ -66,7 +66,13 @@ impl UdpRx {
|
||||
*interconnect = i;
|
||||
},
|
||||
Ok(UdpRxMessage::SetConfig(c)) => {
|
||||
let old_coder = (self.config.decode_channels, self.config.decode_sample_rate);
|
||||
let new_coder = (c.decode_channels, c.decode_sample_rate);
|
||||
self.config = c;
|
||||
|
||||
if old_coder != new_coder {
|
||||
self.decoder_map.values_mut().for_each(|v| v.reconfigure_decoder(&self.config));
|
||||
}
|
||||
},
|
||||
Err(flume::RecvError::Disconnected) => break,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user