-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RSDK-9920] - add lazy_decode #85
[RSDK-9920] - add lazy_decode #85
Conversation
|
||
closeMu sync.RWMutex |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I needed to add this as now both Image and OnPacket's callback (which are called from 2 different goroutines) can try to interact with the pool and the decoder. As a result, I made it so that Image
can execute concurrently with other Image
calls but can't run concurrently with Close
and such that it will early exist if close has already been called.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds like it should be implemented with our StoppableWorker
structure to handle this exact case, can you make a TODO and a ticket to look into this.
Are you seeing cases where Close is not stopping the Image call? If so there's probably a bug or something being badly freed/uncancelled in this code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a similar shape of problem to what we use StoppableWorker
to solve, however I don't think StoppableWorker
is the right solution to this problem as the goroutine calling Image
is spawned by the camera/server.go hosted in the module, not by our code.
I think the approach I used here is reasonable. Close won't do it's thing until all in progress Image
calls complete and once Close
is called, Image
won't execute.
|
||
closeMu sync.RWMutex |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds like it should be implemented with our StoppableWorker
structure to handle this exact case, can you make a TODO and a ticket to look into this.
Are you seeing cases where Close is not stopping the Image call? If so there's probably a bug or something being badly freed/uncancelled in this code.
@@ -250,6 +258,7 @@ func (rc *rtspCamera) closeConnection() { | |||
rc.client.Close() | |||
rc.client = nil | |||
} | |||
rc.resetAU(nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[q] Why reset to nil rather than an empty array of bytes like in the consumer helper?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good question. I'll change consumeAU
to set rc.au to nil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
Co-authored-by: randhid <[email protected]>
Changes:
https://viam.atlassian.net/browse/RSDK-9920
lazy_decode: bool
, default: falsePerformance Impact:
Hardware: Pi 5:
Baseline
lazy_decode: false
or unset:lazy_decode: true
Here is a video of the experience of each config option.
Kapture.2025-02-05.at.14.46.54.mp4