Loading media/codec2/core/include/C2Config.h +27 −0 Original line number Diff line number Diff line Loading @@ -262,6 +262,8 @@ enum C2ParamIndexKind : C2Param::type_index_t { kParamIndexTunneledMode, // struct kParamIndexTunnelHandle, // int32[] kParamIndexTunnelSystemTime, // int64 kParamIndexTunnelHoldRender, // bool kParamIndexTunnelStartRender, // bool // dmabuf allocator kParamIndexStoreDmaBufUsage, // store, struct Loading Loading @@ -2366,6 +2368,31 @@ typedef C2PortParam<C2Info, C2SimpleValueStruct<int64_t>, kParamIndexTunnelSyste C2PortTunnelSystemTime; constexpr char C2_PARAMKEY_OUTPUT_RENDER_TIME[] = "output.render-time"; /** * Tunneled mode video peek signaling flag. * * When a video frame is pushed to the decoder with this parameter set to true, * the decoder must decode the frame, signal partial completion, and hold on the * frame until C2StreamTunnelStartRender is set to true (which resets this * flag). Flush will also result in the frames being returned back to the * client (but not rendered). */ typedef C2StreamParam<C2Info, C2EasyBoolValue, kParamIndexTunnelHoldRender> C2StreamTunnelHoldRender; constexpr char C2_PARAMKEY_TUNNEL_HOLD_RENDER[] = "output.tunnel-hold-render"; /** * Tunneled mode video peek signaling flag. * * Upon receiving this flag, the decoder shall set C2StreamTunnelHoldRender to * false, which shall cause any frames held for rendering to be immediately * displayed, regardless of their timestamps. */ typedef C2StreamParam<C2Info, C2EasyBoolValue, kParamIndexTunnelStartRender> C2StreamTunnelStartRender; constexpr char C2_PARAMKEY_TUNNEL_START_RENDER[] = "output.tunnel-start-render"; C2ENUM(C2PlatformConfig::encoding_quality_level_t, uint32_t, NONE, S_HANDHELD, Loading media/codec2/sfplugin/CCodec.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -673,6 +673,10 @@ public: mCodec->mCallback->onOutputBuffersChanged(); } void onFirstTunnelFrameReady() override { mCodec->mCallback->onFirstTunnelFrameReady(); } private: CCodec *mCodec; }; Loading media/codec2/sfplugin/CCodecBufferChannel.cpp +20 −0 Original line number Diff line number Diff line Loading @@ -209,6 +209,7 @@ status_t CCodecBufferChannel::queueInputBufferInternal( int32_t flags = 0; int32_t tmp = 0; bool eos = false; bool tunnelFirstFrame = false; if (buffer->meta()->findInt32("eos", &tmp) && tmp) { eos = true; mInputMetEos = true; Loading @@ -217,6 +218,9 @@ status_t CCodecBufferChannel::queueInputBufferInternal( if (buffer->meta()->findInt32("csd", &tmp) && tmp) { flags |= C2FrameData::FLAG_CODEC_CONFIG; } if (buffer->meta()->findInt32("tunnel-first-frame", &tmp) && tmp) { tunnelFirstFrame = true; } ALOGV("[%s] queueInputBuffer: buffer->size() = %zu", mName, buffer->size()); std::list<std::unique_ptr<C2Work>> items; std::unique_ptr<C2Work> work(new C2Work); Loading Loading @@ -288,6 +292,13 @@ status_t CCodecBufferChannel::queueInputBufferInternal( // TODO: fill info's work->input.configUpdate = std::move(mParamsToBeSet); if (tunnelFirstFrame) { C2StreamTunnelHoldRender::input tunnelHoldRender{ 0u /* stream */, C2_TRUE /* value */ }; work->input.configUpdate.push_back(C2Param::Copy(tunnelHoldRender)); } work->worklets.clear(); work->worklets.emplace_back(new C2Worklet); Loading Loading @@ -1724,6 +1735,15 @@ bool CCodecBufferChannel::handleWork( } break; } case C2StreamTunnelHoldRender::CORE_INDEX: { C2StreamTunnelHoldRender::output firstTunnelFrameHoldRender; if (!(worklet->output.flags & C2FrameData::FLAG_INCOMPLETE)) break; if (!firstTunnelFrameHoldRender.updateFrom(*param)) break; if (firstTunnelFrameHoldRender.value != C2_TRUE) break; ALOGV("[%s] onWorkDone: first tunnel frame ready", mName); mCCodecCallback->onFirstTunnelFrameReady(); break; } default: ALOGV("[%s] onWorkDone: unrecognized config update (%08X)", mName, param->index()); Loading media/codec2/sfplugin/CCodecBufferChannel.h +1 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ public: virtual void onError(status_t err, enum ActionCode actionCode) = 0; virtual void onOutputFramesRendered(int64_t mediaTimeUs, nsecs_t renderTimeNs) = 0; virtual void onOutputBuffersChanged() = 0; virtual void onFirstTunnelFrameReady() = 0; }; /** Loading media/codec2/sfplugin/CCodecConfig.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -938,6 +938,14 @@ void CCodecConfig::initializeStandardParams() { return value == 0 ? C2_FALSE : C2_TRUE; })); add(ConfigMapper("android._trigger-tunnel-peek", C2_PARAMKEY_TUNNEL_START_RENDER, "value") .limitTo(D::PARAM & D::VIDEO & D::DECODER) .withMapper([](C2Value v) -> C2Value { int32_t value = 0; (void)v.get(&value); return value == 0 ? C2_FALSE : C2_TRUE; })); /* still to do constexpr char KEY_PUSH_BLANK_BUFFERS_ON_STOP[] = "push-blank-buffers-on-shutdown"; Loading Loading
media/codec2/core/include/C2Config.h +27 −0 Original line number Diff line number Diff line Loading @@ -262,6 +262,8 @@ enum C2ParamIndexKind : C2Param::type_index_t { kParamIndexTunneledMode, // struct kParamIndexTunnelHandle, // int32[] kParamIndexTunnelSystemTime, // int64 kParamIndexTunnelHoldRender, // bool kParamIndexTunnelStartRender, // bool // dmabuf allocator kParamIndexStoreDmaBufUsage, // store, struct Loading Loading @@ -2366,6 +2368,31 @@ typedef C2PortParam<C2Info, C2SimpleValueStruct<int64_t>, kParamIndexTunnelSyste C2PortTunnelSystemTime; constexpr char C2_PARAMKEY_OUTPUT_RENDER_TIME[] = "output.render-time"; /** * Tunneled mode video peek signaling flag. * * When a video frame is pushed to the decoder with this parameter set to true, * the decoder must decode the frame, signal partial completion, and hold on the * frame until C2StreamTunnelStartRender is set to true (which resets this * flag). Flush will also result in the frames being returned back to the * client (but not rendered). */ typedef C2StreamParam<C2Info, C2EasyBoolValue, kParamIndexTunnelHoldRender> C2StreamTunnelHoldRender; constexpr char C2_PARAMKEY_TUNNEL_HOLD_RENDER[] = "output.tunnel-hold-render"; /** * Tunneled mode video peek signaling flag. * * Upon receiving this flag, the decoder shall set C2StreamTunnelHoldRender to * false, which shall cause any frames held for rendering to be immediately * displayed, regardless of their timestamps. */ typedef C2StreamParam<C2Info, C2EasyBoolValue, kParamIndexTunnelStartRender> C2StreamTunnelStartRender; constexpr char C2_PARAMKEY_TUNNEL_START_RENDER[] = "output.tunnel-start-render"; C2ENUM(C2PlatformConfig::encoding_quality_level_t, uint32_t, NONE, S_HANDHELD, Loading
media/codec2/sfplugin/CCodec.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -673,6 +673,10 @@ public: mCodec->mCallback->onOutputBuffersChanged(); } void onFirstTunnelFrameReady() override { mCodec->mCallback->onFirstTunnelFrameReady(); } private: CCodec *mCodec; }; Loading
media/codec2/sfplugin/CCodecBufferChannel.cpp +20 −0 Original line number Diff line number Diff line Loading @@ -209,6 +209,7 @@ status_t CCodecBufferChannel::queueInputBufferInternal( int32_t flags = 0; int32_t tmp = 0; bool eos = false; bool tunnelFirstFrame = false; if (buffer->meta()->findInt32("eos", &tmp) && tmp) { eos = true; mInputMetEos = true; Loading @@ -217,6 +218,9 @@ status_t CCodecBufferChannel::queueInputBufferInternal( if (buffer->meta()->findInt32("csd", &tmp) && tmp) { flags |= C2FrameData::FLAG_CODEC_CONFIG; } if (buffer->meta()->findInt32("tunnel-first-frame", &tmp) && tmp) { tunnelFirstFrame = true; } ALOGV("[%s] queueInputBuffer: buffer->size() = %zu", mName, buffer->size()); std::list<std::unique_ptr<C2Work>> items; std::unique_ptr<C2Work> work(new C2Work); Loading Loading @@ -288,6 +292,13 @@ status_t CCodecBufferChannel::queueInputBufferInternal( // TODO: fill info's work->input.configUpdate = std::move(mParamsToBeSet); if (tunnelFirstFrame) { C2StreamTunnelHoldRender::input tunnelHoldRender{ 0u /* stream */, C2_TRUE /* value */ }; work->input.configUpdate.push_back(C2Param::Copy(tunnelHoldRender)); } work->worklets.clear(); work->worklets.emplace_back(new C2Worklet); Loading Loading @@ -1724,6 +1735,15 @@ bool CCodecBufferChannel::handleWork( } break; } case C2StreamTunnelHoldRender::CORE_INDEX: { C2StreamTunnelHoldRender::output firstTunnelFrameHoldRender; if (!(worklet->output.flags & C2FrameData::FLAG_INCOMPLETE)) break; if (!firstTunnelFrameHoldRender.updateFrom(*param)) break; if (firstTunnelFrameHoldRender.value != C2_TRUE) break; ALOGV("[%s] onWorkDone: first tunnel frame ready", mName); mCCodecCallback->onFirstTunnelFrameReady(); break; } default: ALOGV("[%s] onWorkDone: unrecognized config update (%08X)", mName, param->index()); Loading
media/codec2/sfplugin/CCodecBufferChannel.h +1 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ public: virtual void onError(status_t err, enum ActionCode actionCode) = 0; virtual void onOutputFramesRendered(int64_t mediaTimeUs, nsecs_t renderTimeNs) = 0; virtual void onOutputBuffersChanged() = 0; virtual void onFirstTunnelFrameReady() = 0; }; /** Loading
media/codec2/sfplugin/CCodecConfig.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -938,6 +938,14 @@ void CCodecConfig::initializeStandardParams() { return value == 0 ? C2_FALSE : C2_TRUE; })); add(ConfigMapper("android._trigger-tunnel-peek", C2_PARAMKEY_TUNNEL_START_RENDER, "value") .limitTo(D::PARAM & D::VIDEO & D::DECODER) .withMapper([](C2Value v) -> C2Value { int32_t value = 0; (void)v.get(&value); return value == 0 ? C2_FALSE : C2_TRUE; })); /* still to do constexpr char KEY_PUSH_BLANK_BUFFERS_ON_STOP[] = "push-blank-buffers-on-shutdown"; Loading