Renamed platform specific code to use GYP conventions.

Restructured GYP files a bit to clean up things.
Removed copying of images to /tmp
Fixed output location of DumpFileName.rtp.

BUG=None
TEST=Tested compiling and running on Mac, Win, Linux.

Review URL: https://webrtc-codereview.appspot.com/406002

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1802 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
kjellander@webrtc.org 2012-02-29 20:55:25 +00:00
parent a368f86ff6
commit 132eccbb69
9 changed files with 264 additions and 319 deletions

View File

@ -113,6 +113,13 @@
'mac/cocoa_full_screen_window.mm',
],
}],
['OS=="mac"', {
'direct_dependent_settings': {
'include_dirs': [
'mac',
],
},
}],
['OS!="win" or include_internal_video_render==0', {
'sources!': [
'windows/i_video_render_win.h',

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@ -217,16 +217,6 @@ namespace {
}
#define AutoTestSleep ::Sleep
#define VIE_TEST_FILES_ROOT "/sdcard/vie_auto_test/"
#else
#define VIE_TEST_FILES_ROOT "/tmp/"
#endif
namespace {
FILE* OpenTestFile(const char* fileName) {
char filePath[256];
sprintf(filePath, "%s%s", VIE_TEST_FILES_ROOT, fileName);
return fopen(filePath, "rb");
}
}
#endif // WEBRTC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_INTERFACE_VIE_AUTOTEST_DEFINES_H_

View File

@ -459,13 +459,6 @@ void ViEAutoTest::ViECaptureExternalCaptureTest()
unsigned char* videoFrame = new unsigned char[videoFrameLength];
memset(videoFrame, 128, 176 * 144);
// TODO: Find a file to use for testing.
// FILE* foreman = OpenTestFile("akiyo_qcif.yuv");
// if (foreman == NULL)
// {
// ViETest::Log("Failed to open file akiyo_qcif.yuv");
// }
int frameCount = 0;
webrtc::VideoCaptureCapability capability;
capability.width = 176;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@ -8,12 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
/*
* vie_autotest_mac_carbon.cc
*
*/
#include "engine_configurations.h"
#include "engine_configurations.h"
#if defined(CARBON_RENDERING)
#include "vie_autotest_mac_carbon.h"
@ -305,7 +300,8 @@ int main(int argc, const char * argv[])
[NSApplication sharedApplication];
// we have to run the test in a secondary thread because we need to run a runloop, which blocks
// We have to run the test in a secondary thread because we need to run a
// runloop, which blocks.
if (argc > 1)
{
AutoTestClass * autoTestClass = [[AutoTestClass alloc]init];

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@ -8,14 +8,11 @@
* be found in the AUTHORS file in the root of the source tree.
*/
//
// vie_autotest_file.cc
//
#include "vie_autotest_defines.h"
#include "vie_autotest.h"
#include "engine_configurations.h"
#include "testsupport/fileutils.h"
#include "tb_interfaces.h"
#include "tb_capture_device.h"
@ -149,21 +146,19 @@ void ViEAutoTest::ViEFileStandardTest()
const int TEST_SPACING = 1000;
const int VIDEO_LENGTH = 5000;
const std::string root = webrtc::test::ProjectRootPath() +
"src/video_engine/test/auto_test/media/";
const std::string renderStartImage = root + "renderStartImage.jpg";
const std::string captureDeviceImage = root + "captureDeviceImage.jpg";
const std::string renderTimeoutFile = root + "renderTimeoutImage.jpg";
const char renderStartImage[1024] =
VIE_TEST_FILES_ROOT "renderStartImage.jpg";
const char captureDeviceImage[1024] =
VIE_TEST_FILES_ROOT "captureDeviceImage.jpg";
const char renderTimeoutFile[1024] =
VIE_TEST_FILES_ROOT "renderTimeoutImage.jpg";
const char snapshotCaptureDeviceFileName[256] =
VIE_TEST_FILES_ROOT "snapshotCaptureDevice.jpg";
const char incomingVideo[1024] =
VIE_TEST_FILES_ROOT "incomingVideo.avi";
const char outgoingVideo[1024] =
VIE_TEST_FILES_ROOT "outgoingVideo.avi";
char snapshotRenderFileName[256] =
VIE_TEST_FILES_ROOT "snapshotRenderer.jpg";
const std::string output = webrtc::test::OutputPath();
const std::string snapshotCaptureDeviceFileName =
output + "snapshotCaptureDevice.jpg";
const std::string incomingVideo = output + "incomingVideo.avi";
const std::string outgoingVideo = output + "outgoingVideo.avi";
const std::string snapshotRenderFileName =
output + "snapshotRenderer.jpg";
webrtc::ViEPicture capturePicture;
webrtc::ViEPicture renderPicture;
@ -180,7 +175,7 @@ void ViEAutoTest::ViEFileStandardTest()
"seconds", VIDEO_LENGTH);
EXPECT_EQ(0, ptrViEFile->StartRecordIncomingVideo(
videoChannel, incomingVideo, webrtc::NO_AUDIO,
videoChannel, incomingVideo.c_str(), webrtc::NO_AUDIO,
audioCodec2, videoCodec));
AutoTestSleep(VIDEO_LENGTH);
@ -199,15 +194,17 @@ void ViEAutoTest::ViEFileStandardTest()
ViETest::Log("Reading video file information");
EXPECT_EQ(0, ptrViEFile->GetFileInformation(
incomingVideo, fileVideoCodec, fileAudioCodec));
incomingVideo.c_str(), fileVideoCodec, fileAudioCodec));
PrintAudioCodec(fileAudioCodec);
PrintVideoCodec(fileVideoCodec);
}
// testing StartPlayFile and RegisterObserver
{
ViETest::Log("Start playing file: %s with observer", incomingVideo);
EXPECT_EQ(0, ptrViEFile->StartPlayFile(incomingVideo, fileId));
ViETest::Log("Start playing file: %s with observer",
incomingVideo.c_str());
EXPECT_EQ(0, ptrViEFile->StartPlayFile(incomingVideo.c_str(),
fileId));
ViETest::Log("Registering file observer");
EXPECT_EQ(0, ptrViEFile->RegisterObserver(fileId, fileObserver));
@ -250,7 +247,7 @@ void ViEAutoTest::ViEFileStandardTest()
ViETest::Log("Recording outgoing video (currently no audio) for %d "
"seconds", VIDEO_LENGTH);
EXPECT_EQ(0, ptrViEFile->StartRecordOutgoingVideo(
videoChannel, outgoingVideo, webrtc::NO_AUDIO,
videoChannel, outgoingVideo.c_str(), webrtc::NO_AUDIO,
audioCodec2, videoCodec));
AutoTestSleep(VIDEO_LENGTH);
@ -262,7 +259,7 @@ void ViEAutoTest::ViEFileStandardTest()
// again testing GetFileInformation
{
EXPECT_EQ(0, ptrViEFile->GetFileInformation(
incomingVideo, videoCodec, audioCodec2));
incomingVideo.c_str(), videoCodec, audioCodec2));
PrintAudioCodec(audioCodec2);
PrintVideoCodec(videoCodec);
}
@ -299,8 +296,9 @@ void ViEAutoTest::ViEFileStandardTest()
ViETest::Log("Taking snapshot of videoChannel %d", captureId);
EXPECT_EQ(0, ptrViEFile->GetRenderSnapshot(
captureId, snapshotRenderFileName));
ViETest::Log("Wrote image to file %s", snapshotRenderFileName);
captureId, snapshotRenderFileName.c_str()));
ViETest::Log("Wrote image to file %s",
snapshotRenderFileName.c_str());
ViETest::Log("Done\n");
AutoTestSleep(TEST_SPACING);
}
@ -320,9 +318,9 @@ void ViEAutoTest::ViEFileStandardTest()
ViETest::Log("Testing GetCaptureDeviceSnapshot(int, char*)");
ViETest::Log("Taking snapshot from capture device %d", captureId);
EXPECT_EQ(0, ptrViEFile->GetCaptureDeviceSnapshot(
captureId, snapshotCaptureDeviceFileName));
captureId, snapshotCaptureDeviceFileName.c_str()));
ViETest::Log("Wrote image to file %s",
snapshotCaptureDeviceFileName);
snapshotCaptureDeviceFileName.c_str());
ViETest::Log("Done\n");
}
@ -333,7 +331,7 @@ void ViEAutoTest::ViEFileStandardTest()
ViETest::Log("Testing SetCaptureDeviceImage(int, char*)");
EXPECT_EQ(0, ptrViECapture->StopCapture(captureId));
EXPECT_EQ(0, ptrViEFile->SetCaptureDeviceImage(
captureId, captureDeviceImage));
captureId, captureDeviceImage.c_str()));
ViETest::Log("you should see the capture device image now");
AutoTestSleep(2 * RENDER_TIMEOUT);
@ -365,7 +363,7 @@ void ViEAutoTest::ViEFileStandardTest()
ViETest::Log("Stoping renderer, setting start image, then "
"restarting");
EXPECT_EQ(0, ptrViEFile->SetRenderStartImage(
videoChannel, renderStartImage));
videoChannel, renderStartImage.c_str()));
EXPECT_EQ(0, ptrViECapture->StopCapture(captureId));
EXPECT_EQ(0, ptrViERender->StopRender(videoChannel));
@ -409,7 +407,7 @@ void ViEAutoTest::ViEFileStandardTest()
ViETest::Log("Stopping capture device to induce timeout of %d ms",
RENDER_TIMEOUT);
EXPECT_EQ(0, ptrViEFile->SetRenderTimeoutImage(
videoChannel, renderTimeoutFile, RENDER_TIMEOUT));
videoChannel, renderTimeoutFile.c_str(), RENDER_TIMEOUT));
// now stop sending frames to the remote renderer and wait for
// timeout

