Loading media/codec2/sfplugin/CCodecBufferChannel.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,10 @@ namespace { constexpr size_t kSmoothnessFactor = 4; constexpr size_t kRenderingDepth = 3; // This is for keeping IGBP's buffer dropping logic in legacy mode other // than making it non-blocking. Do not change this value. const static size_t kDequeueTimeoutNs = 0; } // namespace CCodecBufferChannel::QueueGuard::QueueGuard( Loading Loading @@ -1456,6 +1460,7 @@ status_t CCodecBufferChannel::setSurface(const sp<Surface> &newSurface) { sp<IGraphicBufferProducer> producer; if (newSurface) { newSurface->setScalingMode(NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW); newSurface->setDequeueTimeout(kDequeueTimeoutNs); producer = newSurface->getIGraphicBufferProducer(); producer->setGenerationNumber(generation); } else { Loading media/codec2/vndk/platform/C2BqBuffer.cpp +22 −30 Original line number Diff line number Diff line Loading @@ -223,7 +223,6 @@ private: } }); if (!transResult.isOk() || status != android::OK) { ALOGD("cannot dequeue buffer %d", status); if (transResult.isOk()) { if (status == android::INVALID_OPERATION || status == android::TIMED_OUT || Loading @@ -233,6 +232,7 @@ private: return C2_BLOCKING; } } ALOGD("cannot dequeue buffer %d", status); return C2_BAD_VALUE; } } Loading Loading @@ -355,14 +355,9 @@ public: return mInit; } static int kMaxIgbpRetry = 20; // TODO: small number can cause crash in releasing. static int kMaxIgbpRetryDelayUs = 10000; int curTry = 0; while (curTry++ < kMaxIgbpRetry) { std::unique_lock<std::mutex> lock(mMutex); // TODO: return C2_NO_INIT if (mProducerId == 0) { std::shared_ptr<C2GraphicAllocation> alloc; c2_status_t err = mAllocator->newGraphicAllocation( Loading @@ -373,7 +368,6 @@ public: std::shared_ptr<C2BufferQueueBlockPoolData> poolData = std::make_shared<C2BufferQueueBlockPoolData>( 0, (uint64_t)0, ~0, shared_from_this()); // TODO: config? *block = _C2BlockFactory::CreateGraphicBlock(alloc, poolData); ALOGV("allocated a buffer successfully"); Loading @@ -382,13 +376,11 @@ public: c2_status_t status = fetchFromIgbp_l(width, height, format, usage, block); if (status == C2_BLOCKING) { lock.unlock(); // in order not to drain cpu from component's spinning ::usleep(kMaxIgbpRetryDelayUs); continue; } return status; } return C2_BLOCKING; } void setRenderCallback(const OnRenderCallback &renderCallback) { std::lock_guard<std::mutex> lock(mMutex); Loading media/libstagefright/ACodec.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -780,6 +780,9 @@ status_t ACodec::handleSetSurface(const sp<Surface> &surface) { // need to enable allocation when attaching surface->getIGraphicBufferProducer()->allowAllocation(true); // dequeueBuffer cannot time out surface->setDequeueTimeout(-1); // for meta data mode, we move dequeud buffers to the new surface. // for non-meta mode, we must move all registered buffers for (size_t i = 0; i < buffers.size(); ++i) { Loading media/libstagefright/MediaCodec.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -2221,6 +2221,7 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { } if (mime.startsWithIgnoreCase("video/")) { mSurface->setDequeueTimeout(-1); mSoftRenderer = new SoftwareRenderer(mSurface, mRotationDegrees); } } Loading Loading @@ -2508,6 +2509,7 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { && (mFlags & kFlagPushBlankBuffersOnShutdown)) { pushBlankBuffersToNativeWindow(mSurface.get()); } surface->setDequeueTimeout(-1); mSoftRenderer = new SoftwareRenderer(surface); // TODO: check if this was successful } else { Loading Loading
media/codec2/sfplugin/CCodecBufferChannel.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,10 @@ namespace { constexpr size_t kSmoothnessFactor = 4; constexpr size_t kRenderingDepth = 3; // This is for keeping IGBP's buffer dropping logic in legacy mode other // than making it non-blocking. Do not change this value. const static size_t kDequeueTimeoutNs = 0; } // namespace CCodecBufferChannel::QueueGuard::QueueGuard( Loading Loading @@ -1456,6 +1460,7 @@ status_t CCodecBufferChannel::setSurface(const sp<Surface> &newSurface) { sp<IGraphicBufferProducer> producer; if (newSurface) { newSurface->setScalingMode(NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW); newSurface->setDequeueTimeout(kDequeueTimeoutNs); producer = newSurface->getIGraphicBufferProducer(); producer->setGenerationNumber(generation); } else { Loading
media/codec2/vndk/platform/C2BqBuffer.cpp +22 −30 Original line number Diff line number Diff line Loading @@ -223,7 +223,6 @@ private: } }); if (!transResult.isOk() || status != android::OK) { ALOGD("cannot dequeue buffer %d", status); if (transResult.isOk()) { if (status == android::INVALID_OPERATION || status == android::TIMED_OUT || Loading @@ -233,6 +232,7 @@ private: return C2_BLOCKING; } } ALOGD("cannot dequeue buffer %d", status); return C2_BAD_VALUE; } } Loading Loading @@ -355,14 +355,9 @@ public: return mInit; } static int kMaxIgbpRetry = 20; // TODO: small number can cause crash in releasing. static int kMaxIgbpRetryDelayUs = 10000; int curTry = 0; while (curTry++ < kMaxIgbpRetry) { std::unique_lock<std::mutex> lock(mMutex); // TODO: return C2_NO_INIT if (mProducerId == 0) { std::shared_ptr<C2GraphicAllocation> alloc; c2_status_t err = mAllocator->newGraphicAllocation( Loading @@ -373,7 +368,6 @@ public: std::shared_ptr<C2BufferQueueBlockPoolData> poolData = std::make_shared<C2BufferQueueBlockPoolData>( 0, (uint64_t)0, ~0, shared_from_this()); // TODO: config? *block = _C2BlockFactory::CreateGraphicBlock(alloc, poolData); ALOGV("allocated a buffer successfully"); Loading @@ -382,13 +376,11 @@ public: c2_status_t status = fetchFromIgbp_l(width, height, format, usage, block); if (status == C2_BLOCKING) { lock.unlock(); // in order not to drain cpu from component's spinning ::usleep(kMaxIgbpRetryDelayUs); continue; } return status; } return C2_BLOCKING; } void setRenderCallback(const OnRenderCallback &renderCallback) { std::lock_guard<std::mutex> lock(mMutex); Loading
media/libstagefright/ACodec.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -780,6 +780,9 @@ status_t ACodec::handleSetSurface(const sp<Surface> &surface) { // need to enable allocation when attaching surface->getIGraphicBufferProducer()->allowAllocation(true); // dequeueBuffer cannot time out surface->setDequeueTimeout(-1); // for meta data mode, we move dequeud buffers to the new surface. // for non-meta mode, we must move all registered buffers for (size_t i = 0; i < buffers.size(); ++i) { Loading
media/libstagefright/MediaCodec.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -2221,6 +2221,7 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { } if (mime.startsWithIgnoreCase("video/")) { mSurface->setDequeueTimeout(-1); mSoftRenderer = new SoftwareRenderer(mSurface, mRotationDegrees); } } Loading Loading @@ -2508,6 +2509,7 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { && (mFlags & kFlagPushBlankBuffersOnShutdown)) { pushBlankBuffersToNativeWindow(mSurface.get()); } surface->setDequeueTimeout(-1); mSoftRenderer = new SoftwareRenderer(surface); // TODO: check if this was successful } else { Loading