Loading media/codec2/sfplugin/CCodecBufferChannel.cpp +24 −8 Original line number Diff line number Diff line Loading @@ -245,6 +245,14 @@ status_t CCodecBufferChannel::queueInputBufferInternal(sp<MediaCodecBuffer> buff "buffer starvation on component.", mName); } } int32_t cvo = 0; if (buffer->meta()->findInt32("cvo", &cvo)) { int32_t rotation = cvo % 360; // change rotation to counter-clock wise. rotation = ((rotation <= 0) ? 0 : 360) - rotation; Mutexed<OutputSurface>::Locked output(mOutputSurface); output->rotation[queuedFrameIndex] = rotation; } work->input.buffers.push_back(c2buffer); queuedBuffers.push_back(c2buffer); } else if (eos) { Loading Loading @@ -695,6 +703,22 @@ status_t CCodecBufferChannel::renderOutputBuffer( c2Buffer->getInfo(C2StreamRotationInfo::output::PARAM_TYPE)); bool flip = rotation && (rotation->flip & 1); uint32_t quarters = ((rotation ? rotation->value : 0) / 90) & 3; { Mutexed<OutputSurface>::Locked output(mOutputSurface); if (output->surface == nullptr) { ALOGI("[%s] cannot render buffer without surface", mName); return OK; } int64_t frameIndex; buffer->meta()->findInt64("frameIndex", &frameIndex); if (output->rotation.count(frameIndex) != 0) { auto it = output->rotation.find(frameIndex); quarters = (it->second / 90) & 3; output->rotation.erase(it); } } uint32_t transform = 0; switch (quarters) { case 0: // no rotation Loading Loading @@ -738,14 +762,6 @@ status_t CCodecBufferChannel::renderOutputBuffer( hdr10PlusInfo.reset(); } { Mutexed<OutputSurface>::Locked output(mOutputSurface); if (output->surface == nullptr) { ALOGI("[%s] cannot render buffer without surface", mName); return OK; } } std::vector<C2ConstGraphicBlock> blocks = c2Buffer->data().graphicBlocks(); if (blocks.size() != 1u) { ALOGD("[%s] expected 1 graphic block, but got %zu", mName, blocks.size()); Loading media/codec2/sfplugin/CCodecBufferChannel.h +1 −0 Original line number Diff line number Diff line Loading @@ -288,6 +288,7 @@ private: sp<Surface> surface; uint32_t generation; int maxDequeueBuffers; std::map<uint64_t, int> rotation; }; Mutexed<OutputSurface> mOutputSurface; Loading media/codec2/sfplugin/CCodecBuffers.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -324,6 +324,7 @@ OutputBuffers::BufferAction OutputBuffers::popFromStashAndRegister( // Append information from the front stash entry to outBuffer. (*outBuffer)->meta()->setInt64("timeUs", entry.timestamp); (*outBuffer)->meta()->setInt32("flags", entry.flags); (*outBuffer)->meta()->setInt64("frameIndex", entry.ordinal.frameIndex.peekll()); if (outputFormat) { ALOGD("[%s] popFromStashAndRegister: output format changed to %s", mName, outputFormat->debugString().c_str()); Loading media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -746,9 +746,15 @@ bool NuPlayer::Decoder::handleAnOutputBuffer( mOutputBuffers.editItemAt(index) = buffer; int64_t frameIndex; bool frameIndexFound = buffer->meta()->findInt64("frameIndex", &frameIndex); buffer->setRange(offset, size); buffer->meta()->clear(); buffer->meta()->setInt64("timeUs", timeUs); if (frameIndexFound) { buffer->meta()->setInt64("frameIndex", frameIndex); } bool eos = flags & MediaCodec::BUFFER_FLAG_EOS; // we do not expect CODECCONFIG or SYNCFRAME for decoder Loading Loading
media/codec2/sfplugin/CCodecBufferChannel.cpp +24 −8 Original line number Diff line number Diff line Loading @@ -245,6 +245,14 @@ status_t CCodecBufferChannel::queueInputBufferInternal(sp<MediaCodecBuffer> buff "buffer starvation on component.", mName); } } int32_t cvo = 0; if (buffer->meta()->findInt32("cvo", &cvo)) { int32_t rotation = cvo % 360; // change rotation to counter-clock wise. rotation = ((rotation <= 0) ? 0 : 360) - rotation; Mutexed<OutputSurface>::Locked output(mOutputSurface); output->rotation[queuedFrameIndex] = rotation; } work->input.buffers.push_back(c2buffer); queuedBuffers.push_back(c2buffer); } else if (eos) { Loading Loading @@ -695,6 +703,22 @@ status_t CCodecBufferChannel::renderOutputBuffer( c2Buffer->getInfo(C2StreamRotationInfo::output::PARAM_TYPE)); bool flip = rotation && (rotation->flip & 1); uint32_t quarters = ((rotation ? rotation->value : 0) / 90) & 3; { Mutexed<OutputSurface>::Locked output(mOutputSurface); if (output->surface == nullptr) { ALOGI("[%s] cannot render buffer without surface", mName); return OK; } int64_t frameIndex; buffer->meta()->findInt64("frameIndex", &frameIndex); if (output->rotation.count(frameIndex) != 0) { auto it = output->rotation.find(frameIndex); quarters = (it->second / 90) & 3; output->rotation.erase(it); } } uint32_t transform = 0; switch (quarters) { case 0: // no rotation Loading Loading @@ -738,14 +762,6 @@ status_t CCodecBufferChannel::renderOutputBuffer( hdr10PlusInfo.reset(); } { Mutexed<OutputSurface>::Locked output(mOutputSurface); if (output->surface == nullptr) { ALOGI("[%s] cannot render buffer without surface", mName); return OK; } } std::vector<C2ConstGraphicBlock> blocks = c2Buffer->data().graphicBlocks(); if (blocks.size() != 1u) { ALOGD("[%s] expected 1 graphic block, but got %zu", mName, blocks.size()); Loading
media/codec2/sfplugin/CCodecBufferChannel.h +1 −0 Original line number Diff line number Diff line Loading @@ -288,6 +288,7 @@ private: sp<Surface> surface; uint32_t generation; int maxDequeueBuffers; std::map<uint64_t, int> rotation; }; Mutexed<OutputSurface> mOutputSurface; Loading
media/codec2/sfplugin/CCodecBuffers.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -324,6 +324,7 @@ OutputBuffers::BufferAction OutputBuffers::popFromStashAndRegister( // Append information from the front stash entry to outBuffer. (*outBuffer)->meta()->setInt64("timeUs", entry.timestamp); (*outBuffer)->meta()->setInt32("flags", entry.flags); (*outBuffer)->meta()->setInt64("frameIndex", entry.ordinal.frameIndex.peekll()); if (outputFormat) { ALOGD("[%s] popFromStashAndRegister: output format changed to %s", mName, outputFormat->debugString().c_str()); Loading
media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -746,9 +746,15 @@ bool NuPlayer::Decoder::handleAnOutputBuffer( mOutputBuffers.editItemAt(index) = buffer; int64_t frameIndex; bool frameIndexFound = buffer->meta()->findInt64("frameIndex", &frameIndex); buffer->setRange(offset, size); buffer->meta()->clear(); buffer->meta()->setInt64("timeUs", timeUs); if (frameIndexFound) { buffer->meta()->setInt64("frameIndex", frameIndex); } bool eos = flags & MediaCodec::BUFFER_FLAG_EOS; // we do not expect CODECCONFIG or SYNCFRAME for decoder Loading