fix: immediately re-arm the DMA pipeline when stopping due to nodata
Host hasn't asked us to stop streaming with altSetting, but has stopped sending data. It may start again at any time without a new altSetting command to re-arm the DMA. So we should re-arm immediately. Fixes a bug where in some cases audio is streaming from host, but not playing out.
This commit is contained in:
1 parent
245c45c682
commit
bb7f701f20
1 file changed
+7
-3
@@ -965,9 +965,13 @@ fn main() -> ! {
|
||||
|
||||
// TODO: we should handle unexpected NODATA differently from 'Stopping'
|
||||
if NODATA_FLAG.swap(false, Ordering::AcqRel) {
|
||||
match uac2.handler().state.load(Ordering::Acquire) {
|
||||
AudioState::Stopping => uac2.handler().transition(AudioState::Stopped),
|
||||
_ => uac2.handler().transition(AudioState::Stopped),
|
||||
let audio = uac2.handler();
|
||||
audio.transition(AudioState::Stopped);
|
||||
// The host is still streaming (alt setting 1) so no alt setting change will
|
||||
// re-arm us; re-arm now so the DMA channel is re-initialised before more data
|
||||
// arrives.
|
||||
if audio.alt_setting == 1 {
|
||||
audio.transition(AudioState::Armed);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user