-
Notifications
You must be signed in to change notification settings - Fork 7
Clang format and merge kixelated/master #10
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
Conversation
Use the revamped C API
Avoid spamming errors when track init fails.
Summary of ChangesHello @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 Highlights
Using Gemini Code AssistThe 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
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 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
|
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.
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)
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)
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)
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)
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)
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.
No description provided.