Skip to content

Conversation

@matthewlai
Copy link
Contributor

  1. We can't share hardware context between streams.

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.

  1. Fixed examples/basics/hw_decode.py to match the updated interface.

@matthewlai matthewlai force-pushed the hwaccel_fixes branch 2 times, most recently from f96b1c4 to c10fc65 Compare December 23, 2024 12:41
@WyattBlue WyattBlue merged commit af30b3d into PyAV-Org:main Dec 24, 2024
8 checks passed
@matthewlai matthewlai deleted the hwaccel_fixes branch December 27, 2024 06:28
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.

2 participants