Skip to content

Conversation

@kixelated
Copy link
Collaborator

No description provided.

@gemini-code-assist
Copy link

Summary of Changes

Hello @kixelated, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request integrates recent changes, likely from a master branch, and applies consistent code formatting throughout the project. A significant addition is the justfile, which simplifies and standardizes development workflows for tasks like building and code style enforcement. Furthermore, the MoQ output module has been made more resilient through improved session and track management, ensuring more reliable streaming operations. The .gitignore file has also been updated to reflect current project needs and improve repository hygiene.

Highlights

  • Code Formatting: Standardized code formatting across several C++ files using clang-format to ensure consistency and readability.
  • Development Workflow: Introduced a justfile to streamline common development tasks such as project setup, building, running CI checks, and automatically fixing formatting issues.
  • MoQ Output Robustness: Enhanced the MoQ output module by improving session and track lifecycle management, including more robust initialization checks and error handling during data writing.
  • .gitignore Refactor: Refactored the .gitignore file for better clarity and maintainability, explicitly excluding common build artifacts, IDE-specific files, and Nix-related directories.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces clang-format for code styling and merges changes from the master branch. It also adds a justfile for easier project interaction. My review focuses on several critical logic issues introduced in src/moq-output.cpp related to resource handle management, which could lead to resource leaks and incorrect behavior. I've also noted a potential issue in CMakeLists.txt that might break macOS builds. The formatting changes and the new justfile are good improvements.

I am having trouble creating individual review comments. Click here to see my feedback.

src/moq-output.cpp (16-18)

critical

The initialization of session, video, and audio members has been changed from -1 to 0. This is problematic because 0 is likely a valid ID returned by moq_session_connect and moq_track_create. This can lead to bugs where valid sessions/tracks are not closed, or tracks are re-initialized on every data packet. These should be initialized to -1 to represent a distinct 'uninitialized' state.

 	  session(-1),
 	  video(-1),
 	  audio(-1),

src/moq-output.cpp (110-120)

critical

The checks > 0 to decide whether to close a session or track are incorrect. If a session or track has an ID of 0, it will not be closed, leading to resource leaks. Since valid IDs are non-negative (>= 0), the check should be if (session >= 0).

	if (session >= 0) {
		moq_session_close(session);
	}

	if (video >= 0) {
		moq_track_close(video);
	}

	if (audio >= 0) {
		moq_track_close(audio);
	}

src/moq-output.cpp (146)

critical

The condition if (audio == 0) is used to lazily initialize the audio track. However, if moq_track_create can return 0 as a valid track ID (which is common for handle-based APIs), this will cause AudioInit() to be called on every audio packet for that track, which is a serious bug. The 'uninitialized' state should be represented by a value that cannot be a valid ID, such as -1. The check should then be if (audio == -1).

This assumes the constructor is also fixed to initialize audio to -1 as suggested in another comment.

	if (audio == -1) {

src/moq-output.cpp (168)

critical

Similar to the audio track, the condition if (video == 0) to initialize the video track is problematic if 0 is a valid track ID. This would cause repeated re-initialization. Please use a dedicated value like -1 for the uninitialized state and check for that.

This assumes the constructor is also fixed to initialize video to -1 as suggested in another comment.

	if (video == -1) {

CMakeLists.txt (39-42)

medium

The add_custom_command to copy the moq dylib into the macOS app bundle has been removed. While this might be handled by another mechanism now (e.g., a project-specific CMake macro), its removal is suspicious and could break the macOS build by failing to bundle a required shared library. Could you please confirm that this is intentional and that the library is still correctly bundled on macOS? If not, this change should be reverted.

@kixelated kixelated merged commit b902853 into moq-dev:master Dec 13, 2025
1 of 3 checks passed
@kixelated kixelated deleted the clang-format branch December 13, 2025 01:32
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.

1 participant