On Sat, 24 Apr 2021 02:23:19 GMT, Alexander Matveev <almat...@openjdk.org> 
wrote:

> Remote Desktop will change default audio device when connecting or 
> disconnecting to it's own audio device. Also, when remote desktop is 
> disconnect, then remote desktop default audio device is removed and system 
> default device is not restored until user logs back to computer. So, after 
> remote desktop is disconnected, then system left without any default audio 
> devices.
> 
> To fix this we will unload DirectSound when audio device is gone and will 
> continue playback by throwing away audio data. Once we receive notification 
> that default audio device is back, we will load it and continue playback via 
> this device.
> 
> Loading device done in loop, since it is not always available right after 
> notification, but will be after very short period of time.
> 
> Tested by connecting/disconnecting remote desktop and switching between 
> remote and normal desktop. In second case audio will switch between remote or 
> speakers.
> 
> Since audio device is gone and not restored after disconnect, there will be 
> no audio on machine local speakers, until user logs back again.

As far as I can tell, the code changes look fine to me.

While testing this, the stream always keeps playing now. Sometimes I can't hear 
the audio, when it reconnects while playing the stream the first time. What I 
did was:

1. Run Ensemble
2. Select the "Audio Bar Chart" sample
3. Disconnect from remote desktop
4. Reconnect to remote desktop

The audio stream continues to play, as seen by the chart continuing to be 
updated, but I can't hear anything. If I select any other sample, and then 
select the Audio Bar Chart sample again, I can disconnect / reconnect and 
everything is fine -- I can hear the audio.

Btw, the same thing happens if I initially select the Advanced Media sample. If 
it is the first media sample that is run, then when I disconnect / reconnect, I 
can't hear anything, but the video keeps playing.

-------------

PR: https://git.openjdk.java.net/jfx/pull/479

Reply via email to