iOS: Add resource files for tests and implement OutputPath
With this change the following tests have been successfully passing in the iOS Simulator for iPhone 5 and iOS 9: * audio_decoder_unittests * common_video_unittests * modules_tests * rtc_api_objc_tests * rtc_pc_unittests * system_wrappers_unittests * voice_engine_unittests The modules_unittests and common_audio_unittests are handled in https://codereview.webrtc.org/1698033002/ BUG=webrtc:4755 NOTRY=True Review URL: https://codereview.webrtc.org/1694353003 Cr-Commit-Position: refs/heads/master@{#11646}
This commit is contained in:
@ -1,7 +1,31 @@
|
|||||||
{
|
{
|
||||||
"tests": [
|
"tests": [
|
||||||
|
{
|
||||||
|
"app": "audio_decoder_unittests"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"app": "common_audio_unittests"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"app": "common_video_unittests"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"app": "modules_tests"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"app": "modules_unittests"
|
"app": "modules_unittests"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"app": "rtc_api_objc_tests"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"app": "rtc_pc_unittests"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"app": "system_wrappers_unittests"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"app": "voice_engine_unittests"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,6 +35,11 @@
|
|||||||
'<(DEPTH)/testing/android/native_test.gyp:native_test_native_code',
|
'<(DEPTH)/testing/android/native_test.gyp:native_test_native_code',
|
||||||
],
|
],
|
||||||
}],
|
}],
|
||||||
|
['OS=="ios"', {
|
||||||
|
'mac_bundle_resources': [
|
||||||
|
'<(DEPTH)/resources/foreman_cif.yuv',
|
||||||
|
],
|
||||||
|
}],
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
], # targets
|
], # targets
|
||||||
|
|||||||
@ -103,8 +103,8 @@ TestLibYuv::TestLibYuv()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TestLibYuv::SetUp() {
|
void TestLibYuv::SetUp() {
|
||||||
const std::string input_file_name = webrtc::test::ProjectRootPath() +
|
const std::string input_file_name = webrtc::test::ResourcePath("foreman_cif",
|
||||||
"resources/foreman_cif.yuv";
|
"yuv");
|
||||||
source_file_ = fopen(input_file_name.c_str(), "rb");
|
source_file_ = fopen(input_file_name.c_str(), "rb");
|
||||||
ASSERT_TRUE(source_file_ != NULL) << "Cannot read file: "<<
|
ASSERT_TRUE(source_file_ != NULL) << "Cannot read file: "<<
|
||||||
input_file_name << "\n";
|
input_file_name << "\n";
|
||||||
|
|||||||
@ -164,6 +164,15 @@
|
|||||||
'sources!': [
|
'sources!': [
|
||||||
'sctp/sctpdataengine_unittest.cc',
|
'sctp/sctpdataengine_unittest.cc',
|
||||||
],
|
],
|
||||||
|
'mac_bundle_resources': [
|
||||||
|
'<(DEPTH)/resources/media/captured-320x240-2s-48.frames',
|
||||||
|
'<(DEPTH)/resources/media/faces.1280x720_P420.yuv',
|
||||||
|
'<(DEPTH)/resources/media/faces_I420.jpg',
|
||||||
|
'<(DEPTH)/resources/media/faces_I422.jpg',
|
||||||
|
'<(DEPTH)/resources/media/faces_I444.jpg',
|
||||||
|
'<(DEPTH)/resources/media/faces_I411.jpg',
|
||||||
|
'<(DEPTH)/resources/media/faces_I400.jpg',
|
||||||
|
],
|
||||||
}],
|
}],
|
||||||
],
|
],
|
||||||
}, # target rtc_media_unittests
|
}, # target rtc_media_unittests
|
||||||
|
|||||||
@ -96,8 +96,8 @@ double MseInputOutput(const std::vector<int16_t>& input,
|
|||||||
class AudioDecoderTest : public ::testing::Test {
|
class AudioDecoderTest : public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
AudioDecoderTest()
|
AudioDecoderTest()
|
||||||
: input_audio_(webrtc::test::ProjectRootPath() +
|
: input_audio_(
|
||||||
"resources/audio_coding/testfile32kHz.pcm",
|
webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm"),
|
||||||
32000),
|
32000),
|
||||||
codec_input_rate_hz_(32000), // Legacy default value.
|
codec_input_rate_hz_(32000), // Legacy default value.
|
||||||
encoded_(NULL),
|
encoded_(NULL),
|
||||||
|
|||||||
@ -159,6 +159,11 @@
|
|||||||
'<(DEPTH)/testing/android/native_test.gyp:native_test_native_code',
|
'<(DEPTH)/testing/android/native_test.gyp:native_test_native_code',
|
||||||
],
|
],
|
||||||
}],
|
}],
|
||||||
|
['OS=="ios"', {
|
||||||
|
'mac_bundle_resources': [
|
||||||
|
'<(DEPTH)/resources/audio_coding/testfile32kHz.pcm',
|
||||||
|
],
|
||||||
|
}],
|
||||||
],
|
],
|
||||||
}, # audio_decoder_unittests
|
}, # audio_decoder_unittests
|
||||||
|
|
||||||
|
|||||||
@ -107,6 +107,14 @@
|
|||||||
'<(DEPTH)/testing/android/native_test.gyp:native_test_native_code',
|
'<(DEPTH)/testing/android/native_test.gyp:native_test_native_code',
|
||||||
],
|
],
|
||||||
}],
|
}],
|
||||||
|
['OS=="ios"', {
|
||||||
|
'mac_bundle_resources': [
|
||||||
|
'<(DEPTH)/resources/audio_coding/testfile32kHz.pcm',
|
||||||
|
'<(DEPTH)/resources/audio_coding/teststereo32kHz.pcm',
|
||||||
|
'<(DEPTH)/resources/foreman_cif.yuv',
|
||||||
|
'<(DEPTH)/resources/paris_qcif.yuv',
|
||||||
|
],
|
||||||
|
}],
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@ -81,7 +81,13 @@ void ReceivePackets(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(FecTest, FecTest) {
|
// Too slow to finish before timeout on iOS. See webrtc:4755.
|
||||||
|
#if defined(WEBRTC_IOS)
|
||||||
|
#define MAYBE_FecTest DISABLED_FecTest
|
||||||
|
#else
|
||||||
|
#define MAYBE_FecTest FecTest
|
||||||
|
#endif
|
||||||
|
TEST(FecTest, MAYBE_FecTest) {
|
||||||
// TODO(marpan): Split this function into subroutines/helper functions.
|
// TODO(marpan): Split this function into subroutines/helper functions.
|
||||||
enum { kMaxNumberMediaPackets = 48 };
|
enum { kMaxNumberMediaPackets = 48 };
|
||||||
enum { kMaxNumberFecPackets = 48 };
|
enum { kMaxNumberFecPackets = 48 };
|
||||||
|
|||||||
@ -84,7 +84,9 @@ struct RateControlMetrics {
|
|||||||
// Sequence used is foreman (CIF): may be better to use VGA for resize test.
|
// Sequence used is foreman (CIF): may be better to use VGA for resize test.
|
||||||
const int kCIFWidth = 352;
|
const int kCIFWidth = 352;
|
||||||
const int kCIFHeight = 288;
|
const int kCIFHeight = 288;
|
||||||
|
#if !defined(WEBRTC_IOS)
|
||||||
const int kNbrFramesShort = 100; // Some tests are run for shorter sequence.
|
const int kNbrFramesShort = 100; // Some tests are run for shorter sequence.
|
||||||
|
#endif
|
||||||
const int kNbrFramesLong = 299;
|
const int kNbrFramesLong = 299;
|
||||||
|
|
||||||
// Parameters from VP8 wrapper, which control target size of key frames.
|
// Parameters from VP8 wrapper, which control target size of key frames.
|
||||||
@ -621,6 +623,9 @@ TEST_F(VideoProcessorIntegrationTest, Process0PercentPacketLossH264) {
|
|||||||
|
|
||||||
#endif // defined(WEBRTC_VIDEOPROCESSOR_H264_TESTS)
|
#endif // defined(WEBRTC_VIDEOPROCESSOR_H264_TESTS)
|
||||||
|
|
||||||
|
// Fails on iOS. See webrtc:4755.
|
||||||
|
#if !defined(WEBRTC_IOS)
|
||||||
|
|
||||||
// VP9: Run with no packet loss and fixed bitrate. Quality should be very high.
|
// VP9: Run with no packet loss and fixed bitrate. Quality should be very high.
|
||||||
// One key frame (first frame only) in sequence. Setting |key_frame_interval|
|
// One key frame (first frame only) in sequence. Setting |key_frame_interval|
|
||||||
// to -1 below means no periodic key frames in test.
|
// to -1 below means no periodic key frames in test.
|
||||||
@ -842,6 +847,8 @@ TEST_F(VideoProcessorIntegrationTest, Process10PercentPacketLoss) {
|
|||||||
rc_metrics);
|
rc_metrics);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // !defined(WEBRTC_IOS)
|
||||||
|
|
||||||
// The tests below are currently disabled for Android. For ARM, the encoder
|
// The tests below are currently disabled for Android. For ARM, the encoder
|
||||||
// uses |cpu_speed| = 12, as opposed to default |cpu_speed| <= 6 for x86,
|
// uses |cpu_speed| = 12, as opposed to default |cpu_speed| <= 6 for x86,
|
||||||
// which leads to significantly different quality. The quality and rate control
|
// which leads to significantly different quality. The quality and rate control
|
||||||
@ -855,7 +862,8 @@ TEST_F(VideoProcessorIntegrationTest, Process10PercentPacketLoss) {
|
|||||||
// low to high to medium. Check that quality and encoder response to the new
|
// low to high to medium. Check that quality and encoder response to the new
|
||||||
// target rate/per-frame bandwidth (for each rate update) is within limits.
|
// target rate/per-frame bandwidth (for each rate update) is within limits.
|
||||||
// One key frame (first frame only) in sequence.
|
// One key frame (first frame only) in sequence.
|
||||||
#if defined(WEBRTC_ANDROID)
|
// Too slow to finish before timeout on iOS. See webrtc:4755.
|
||||||
|
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
|
||||||
#define MAYBE_ProcessNoLossChangeBitRateVP8 \
|
#define MAYBE_ProcessNoLossChangeBitRateVP8 \
|
||||||
DISABLED_ProcessNoLossChangeBitRateVP8
|
DISABLED_ProcessNoLossChangeBitRateVP8
|
||||||
#else
|
#else
|
||||||
@ -892,7 +900,8 @@ TEST_F(VideoProcessorIntegrationTest, MAYBE_ProcessNoLossChangeBitRateVP8) {
|
|||||||
// for the rate control metrics can be lower. One key frame (first frame only).
|
// for the rate control metrics can be lower. One key frame (first frame only).
|
||||||
// Note: quality after update should be higher but we currently compute quality
|
// Note: quality after update should be higher but we currently compute quality
|
||||||
// metrics averaged over whole sequence run.
|
// metrics averaged over whole sequence run.
|
||||||
#if defined(WEBRTC_ANDROID)
|
// Too slow to finish before timeout on iOS. See webrtc:4755.
|
||||||
|
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
|
||||||
#define MAYBE_ProcessNoLossChangeFrameRateFrameDropVP8 \
|
#define MAYBE_ProcessNoLossChangeFrameRateFrameDropVP8 \
|
||||||
DISABLED_ProcessNoLossChangeFrameRateFrameDropVP8
|
DISABLED_ProcessNoLossChangeFrameRateFrameDropVP8
|
||||||
#else
|
#else
|
||||||
@ -927,7 +936,8 @@ TEST_F(VideoProcessorIntegrationTest,
|
|||||||
|
|
||||||
// Run with no packet loss, at low bitrate. During this time we should've
|
// Run with no packet loss, at low bitrate. During this time we should've
|
||||||
// resized once. Expect 2 key frames generated (first and one for resize).
|
// resized once. Expect 2 key frames generated (first and one for resize).
|
||||||
#if defined(WEBRTC_ANDROID)
|
// Too slow to finish before timeout on iOS. See webrtc:4755.
|
||||||
|
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
|
||||||
#define MAYBE_ProcessNoLossSpatialResizeFrameDropVP8 \
|
#define MAYBE_ProcessNoLossSpatialResizeFrameDropVP8 \
|
||||||
DISABLED_ProcessNoLossSpatialResizeFrameDropVP8
|
DISABLED_ProcessNoLossSpatialResizeFrameDropVP8
|
||||||
#else
|
#else
|
||||||
@ -961,7 +971,8 @@ TEST_F(VideoProcessorIntegrationTest,
|
|||||||
// encoding rate mismatch are applied to each layer.
|
// encoding rate mismatch are applied to each layer.
|
||||||
// No dropped frames in this test, and internal spatial resizer is off.
|
// No dropped frames in this test, and internal spatial resizer is off.
|
||||||
// One key frame (first frame only) in sequence, so no spatial resizing.
|
// One key frame (first frame only) in sequence, so no spatial resizing.
|
||||||
#if defined(WEBRTC_ANDROID)
|
// Too slow to finish before timeout on iOS. See webrtc:4755.
|
||||||
|
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
|
||||||
#define MAYBE_ProcessNoLossTemporalLayersVP8 \
|
#define MAYBE_ProcessNoLossTemporalLayersVP8 \
|
||||||
DISABLED_ProcessNoLossTemporalLayersVP8
|
DISABLED_ProcessNoLossTemporalLayersVP8
|
||||||
#else
|
#else
|
||||||
|
|||||||
@ -26,7 +26,7 @@ CmdArgs::CmdArgs()
|
|||||||
width(352),
|
width(352),
|
||||||
height(288),
|
height(288),
|
||||||
rtt(0),
|
rtt(0),
|
||||||
inputFile(webrtc::test::ProjectRootPath() + "/resources/foreman_cif.yuv"),
|
inputFile(webrtc::test::ResourcePath("foreman_cif", "yuv")),
|
||||||
outputFile(webrtc::test::OutputPath() +
|
outputFile(webrtc::test::OutputPath() +
|
||||||
"video_coding_test_output_352x288.yuv") {}
|
"video_coding_test_output_352x288.yuv") {}
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@ DEFINE_int32(width, 352, "Width in pixels of the frames in the input file.");
|
|||||||
DEFINE_int32(height, 288, "Height in pixels of the frames in the input file.");
|
DEFINE_int32(height, 288, "Height in pixels of the frames in the input file.");
|
||||||
DEFINE_int32(rtt, 0, "RTT (round-trip time), in milliseconds.");
|
DEFINE_int32(rtt, 0, "RTT (round-trip time), in milliseconds.");
|
||||||
DEFINE_string(input_filename,
|
DEFINE_string(input_filename,
|
||||||
webrtc::test::ProjectRootPath() + "/resources/foreman_cif.yuv",
|
webrtc::test::ResourcePath("foreman_cif", "yuv"),
|
||||||
"Input file.");
|
"Input file.");
|
||||||
DEFINE_string(output_filename,
|
DEFINE_string(output_filename,
|
||||||
webrtc::test::OutputPath() +
|
webrtc::test::OutputPath() +
|
||||||
|
|||||||
@ -43,6 +43,7 @@ namespace test {
|
|||||||
|
|
||||||
#if defined(WEBRTC_IOS)
|
#if defined(WEBRTC_IOS)
|
||||||
// Defined in iosfileutils.mm. No header file to discourage use elsewhere.
|
// Defined in iosfileutils.mm. No header file to discourage use elsewhere.
|
||||||
|
std::string IOSOutputPath();
|
||||||
std::string IOSResourcePath(std::string name, std::string extension);
|
std::string IOSResourcePath(std::string name, std::string extension);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -59,9 +60,12 @@ const char* kRootDirName = "/sdcard/";
|
|||||||
#else
|
#else
|
||||||
// The file we're looking for to identify the project root dir.
|
// The file we're looking for to identify the project root dir.
|
||||||
const char* kProjectRootFileName = "DEPS";
|
const char* kProjectRootFileName = "DEPS";
|
||||||
|
#if !defined(WEBRTC_IOS)
|
||||||
const char* kOutputDirName = "out";
|
const char* kOutputDirName = "out";
|
||||||
const char* kFallbackPath = "./";
|
|
||||||
#endif
|
#endif
|
||||||
|
const char* kFallbackPath = "./";
|
||||||
|
#endif // !defined(WEBRTC_ANDROID)
|
||||||
|
|
||||||
#if !defined(WEBRTC_IOS)
|
#if !defined(WEBRTC_IOS)
|
||||||
const char* kResourcesDirName = "resources";
|
const char* kResourcesDirName = "resources";
|
||||||
#endif
|
#endif
|
||||||
@ -140,6 +144,9 @@ std::string ProjectRootPath() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string OutputPath() {
|
std::string OutputPath() {
|
||||||
|
#if defined(WEBRTC_IOS)
|
||||||
|
return IOSOutputPath();
|
||||||
|
#else
|
||||||
std::string path = ProjectRootPath();
|
std::string path = ProjectRootPath();
|
||||||
if (path == kCannotFindProjectRootDir) {
|
if (path == kCannotFindProjectRootDir) {
|
||||||
return kFallbackPath;
|
return kFallbackPath;
|
||||||
@ -149,6 +156,7 @@ std::string OutputPath() {
|
|||||||
return kFallbackPath;
|
return kFallbackPath;
|
||||||
}
|
}
|
||||||
return path + kPathDelimiter;
|
return path + kPathDelimiter;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string WorkingDir() {
|
std::string WorkingDir() {
|
||||||
|
|||||||
@ -54,6 +54,18 @@ std::string IOSResourcePath(std::string name, std::string extension) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For iOS, we don't have access to the output directory. Return the path to the
|
||||||
|
// temporary directory instead. This is mostly used by tests that need to write
|
||||||
|
// output files to disk.
|
||||||
|
std::string IOSOutputPath() {
|
||||||
|
@autoreleasepool {
|
||||||
|
NSString* tempDir = NSTemporaryDirectory();
|
||||||
|
if (tempDir == nil)
|
||||||
|
tempDir = @"/tmp";
|
||||||
|
return StdStringFromNSString(tempDir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace test
|
} // namespace test
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
||||||
|
|||||||
@ -204,6 +204,12 @@
|
|||||||
'<(DEPTH)/testing/android/native_test.gyp:native_test_native_code',
|
'<(DEPTH)/testing/android/native_test.gyp:native_test_native_code',
|
||||||
],
|
],
|
||||||
}],
|
}],
|
||||||
|
['OS=="ios"', {
|
||||||
|
'mac_bundle_resources': [
|
||||||
|
'<(DEPTH)/resources/foreman_cif_short.yuv',
|
||||||
|
'<(DEPTH)/resources/voice_engine/audio_long16.pcm',
|
||||||
|
],
|
||||||
|
}],
|
||||||
['enable_protobuf==1', {
|
['enable_protobuf==1', {
|
||||||
'defines': [
|
'defines': [
|
||||||
'ENABLE_RTC_EVENT_LOG',
|
'ENABLE_RTC_EVENT_LOG',
|
||||||
|
|||||||
Reference in New Issue
Block a user