-
Notifications
You must be signed in to change notification settings - Fork 111
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-9703] - Maintain dynamic resolution preference through reconfigures #4738
Open
seanavery
wants to merge
4
commits into
viamrobotics:main
Choose a base branch
from
seanavery:RSDK-9703
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
viambot
added
the
safe to test
This pull request is marked safe to test from a trusted zone
label
Jan 23, 2025
viambot
added
safe to test
This pull request is marked safe to test from a trusted zone
and removed
safe to test
This pull request is marked safe to test from a trusted zone
labels
Jan 24, 2025
viambot
added
safe to test
This pull request is marked safe to test from a trusted zone
and removed
safe to test
This pull request is marked safe to test from a trusted zone
labels
Jan 24, 2025
viambot
added
safe to test
This pull request is marked safe to test from a trusted zone
and removed
safe to test
This pull request is marked safe to test from a trusted zone
labels
Jan 24, 2025
seanavery
changed the title
[RSDK-9703] - Do not refresh stream if camera component has not been reconfigured
[RSDK-9703] - Maintain dynamic resolution preference through reconfigures
Jan 24, 2025
10 tasks
randhid
reviewed
Jan 24, 2025
Comment on lines
+414
to
+416
func (state *StreamState) IsResized() bool { | ||
return state.isResized | ||
} |
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.
Is this thread safe?
randhid
reviewed
Jan 24, 2025
Comment on lines
+661
to
+691
// Check stream state for the camera to see if it is in resized mode. | ||
// If it is in resized mode, we want to apply the resize transformation to the | ||
// video source before swapping it. | ||
streamState, ok := server.nameToStreamState[cam.Name().SDPTrackName()] | ||
if ok && streamState.IsResized() { | ||
server.logger.Debugf("stream %q is resized attempting to reapply resize transformation", cam.Name().SDPTrackName()) | ||
mediaProps, err := existing.MediaProperties(server.closedCtx) | ||
if err != nil { | ||
server.logger.Errorf("error getting media properties from resize source: %v", err) | ||
} else { | ||
// resizeVideoSource should always have a width and height set. | ||
height, width := mediaProps.Height, mediaProps.Width | ||
if height != 0 && width != 0 { | ||
server.logger.Debugf( | ||
"resizing video source to width %d and height %d", | ||
width, height, | ||
) | ||
resizer := gostream.NewResizeVideoSource(cam, width, height) | ||
existing.Swap(resizer) | ||
continue | ||
} | ||
} | ||
// If we can't get the media properties or the width and height are 0, we fall back to | ||
// the original source and need to notify the stream state that the source is no longer | ||
// resized. | ||
server.logger.Warnf("falling back to original source for stream %q", cam.Name().SDPTrackName()) | ||
err = streamState.Reset() | ||
if err != nil { | ||
server.logger.Errorf("error resetting stream %q: %v", cam.Name().SDPTrackName(), 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.
Is there a way to test this within an existing test?
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.
Description
This PR adds a check before refreshing a video source to see if it is in resized mode. If the streamState is resized, we re-apply the resize transformation before swapping.
Tests