Chih-Yu Huang
authored
C2ArcProtectedGraphicAllocator allocates the protected buffer when priorGraphicAllocation() is called, and releases the protected buffer if all the corrresponding C2GraphicAllocations are released. Originally, we store the the registered graphic buffers with GraphicBuffer. Each time when fetchGraphicBlock() is called, we call priorGraphicAllocation() to convert GraphicBuffer to C2GraphicAllocation. The component releases the C2GraphicAllocation after decoding a frame and passing it to framework. So at the end we continue allocating and releasing protected buffers during decoding. This CL changes to store C2GraphicAllocation directly. We don't call priorGraphicAllocation() when recycling the buffer, and the registered C2GraphicAllocations are released when resolution change or component is destroyed. Bug: 181541291 Test: android.media.cts.AdaptivePlaybackTest Change-Id: Ib0cf9fe9d4609f3a566c514429d281c1c54b458d