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

Initiate decoders globally #153

Merged
merged 3 commits into from
Jan 16, 2025
Merged

Initiate decoders globally #153

merged 3 commits into from
Jan 16, 2025

Conversation

cedricve
Copy link
Member

@cedricve cedricve commented Jan 15, 2025

Description

Pull Request Title: Initiate decoders globally

Description:

Motivation:

The motivation behind this change is to streamline the initialization and management of decoders within the Golibrtsp structure. By initiating the H264 and H265 frame decoders globally, we aim to enhance the efficiency and maintainability of the code. This change also reduces redundancy and potential errors related to multiple initializations and closures of the same decoders.

Changes:

  1. Global Initialization of Decoders:

    • Introduced global variables H264FrameDecoder and H265FrameDecoder.
    • Added an init function to initialize these decoders at the start of the program.
    • Error handling for decoder initialization is performed within the init function, logging any issues encountered.
  2. Refactor Connect Method:

    • Updated the Connect method to use the globally initialized decoders instead of creating new instances each time a connection is made.
    • Removed redundant decoder initialization code from the Connect method.
  3. Update Close Method:

    • Commented out the closure of decoders in the Close method, as they are now managed globally and should not be closed individually.

Benefits:

  • Efficiency: By initializing the decoders globally, we avoid multiple allocations and deallocations, which can be resource-intensive.
  • Maintainability: Centralizing the initialization logic simplifies the codebase, making it easier to manage and debug.
  • Error Handling: Initializing decoders globally allows for centralized error handling, ensuring any issues are logged immediately during startup.

This change improves the overall stability and performance of the project by ensuring decoders are correctly managed and reducing the complexity of the Golibrtsp implementation.

@cedricve cedricve merged commit 9cb3c97 into master Jan 16, 2025
9 checks passed
@cedricve cedricve deleted the feature/global-decoder branch January 16, 2025 20:47
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