File handling in vie_auto_test now uses fileutils so input and output file end up in a good place.
BUG= TEST= Review URL: http://webrtc-codereview.appspot.com/301003 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1103 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
82d91ae6cf
commit
23e1c0a0b1
2
DEPS
2
DEPS
@ -14,7 +14,7 @@ vars = {
|
|||||||
|
|
||||||
# External resources like video and audio files used for testing purposes.
|
# External resources like video and audio files used for testing purposes.
|
||||||
# Downloaded on demand when needed.
|
# Downloaded on demand when needed.
|
||||||
"webrtc_resources_revision": "2",
|
"webrtc_resources_revision": "3",
|
||||||
}
|
}
|
||||||
|
|
||||||
# NOTE: Prefer revision numbers to tags for svn deps.
|
# NOTE: Prefer revision numbers to tags for svn deps.
|
||||||
|
@ -8,26 +8,23 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstdio>
|
|
||||||
|
|
||||||
#include "gflags/gflags.h"
|
#include "gflags/gflags.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
#include "testsupport/metrics/video_metrics.h"
|
||||||
#include "vie_autotest.h"
|
#include "vie_autotest.h"
|
||||||
#include "vie_autotest_window_manager_interface.h"
|
|
||||||
#include "vie_comparison_tests.h"
|
#include "vie_comparison_tests.h"
|
||||||
#include "vie_integration_test_base.h"
|
#include "vie_integration_test_base.h"
|
||||||
#include "vie_to_file_renderer.h"
|
#include "vie_to_file_renderer.h"
|
||||||
#include "vie_window_creator.h"
|
|
||||||
#include "testsupport/metrics/video_metrics.h"
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// These flags are checked upon running the test.
|
// The input file must be QCIF since I420 gets scaled to that in the tests
|
||||||
DEFINE_string(i420_test_video_path, "", "Path to an i420-coded raw video file"
|
// (it is so bandwidth-heavy we have no choice). Our comparison algorithms
|
||||||
" to use for the test. This file is fed into the fake camera"
|
// wouldn't like scaling, so this will work when we compare with the original.
|
||||||
" and will therefore be what the camera 'sees'.");
|
const std::string input_file = ViETest::GetResultOutputPath() +
|
||||||
DEFINE_int32(i420_test_video_width, 0, "The width of the provided video.");
|
"resources/paris_qcif.yuv";
|
||||||
DEFINE_int32(i420_test_video_height, 0, "The height of the provided video.");
|
const int input_width = 176;
|
||||||
|
const int input_height = 144;
|
||||||
|
|
||||||
class ViEComparisonTest: public testing::Test {
|
class ViEComparisonTest: public testing::Test {
|
||||||
public:
|
public:
|
||||||
@ -35,16 +32,21 @@ class ViEComparisonTest: public testing::Test {
|
|||||||
std::string test_case_name =
|
std::string test_case_name =
|
||||||
::testing::UnitTest::GetInstance()->current_test_info()->name();
|
::testing::UnitTest::GetInstance()->current_test_info()->name();
|
||||||
|
|
||||||
std::string local_preview_filename = test_case_name + "-local-preview.yuv";
|
std::string output_path = ViETest::GetResultOutputPath();
|
||||||
std::string remote_filename = test_case_name + "-remote.yuv";
|
std::string local_preview_filename =
|
||||||
|
test_case_name + "-local-preview.yuv";
|
||||||
|
std::string remote_filename =
|
||||||
|
test_case_name + "-remote.yuv";
|
||||||
|
|
||||||
if (!local_file_renderer_.PrepareForRendering(local_preview_filename)) {
|
if (!local_file_renderer_.PrepareForRendering(output_path,
|
||||||
FAIL() << "Could not open output file " << local_preview_filename <<
|
local_preview_filename)) {
|
||||||
" for writing.";
|
FAIL() << "Could not open output file " << output_path <<
|
||||||
|
local_preview_filename << " for writing.";
|
||||||
}
|
}
|
||||||
if (!remote_file_renderer_.PrepareForRendering(remote_filename)) {
|
if (!remote_file_renderer_.PrepareForRendering(output_path,
|
||||||
FAIL() << "Could not open output file " << remote_filename <<
|
remote_filename)) {
|
||||||
" for writing.";
|
FAIL() << "Could not open output file " << output_path <<
|
||||||
|
remote_filename << " for writing.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,41 +75,34 @@ class ViEComparisonTest: public testing::Test {
|
|||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(ViEComparisonTest, RunsBaseStandardTestWithoutErrors) {
|
TEST_F(ViEComparisonTest, RunsBaseStandardTestWithoutErrors) {
|
||||||
tests_.TestCallSetup(FLAGS_i420_test_video_path,
|
ASSERT_TRUE(tests_.TestCallSetup(input_file, input_width, input_height,
|
||||||
FLAGS_i420_test_video_width,
|
|
||||||
FLAGS_i420_test_video_height,
|
|
||||||
&local_file_renderer_,
|
&local_file_renderer_,
|
||||||
&remote_file_renderer_);
|
&remote_file_renderer_));
|
||||||
|
|
||||||
QualityMetricsResult psnr_result;
|
QualityMetricsResult psnr_result;
|
||||||
int psnr_error = PsnrFromFiles(
|
int psnr_error = PsnrFromFiles(
|
||||||
FLAGS_i420_test_video_path.c_str(),
|
input_file.c_str(), remote_file_renderer_.GetFullOutputPath().c_str(),
|
||||||
remote_file_renderer_.output_filename().c_str(),
|
input_width, input_height, &psnr_result);
|
||||||
FLAGS_i420_test_video_width,
|
|
||||||
FLAGS_i420_test_video_height,
|
|
||||||
&psnr_result);
|
|
||||||
|
|
||||||
ASSERT_EQ(0, psnr_error) << "The PSNR routine failed - output files missing?";
|
ASSERT_EQ(0, psnr_error) << "The PSNR routine failed - output files missing?";
|
||||||
ASSERT_GT(psnr_result.average, 25); // That is, we want at least 25 dB
|
ASSERT_GT(psnr_result.average, 28); // That is, we want at least 28 dB
|
||||||
|
|
||||||
QualityMetricsResult ssim_result;
|
QualityMetricsResult ssim_result;
|
||||||
int ssim_error = SsimFromFiles(
|
int ssim_error = SsimFromFiles(
|
||||||
FLAGS_i420_test_video_path.c_str(),
|
input_file.c_str(), remote_file_renderer_.GetFullOutputPath().c_str(),
|
||||||
remote_file_renderer_.output_filename().c_str(),
|
input_width, input_height, &ssim_result);
|
||||||
FLAGS_i420_test_video_width,
|
|
||||||
FLAGS_i420_test_video_height,
|
|
||||||
&ssim_result);
|
|
||||||
|
|
||||||
ASSERT_EQ(0, ssim_error) << "The SSIM routine failed - output files missing?";
|
ASSERT_EQ(0, ssim_error) << "The SSIM routine failed - output files missing?";
|
||||||
ASSERT_GT(ssim_result.average, 0.85f); // 1 = perfect, -1 = terrible
|
ASSERT_GT(ssim_result.average, 0.95f); // 1 = perfect, -1 = terrible
|
||||||
|
|
||||||
|
ViETest::Log("Results: PSNR %f SSIM %f",
|
||||||
|
psnr_result.average, ssim_result.average);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ViEComparisonTest, RunsCodecTestWithoutErrors) {
|
TEST_F(ViEComparisonTest, RunsCodecTestWithoutErrors) {
|
||||||
tests_.TestCodecs(FLAGS_i420_test_video_path,
|
ASSERT_TRUE(tests_.TestCodecs(input_file, input_width, input_height,
|
||||||
FLAGS_i420_test_video_width,
|
|
||||||
FLAGS_i420_test_video_height,
|
|
||||||
&local_file_renderer_,
|
&local_file_renderer_,
|
||||||
&remote_file_renderer_);
|
&remote_file_renderer_));
|
||||||
|
|
||||||
// We compare the local and remote here instead of with the original.
|
// We compare the local and remote here instead of with the original.
|
||||||
// The reason is that it is hard to say when the three consecutive tests
|
// The reason is that it is hard to say when the three consecutive tests
|
||||||
@ -115,28 +110,27 @@ TEST_F(ViEComparisonTest, RunsCodecTestWithoutErrors) {
|
|||||||
// original to get a fair comparison.
|
// original to get a fair comparison.
|
||||||
QualityMetricsResult psnr_result;
|
QualityMetricsResult psnr_result;
|
||||||
int psnr_error = PsnrFromFiles(
|
int psnr_error = PsnrFromFiles(
|
||||||
local_file_renderer_.output_filename().c_str(),
|
input_file.c_str(),
|
||||||
remote_file_renderer_.output_filename().c_str(),
|
remote_file_renderer_.GetFullOutputPath().c_str(),
|
||||||
FLAGS_i420_test_video_width,
|
input_width, input_height, &psnr_result);
|
||||||
FLAGS_i420_test_video_height,
|
|
||||||
&psnr_result);
|
|
||||||
|
|
||||||
ASSERT_EQ(0, psnr_error) << "The PSNR routine failed - output files missing?";
|
ASSERT_EQ(0, psnr_error) << "The PSNR routine failed - output files missing?";
|
||||||
// This test includes VP8 which is a bit lossy. According to Wikipedia between
|
// TODO(phoglund): This value should be higher. Investigate why the remote
|
||||||
// 20-25 is considered OK for transmission codecs and we seem to be getting
|
// file turns out 6 seconds shorter than the local file (frame dropping?...)
|
||||||
// like 21 so 20 seems like a good threshold value here.
|
|
||||||
EXPECT_GT(psnr_result.average, 20);
|
EXPECT_GT(psnr_result.average, 20);
|
||||||
|
|
||||||
QualityMetricsResult ssim_result;
|
QualityMetricsResult ssim_result;
|
||||||
int ssim_error = SsimFromFiles(
|
int ssim_error = SsimFromFiles(
|
||||||
local_file_renderer_.output_filename().c_str(),
|
local_file_renderer_.GetFullOutputPath().c_str(),
|
||||||
remote_file_renderer_.output_filename().c_str(),
|
remote_file_renderer_.GetFullOutputPath().c_str(),
|
||||||
FLAGS_i420_test_video_width,
|
input_width, input_height, &ssim_result);
|
||||||
FLAGS_i420_test_video_height,
|
|
||||||
&ssim_result);
|
|
||||||
|
|
||||||
|
// TODO(phoglund): This value should also be higher.
|
||||||
ASSERT_EQ(0, ssim_error) << "The SSIM routine failed - output files missing?";
|
ASSERT_EQ(0, ssim_error) << "The SSIM routine failed - output files missing?";
|
||||||
EXPECT_GT(ssim_result.average, 0.8f); // 1 = perfect, -1 = terrible
|
EXPECT_GT(ssim_result.average, 0.7f); // 1 = perfect, -1 = terrible
|
||||||
|
|
||||||
|
ViETest::Log("Results: PSNR %f SSIM %f",
|
||||||
|
psnr_result.average, ssim_result.average);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -64,7 +64,7 @@ TEST_F(ViEStandardIntegrationTest, RunsRenderTestWithoutErrors) {
|
|||||||
tests_->ViERenderStandardTest();
|
tests_->ViERenderStandardTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ViEStandardIntegrationTest, RunsRtpRctpTestWithoutErrors) {
|
TEST_F(ViEStandardIntegrationTest, RunsRtpRtcpTestWithoutErrors) {
|
||||||
tests_->ViERtpRtcpStandardTest();
|
tests_->ViERtpRtcpStandardTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,16 +20,18 @@ ViEToFileRenderer::~ViEToFileRenderer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool ViEToFileRenderer::PrepareForRendering(
|
bool ViEToFileRenderer::PrepareForRendering(
|
||||||
|
const std::string& output_path,
|
||||||
const std::string& output_filename) {
|
const std::string& output_filename) {
|
||||||
|
|
||||||
assert(output_file_ == NULL);
|
assert(output_file_ == NULL);
|
||||||
|
|
||||||
output_file_ = std::fopen(output_filename.c_str(), "wb");
|
output_file_ = std::fopen((output_path + output_filename).c_str(), "wb");
|
||||||
if (output_file_ == NULL) {
|
if (output_file_ == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
output_filename_ = output_filename;
|
output_filename_ = output_filename;
|
||||||
|
output_path_ = output_path;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,30 +43,34 @@ void ViEToFileRenderer::StopRendering() {
|
|||||||
|
|
||||||
bool ViEToFileRenderer::SaveOutputFile(const std::string& prefix) {
|
bool ViEToFileRenderer::SaveOutputFile(const std::string& prefix) {
|
||||||
assert(output_file_ == NULL && output_filename_ != "");
|
assert(output_file_ == NULL && output_filename_ != "");
|
||||||
if (std::rename(output_filename_.c_str(),
|
if (std::rename((output_path_ + output_filename_).c_str(),
|
||||||
(prefix + output_filename_).c_str()) != 0) {
|
(output_path_ + prefix + output_filename_).c_str()) != 0) {
|
||||||
std::perror("Failed to rename output file");
|
std::perror("Failed to rename output file");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Forget about the file
|
ForgetOutputFile();
|
||||||
output_filename_ = "";
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ViEToFileRenderer::DeleteOutputFile() {
|
bool ViEToFileRenderer::DeleteOutputFile() {
|
||||||
assert(output_file_ == NULL && output_filename_ != "");
|
assert(output_file_ == NULL && output_filename_ != "");
|
||||||
if (std::remove(output_filename_.c_str()) != 0) {
|
if (std::remove((output_path_ + output_filename_).c_str()) != 0) {
|
||||||
std::perror("Failed to delete output file");
|
std::perror("Failed to delete output file");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
output_filename_ = "";
|
ForgetOutputFile();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& ViEToFileRenderer::output_filename() const {
|
std::string ViEToFileRenderer::GetFullOutputPath() const {
|
||||||
assert(output_file_ != NULL);
|
assert(output_file_ != NULL);
|
||||||
|
|
||||||
return output_filename_;
|
return output_path_ + output_filename_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ViEToFileRenderer::ForgetOutputFile() {
|
||||||
|
output_filename_ = "";
|
||||||
|
output_path_ = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
int ViEToFileRenderer::DeliverFrame(unsigned char *buffer,
|
int ViEToFileRenderer::DeliverFrame(unsigned char *buffer,
|
||||||
|
@ -23,7 +23,8 @@ class ViEToFileRenderer: public webrtc::ExternalRenderer {
|
|||||||
virtual ~ViEToFileRenderer();
|
virtual ~ViEToFileRenderer();
|
||||||
|
|
||||||
// Returns false if we fail opening the output filename for writing.
|
// Returns false if we fail opening the output filename for writing.
|
||||||
bool PrepareForRendering(const std::string& output_filename);
|
bool PrepareForRendering(const std::string& output_path,
|
||||||
|
const std::string& output_filename);
|
||||||
|
|
||||||
// Closes the output file.
|
// Closes the output file.
|
||||||
void StopRendering();
|
void StopRendering();
|
||||||
@ -45,10 +46,13 @@ class ViEToFileRenderer: public webrtc::ExternalRenderer {
|
|||||||
int DeliverFrame(unsigned char* buffer, int buffer_size,
|
int DeliverFrame(unsigned char* buffer, int buffer_size,
|
||||||
unsigned int time_stamp);
|
unsigned int time_stamp);
|
||||||
|
|
||||||
const std::string& output_filename() const;
|
std::string GetFullOutputPath() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void ForgetOutputFile();
|
||||||
|
|
||||||
std::FILE* output_file_;
|
std::FILE* output_file_;
|
||||||
|
std::string output_path_;
|
||||||
std::string output_filename_;
|
std::string output_filename_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "engine_configurations.h"
|
#include "engine_configurations.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
@ -27,7 +28,6 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#elif defined (WEBRTC_ANDROID)
|
#elif defined (WEBRTC_ANDROID)
|
||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
#include <string>
|
|
||||||
#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
|
#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@ -148,7 +148,7 @@ class ViETest {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated(qhogpat): Prefer to use googletest macros in all cases
|
// Deprecated(phoglund): Prefer to use googletest macros in all cases
|
||||||
// except the custom call case.
|
// except the custom call case.
|
||||||
static int TestError(bool expr, const char* fmt, ...) {
|
static int TestError(bool expr, const char* fmt, ...) {
|
||||||
if (!expr) {
|
if (!expr) {
|
||||||
@ -168,6 +168,13 @@ class ViETest {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns a suitable path to write trace and result files to.
|
||||||
|
// You should always use this when you want to write output files.
|
||||||
|
// The returned path is guaranteed to end with a path separator.
|
||||||
|
// This function may be run at any time during the program's execution.
|
||||||
|
// Implemented in vie_autotest.cc
|
||||||
|
static std::string GetResultOutputPath();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void AssertError(const char* message) {
|
static void AssertError(const char* message) {
|
||||||
#ifdef VIE_ASSERT_ERROR
|
#ifdef VIE_ASSERT_ERROR
|
||||||
|
@ -31,16 +31,19 @@ class ViEToFileRenderer;
|
|||||||
// input is restarted between stages.
|
// input is restarted between stages.
|
||||||
class ViEComparisonTests {
|
class ViEComparisonTests {
|
||||||
public:
|
public:
|
||||||
// Test a typical simple call setup.
|
// Test a typical simple call setup. Returns false if the input file
|
||||||
void TestCallSetup(
|
// could not be opened; reports errors using googletest macros otherwise.
|
||||||
|
bool TestCallSetup(
|
||||||
const std::string& i420_test_video_path,
|
const std::string& i420_test_video_path,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
ViEToFileRenderer* local_file_renderer,
|
ViEToFileRenderer* local_file_renderer,
|
||||||
ViEToFileRenderer* remote_file_renderer);
|
ViEToFileRenderer* remote_file_renderer);
|
||||||
|
|
||||||
// Tries testing the I420 and VP8 codecs in turn.
|
// Tries testing the I420 and VP8 codecs in turn. Returns false if the
|
||||||
void TestCodecs(
|
// input file could not be opened; reports errors using googletest macros
|
||||||
|
// otherwise.
|
||||||
|
bool TestCodecs(
|
||||||
const std::string& i420_video_file,
|
const std::string& i420_video_file,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
|
@ -59,8 +59,6 @@ void TestI420CallSetup(webrtc::ViECodec* codec_interface,
|
|||||||
|
|
||||||
// Call started.
|
// Call started.
|
||||||
ViETest::Log("Call started");
|
ViETest::Log("Call started");
|
||||||
ViETest::Log("You should see a local preview from camera %s"
|
|
||||||
" in window 1 and the remote video in window 2.", device_name);
|
|
||||||
|
|
||||||
AutoTestSleep(KAutoTestSleepTimeMs);
|
AutoTestSleep(KAutoTestSleepTimeMs);
|
||||||
|
|
||||||
|
@ -12,21 +12,16 @@
|
|||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
TbInterfaces::TbInterfaces(const char* testName) {
|
TbInterfaces::TbInterfaces(const char* test_name) {
|
||||||
char traceFile[256] = "";
|
std::string trace_file_path =
|
||||||
|
(ViETest::GetResultOutputPath() + test_name) + "_trace.txt";
|
||||||
|
|
||||||
#ifdef WEBRTC_ANDROID
|
ViETest::Log("Creating ViE Interfaces for test %s\n", test_name);
|
||||||
strcat(traceFile,"/sdcard/");
|
|
||||||
#endif
|
|
||||||
strcat(traceFile, testName);
|
|
||||||
strcat(traceFile, "_trace.txt");
|
|
||||||
|
|
||||||
ViETest::Log("Creating ViE Interfaces for test %s\n", testName);
|
|
||||||
|
|
||||||
video_engine = webrtc::VideoEngine::Create();
|
video_engine = webrtc::VideoEngine::Create();
|
||||||
EXPECT_TRUE(video_engine != NULL);
|
EXPECT_TRUE(video_engine != NULL);
|
||||||
|
|
||||||
EXPECT_EQ(0, video_engine->SetTraceFile(traceFile));
|
EXPECT_EQ(0, video_engine->SetTraceFile(trace_file_path.c_str()));
|
||||||
EXPECT_EQ(0, video_engine->SetTraceFilter(webrtc::kTraceAll));
|
EXPECT_EQ(0, video_engine->SetTraceFilter(webrtc::kTraceAll));
|
||||||
|
|
||||||
base = webrtc::ViEBase::GetInterface(video_engine);
|
base = webrtc::ViEBase::GetInterface(video_engine);
|
||||||
|
@ -12,16 +12,28 @@
|
|||||||
// vie_autotest.cc
|
// vie_autotest.cc
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
#include "vie_autotest_defines.h"
|
|
||||||
#include "vie_autotest.h"
|
#include "vie_autotest.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "video_render.h"
|
|
||||||
|
|
||||||
|
#include "engine_configurations.h"
|
||||||
|
#include "testsupport/fileutils.h"
|
||||||
|
#include "video_render.h"
|
||||||
|
#include "vie_autotest_defines.h"
|
||||||
|
|
||||||
|
// ViETest implementation
|
||||||
FILE* ViETest::log_file_ = NULL;
|
FILE* ViETest::log_file_ = NULL;
|
||||||
char* ViETest::log_str_ = NULL;
|
char* ViETest::log_str_ = NULL;
|
||||||
|
|
||||||
|
std::string ViETest::GetResultOutputPath() {
|
||||||
|
#ifdef WEBRTC_ANDROID
|
||||||
|
return "/sdcard/";
|
||||||
|
#else
|
||||||
|
return webrtc::test::OutputPath();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// ViEAutoTest implementation
|
||||||
ViEAutoTest::ViEAutoTest(void* window1, void* window2) :
|
ViEAutoTest::ViEAutoTest(void* window1, void* window2) :
|
||||||
_window1(window1),
|
_window1(window1),
|
||||||
_window2(window2),
|
_window2(window2),
|
||||||
|
@ -71,6 +71,8 @@ void ViEAutoTest::ViEBaseStandardTest() {
|
|||||||
// ***************************************************************
|
// ***************************************************************
|
||||||
// Run the actual test:
|
// Run the actual test:
|
||||||
// ***************************************************************
|
// ***************************************************************
|
||||||
|
ViETest::Log("You should shortly see a local preview from camera %s"
|
||||||
|
" in window 1 and the remote video in window 2.", device_name);
|
||||||
::TestI420CallSetup(interfaces.codec, interfaces.video_engine,
|
::TestI420CallSetup(interfaces.codec, interfaces.video_engine,
|
||||||
base_interface, interfaces.network, video_channel,
|
base_interface, interfaces.network, video_channel,
|
||||||
device_name);
|
device_name);
|
||||||
@ -124,12 +126,9 @@ void ViEAutoTest::ViEBaseAPITest() {
|
|||||||
webrtc::VideoEngine* ptrViE = webrtc::VideoEngine::Create();
|
webrtc::VideoEngine* ptrViE = webrtc::VideoEngine::Create();
|
||||||
EXPECT_TRUE(NULL != ptrViE);
|
EXPECT_TRUE(NULL != ptrViE);
|
||||||
|
|
||||||
#ifdef WEBRTC_ANDROID
|
std::string trace_file_path =
|
||||||
EXPECT_EQ(0,
|
ViETest::GetResultOutputPath() + "ViEBaseAPI_trace.txt";
|
||||||
video_engine->SetTraceFile("/sdcard/WebRTC/ViEBaseAPI_trace.txt"));
|
EXPECT_EQ(0, ptrViE->SetTraceFile(trace_file_path.c_str()));
|
||||||
#else
|
|
||||||
EXPECT_EQ(0, ptrViE->SetTraceFile("ViEBaseAPI_trace.txt"));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ptrViEBase = webrtc::ViEBase::GetInterface(ptrViE);
|
ptrViEBase = webrtc::ViEBase::GetInterface(ptrViE);
|
||||||
EXPECT_TRUE(NULL != ptrViEBase);
|
EXPECT_TRUE(NULL != ptrViEBase);
|
||||||
|
@ -13,11 +13,11 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "vie_autotest_defines.h"
|
|
||||||
#include "vie_autotest.h"
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "vie_autotest.h"
|
||||||
|
#include "vie_autotest_defines.h"
|
||||||
|
|
||||||
#define VCM_RED_PAYLOAD_TYPE 96
|
#define VCM_RED_PAYLOAD_TYPE 96
|
||||||
#define VCM_ULPFEC_PAYLOAD_TYPE 97
|
#define VCM_ULPFEC_PAYLOAD_TYPE 97
|
||||||
#define DEFAULT_SEND_IP "127.0.0.1"
|
#define DEFAULT_SEND_IP "127.0.0.1"
|
||||||
@ -367,7 +367,9 @@ int ViEAutoTest::ViECustomCall()
|
|||||||
"ERROR: %s at line %d",
|
"ERROR: %s at line %d",
|
||||||
__FUNCTION__, __LINE__);
|
__FUNCTION__, __LINE__);
|
||||||
|
|
||||||
error = ptrViE->SetTraceFile("ViECustomCall_trace.txt");
|
std::string trace_file =
|
||||||
|
ViETest::GetResultOutputPath() + "ViECustomCall_trace.txt";
|
||||||
|
error = ptrViE->SetTraceFile(trace_file.c_str());
|
||||||
numberOfErrors += ViETest::TestError(error == 0,
|
numberOfErrors += ViETest::TestError(error == 0,
|
||||||
"ERROR: %s at line %d",
|
"ERROR: %s at line %d",
|
||||||
__FUNCTION__, __LINE__);
|
__FUNCTION__, __LINE__);
|
||||||
|
@ -14,16 +14,18 @@
|
|||||||
// This code is also used as sample code for ViE 3.0
|
// This code is also used as sample code for ViE 3.0
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "vie_autotest_defines.h"
|
|
||||||
#include "vie_autotest.h"
|
|
||||||
|
|
||||||
// ===================================================================
|
// ===================================================================
|
||||||
//
|
//
|
||||||
// BEGIN: VideoEngine 3.0 Sample Code
|
// BEGIN: VideoEngine 3.0 Sample Code
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include "common_types.h"
|
#include "common_types.h"
|
||||||
|
#include "tb_external_transport.h"
|
||||||
#include "voe_base.h"
|
#include "voe_base.h"
|
||||||
|
#include "vie_autotest_defines.h"
|
||||||
|
#include "vie_autotest.h"
|
||||||
#include "vie_base.h"
|
#include "vie_base.h"
|
||||||
#include "vie_capture.h"
|
#include "vie_capture.h"
|
||||||
#include "vie_codec.h"
|
#include "vie_codec.h"
|
||||||
@ -31,8 +33,6 @@
|
|||||||
#include "vie_render.h"
|
#include "vie_render.h"
|
||||||
#include "vie_rtp_rtcp.h"
|
#include "vie_rtp_rtcp.h"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include "tb_external_transport.h"
|
|
||||||
#define VCM_RED_PAYLOAD_TYPE 96
|
#define VCM_RED_PAYLOAD_TYPE 96
|
||||||
#define VCM_ULPFEC_PAYLOAD_TYPE 97
|
#define VCM_ULPFEC_PAYLOAD_TYPE 97
|
||||||
|
|
||||||
@ -62,22 +62,14 @@ int VideoEngineSampleCode(void* window1, void* window2)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WEBRTC_ANDROID
|
std::string trace_file =
|
||||||
error = ptrViE->SetTraceFile("/sdcard/ViELoopbackCall_trace.txt");
|
ViETest::GetResultOutputPath() + "ViELoopbackCall_trace.txt";
|
||||||
|
error = ptrViE->SetTraceFile(trace_file.c_str());
|
||||||
if (error == -1)
|
if (error == -1)
|
||||||
{
|
{
|
||||||
printf("ERROR in VideoEngine::SetTraceFile\n");
|
printf("ERROR in VideoEngine::SetTraceFile\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
error = ptrViE->SetTraceFile("ViELoopbackCall_trace.txt");
|
|
||||||
if (error == -1)
|
|
||||||
{
|
|
||||||
printf("ERROR in VideoEngine::SetTraceFile\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Init VideoEngine and create a channel
|
// Init VideoEngine and create a channel
|
||||||
|
@ -13,14 +13,13 @@
|
|||||||
//
|
//
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "vie_autotest_defines.h"
|
|
||||||
#include "vie_autotest.h"
|
|
||||||
#include "engine_configurations.h"
|
#include "engine_configurations.h"
|
||||||
|
|
||||||
#include "tb_capture_device.h"
|
#include "tb_capture_device.h"
|
||||||
#include "tb_external_transport.h"
|
#include "tb_external_transport.h"
|
||||||
#include "tb_interfaces.h"
|
#include "tb_interfaces.h"
|
||||||
#include "tb_video_channel.h"
|
#include "tb_video_channel.h"
|
||||||
|
#include "vie_autotest.h"
|
||||||
|
#include "vie_autotest_defines.h"
|
||||||
|
|
||||||
class ViERtpObserver: public webrtc::ViERTPObserver
|
class ViERtpObserver: public webrtc::ViERTPObserver
|
||||||
{
|
{
|
||||||
@ -325,18 +324,14 @@ void ViEAutoTest::ViERtpRtcpStandardTest()
|
|||||||
|
|
||||||
ViETest::Log("Testing RTP dump...\n");
|
ViETest::Log("Testing RTP dump...\n");
|
||||||
|
|
||||||
#ifdef WEBRTC_ANDROID
|
std::string inDumpName =
|
||||||
const char* inDumpName = "/sdcard/IncomingRTPDump.rtp";
|
ViETest::GetResultOutputPath() + "IncomingRTPDump.rtp";
|
||||||
const char* outDumpName = "/sdcard/OutgoingRTPDump.rtp";
|
std::string outDumpName =
|
||||||
#else
|
ViETest::GetResultOutputPath() + "OutgoingRTPDump.rtp";
|
||||||
const char* inDumpName = "IncomingRTPDump.rtp";
|
|
||||||
const char* outDumpName = "OutgoingRTPDump.rtp";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
EXPECT_EQ(0, ViE.rtp_rtcp->StartRTPDump(
|
EXPECT_EQ(0, ViE.rtp_rtcp->StartRTPDump(
|
||||||
tbChannel.videoChannel, inDumpName, webrtc::kRtpIncoming));
|
tbChannel.videoChannel, inDumpName.c_str(), webrtc::kRtpIncoming));
|
||||||
EXPECT_EQ(0, ViE.rtp_rtcp->StartRTPDump(
|
EXPECT_EQ(0, ViE.rtp_rtcp->StartRTPDump(
|
||||||
tbChannel.videoChannel, outDumpName, webrtc::kRtpOutgoing));
|
tbChannel.videoChannel, outDumpName.c_str(), webrtc::kRtpOutgoing));
|
||||||
|
|
||||||
EXPECT_EQ(0, ViE.base->StartSend(tbChannel.videoChannel));
|
EXPECT_EQ(0, ViE.base->StartSend(tbChannel.videoChannel));
|
||||||
|
|
||||||
@ -353,11 +348,11 @@ void ViEAutoTest::ViERtpRtcpStandardTest()
|
|||||||
|
|
||||||
// Make sure data was actually saved to the file and we stored the same
|
// Make sure data was actually saved to the file and we stored the same
|
||||||
// amount of data in both files
|
// amount of data in both files
|
||||||
FILE* inDump = fopen(inDumpName, "r");
|
FILE* inDump = fopen(inDumpName.c_str(), "r");
|
||||||
fseek(inDump, 0L, SEEK_END);
|
fseek(inDump, 0L, SEEK_END);
|
||||||
long inEndPos = ftell(inDump);
|
long inEndPos = ftell(inDump);
|
||||||
fclose(inDump);
|
fclose(inDump);
|
||||||
FILE* outDump = fopen(outDumpName, "r");
|
FILE* outDump = fopen(outDumpName.c_str(), "r");
|
||||||
fseek(outDump, 0L, SEEK_END);
|
fseek(outDump, 0L, SEEK_END);
|
||||||
long outEndPos = ftell(outDump);
|
long outEndPos = ftell(outDump);
|
||||||
fclose(outDump);
|
fclose(outDump);
|
||||||
|
@ -8,11 +8,13 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "vie_autotest_defines.h"
|
#include <iostream>
|
||||||
#include "vie_autotest.h"
|
|
||||||
|
|
||||||
#include "common_types.h"
|
#include "common_types.h"
|
||||||
|
#include "tb_external_transport.h"
|
||||||
#include "voe_base.h"
|
#include "voe_base.h"
|
||||||
|
#include "vie_autotest_defines.h"
|
||||||
|
#include "vie_autotest.h"
|
||||||
#include "vie_base.h"
|
#include "vie_base.h"
|
||||||
#include "vie_capture.h"
|
#include "vie_capture.h"
|
||||||
#include "vie_codec.h"
|
#include "vie_codec.h"
|
||||||
@ -20,8 +22,6 @@
|
|||||||
#include "vie_render.h"
|
#include "vie_render.h"
|
||||||
#include "vie_rtp_rtcp.h"
|
#include "vie_rtp_rtcp.h"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include "tb_external_transport.h"
|
|
||||||
#define VCM_RED_PAYLOAD_TYPE 96
|
#define VCM_RED_PAYLOAD_TYPE 96
|
||||||
#define VCM_ULPFEC_PAYLOAD_TYPE 97
|
#define VCM_ULPFEC_PAYLOAD_TYPE 97
|
||||||
|
|
||||||
@ -51,28 +51,16 @@ int VideoEngineSimulcastTest(void* window1, void* window2)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WEBRTC_ANDROID
|
|
||||||
error = ptrViE->SetTraceFile("/sdcard/ViETrace.txt");
|
std::string trace_file =
|
||||||
|
ViETest::GetResultOutputPath() + "ViESimulcast_trace.txt";
|
||||||
|
error = ptrViE->SetTraceFile(trace_file.c_str());
|
||||||
if (error == -1)
|
if (error == -1)
|
||||||
{
|
{
|
||||||
printf("ERROR in VideoEngine::SetTraceFile\n");
|
printf("ERROR in VideoEngine::SetTraceFile\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = ptrViE->SetTraceFile("/sdcard/ViEEncryptedTrace.txt");
|
|
||||||
if (error == -1)
|
|
||||||
{
|
|
||||||
printf("ERROR in VideoEngine::SetTraceFile\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
error = ptrViE->SetTraceFile("ViETrace.txt");
|
|
||||||
if (error == -1)
|
|
||||||
{
|
|
||||||
printf("ERROR in VideoEngine::SetTraceFile\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
//
|
//
|
||||||
// Init VideoEngine and create a channel
|
// Init VideoEngine and create a channel
|
||||||
//
|
//
|
||||||
|
@ -18,8 +18,7 @@
|
|||||||
#include "vie_fake_camera.h"
|
#include "vie_fake_camera.h"
|
||||||
#include "vie_to_file_renderer.h"
|
#include "vie_to_file_renderer.h"
|
||||||
|
|
||||||
|
bool ViEComparisonTests::TestCallSetup(
|
||||||
void ViEComparisonTests::TestCallSetup(
|
|
||||||
const std::string& i420_video_file,
|
const std::string& i420_video_file,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
@ -38,7 +37,7 @@ void ViEComparisonTests::TestCallSetup(
|
|||||||
// No point in continuing if we have no proper video source
|
// No point in continuing if we have no proper video source
|
||||||
ADD_FAILURE() << "Could not open input video " << i420_video_file <<
|
ADD_FAILURE() << "Could not open input video " << i420_video_file <<
|
||||||
": aborting test...";
|
": aborting test...";
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
int capture_id = fake_camera.capture_id();
|
int capture_id = fake_camera.capture_id();
|
||||||
|
|
||||||
@ -78,9 +77,10 @@ void ViEComparisonTests::TestCallSetup(
|
|||||||
fake_camera.StopCamera();
|
fake_camera.StopCamera();
|
||||||
|
|
||||||
EXPECT_EQ(0, interfaces.base->DeleteChannel(video_channel));
|
EXPECT_EQ(0, interfaces.base->DeleteChannel(video_channel));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViEComparisonTests::TestCodecs(
|
bool ViEComparisonTests::TestCodecs(
|
||||||
const std::string& i420_video_file,
|
const std::string& i420_video_file,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
@ -94,7 +94,7 @@ void ViEComparisonTests::TestCodecs(
|
|||||||
// No point in continuing if we have no proper video source
|
// No point in continuing if we have no proper video source
|
||||||
ADD_FAILURE() << "Could not open input video " << i420_video_file <<
|
ADD_FAILURE() << "Could not open input video " << i420_video_file <<
|
||||||
": aborting test...";
|
": aborting test...";
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int video_channel = -1;
|
int video_channel = -1;
|
||||||
@ -115,4 +115,5 @@ void ViEComparisonTests::TestCodecs(
|
|||||||
width, height);
|
width, height);
|
||||||
|
|
||||||
fake_camera.StopCamera();
|
fake_camera.StopCamera();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user