Loading media/codec2/sfplugin/CCodecBufferChannel.cpp +13 −0 Original line number Original line Diff line number Diff line Loading @@ -2041,6 +2041,9 @@ void CCodecBufferChannel::sendOutputBuffers() { sp<MediaCodecBuffer> outBuffer; sp<MediaCodecBuffer> outBuffer; std::shared_ptr<C2Buffer> c2Buffer; std::shared_ptr<C2Buffer> c2Buffer; constexpr int kMaxReallocTry = 5; int reallocTryNum = 0; while (true) { while (true) { Mutexed<Output>::Locked output(mOutput); Mutexed<Output>::Locked output(mOutput); if (!output->buffers) { if (!output->buffers) { Loading @@ -2048,6 +2051,9 @@ void CCodecBufferChannel::sendOutputBuffers() { } } action = output->buffers->popFromStashAndRegister( action = output->buffers->popFromStashAndRegister( &c2Buffer, &index, &outBuffer); &c2Buffer, &index, &outBuffer); if (action != OutputBuffers::REALLOCATE) { reallocTryNum = 0; } switch (action) { switch (action) { case OutputBuffers::SKIP: case OutputBuffers::SKIP: return; return; Loading @@ -2058,6 +2064,13 @@ void CCodecBufferChannel::sendOutputBuffers() { mCallback->onOutputBufferAvailable(index, outBuffer); mCallback->onOutputBufferAvailable(index, outBuffer); break; break; case OutputBuffers::REALLOCATE: case OutputBuffers::REALLOCATE: if (++reallocTryNum > kMaxReallocTry) { output.unlock(); ALOGE("[%s] sendOutputBuffers: tried %d realloc and failed", mName, kMaxReallocTry); mCCodecCallback->onError(UNKNOWN_ERROR, ACTION_CODE_FATAL); return; } if (!output->buffers->isArrayMode()) { if (!output->buffers->isArrayMode()) { output->buffers = output->buffers = output->buffers->toArrayMode(output->numSlots); output->buffers->toArrayMode(output->numSlots); Loading Loading
media/codec2/sfplugin/CCodecBufferChannel.cpp +13 −0 Original line number Original line Diff line number Diff line Loading @@ -2041,6 +2041,9 @@ void CCodecBufferChannel::sendOutputBuffers() { sp<MediaCodecBuffer> outBuffer; sp<MediaCodecBuffer> outBuffer; std::shared_ptr<C2Buffer> c2Buffer; std::shared_ptr<C2Buffer> c2Buffer; constexpr int kMaxReallocTry = 5; int reallocTryNum = 0; while (true) { while (true) { Mutexed<Output>::Locked output(mOutput); Mutexed<Output>::Locked output(mOutput); if (!output->buffers) { if (!output->buffers) { Loading @@ -2048,6 +2051,9 @@ void CCodecBufferChannel::sendOutputBuffers() { } } action = output->buffers->popFromStashAndRegister( action = output->buffers->popFromStashAndRegister( &c2Buffer, &index, &outBuffer); &c2Buffer, &index, &outBuffer); if (action != OutputBuffers::REALLOCATE) { reallocTryNum = 0; } switch (action) { switch (action) { case OutputBuffers::SKIP: case OutputBuffers::SKIP: return; return; Loading @@ -2058,6 +2064,13 @@ void CCodecBufferChannel::sendOutputBuffers() { mCallback->onOutputBufferAvailable(index, outBuffer); mCallback->onOutputBufferAvailable(index, outBuffer); break; break; case OutputBuffers::REALLOCATE: case OutputBuffers::REALLOCATE: if (++reallocTryNum > kMaxReallocTry) { output.unlock(); ALOGE("[%s] sendOutputBuffers: tried %d realloc and failed", mName, kMaxReallocTry); mCCodecCallback->onError(UNKNOWN_ERROR, ACTION_CODE_FATAL); return; } if (!output->buffers->isArrayMode()) { if (!output->buffers->isArrayMode()) { output->buffers = output->buffers = output->buffers->toArrayMode(output->numSlots); output->buffers->toArrayMode(output->numSlots); Loading