Merge of nested IF-IF cases - S-W (#48372)

This commit is contained in:
Franck Nijhof 2021-03-27 10:54:59 +01:00 committed by GitHub
parent 3aed84560f
commit 8d5ce53098
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 128 additions and 126 deletions

View file

@ -50,9 +50,8 @@ class HlsMasterPlaylistView(StreamView):
track = stream.add_provider("hls")
stream.start()
# Wait for a segment to be ready
if not track.segments:
if not await track.recv():
return web.HTTPNotFound()
if not track.segments and not await track.recv():
return web.HTTPNotFound()
headers = {"Content-Type": FORMAT_CONTENT_TYPE["hls"]}
return web.Response(body=self.render(track).encode("utf-8"), headers=headers)
@ -110,9 +109,8 @@ class HlsPlaylistView(StreamView):
track = stream.add_provider("hls")
stream.start()
# Wait for a segment to be ready
if not track.segments:
if not await track.recv():
return web.HTTPNotFound()
if not track.segments and not await track.recv():
return web.HTTPNotFound()
headers = {"Content-Type": FORMAT_CONTENT_TYPE["hls"]}
return web.Response(body=self.render(track).encode("utf-8"), headers=headers)