diff --git a/modules/video_coding/BUILD.gn b/modules/video_coding/BUILD.gn index 731ef211bd..e69fb867cd 100644 --- a/modules/video_coding/BUILD.gn +++ b/modules/video_coding/BUILD.gn @@ -1088,7 +1088,10 @@ if (rtc_include_tests) { if (is_android) { sources += [ "codecs/test/videocodec_test_mediacodec.cc" ] - deps += [ ":android_codec_factory_helper" ] + deps += [ + ":android_codec_factory_helper", + "../../rtc_base:stringutils", + ] } if (is_ios || is_mac) { diff --git a/modules/video_coding/codecs/test/videocodec_test_mediacodec.cc b/modules/video_coding/codecs/test/videocodec_test_mediacodec.cc index 8a1cf01a66..fce21544b4 100644 --- a/modules/video_coding/codecs/test/videocodec_test_mediacodec.cc +++ b/modules/video_coding/codecs/test/videocodec_test_mediacodec.cc @@ -17,6 +17,7 @@ #include "media/base/media_constants.h" #include "modules/video_coding/codecs/test/android_codec_factory_helper.h" #include "modules/video_coding/codecs/test/videocodec_test_fixture_impl.h" +#include "rtc_base/strings/string_builder.h" #include "test/gtest.h" #include "test/testsupport/file_utils.h" @@ -27,34 +28,48 @@ namespace { const int kForemanNumFrames = 300; const int kForemanFramerateFps = 30; +struct RateProfileData { + std::string name; + std::vector rate_profile; +}; + const size_t kConstRateIntervalSec = 10; -const std::vector kBitRateHighLowHigh = { - {/*target_kbps=*/3000, /*input_fps=*/30, /*frame_num=*/0}, - {/*target_kbps=*/1500, /*input_fps=*/30, /*frame_num=*/300}, - {/*target_kbps=*/750, /*input_fps=*/30, /*frame_num=*/600}, - {/*target_kbps=*/1500, /*input_fps=*/30, /*frame_num=*/900}, - {/*target_kbps=*/3000, /*input_fps=*/30, /*frame_num=*/1200}}; -const std::vector kBitRateLowHighLow = { - {/*target_kbps=*/750, /*input_fps=*/30, /*frame_num=*/0}, - {/*target_kbps=*/1500, /*input_fps=*/30, /*frame_num=*/300}, - {/*target_kbps=*/3000, /*input_fps=*/30, /*frame_num=*/600}, - {/*target_kbps=*/1500, /*input_fps=*/30, /*frame_num=*/900}, - {/*target_kbps=*/720, /*input_fps=*/30, /*frame_num=*/1200}}; +const RateProfileData kBitRateHighLowHigh = { + /*name=*/"BitRateHighLowHigh", + /*rate_profile=*/{ + {/*target_kbps=*/3000, /*input_fps=*/30, /*frame_num=*/0}, + {/*target_kbps=*/1500, /*input_fps=*/30, /*frame_num=*/300}, + {/*target_kbps=*/750, /*input_fps=*/30, /*frame_num=*/600}, + {/*target_kbps=*/1500, /*input_fps=*/30, /*frame_num=*/900}, + {/*target_kbps=*/3000, /*input_fps=*/30, /*frame_num=*/1200}}}; -const std::vector kFrameRateHighLowHigh = { - {/*target_kbps=*/2000, /*input_fps=*/30, /*frame_num=*/0}, - {/*target_kbps=*/2000, /*input_fps=*/15, /*frame_num=*/300}, - {/*target_kbps=*/2000, /*input_fps=*/7.5, /*frame_num=*/450}, - {/*target_kbps=*/2000, /*input_fps=*/15, /*frame_num=*/525}, - {/*target_kbps=*/2000, /*input_fps=*/30, /*frame_num=*/675}}; +const RateProfileData kBitRateLowHighLow = { + /*name=*/"BitRateLowHighLow", + /*rate_profile=*/{ + {/*target_kbps=*/750, /*input_fps=*/30, /*frame_num=*/0}, + {/*target_kbps=*/1500, /*input_fps=*/30, /*frame_num=*/300}, + {/*target_kbps=*/3000, /*input_fps=*/30, /*frame_num=*/600}, + {/*target_kbps=*/1500, /*input_fps=*/30, /*frame_num=*/900}, + {/*target_kbps=*/750, /*input_fps=*/30, /*frame_num=*/1200}}}; -const std::vector kFrameRateLowHighLow = { - {/*target_kbps=*/2000, /*input_fps=*/7.5, /*frame_num=*/0}, - {/*target_kbps=*/2000, /*input_fps=*/15, /*frame_num=*/75}, - {/*target_kbps=*/2000, /*input_fps=*/30, /*frame_num=*/225}, - {/*target_kbps=*/2000, /*input_fps=*/15, /*frame_num=*/525}, - {/*target_kbps=*/2000, /*input_fps=*/7.5, /*frame_num=*/775}}; +const RateProfileData kFrameRateHighLowHigh = { + /*name=*/"FrameRateHighLowHigh", + /*rate_profile=*/{ + {/*target_kbps=*/2000, /*input_fps=*/30, /*frame_num=*/0}, + {/*target_kbps=*/2000, /*input_fps=*/15, /*frame_num=*/300}, + {/*target_kbps=*/2000, /*input_fps=*/7.5, /*frame_num=*/450}, + {/*target_kbps=*/2000, /*input_fps=*/15, /*frame_num=*/525}, + {/*target_kbps=*/2000, /*input_fps=*/30, /*frame_num=*/675}}}; + +const RateProfileData kFrameRateLowHighLow = { + /*name=*/"FrameRateLowHighLow", + /*rate_profile=*/{ + {/*target_kbps=*/2000, /*input_fps=*/7.5, /*frame_num=*/0}, + {/*target_kbps=*/2000, /*input_fps=*/15, /*frame_num=*/75}, + {/*target_kbps=*/2000, /*input_fps=*/30, /*frame_num=*/225}, + {/*target_kbps=*/2000, /*input_fps=*/15, /*frame_num=*/525}, + {/*target_kbps=*/2000, /*input_fps=*/7.5, /*frame_num=*/775}}}; VideoCodecTestFixture::Config CreateConfig() { VideoCodecTestFixture::Config config; @@ -175,11 +190,21 @@ TEST(VideoCodecTestMediaCodec, ForemanMixedRes100kbpsVp8H264) { class VideoCodecTestMediaCodecRateAdaptation : public ::testing::TestWithParam< - std::tuple, std::string>> {}; + std::tuple> { + public: + static std::string ParamInfoToStr( + const ::testing::TestParamInfo< + VideoCodecTestMediaCodecRateAdaptation::ParamType>& info) { + char buf[512]; + rtc::SimpleStringBuilder ss(buf); + ss << std::get<0>(info.param).name << "_" << std::get<1>(info.param); + return ss.str(); + } +}; TEST_P(VideoCodecTestMediaCodecRateAdaptation, DISABLED_RateAdaptation) { const std::vector rate_profile = - std::get<0>(GetParam()); + std::get<0>(GetParam()).rate_profile; const std::string codec_name = std::get<1>(GetParam()); VideoCodecTestFixture::Config config; @@ -235,7 +260,8 @@ INSTANTIATE_TEST_SUITE_P( kFrameRateHighLowHigh), ::testing::Values(cricket::kVp8CodecName, cricket::kVp9CodecName, - cricket::kH264CodecName))); + cricket::kH264CodecName)), + VideoCodecTestMediaCodecRateAdaptation::ParamInfoToStr); } // namespace test } // namespace webrtc