Bug 1774939: Rebuild video layer if it fails to enqueue a surface. r=mstange
commitcdfeb597d3523b4bc91b992cafa45d65f9031991
authorBrad Werth <bwerth@mozilla.com>
Tue, 28 Jun 2022 20:05:10 +0000 (28 20:05 +0000)
committerBrad Werth <bwerth@mozilla.com>
Tue, 28 Jun 2022 20:05:10 +0000 (28 20:05 +0000)
treee607ebbc0a448e1f16dc99a7ecbf7428fb23f76c
parentdb4d27e57d1f0e4cc7b6c3650a5258d1bb67e79e
Bug 1774939: Rebuild video layer if it fails to enqueue a surface. r=mstange

For unknown reasons, AVSampleBufferDisplayLayer may sometimes stop
enqueueing new buffers. In this case it will return false for the
readyForMoreMediaData property. When this happens, there's no guarantee
that the layer will ever accept new buffers again. We can work around
this by rebuilding the video layer when it locks up, which ensures that
the video sample is displayed in the next update, seemingly without
visual jitter.

This is not useful if the video enqueueing is failing due to memory
pressure, but more serious failure points would likely be occurring at the
same time.

This patch also adds to the logging we will see when the pref
`gfx.core-animation.specialize-video.log` is set.

Differential Revision: https://phabricator.services.mozilla.com/D149920
gfx/layers/NativeLayerCA.mm