diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2019-09-14 23:18:34 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2019-09-14 23:18:34 +0000 |
commit | b567678cbce7b2ddaa21636560103742674e538b (patch) | |
tree | 6b1d8db97e5f7f22f2dfce72d9e051b770579b3c | |
parent | d26bf3eb00f77234a7d2130c639831167a977ce6 (diff) | |
parent | 1f1b954261e8821a7bf03c25abfd127dcc1f4844 (diff) | |
download | av-b567678cbce7b2ddaa21636560103742674e538b.tar.gz |
Snap for 5876498 from 1f1b954261e8821a7bf03c25abfd127dcc1f4844 to qt-qpr1-release
Change-Id: I92f70b5fbdf2c6296b0cb60af00f9f69a18cd889
-rw-r--r-- | media/codec2/components/avc/C2SoftAvcDec.cpp | 29 | ||||
-rw-r--r-- | media/codec2/components/avc/C2SoftAvcDec.h | 2 | ||||
-rw-r--r-- | media/codec2/components/hevc/C2SoftHevcDec.cpp | 28 | ||||
-rw-r--r-- | media/codec2/components/hevc/C2SoftHevcDec.h | 2 |
4 files changed, 54 insertions, 7 deletions
diff --git a/media/codec2/components/avc/C2SoftAvcDec.cpp b/media/codec2/components/avc/C2SoftAvcDec.cpp index 3f015b464c..fa98178187 100644 --- a/media/codec2/components/avc/C2SoftAvcDec.cpp +++ b/media/codec2/components/avc/C2SoftAvcDec.cpp @@ -33,7 +33,8 @@ namespace android { namespace { constexpr char COMPONENT_NAME[] = "c2.android.avc.decoder"; - +constexpr uint32_t kDefaultOutputDelay = 8; +constexpr uint32_t kMaxOutputDelay = 16; } // namespace class C2SoftAvcDec::IntfImpl : public SimpleInterface<void>::BaseParams { @@ -54,7 +55,9 @@ public: // TODO: Proper support for reorder depth. addParameter( DefineParam(mActualOutputDelay, C2_PARAMKEY_OUTPUT_DELAY) - .withConstValue(new C2PortActualDelayTuning::output(8u)) + .withDefault(new C2PortActualDelayTuning::output(kDefaultOutputDelay)) + .withFields({C2F(mActualOutputDelay, value).inRange(0, kMaxOutputDelay)}) + .withSetter(Setter<decltype(*mActualOutputDelay)>::StrictValueWithNoDeps) .build()); // TODO: output latency and reordering @@ -196,7 +199,6 @@ public: 0u, HAL_PIXEL_FORMAT_YCBCR_420_888)) .build()); } - static C2R SizeSetter(bool mayBlock, const C2P<C2StreamPictureSizeInfo::output> &oldMe, C2P<C2StreamPictureSizeInfo::output> &me) { (void)mayBlock; @@ -333,6 +335,7 @@ C2SoftAvcDec::C2SoftAvcDec( mDecHandle(nullptr), mOutBufferFlush(nullptr), mIvColorFormat(IV_YUV_420P), + mOutputDelay(kDefaultOutputDelay), mWidth(320), mHeight(240), mHeaderDecoded(false), @@ -882,6 +885,26 @@ void C2SoftAvcDec::process( work->result = C2_CORRUPTED; return; } + if (s_decode_op.i4_reorder_depth >= 0 && mOutputDelay != s_decode_op.i4_reorder_depth) { + mOutputDelay = s_decode_op.i4_reorder_depth; + ALOGV("New Output delay %d ", mOutputDelay); + + C2PortActualDelayTuning::output outputDelay(mOutputDelay); + std::vector<std::unique_ptr<C2SettingResult>> failures; + c2_status_t err = + mIntf->config({&outputDelay}, C2_MAY_BLOCK, &failures); + if (err == OK) { + work->worklets.front()->output.configUpdate.push_back( + C2Param::Copy(outputDelay)); + } else { + ALOGE("Cannot set output delay"); + mSignalledError = true; + work->workletsProcessed = 1u; + work->result = C2_CORRUPTED; + return; + } + continue; + } if (0 < s_decode_op.u4_pic_wd && 0 < s_decode_op.u4_pic_ht) { if (mHeaderDecoded == false) { mHeaderDecoded = true; diff --git a/media/codec2/components/avc/C2SoftAvcDec.h b/media/codec2/components/avc/C2SoftAvcDec.h index 72ee583a33..4414a26c96 100644 --- a/media/codec2/components/avc/C2SoftAvcDec.h +++ b/media/codec2/components/avc/C2SoftAvcDec.h @@ -157,7 +157,7 @@ private: size_t mNumCores; IV_COLOR_FORMAT_T mIvColorFormat; - + uint32_t mOutputDelay; uint32_t mWidth; uint32_t mHeight; uint32_t mStride; diff --git a/media/codec2/components/hevc/C2SoftHevcDec.cpp b/media/codec2/components/hevc/C2SoftHevcDec.cpp index 7232572789..df677c284e 100644 --- a/media/codec2/components/hevc/C2SoftHevcDec.cpp +++ b/media/codec2/components/hevc/C2SoftHevcDec.cpp @@ -33,7 +33,8 @@ namespace android { namespace { constexpr char COMPONENT_NAME[] = "c2.android.hevc.decoder"; - +constexpr uint32_t kDefaultOutputDelay = 8; +constexpr uint32_t kMaxOutputDelay = 16; } // namespace class C2SoftHevcDec::IntfImpl : public SimpleInterface<void>::BaseParams { @@ -54,7 +55,9 @@ public: // TODO: Proper support for reorder depth. addParameter( DefineParam(mActualOutputDelay, C2_PARAMKEY_OUTPUT_DELAY) - .withConstValue(new C2PortActualDelayTuning::output(8u)) + .withDefault(new C2PortActualDelayTuning::output(kDefaultOutputDelay)) + .withFields({C2F(mActualOutputDelay, value).inRange(0, kMaxOutputDelay)}) + .withSetter(Setter<decltype(*mActualOutputDelay)>::StrictValueWithNoDeps) .build()); addParameter( @@ -327,6 +330,7 @@ C2SoftHevcDec::C2SoftHevcDec( mDecHandle(nullptr), mOutBufferFlush(nullptr), mIvColorformat(IV_YUV_420P), + mOutputDelay(kDefaultOutputDelay), mWidth(320), mHeight(240), mHeaderDecoded(false), @@ -877,6 +881,26 @@ void C2SoftHevcDec::process( work->result = C2_CORRUPTED; return; } + if (s_decode_op.i4_reorder_depth >= 0 && mOutputDelay != s_decode_op.i4_reorder_depth) { + mOutputDelay = s_decode_op.i4_reorder_depth; + ALOGV("New Output delay %d ", mOutputDelay); + + C2PortActualDelayTuning::output outputDelay(mOutputDelay); + std::vector<std::unique_ptr<C2SettingResult>> failures; + c2_status_t err = + mIntf->config({&outputDelay}, C2_MAY_BLOCK, &failures); + if (err == OK) { + work->worklets.front()->output.configUpdate.push_back( + C2Param::Copy(outputDelay)); + } else { + ALOGE("Cannot set output delay"); + mSignalledError = true; + work->workletsProcessed = 1u; + work->result = C2_CORRUPTED; + return; + } + continue; + } if (0 < s_decode_op.u4_pic_wd && 0 < s_decode_op.u4_pic_ht) { if (mHeaderDecoded == false) { mHeaderDecoded = true; diff --git a/media/codec2/components/hevc/C2SoftHevcDec.h b/media/codec2/components/hevc/C2SoftHevcDec.h index b7664e65e5..ce63a6c4c3 100644 --- a/media/codec2/components/hevc/C2SoftHevcDec.h +++ b/media/codec2/components/hevc/C2SoftHevcDec.h @@ -115,7 +115,7 @@ struct C2SoftHevcDec : public SimpleC2Component { size_t mNumCores; IV_COLOR_FORMAT_T mIvColorformat; - + uint32_t mOutputDelay; uint32_t mWidth; uint32_t mHeight; uint32_t mStride; |