WASPI - Fix stream start after destroy (#241)

* waspi - Fix stream start after destroy

* Fix stream name
This commit is contained in:
Andre-Philippe Paquet 2018-09-12 07:13:13 -04:00 committed by Pierre Krieger
parent 95caa88cfa
commit 1a3a8956e4
1 changed files with 17 additions and 11 deletions

View File

@ -449,21 +449,27 @@ impl EventLoop {
} }
}, },
Command::PlayStream(stream_id) => { Command::PlayStream(stream_id) => {
if let Some(v) = run_context.streams.get_mut(stream_id.0) { match run_context.streams.iter_mut().find(|v| v.id == stream_id) {
if !v.playing { None => continue,
let hresult = (*v.audio_client).Start(); Some(stream) => {
check_result(hresult).unwrap(); if !stream.playing {
v.playing = true; let hresult = (*stream.audio_client).Start();
check_result(hresult).unwrap();
stream.playing = true;
}
} }
} }
}, },
Command::PauseStream(stream_id) => { Command::PauseStream(stream_id) => {
if let Some(v) = run_context.streams.get_mut(stream_id.0) { match run_context.streams.iter_mut().find(|v| v.id == stream_id) {
if v.playing { None => continue,
let hresult = (*v.audio_client).Stop(); Some(stream) => {
check_result(hresult).unwrap(); if stream.playing {
v.playing = false; let hresult = (*stream.audio_client).Stop();
} check_result(hresult).unwrap();
stream.playing = false;
}
},
} }
}, },
} }