8000
Skip to content

fixed MPEG-PS (DVD)/av-lib and a hardcoded time_base#2058

Open
uknunknown wants to merge 1 commit intotvheadend:masterfrom
uknunknown:fix_libav_dvd
Open

fixed MPEG-PS (DVD)/av-lib and a hardcoded time_base#2058
uknunknown wants to merge 1 commit intotvheadend:masterfrom
uknunknown:fix_libav_dvd

Conversation

@uknunknown
Copy link
Copy Markdown
Contributor
  • fixed MPEG-PS (DVD)/av-lib and a hardcoded time_base
  • added a worst case fallback to (90000,1)

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @uknunknown, 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 significantly enhances the handling of MPEG-PS (DVD) streams by integrating the mpeg2dvd muxer and applying DVD-specific VBV parameters. It also addresses and corrects hardcoded time base values for both audio and video streams, replacing them with more dynamic and robust methods, including a fallback for invalid time bases. Furthermore, the changes ensure that bitstream filters are applied judiciously, avoiding incorrect processing for MPEG-2 video within MPEG-PS.

Highlights

  • MPEG-PS (DVD) Muxer Support: Enabled explicit support for the mpeg2dvd muxer by adding it to the MUXERS list in Makefile.ffmpeg.
  • DVD-Compliant VBV Parameters: Configured specific Video Buffer Verifier (VBV) parameters for MPEG-PS streams, setting rc_max_rate to 9.8 Mbps and rc_buffer_size to 1.835 Mbps, aligning with DVD specifications.
  • Dynamic Audio Time Base: Removed a hardcoded time base for audio streams, ensuring that the stream's actual time base (st->time_base) is always used, improving accuracy.
  • Robust Video Time Base Handling: Replaced a hardcoded video time base (1/25) with a dynamic calculation using av_reduce and introduced a fallback to a default mpeg_tc time base if the stream's time base is invalid.
  • Conditional Bitstream Filter Application: Modified the bitstream filter (BSF) allocation logic to prevent the application of inappropriate filters (like MP4-to-Annex B conversion) for MPEG-2 video streams within MPEG-PS containers, ensuring correct stream processing.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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
Copy Markdown
@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 fixes for MPEG-PS (DVD) muxing with libav. The changes include adding the mpeg2dvd muxer, setting appropriate bitrate and buffer size for MPEG-PS, fixing a hardcoded time_base, and skipping unnecessary bitstream filtering for MPEG-2 video streams. The changes appear correct and address the described issues. I have one suggestion to improve maintainability by replacing magic numbers with named constants.

Comment on lines +115 to 117
c->rc_max_rate = 9800000;
// Set the VBV buffer size (1.835 Mbps for DVD)
c->rc_buffer_size = 224*1024*8;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

These hardcoded values for DVD video parameters (9800000 and 224*1024*8) are magic numbers. To improve code readability and maintainability, consider defining them as named constants with descriptive names (e.g., DVD_MAX_BITRATE, DVD_VBV_BUFFER_SIZE_BITS) at the top of the file or in a relevant header.

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

- fixed MPEG-PS (DVD)/av-lib and a hardcoded time_base
- added a worst case fallback to (90000,1)
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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

0