diff --git a/.gitattributes b/.gitattributes index 55920c693..faf076f3f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1 @@ test/unittest/resources/reference_parser_test/mp4/*.mp4 filter=lfs diff=lfs merge=lfs -text -test/unittest/resources/reference_parser_test/json/*.json filter=lfs diff=lfs merge=lfs -text diff --git a/services/media_engine/plugins/ffmpeg_adapter/demuxer/ffmpeg_reference_parser.cpp b/services/media_engine/plugins/ffmpeg_adapter/demuxer/ffmpeg_reference_parser.cpp index 07abeed23..ced0251f0 100644 --- a/services/media_engine/plugins/ffmpeg_adapter/demuxer/ffmpeg_reference_parser.cpp +++ b/services/media_engine/plugins/ffmpeg_adapter/demuxer/ffmpeg_reference_parser.cpp @@ -39,7 +39,7 @@ namespace { constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, LOG_DOMAIN_DEMUXER, "FfmpegReferenceParser" }; -constexpr int32_t REFERENCE_PARSER_TIMEOUT_MS = 20000; +constexpr int64_t REFERENCE_PARSER_TIMEOUT_MS = 20000; } namespace OHOS { @@ -247,7 +247,8 @@ Status FFmpegDemuxerPlugin::ParserRefInfoLoop(AVPacket *pkt, uint32_t curStreamI return Status::ERROR_UNKNOWN; } InsertIframePtsMap(pkt, parserCurGopId_, parserRefVideoStreamIdx_, iFramePtsMap_); - FALSE_RETURN_V_NOLOG(pkt->stream_index == parserRefVideoStreamIdx_ || ffmpegRet == AVERROR_EOF, Status::OK); + FALSE_RETURN_V_MSG_D(pkt->stream_index == parserRefVideoStreamIdx_ || ffmpegRet == AVERROR_EOF, Status::OK, + "eos or not video"); int64_t dts = AvTime2Us( ConvertTimeFromFFmpeg(pkt->dts, parserRefFormatContext_->streams[parserRefVideoStreamIdx_]->time_base)); Status result = referenceParser_->ParserNalUnits(pkt->data, pkt->size, curStreamId, dts); @@ -376,7 +377,7 @@ Status FFmpegDemuxerPlugin::ParserRefInfo() auto now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()); auto duration = now - std::chrono::milliseconds(start.count()); - FALSE_RETURN_V_MSG_W(duration < std::chrono::milliseconds(REFERENCE_PARSER_TIMEOUT_MS), Status::ERROR_UNKNOWN, + FALSE_RETURN_V_MSG_W(duration.count() < REFERENCE_PARSER_TIMEOUT_MS, Status::ERROR_UNKNOWN, "reference parser timeout"); } diff --git a/test/moduletest/demuxer/src/InnerAPI/parser_test.cpp b/test/moduletest/demuxer/src/InnerAPI/parser_test.cpp index 49c989d1c..2310f6aea 100644 --- a/test/moduletest/demuxer/src/InnerAPI/parser_test.cpp +++ b/test/moduletest/demuxer/src/InnerAPI/parser_test.cpp @@ -1034,7 +1034,22 @@ HWTEST_F(InnerParsercNdkTest, DEMUXER_REFERENCE_HDR_0010, TestSize.Level1) } shared_ptr parserSample = make_shared(g_file_hdr_1_hevc); parserSample->InitParameter(MP4Scene::HDR_1_HEVC); - ASSERT_TRUE(parserSample->RunSeekScene(WorkPts::END_PTS)); + ASSERT_TRUE(parserSample->RunSeekScene(WorkPts::RANDOM_PTS)); +} + +/** + * @tc.number : DEMUXER_REFERENCE_HDR_0011 + * @tc.name : Randomly generating Pts corresponding to the N existing positions frame in HDR sequence + * @tc.desc : func test + */ +HWTEST_F(InnerParsercNdkTest, DEMUXER_REFERENCE_HDR_0011, TestSize.Level1) +{ + if (access(HEVC_LIB_PATH.c_str(), F_OK) != 0) { + return; + } + shared_ptr parserSample = make_shared(g_file_hdr_1_hevc); + parserSample->InitParameter(MP4Scene::HDR_1_HEVC); + ASSERT_TRUE(parserSample->RunSpeedScene(WorkPts::RANDOM_PTS)); } /** diff --git a/test/unittest/resources/reference_parser_test/json/ipb_0_frame.json b/test/unittest/resources/reference_parser_test/json/ipb_0_frame.json deleted file mode 100644 index 1f94f4dd5..000000000 --- a/test/unittest/resources/reference_parser_test/json/ipb_0_frame.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:839a846804c53390f5993518bf2eee6c5d10b88354f63fd80cd734d4859b4cc3 -size 13650 diff --git a/test/unittest/resources/reference_parser_test/json/ipb_0_gop.json b/test/unittest/resources/reference_parser_test/json/ipb_0_gop.json deleted file mode 100644 index bd1b7482e..000000000 --- a/test/unittest/resources/reference_parser_test/json/ipb_0_gop.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:60a8ff7faeb4db2f08cf04bcc6ea64d14e524b55c899b34dc38409388cdbc878 -size 178 diff --git a/test/unittest/resources/reference_parser_test/json/ipb_1_frame.json b/test/unittest/resources/reference_parser_test/json/ipb_1_frame.json deleted file mode 100644 index 3a855d918..000000000 --- a/test/unittest/resources/reference_parser_test/json/ipb_1_frame.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:42b0701d91c39a72b2d8ee15f410b29d8588f2df767c92d06a678329330293e6 -size 6808 diff --git a/test/unittest/resources/reference_parser_test/json/ipb_1_gop.json b/test/unittest/resources/reference_parser_test/json/ipb_1_gop.json deleted file mode 100644 index a6c4a9cdc..000000000 --- a/test/unittest/resources/reference_parser_test/json/ipb_1_gop.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ec86dedec93fcbfbd76e4de5a27510393a4638385453cdd122ad706ee2e18f45 -size 178 diff --git a/test/unittest/resources/reference_parser_test/json/ippp_0_frame.json b/test/unittest/resources/reference_parser_test/json/ippp_0_frame.json deleted file mode 100644 index 757732333..000000000 --- a/test/unittest/resources/reference_parser_test/json/ippp_0_frame.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9d9bbf1669575934fcf436426b0286b69235ccc8d6ea7abfab5e8ab80cc17dec -size 290391 diff --git a/test/unittest/resources/reference_parser_test/json/ippp_0_gop.json b/test/unittest/resources/reference_parser_test/json/ippp_0_gop.json deleted file mode 100644 index 603313f92..000000000 --- a/test/unittest/resources/reference_parser_test/json/ippp_0_gop.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:97b897cd4e7df1c9f1ced415d863944577e0617fcf613dc61066d777198daef3 -size 3795 diff --git a/test/unittest/resources/reference_parser_test/json/ippp_1_frame.json b/test/unittest/resources/reference_parser_test/json/ippp_1_frame.json deleted file mode 100644 index 0c96ef067..000000000 --- a/test/unittest/resources/reference_parser_test/json/ippp_1_frame.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:04e1826d44e5352ff8ad853453c1265bc8a379ae5b7b621ff705a8fab73acf47 -size 116611 diff --git a/test/unittest/resources/reference_parser_test/json/ippp_1_gop.json b/test/unittest/resources/reference_parser_test/json/ippp_1_gop.json deleted file mode 100644 index 9b1e36a4f..000000000 --- a/test/unittest/resources/reference_parser_test/json/ippp_1_gop.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:70e00c24b3f41db0ef1529548158c775559ff31fb9c07767aa6cb53eec97adb9 -size 3048 diff --git a/test/unittest/resources/reference_parser_test/json/ippp_scala_0_frame.json b/test/unittest/resources/reference_parser_test/json/ippp_scala_0_frame.json deleted file mode 100644 index bccd18412..000000000 --- a/test/unittest/resources/reference_parser_test/json/ippp_scala_0_frame.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:49286c42c37c797f17cd3f4a40888a419a8a794829bbf5f7aaa210dffa6b8158 -size 57968 diff --git a/test/unittest/resources/reference_parser_test/json/ippp_scala_0_gop.json b/test/unittest/resources/reference_parser_test/json/ippp_scala_0_gop.json deleted file mode 100644 index 6cbeaa00d..000000000 --- a/test/unittest/resources/reference_parser_test/json/ippp_scala_0_gop.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e83307e1a057cf3b6829e6ad9301891568ec4d389c96ea7599ddfa23846f0c7a -size 801 diff --git a/test/unittest/resources/reference_parser_test/json/ippp_scala_1_frame.json b/test/unittest/resources/reference_parser_test/json/ippp_scala_1_frame.json deleted file mode 100644 index 08d37fd78..000000000 --- a/test/unittest/resources/reference_parser_test/json/ippp_scala_1_frame.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c23cfc3e750dee251ed5c9f7b4fa7487efbf8be1230fe86ef0e935c8945ef211 -size 5686 diff --git a/test/unittest/resources/reference_parser_test/json/ippp_scala_1_gop.json b/test/unittest/resources/reference_parser_test/json/ippp_scala_1_gop.json deleted file mode 100644 index 643799950..000000000 --- a/test/unittest/resources/reference_parser_test/json/ippp_scala_1_gop.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f3eba9c703979ad45e2e2a06e9665529cd2d6a17157c2d867ac24c30080217ef -size 442 diff --git a/test/unittest/resources/reference_parser_test/json/sdtp_ext_frame.json b/test/unittest/resources/reference_parser_test/json/sdtp_ext_frame.json deleted file mode 100644 index 38baa8abb..000000000 --- a/test/unittest/resources/reference_parser_test/json/sdtp_ext_frame.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5069c1063f5cb2ff5dacdaf18e284cdd22cd0ebd69e27ce118539fa8a3cb49bf -size 33581 diff --git a/test/unittest/resources/reference_parser_test/json/sdtp_ext_gop.json b/test/unittest/resources/reference_parser_test/json/sdtp_ext_gop.json deleted file mode 100644 index 9d575f433..000000000 --- a/test/unittest/resources/reference_parser_test/json/sdtp_ext_gop.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5cc05435c2b946521ca94334f6631f4d39e72e37d81a570153d670d7533fe184 -size 533 diff --git a/test/unittest/resources/reference_parser_test/json/sdtp_frame.json b/test/unittest/resources/reference_parser_test/json/sdtp_frame.json deleted file mode 100644 index 14905dc70..000000000 --- a/test/unittest/resources/reference_parser_test/json/sdtp_frame.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c3f60c22dde85e743d184e609142a3e250b7a8dc0bf721fc58c4883d7a683dcc -size 61174 diff --git a/test/unittest/resources/reference_parser_test/json/sdtp_gop.json b/test/unittest/resources/reference_parser_test/json/sdtp_gop.json deleted file mode 100644 index d7a2b1bc0..000000000 --- a/test/unittest/resources/reference_parser_test/json/sdtp_gop.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3151c7b1ddb3ead81d5513a7354cdf3c43b1904cd1fd45a6034c13dd4db7a2cd -size 1608