diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/BUILD.gn | 3 | ||||
-rw-r--r-- | test/encoder_settings.cc | 2 | ||||
-rw-r--r-- | test/fake_encoder.cc | 10 | ||||
-rw-r--r-- | test/test.gyp | 16 | ||||
-rw-r--r-- | test/testsupport/android/root_path_android.cc | 26 | ||||
-rw-r--r-- | test/testsupport/android/root_path_android_chromium.cc | 34 | ||||
-rw-r--r-- | test/testsupport/fileutils.cc | 39 | ||||
-rw-r--r-- | test/testsupport/fileutils_unittest.cc | 7 |
8 files changed, 30 insertions, 107 deletions
diff --git a/test/BUILD.gn b/test/BUILD.gn index db17c31e..870404e7 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -67,10 +67,7 @@ source_set("test_support") { ] if (is_android) { - sources += [ "testsupport/android/root_path_android_chromium.cc" ] deps += [ "//base:base" ] - } else { - sources += [ "testsupport/android/root_path_android.cc" ] } configs += [ "..:common_config" ] diff --git a/test/encoder_settings.cc b/test/encoder_settings.cc index db064bb8..bae13505 100644 --- a/test/encoder_settings.cc +++ b/test/encoder_settings.cc @@ -60,6 +60,8 @@ VideoReceiveStream::Decoder CreateMatchingDecoder( decoder.payload_name = encoder_settings.payload_name; if (encoder_settings.payload_name == "VP8") { decoder.decoder = VideoDecoder::Create(VideoDecoder::kVp8); + } else if (encoder_settings.payload_name == "VP9") { + decoder.decoder = VideoDecoder::Create(VideoDecoder::kVp9); } else { decoder.decoder = new FakeDecoder(); } diff --git a/test/fake_encoder.cc b/test/fake_encoder.cc index 9551c820..0573c8af 100644 --- a/test/fake_encoder.cc +++ b/test/fake_encoder.cc @@ -51,7 +51,8 @@ int32_t FakeEncoder::Encode( assert(config_.maxFramerate > 0); int time_since_last_encode_ms = 1000 / config_.maxFramerate; int64_t time_now_ms = clock_->TimeInMilliseconds(); - if (last_encode_time_ms_ > 0) { + const bool first_encode = last_encode_time_ms_ == 0; + if (!first_encode) { // For all frames but the first we can estimate the display time by looking // at the display time of the previous frame. time_since_last_encode_ms = time_now_ms - last_encode_time_ms_; @@ -80,6 +81,12 @@ int32_t FakeEncoder::Encode( int stream_bits = (bits_available > max_stream_bits) ? max_stream_bits : bits_available; int stream_bytes = (stream_bits + 7) / 8; + if (first_encode) { + // The first frame is a key frame and should be larger. + // TODO(holmer): The FakeEncoder should store the bits_available between + // encodes so that it can compensate for oversized frames. + stream_bytes *= 10; + } if (static_cast<size_t>(stream_bytes) > sizeof(encoded_buffer_)) stream_bytes = sizeof(encoded_buffer_); @@ -96,7 +103,6 @@ int32_t FakeEncoder::Encode( assert(callback_ != NULL); if (callback_->Encoded(encoded, &specifics, NULL) != 0) return -1; - bits_available -= encoded._length * 8; } return 0; diff --git a/test/test.gyp b/test/test.gyp index 5c959b9e..7aba2f57 100644 --- a/test/test.gyp +++ b/test/test.gyp @@ -98,8 +98,6 @@ '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers', ], 'sources': [ - 'testsupport/android/root_path_android.cc', - 'testsupport/android/root_path_android_chromium.cc', 'testsupport/fileutils.cc', 'testsupport/fileutils.h', 'testsupport/frame_reader.cc', @@ -117,20 +115,6 @@ 'testsupport/trace_to_stderr.cc', 'testsupport/trace_to_stderr.h', ], - 'conditions': [ - ['OS=="android"', { - 'dependencies': [ - '<(DEPTH)/base/base.gyp:base', - ], - 'sources!': [ - 'testsupport/android/root_path_android.cc', - ], - }, { - 'sources!': [ - 'testsupport/android/root_path_android_chromium.cc', - ], - }], - ], }, { # Depend on this target when you want to have test_support but also the diff --git a/test/testsupport/android/root_path_android.cc b/test/testsupport/android/root_path_android.cc deleted file mode 100644 index 6eca5f57..00000000 --- a/test/testsupport/android/root_path_android.cc +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2013 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 - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#include <string> - -namespace webrtc { -namespace test { - -static const char* kRootDirName = "/sdcard/"; -std::string ProjectRootPathAndroid() { - return kRootDirName; -} - -std::string OutputPathAndroid() { - return kRootDirName; -} - -} // namespace test -} // namespace webrtc diff --git a/test/testsupport/android/root_path_android_chromium.cc b/test/testsupport/android/root_path_android_chromium.cc deleted file mode 100644 index f8e65f4f..00000000 --- a/test/testsupport/android/root_path_android_chromium.cc +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2013 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 - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#include "base/android/path_utils.h" -#include "base/files/file_path.h" - -namespace webrtc { -namespace test { - -std::string OutputPathImpl(); - -// This file is only compiled when running WebRTC tests in a Chromium workspace. -// The Android testing framework will push files relative to the root path of -// the Chromium workspace. The root path for webrtc is one directory up from -// trunk/webrtc (in standalone) or src/third_party/webrtc (in Chromium). -std::string ProjectRootPathAndroid() { - base::FilePath root_path; - base::android::GetExternalStorageDirectory(&root_path); - return root_path.value() + "/"; -} - -std::string OutputPathAndroid() { - return OutputPathImpl(); -} - -} // namespace test -} // namespace webrtc diff --git a/test/testsupport/fileutils.cc b/test/testsupport/fileutils.cc index a3e66201..36ca391c 100644 --- a/test/testsupport/fileutils.cc +++ b/test/testsupport/fileutils.cc @@ -50,15 +50,15 @@ const char* kPathDelimiter = "/"; #endif #ifdef WEBRTC_ANDROID -const char* kResourcesDirName = "resources"; +const char* kRootDirName = "/sdcard/"; #else // The file we're looking for to identify the project root dir. const char* kProjectRootFileName = "DEPS"; -const char* kResourcesDirName = "resources"; +const char* kOutputDirName = "out"; +const char* kFallbackPath = "./"; #endif +const char* kResourcesDirName = "resources"; -const char* kFallbackPath = "./"; -const char* kOutputDirName = "out"; char relative_dir_path[FILENAME_MAX]; bool relative_dir_path_set = false; @@ -66,9 +66,6 @@ bool relative_dir_path_set = false; const char* kCannotFindProjectRootDir = "ERROR_CANNOT_FIND_PROJECT_ROOT_DIR"; -std::string OutputPathAndroid(); -std::string ProjectRootPathAndroid(); - void SetExecutablePath(const std::string& path) { std::string working_dir = WorkingDir(); std::string temp_path = path; @@ -95,30 +92,18 @@ bool FileExists(std::string& file_name) { return stat(file_name.c_str(), &file_info) == 0; } -std::string OutputPathImpl() { - std::string path = ProjectRootPath(); - if (path == kCannotFindProjectRootDir) { - return kFallbackPath; - } - path += kOutputDirName; - if (!CreateDir(path)) { - return kFallbackPath; - } - return path + kPathDelimiter; -} - #ifdef WEBRTC_ANDROID std::string ProjectRootPath() { - return ProjectRootPathAndroid(); + return kRootDirName; } std::string OutputPath() { - return OutputPathAndroid(); + return kRootDirName; } std::string WorkingDir() { - return ProjectRootPath(); + return kRootDirName; } #else // WEBRTC_ANDROID @@ -148,7 +133,15 @@ std::string ProjectRootPath() { } std::string OutputPath() { - return OutputPathImpl(); + std::string path = ProjectRootPath(); + if (path == kCannotFindProjectRootDir) { + return kFallbackPath; + } + path += kOutputDirName; + if (!CreateDir(path)) { + return kFallbackPath; + } + return path + kPathDelimiter; } std::string WorkingDir() { diff --git a/test/testsupport/fileutils_unittest.cc b/test/testsupport/fileutils_unittest.cc index 114f1083..dff7f224 100644 --- a/test/testsupport/fileutils_unittest.cc +++ b/test/testsupport/fileutils_unittest.cc @@ -66,7 +66,7 @@ TEST_F(FileUtilsTest, ProjectRootPath) { } // Similar to the above test, but for the output dir -TEST_F(FileUtilsTest, OutputPathFromUnchangedWorkingDir) { +TEST_F(FileUtilsTest, DISABLED_ON_ANDROID(OutputPathFromUnchangedWorkingDir)) { std::string path = webrtc::test::OutputPath(); std::string expected_end = "out"; expected_end = kPathDelimiter + expected_end + kPathDelimiter; @@ -80,10 +80,11 @@ TEST_F(FileUtilsTest, DISABLED_ON_ANDROID(OutputPathFromRootWorkingDir)) { ASSERT_EQ("./", webrtc::test::OutputPath()); } -TEST_F(FileUtilsTest, DISABLED_ON_ANDROID(TempFilename)) { +TEST_F(FileUtilsTest, TempFilename) { std::string temp_filename = webrtc::test::TempFilename( webrtc::test::OutputPath(), "TempFilenameTest"); - ASSERT_TRUE(webrtc::test::FileExists(temp_filename)); + ASSERT_TRUE(webrtc::test::FileExists(temp_filename)) + << "Couldn't find file: " << temp_filename; remove(temp_filename.c_str()); } |