Add a way to get RTSP status#31
Open
PulpFiction-Jeson wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a public way to query an RTSPClient instance’s RTSP connection status and resets the internal status state when Stop() is called, supporting scenarios where a client instance is reused across multiple stream switches.
Changes:
- Exposes
RtspStatuspublicly and adds a public API to retrieve the current status. - Resets
_rtspSocketStatustoWaitingToConnectwhenStop()is called.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+360
to
+363
| public RtspStatus GetRtspStatus() | ||
| { | ||
| return _rtspSocketStatus; | ||
| } |
Comment on lines
459
to
463
| public void Stop() | ||
| { | ||
| StopClient(); | ||
| _rtspSocketStatus = RtspStatus.WaitingToConnect; | ||
| } |
Contributor
Author
|
In my project, there are many plans (a plan represents which streams are shown on several monitors, or something similar). For each stream, I create an RTSP client instance, each with its own thread, constantly checking whether the stream needs to connect() or stop(). Without this status, there's no way to tell. |
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.
1.Add a way to get RTSP status
2.Reset the state when you actively call Stop()
Reason for change:
When doing real-time preview and switching of multiple streams, you can create and reuse RTSPClient instances in advance. Call connect when you need to play, and call stop when you don't. Before calling, you can use rtspstatus to check the status of the current instance to avoid repeated calls and some errors.