Added frame iterator explanation comment
This commit is contained in:
parent
f51d4ff200
commit
90ccd0bc4e
1 changed files with 9 additions and 4 deletions
|
|
@ -565,15 +565,20 @@ class PiCameraStreamer(BaseCamera):
|
|||
# While the iterator is not closed
|
||||
try:
|
||||
while True:
|
||||
# reset stream for next frame
|
||||
# Reset the stream for the next frame
|
||||
self.stream.seek(0)
|
||||
self.stream.truncate()
|
||||
# to stream, read the new frame
|
||||
# Sleep for the approximate camera framerate
|
||||
time.sleep(1 / self.camera.framerate * 0.1)
|
||||
# yield the result to be read
|
||||
# Get the latest frame data from the stream
|
||||
frame = self.stream.getvalue()
|
||||
|
||||
# ensure the size of package is right
|
||||
# This loop iterates faster than the PiCamera will collect
|
||||
# frames. On iterations between frames, the buffer will be
|
||||
# empty (because we truncated it earlier). In these cases
|
||||
# we just pass and loop again until a frame is actually present.
|
||||
# This also means that the size of FrameStream is always 1 frame,
|
||||
# since we truncate it here before a new frame can be appended.
|
||||
if len(frame) == 0:
|
||||
pass
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue