Skip to content

core: frontend: VideoStreamCreationDialog: use even default UDP ports #3375

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

Merged
merged 1 commit into from
Jul 9, 2025

Conversation

ES-Alexander
Copy link
Collaborator

@ES-Alexander ES-Alexander commented Jun 12, 2025

  • Odd ports can be assumed as allocated to audio streams
  • May improve stream detection robustness with control stations like QGroundControl

Summary by Sourcery

Enhancements:

  • Adjust default UDP endpoint ports to use 5600 + 2 × index for both UDP and UDP265 streams to ensure only even ports are assigned.

- Odd ports can be assumed as allocated to audio streams
- May improve stream detection robustness with control stations like QGroundControl
Copy link

sourcery-ai bot commented Jun 12, 2025

Reviewer's Guide

This PR modifies the default UDP port assignment logic in the VideoStreamCreationDialog to ensure even ports by doubling the index offset, thereby enhancing compatibility with control stations like QGroundControl.

Flow Diagram for Default UDP Port Assignment

flowchart TD
    subgraph "VideoStreamCreationDialog: updateStreamEndpoint()"
        A[Start] --> B{Stream Type?};
        B -- "StreamType.UDP" --> C{Endpoint set?};
        C -- "No" --> D["Set endpoint with port: 5600 + 2 * index"];
        D --> E[End];
        C -- "Yes" --> E;
        B -- "StreamType.UDP265" --> F{Endpoint set?};
        F -- "No" --> G["Set endpoint with port: 5600 + 2 * index"];
        G --> E;
        F -- "Yes" --> E;
        B -- "Other" --> H[...];
        H --> E;
    end
Loading

File-Level Changes

Change Details Files
Use even-numbered default ports for UDP-based streams
  • Changed UDP stream port calculation from 5600 + index to 5600 + 2 * index
  • Changed UDP265 stream port calculation from 5600 + index to 5600 + 2 * index
core/frontend/src/components/video-manager/VideoStreamCreationDialog.vue

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @ES-Alexander - I've reviewed your changes - here's some feedback:

  • Extract the base port (5600) and the even-offset multiplier (2) into named constants or a helper to avoid magic numbers and clarify the port calculation logic.
  • Add a boundary check to ensure 5600 + 2 * index doesn’t exceed the valid UDP port range (1–65535) or collide with other reserved ports.
  • Consider refactoring the duplicated UDP and UDP265 endpoint setup into a shared function to DRY up the code and simplify maintenance.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Extract the base port (5600) and the even-offset multiplier (2) into named constants or a helper to avoid magic numbers and clarify the port calculation logic.
- Add a boundary check to ensure `5600 + 2 * index` doesn’t exceed the valid UDP port range (1–65535) or collide with other reserved ports.
- Consider refactoring the duplicated UDP and UDP265 endpoint setup into a shared function to DRY up the code and simplify maintenance.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@joaoantoniocardoso
Copy link
Member

joaoantoniocardoso commented Jun 24, 2025

Should we do the same on the MCM's default UDP profile?

@ES-Alexander
Copy link
Collaborator Author

Should we do the same on the MCM's default UDP profile?

@joaoantoniocardoso I don't expect it would hurt 🤷
@patrickelectric any thoughts on that? :-)

@patrickelectric
Copy link
Member

patrickelectric commented Jun 25, 2025

I don't see a reason to have the audio and the video in different port, the idea is to merge both together in our end. The concept of splitting is from the old companion, that is not an good example.

@patrickelectric
Copy link
Member

patrickelectric commented Jul 9, 2025

After discussing with @joaoantoniocardoso we believe that will be much easier to receive and send the audio using different channels.

@patrickelectric patrickelectric merged commit 54d2325 into bluerobotics:master Jul 9, 2025
6 checks passed
@joaoantoniocardoso joaoantoniocardoso added the move-to-stable Needs to be cherry-picked and move to stable label Aug 8, 2025
@ES-Alexander ES-Alexander deleted the even-videos branch August 8, 2025 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
move-to-stable Needs to be cherry-picked and move to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants