Skip to content
This repository has been archived by the owner on Dec 21, 2021. It is now read-only.

Commit

Permalink
fix ffmpeg pipe file locking issue on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
irmen committed Jul 26, 2018
1 parent cf9f2c3 commit cde723c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bouldercaves/synthplayer/streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import wave
import os
import io
import time
import logging
from collections import namedtuple
from typing import Callable, Generator, BinaryIO, Optional, Union, Iterable, Tuple, List, Dict
Expand Down Expand Up @@ -206,7 +207,10 @@ def read(self, size):
def close(self) -> None:
log.debug("closing stream %s", self.name)
if self.stream:
self.stream.read(100000) # read possible surplus data to clean the pipe
self.stream.close()
if os.name=="nt":
time.sleep(0.02) # windows sometimes keeps the file locked for a bit

@property
def closed(self) -> bool:
Expand Down

0 comments on commit cde723c

Please sign in to comment.