Allow BlastBufferQueue to acquire an additional buffer
We want to be able to send buffers from BlastBufferQueue to the server as soon as possible. This allows us among other things, dropping the oldest buffer when multiple buffers with timestamps are queued up. To support this behavior with BlastBufferQueue, we need to acquire an additional buffer and send it to SurfaceFlinger. This requires changing the consumer owned by BlastBufferQueue to acquire an additional buffer. This change is safe because we will only acquire the buffer if its not droppable, maintaining the contract with the producer. If the buffer is not droppable, i.e. the producer is in sync mode, once the buffer has been queued, the buffer is owned by the queue until it is released or acquired by the consumer. By acquiring an additional buffer, we transfer the ownership to the consumer earlier. The server has more info to make decisions faster. The producer still has access the same number of buffers and is unaffected. If the producer is in async mode, then this buffer may be released by the producer when trying to queue a buffer. So we check if the buffer is droppable, and we do not acquire the extra buffer in this scenario. Test: atest BlastBufferQueueTests android.media.cts.PresentationSyncTest Bug: b/176507654, b/176967609 Change-Id: I494a9edcbea0b1c297ee75df2b840d8328e59eca
Loading
Please register or sign in to comment