Skip to content
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

Added option to completely skip RTSP Discovery in autodiscover() #47

Merged
merged 12 commits into from
Jul 22, 2024

Conversation

honeytung
Copy link
Member

This PR added a option to turn off RTSP Discovery as in some cases it will take some time to search for cameras in the local network.

@@ -23,7 +23,7 @@
@click.option(
"--rtsp_discover_modes",
type=click.Choice(PREVIEW_RTSP_COMMAND_CHOICES, case_sensitive=False),
default="light",
default="disable",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be better to set it to disable since we don't want to guess passwords by default.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we do want to guess passwords in autodiscover. Without the password, we cannot connect to the grabber, which is the point of the autodiscover, right? I guess there is the question of how thorough we are with our password guessing; maybe that should be an option?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, the mode light should be alright but other modes such as complete_fast and complete_slow may cause you to exceed the number of attempts before the camera blocks you.

@honeytung honeytung marked this pull request as ready for review July 18, 2024 01:57
Copy link
Contributor

@timmarkhuff timmarkhuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good, but I have a few comments/questions.

Should this also be added to the CLI? I think the behavior should be similar to the function, default behavior is to not search for rtsp cameras. Then maybe there is a flag they can set to search for rtsp cameras or not. Or maybe they specify a class AutodiscoverMode?

Also, I wonder if class AutodiscoverModes should be class AutodiscoverMode (singular). When i see a line like this, it makes me think that I am passing in a list of modes, but it's really just a string.

def autodiscover(warmup_delay: float = 1.0, rtsp_discover_modes: Union[AutodiscoverModes, None] = None) -> dict:

@@ -23,7 +23,7 @@
@click.option(
"--rtsp_discover_modes",
type=click.Choice(PREVIEW_RTSP_COMMAND_CHOICES, case_sensitive=False),
default="light",
default="disable",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we do want to guess passwords in autodiscover. Without the password, we cannot connect to the grabber, which is the point of the autodiscover, right? I guess there is the question of how thorough we are with our password guessing; maybe that should be an option?

@honeytung honeytung requested a review from timmarkhuff July 18, 2024 19:03
Copy link
Collaborator

@brandon-groundlight brandon-groundlight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks reasonable to me. Only not approving so Tim can take another pass

type=click.Choice(PREVIEW_RTSP_COMMAND_CHOICES, case_sensitive=False),
default="light",
default="disable",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit, but 'disable' is a weird choice for the default. 'disable' implies the default should be to search for rtsp urls and we're going out of our way to turn it off. 'off' or 'none' would make more sense to me

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I agree, off would be a better naming for this.

Copy link
Contributor

@timmarkhuff timmarkhuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a few small nits

README.md Outdated
@@ -174,7 +174,7 @@ The table below shows all available configurations and the cameras to which they
In addition to the configurations in the table above, you can set any Basler camera property by including `options.basler.<BASLER PROPERTY NAME>`. For example, it's common to set `options.basler.PixelFormat` to `RGB8`.

### Autodiscovery
Autodiscovery automatically connects to all cameras that are plugged into your machine or discoverable on the network, including `generic_usb`, `realsense` and `basler` cameras. Default configurations will be loaded for each camera. Please note that RTSP streams cannot be discovered in this manner; RTSP URLs must be specified in the configurations or can be discovered using a separate tool below.
Autodiscovery automatically connects to all cameras that are plugged into your machine or discoverable on the network, including `generic_usb`, `realsense`, `basler`, and ONVIF supported `RTSP` cameras. Default configurations will be loaded for each camera. Note that discovery of RTSP cameras will be disabled by default but can be enabled by setting `rtsp_discover_mode`. Refer to [RTSP Discovery](#rtsp-discovery) section for different options.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should just be rstp (lowercase) here. Should match the actual input type that is used when creating the grabber.

light: Only try first two usernames and passwords ("admin:admin" and no username/password).
complete_fast: Try the entire DEFAULT_CREDENTIALS without delays in between.
complete_slow: Try the entire DEFAULT_CREDENTIALS with a delay of 1 seconds in between.
Defaults to AutodiscoverModes.light.
Defaults to ip_only.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should 'Defaults to ip_only' be removed? It default to off, right?

@timmarkhuff timmarkhuff self-requested a review July 22, 2024 17:29
Copy link
Contributor

@timmarkhuff timmarkhuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@honeytung honeytung merged commit 5009d6b into main Jul 22, 2024
3 checks passed
@honeytung honeytung deleted the autodiscovery-rtsp-option branch July 22, 2024 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants