+Buffer stuffing is first detected through a callback when RenderThread is blocked in BlastBufferQueue#dequeueBuffer, where an app may wait for a buffer to become available. When RenderThread is blocked on dequeueBuffer, the system is maximally stuffed as there are no available buffers and is vulnerable to additional jank. The callback provides the duration spent blocked in dequeueBuffer, which is used to guard against potential false positives that might result from slight variations in buffer release timing. As there is one BlastBufferQueue associated with the SurfaceControl on the root window, waiting for the buffer release callback here also filters out other SurfaceControl buffer producers that do not require buffer stuffing recovery, such as games, media, and camera. These other buffer producers may have expectedly higher buffer counts because they can queue up more buffers in advance to meet high throughput, low latency requirements. For example, a video might queue up as many buffers as possible in preparation for the upcoming frames. It would be considered acceptable for it to be stuffed in this case because it is not affecting other CUJs and the stuffing helps prepare the rendering pipeline.
0 commit comments