【修改说明】fix bug

Signed-off-by: wangyongkai <wangyongkai5@h-partners.com>
This commit is contained in:
wangyongkai 2024-09-20 16:25:53 +08:00
parent 75ad80a1dd
commit 99482069dd
3 changed files with 11 additions and 3 deletions

View File

@ -629,7 +629,8 @@ void VideoEncSample::PrepareInner()
time_ = chrono::time_point_cast<chrono::milliseconds>(chrono::system_clock::now()).time_since_epoch().count();
}
void VideoEncSample::InputLtrParam(std::shared_ptr<FormatMock> format, int32_t frameInputCount)
void VideoEncSample::InputLtrParam(std::shared_ptr<FormatMock> format, int32_t frameInputCount,
std::shared_ptr<AVBufferMock> buffer)
{
if (!ltrParam.enableUseLtr) {
return;
@ -647,6 +648,9 @@ void VideoEncSample::InputLtrParam(std::shared_ptr<FormatMock> format, int32_t f
} else if (frameInputCount == useLtrIndex && frameInputCount > 0) {
format->PutIntValue(Media::Tag::VIDEO_ENCODER_PER_FRAME_USE_LTR, frameInputCount - interval);
}
if (buffer) {
buffer->SetParameter(format);
}
}
void VideoEncSample::InputParamLoopFunc()
@ -678,7 +682,7 @@ void VideoEncSample::InputParamLoopFunc()
format->PutIntValue(Media::Tag::VIDEO_ENCODER_PER_FRAME_DISCARD, 1);
}
InputLtrParam(format, frameInputCount_);
InputLtrParam(format, frameInputCount_, nullptr);
UNITTEST_INFO_LOG("parameter: %s", format->DumpInfo());
int32_t ret = PushInputParameter(index);
@ -961,6 +965,7 @@ int32_t VideoEncSample::InputLoopInnerExt()
for (int32_t i = 0; i < attr.size; i += stride) {
(void)inFile_->read(dst + i, DEFAULT_WIDTH_VENC);
}
InputLtrParam(format, frameInputCount_, buffer);
}
if (attr.flags & AVCODEC_BUFFER_FLAG_EOS) {

View File

@ -171,7 +171,8 @@ private:
int32_t OutputLoopInnerExt();
int32_t InputLoopInnerExt();
void CheckFormatKey(OH_AVCodecBufferAttr attr, std::shared_ptr<AVBufferMock> buffer);
void InputLtrParam(std::shared_ptr<FormatMock> format, int32_t frameInputCount);
void InputLtrParam(std::shared_ptr<FormatMock> format, int32_t frameInputCount,
std::shared_ptr<AVBufferMock> buffer);
void CheckSHA();
void PerformEosFrameAndVerifiedSHA();
std::shared_ptr<VideoEncMock> videoEnc_ = nullptr;

View File

@ -36,6 +36,7 @@ using namespace OHOS::Media;
namespace {
constexpr int32_t DEFAULT_LTR_COUNT = 4;
constexpr int32_t DEFAULT_LTR_INTERVAL = 4;
class TEST_SUIT : public testing::TestWithParam<int32_t> {
public:
static void SetUpTestCase(void);
@ -652,6 +653,7 @@ HWTEST_P(TEST_SUIT, VideoEncoder_Feature_Long_Term_Reference_001, TestSize.Level
if (!GetTemporalScalabilityCapability(GetParam(), false)) {
return;
};
videoEnc_->isAVBufferMode_ = true;
CreateByNameWithParam(GetParam());
SetFormatWithParam(GetParam());
PrepareSource(GetParam());