Skip to content

Commit 60f74bd

Browse files
committed
fixed stream reader returning empty frame past eof
1 parent a081978 commit 60f74bd

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/ffmpegio/streams/SimpleStreams.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def __init__(
8888

8989
self.samplesize = utils.get_samplesize(self.shape, self.dtype)
9090

91-
self.blocksize = blocksize or max(1024 ** 2 // self.samplesize, 1)
91+
self.blocksize = blocksize or max(1024**2 // self.samplesize, 1)
9292
logging.debug("[reader main] completed init")
9393

9494
def close(self):
@@ -146,10 +146,10 @@ def __iter__(self):
146146
return self
147147

148148
def __next__(self):
149-
try:
150-
return self.read(self.blocksize)
151-
except:
149+
F = self.read(self.blocksize)
150+
if F is None:
152151
raise StopIteration
152+
return F
153153

154154
def readlog(self, n=None):
155155
if n is not None:
@@ -176,6 +176,7 @@ def read(self, n=-1):
176176
logging.debug(f"[reader main] read {len(b)} bytes")
177177
if not len(b):
178178
self._proc.stdout.close()
179+
return None
179180
return self._converter(b=b, shape=self.shape, dtype=self.dtype, squeeze=False)
180181

181182
def readinto(self, array):

0 commit comments

Comments
 (0)