Repository navigation
Raise NanoKVMInvalidResponseError for empty snapshots, use get_snapshot in examples - #68
Merged
Merged
Conversation
…ot in examples get_snapshot() raised the base NanoKVMError when the MJPEG stream ended before any frame; it now raises NanoKVMInvalidResponseError, a subclass, so existing handlers still catch it. The README and blocking-client examples save a screenshot with get_snapshot() instead of breaking out of a stream loop. Both come from #61. Co-authored-by: Antonio Vázquez Blanco <[email protected]>
get_snapshot() refused the Pro outright, because opening MJPEG there ends any WebRTC session in progress. Callers that know no session is open, or accept losing it, can now pass interrupt_webrtc=True. Without it the Pro still refuses, and the error names the flag. Measured on a Pro 1.2.15: the interrupted session raises NanoKVMVideoModeError and does not recover, while a session started after the snapshot gets video without changing the stream mode.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Carries over two ideas from #61 by @antoniovazquezblanco, which was closed as superseded by
get_snapshot()from #65. He is credited as co-author on the commit.Changes
get_snapshot()raisesNanoKVMInvalidResponseErrorwhen the MJPEG stream ends before any frame, instead of the baseNanoKVMError.docs/streaming.mdsays so.docs/sync.mdsave a screenshot withget_snapshot()instead of breaking out of anmjpeg_stream()/mjpeg_stream_bytes()loop.get_snapshot(interrupt_webrtc=True)works on the Pro. Opening MJPEG there ends any WebRTC session in progress, so the Pro still refuses by default, and the error names the flag.Behaviour changes
NanoKVMInvalidResponseError. It subclassesNanoKVMError, so existing handlers still catch it.Testing
520 unit tests pass, 1 of them new. Against a NanoKVM Pro 1.2.15 with an aiortc peer, repeated 3 times: a snapshot during a WebRTC session ends it with
NanoKVMVideoModeError; a session started afterwards decodes ~60 fps without changing the stream mode; a snapshot with no session open has no effect on later ones.