diff --git a/webrtc/video_engine/test/auto_test/automated/vie_video_verification_test.cc b/webrtc/video_engine/test/auto_test/automated/vie_video_verification_test.cc index 8ea8bd75b..825afe650 100644 --- a/webrtc/video_engine/test/auto_test/automated/vie_video_verification_test.cc +++ b/webrtc/video_engine/test/auto_test/automated/vie_video_verification_test.cc @@ -31,11 +31,8 @@ class ViEVideoVerificationTest : public testing::Test { protected: void SetUp() { input_file_ = webrtc::test::ResourcePath("paris_qcif", "yuv"); - } - - void TearDown() { - TearDownFileRenderer(local_file_renderer_); - TearDownFileRenderer(remote_file_renderer_); + local_file_renderer_ = NULL; + remote_file_renderer_ = NULL; } void InitializeFileRenderers() { @@ -59,20 +56,6 @@ class ViEVideoVerificationTest : public testing::Test { remote_file_renderer_->StopRendering(); } - void TearDownFileRenderer(ViEToFileRenderer* file_renderer) { - assert(file_renderer); - bool test_failed = ::testing::UnitTest::GetInstance()-> - current_test_info()->result()->Failed(); - if (test_failed) { - // Leave the files for analysis if the test failed. - file_renderer->SaveOutputFile("failed-"); - } else { - // No reason to keep the files if we succeeded. - file_renderer->DeleteOutputFile(); - } - delete file_renderer; - } - void CompareFiles(const std::string& reference_file, const std::string& test_file, double* psnr_result, double *ssim_result) { @@ -93,6 +76,12 @@ class ViEVideoVerificationTest : public testing::Test { psnr.average, ssim.average); } + // Note: must call AFTER CompareFiles. + void TearDownFileRenderers() { + TearDownFileRenderer(local_file_renderer_); + TearDownFileRenderer(remote_file_renderer_); + } + std::string input_file_; ViEToFileRenderer* local_file_renderer_; ViEToFileRenderer* remote_file_renderer_; @@ -112,9 +101,26 @@ class ViEVideoVerificationTest : public testing::Test { " for writing."; } } + + void TearDownFileRenderer(ViEToFileRenderer* file_renderer) { + assert(file_renderer); + bool test_failed = ::testing::UnitTest::GetInstance()-> + current_test_info()->result()->Failed(); + if (test_failed) { + // Leave the files for analysis if the test failed. + file_renderer->SaveOutputFile("failed-"); + } else { + // No reason to keep the files if we succeeded. + file_renderer->DeleteOutputFile(); + } + delete file_renderer; + } }; -TEST_F(ViEVideoVerificationTest, RunsBaseStandardTestWithoutErrors) { +// TODO(phoglund): Needs to be rewritten to use external transport. Currently +// the new memory-safe decoder is too slow with I420 with the default packet +// engine. See http://code.google.com/p/webrtc/issues/detail?id=1103. +TEST_F(ViEVideoVerificationTest, DISABLED_RunsBaseStandardTestWithoutErrors) { // The I420 test should give pretty good values since it's a lossless codec // running on the default bitrate. It should average about 30 dB but there // may be cases where it dips as low as 26 under adverse conditions. That's @@ -134,6 +140,8 @@ TEST_F(ViEVideoVerificationTest, RunsBaseStandardTestWithoutErrors) { double actual_ssim = 0; CompareFiles(input_file_, output_file, &actual_psnr, &actual_ssim); + TearDownFileRenderers(); + if (actual_psnr >= kExpectedMinimumPSNR && actual_ssim >= kExpectedMinimumSSIM) { // Test succeeded! @@ -171,6 +179,8 @@ TEST_F(ViEVideoVerificationTest, RunsCodecTestWithoutErrors) { double actual_ssim = 0; CompareFiles(reference_file, output_file, &actual_psnr, &actual_ssim); + TearDownFileRenderers(); + if (actual_psnr >= kExpectedMinimumPSNR && actual_ssim >= kExpectedMinimumSSIM) { // Test succeeded! @@ -244,6 +254,8 @@ TEST_F(ViEVideoVerificationTest, DISABLED_RunsFullStackWithoutErrors) { double actual_ssim = 0; CompareFiles(reference_file, output_file, &actual_psnr, &actual_ssim); + TearDownFileRenderers(); + const double kExpectedMinimumPSNR = 24; const double kExpectedMinimumSSIM = 0.7;