Animation/Rendering is delayed when the window is not focused

Hi everyone,

I’m facing a weird issue and I need your help about it. I have a fire animation, coupled with two particles systems and a sound cue for create a nice shoot effect.

However, my issue is that when my game window is not focused (I have two instance running on the same computer), all the rendering is delay by a couple of ms which make the sound not synchronized properly with the rendering part.

I’ve made a short clip you can find it bellow. The first two shots are perfectly synchronized cause the window has the focus. All the other are not synchronized cause my window lost the focus. The rendering delay is very small but we can feel it because the sound is not delayed at all.

Here is the video: https://www.youtube.com/watch?v=QhRM9qGKWtc&feature=youtu.be

Previous video: https://www.youtube.com/watch?v=4LMEjfcx9tw&feature=youtu.be

Is this a normal behavior or is this a bug ?
Thanks for reading. Best regards.