Fixed HWAccel so we don't share contexts between streams#1689
Merged
WyattBlue merged 2 commits intoPyAV-Org:mainfrom Dec 24, 2024
Merged
Fixed HWAccel so we don't share contexts between streams#1689WyattBlue merged 2 commits intoPyAV-Org:mainfrom
WyattBlue merged 2 commits intoPyAV-Org:mainfrom
Conversation
f96b1c4 to
c10fc65
Compare
c10fc65 to
10bea3b
Compare
b577ee3 to
be9d4da
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
They may have different codecs (if both supported by the hardware), and in the future different devices and options. With the merging of HWAccel and HWAccelCtx we need to make a copy before we initialize the context.
IMO this makes the HWAccel class a bit confusing as it's now trying to do two different things - 1. Configs the user can supply that can be combined with a codec to create a hardware context, and 2. the hardware context itself. I think it makes more sense to keep them separate, but if you really want to merge them, the fix here fixes the multiple streams problem.
I removed the codec field from the class as that should never be supplied via init(). We only get that when we create an object for the class' second role using create(), and we can just pass it into _initialize_hw_context() then, after which we don't need the codec anymore.
In the future we may want to allow the user to specify multiple hwaccels for different codecs, then we'll need to add it back as a field, and it will be very confusing then, but that's another problem for another time.