-
Notifications
You must be signed in to change notification settings - Fork 110
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-7403: Improve remote camera clients. #4294
Conversation
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.
Pushed with a merge I screwed up -- but I think git figured it out.
Relying on CI to tell me if things are working.
// GetSleepTimeFromErrorCount returns a sleep time from an error count. | ||
func (opts *BackoffTuningOptions) GetSleepTimeFromErrorCount(errorCount int) time.Duration { | ||
if errorCount < 1 || opts == nil { | ||
return 0 | ||
} | ||
multiplier := math.Pow(2, float64(errorCount-1)) |
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.
Bugfix: This would go wildly negative after few seconds of errors.
Cooldown: 5 * time.Second, | ||
} | ||
if err := streamFunc(opts); err != nil { | ||
if err := streamFunc(&webstream.BackoffTuningOptions{}); err != 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.
Settings removed because it never worked. And now streamFunc
disobeys the the input anyways. So make it explicit this code has no expectations about backoff. Removing the need to pass a BackoffTuningOptions
was a bit noisy, so I'm avoiding doing that in this PR.
components/camera/client.go
Outdated
c.rtpPassthroughMu.Lock() | ||
for _, tmp := range c.runningStreams { | ||
if count.Add(1)%10000 == 0 { | ||
c.logger.Infow("ReadRTP called. Sampling 1/10000", "count", count.Load(), "packetTs", pkt.Header.Timestamp) |
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.
Changed to debug
test.That(t, startCount.Load(), test.ShouldEqual, 2) | ||
test.That(t, stopCount.Load(), test.ShouldEqual, 2) | ||
|
||
// multiple Decrement() calls when the count is already at zero doesn't call any methods |
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 assertion was no longer true. Excessive decrements were calling logger.Fatal
. I believe that's how I inherited the PR (i might have smashed git history -- on multiple branches by accident).
Should definitely flag if there's a reason we expect multiple decrements to take place.
Test failure caught a stream state event handler leak -- taking a look:
|
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.
Looks great, just some non blocking feedback to confirm you intended to delete some tests & some suggestions around logging level.
pc, ok := rpc.ContextPeerConnection(ctx) | ||
server.logger.Infow("Adding video stream", "name", req.Name, "peerConn", pc) | ||
defer server.logger.Warnf("AddStream END %s", req.Name) |
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.
Do we want to keep this at warn or downgrade this to Info?
Users may be surprised to see warning logs whenever they open a video stream.
// If it no longer exists, it: | ||
// 1. calls RemoveTrack on the senders of all peer connections that called AddTrack on the camera name. | ||
// 2. decrements the number of active peers on the stream state (which should result in the | ||
// stream state having no subscribers and calling gostream.Stop() or rtppaserverthrough.Unsubscribe) |
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.
// stream state having no subscribers and calling gostream.Stop() or rtppaserverthrough.Unsubscribe) | |
// stream state having no subscribers and calling gostream.Stop() or rtp passthrough.Unsubscribe() |
pc, ok := rpc.ContextPeerConnection(ctx) | ||
server.logger.Infow("Adding video stream", "name", req.Name, "peerConn", pc) | ||
defer server.logger.Warnf("AddStream END %s", req.Name) |
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.
defer server.logger.Warnf("AddStream END %s", req.Name) | |
defer server.logger.Infof("AddStream END %s", req.Name) |
ss.activePeers-- | ||
if ss.activePeers <= 0 { | ||
ss.activePeers = 0 | ||
state.logger.Warn("rtp_passthrough not possible, falling back to GoStream", "err", err) |
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.
state.logger.Warn("rtp_passthrough not possible, falling back to GoStream", "err", err) | |
state.logger.Info("rtp_passthrough not possible, falling back to GoStream", "err", err) |
I don't think we want to emit warn logs for cameras like webcam, how about we just emit this at info level?
if err != nil { | ||
ss.logger.CDebugw(ctx, "rtp_passthrough not possible, falling back to GoStream", "err", err.Error(), "name", ss.Stream.Name()) | ||
state.logger.Warnw("tick: rtp_passthrough not possible, falling back to GoStream", "err", err) |
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.
state.logger.Warnw("tick: rtp_passthrough not possible, falling back to GoStream", "err", err) | |
state.logger.InfoW("tick: rtp_passthrough not possible, falling back to GoStream", "err", err) |
} | ||
ss.logger.CWarnw(ctx, "Stream using experimental H264 passthrough", "name", ss.Stream.Name()) | ||
ss.monitorSubscription(sub) | ||
state.logger.Warnw("Stream using experimental H264 passthrough", "name", state.Stream.Name()) |
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.
state.logger.Warnw("Stream using experimental H264 passthrough", "name", state.Stream.Name()) | |
state.logger.Infow("Stream using experimental H264 passthrough", "name", state.Stream.Name()) |
@@ -1912,232 +1910,6 @@ func TestConfigMethod(t *testing.T) { | |||
test.That(t, actualCfg, test.ShouldResemble, &expectedCfg) | |||
} | |||
|
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.
Just confirming, we want to be deleting TestReconnectRemote & TestReconnectRemoteChangeConfig?
No description provided.