View File

@ -18,6 +18,7 @@
#include "tb_external_transport.h"
#include "tb_interfaces.h"
#include "tb_video_channel.h"
#include "testsupport/fileutils.h"
#include "vie_autotest.h"
#include "vie_autotest_defines.h"
@ -612,7 +613,9 @@ void ViEAutoTest::ViERtpRtcpAPITest()
#ifdef WEBRTC_ANDROID
const char* dumpName = "/sdcard/DumpFileName.rtp";
#else
const char* dumpName = "DumpFileName.rtp";
std::string output_file = webrtc::test::OutputPath() +
"DumpFileName.rtp";
const char* dumpName = output_file.c_str();
#endif
EXPECT_EQ(0, ViE.rtp_rtcp->StartRTPDump(
tbChannel.videoChannel, dumpName, webrtc::kRtpIncoming));

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source

View File

@ -109,45 +109,14 @@
'source/vie_autotest_linux.cc',
'source/vie_window_manager_factory_linux.cc',
# Mac
'source/vie_autotest_mac_cocoa.mm',
'source/vie_autotest_mac_carbon.cc',
'source/vie_autotest_cocoa_mac.mm',
'source/vie_autotest_carbon_mac.cc',
'source/vie_window_manager_factory_mac.mm',
# Windows
'source/vie_autotest_windows.cc',
'source/vie_autotest_win.cc',
'source/vie_window_manager_factory_win.cc',
],
'copies': [{
'destination': '/tmp',
'files': [
'media/captureDeviceImage.bmp',
'media/captureDeviceImage.jpg',
'media/renderStartImage.bmp',
'media/renderStartImage.jpg',
'media/renderTimeoutImage.bmp',
'media/renderTimeoutImage.jpg',
],
}],
'conditions': [
# TODO(andrew): rename these to be suffixed with _mac and _win. They
# will then be automatically excluded.
['OS!="mac"', {
'sources!': [
'source/vie_autotest_mac_cocoa.cc',
'source/vie_autotest_mac_carbon.cc',
'source/vie_window_manager_factory_mac.mm',
],
}],
['OS!="win"', {
'sources!': [
'source/vie_autotest_windows.cc',
],
}],
['OS!="linux"', {
'sources!': [
'source/vie_window_manager_factory_linux.cc',
],
}],
# TODO(andrew): this likely isn't an actual dependency. It should be
# included in webrtc.gyp or video_engine.gyp instead.
['OS=="win"', {
@ -155,18 +124,7 @@
'vie_win_test',
],
}],
['OS=="linux"', {
# TODO(andrew): these should be provided directly by the projects
# which require them instead.
'libraries': [
'-lXext',
'-lX11',
],
}],
['OS=="mac"', {
'include_dirs': [
'../../../modules/video_render/main/source/mac',
],
'xcode_settings': {
'OTHER_LDFLAGS': [
'-framework Foundation -framework AppKit -framework Cocoa -framework OpenGL -framework CoreVideo -framework CoreAudio -framework AudioToolbox',