Skip to content
Snippets Groups Projects
user avatar
Chih-Yu Huang authored
During decoding, graphic buffers are owned by component (i.e. local
buffers) or CCodec framework (i.e. remote buffers).  When switching
surface, the CCodec framework migrates remote buffers to the new
surfaces, then call C2BufferQueueBlockPool::configureProducer().
C2BufferQueueBlockPool implementation then migrates local buffers.
However, the CCodec and C2BufferQueueBlockPool implementation don't
guaratee to migrate all the existing buffers, and might allocate new
buffers. This violates the V4L2 stateful API's requirement.

Originally, C2VdaBqBlockPool migrates all the buffers again, and tries
to detach the slot of buffers migrated by CCodec framework. we assume
there should be only at most N buffers at BufferQueue, where N is the
number passed via setMaxDequeuedBufferCount(). However, this
assumption is wrong, so we failed to detach all buffers migrated by
CCodec framework.

In this CL, C2VdaBqBlockPool migrates local buffers when switching
surface, similar to C2BufferQueueBlockPool. After we dequeue
NUM_BUFFER_SLOTS buffers, all the migrated buffers should be dequeued
at least once. Then we could detect the lost buffers, and attach them
to the new surface.

Bug: 174188958
Test: android.media.cts.AdaptivePlaybackTest
Test: android.media.cts.MediaCodecPlayerTest#testPlaybackSwitchViews

Change-Id: Ifc30b62e69608be4ebc24ce1ea1a97be11f25a37
576a7239
History
Name Last commit Last update
..