we need to break out, when no data is comming

This commit is contained in:
Jonathan Baecker 2019-05-27 11:13:05 +02:00
parent f52a045eef
commit 66f6a4242d
2 changed files with 14 additions and 7 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@
.DS_Store
__pycache__/
*-orig.*
*.json

View File

@ -978,19 +978,21 @@ def play_clips(buffer, GetSourceIter):
[
'ffmpeg', '-v', 'error', '-hide_banner', '-nostats'
] + src_cmd + list(ff_pre_settings),
stdout=PIPE,
stderr=PIPE,
stdin=PIPE
stdout=PIPE
)
for package in iter(decoder.stdout.readline, ''):
buffer.put(package)
for data in iter(decoder.stdout.readline, ''):
if not data:
break
buffer.put(data)
# TODO: make this nicer
except Exception:
print(traceback.format_exc())
finally:
buffer.put(None)
decoder.wait()
@ -1053,8 +1055,12 @@ def main():
# while True is bad, it needs a check to be able to exit
# with this loop we also end up never in the check_process function
while True:
line = buffer.get()
playout.stdin.write(line)
data = buffer.get()
if not data:
playout.terminate()
break
playout.stdin.write(data)
check_process(play_thread, playout)
finally: