Skip to content

vtdec: fix overwrite of decoded frames with hw acceleration

Make sure to increase the IOSurface count from the decoder callback instead of delegating it to the GL thread. Otherwise, the IOSurface is returned to the pool and we end up with a frame whose underlaying IOSurface is reused to decode a new frame.

I detected the issue with some unit tests using playbin in which I was seeking to a position and checking that the last sample had the right content. They were failing with random values only when using vtdec_hw so I assumed the output frames where being overwritten. It seems that the IOSurface usage count is increased too late, in the GL thread, rather than the decoder callback thread. The IOSurfaceis returned to the pool and reused to decode a new frame.

Edited by Andoni Morales Alastruey

Merge request reports