reduce the chances of a race condition in mplayer code

Not perfect, it may still happen.

https://anki.tenderapp.com/discussions/ankidesktop/39832-an-error-occurred-audio
This commit is contained in:
Damien Elmes 2020-03-23 19:15:32 +10:00
parent f889616ef1
commit 84eaf43525

View file

@ -393,8 +393,9 @@ class SimpleMplayerSlaveModePlayer(SimpleMplayerPlayer):
The trailing newline is automatically added.""" The trailing newline is automatically added."""
str_args = [str(x) for x in args] str_args = [str(x) for x in args]
self._process.stdin.write(" ".join(str_args).encode("utf8") + b"\n") if self._process:
self._process.stdin.flush() self._process.stdin.write(" ".join(str_args).encode("utf8") + b"\n")
self._process.stdin.flush()
def seek_relative(self, secs: int) -> None: def seek_relative(self, secs: int) -> None:
self.command("seek", secs, 0) self.command("seek", secs, 0)