Format /test folder
Formatting done via: git ls-files | grep -E '^test\/.*\.(h|cc|mm)' | xargs clang-format -i No-Iwyu: Includes didn't change and it isn't related to formatting Bug: webrtc:42225392 Change-Id: I3a75019dee1ad9bef713d80a5f79cbc56adab472 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/373903 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#43690}
This commit is contained in:
parent
825379f4dc
commit
557d387a2e
@ -40,8 +40,7 @@ bool FakeDecoder::Configure(const Settings& settings) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t FakeDecoder::Decode(const EncodedImage& input,
|
int32_t FakeDecoder::Decode(const EncodedImage& input, int64_t render_time_ms) {
|
||||||
int64_t render_time_ms) {
|
|
||||||
if (input._encodedWidth > 0 && input._encodedHeight > 0) {
|
if (input._encodedWidth > 0 && input._encodedHeight > 0) {
|
||||||
width_ = input._encodedWidth;
|
width_ = input._encodedWidth;
|
||||||
height_ = input._encodedHeight;
|
height_ = input._encodedHeight;
|
||||||
|
|||||||
@ -34,8 +34,7 @@ class FakeDecoder : public VideoDecoder {
|
|||||||
|
|
||||||
bool Configure(const Settings& settings) override;
|
bool Configure(const Settings& settings) override;
|
||||||
|
|
||||||
int32_t Decode(const EncodedImage& input,
|
int32_t Decode(const EncodedImage& input, int64_t render_time_ms) override;
|
||||||
int64_t render_time_ms) override;
|
|
||||||
|
|
||||||
int32_t RegisterDecodeCompleteCallback(
|
int32_t RegisterDecodeCompleteCallback(
|
||||||
DecodedImageCallback* callback) override;
|
DecodedImageCallback* callback) override;
|
||||||
@ -62,8 +61,7 @@ class FakeH264Decoder : public FakeDecoder {
|
|||||||
public:
|
public:
|
||||||
virtual ~FakeH264Decoder() {}
|
virtual ~FakeH264Decoder() {}
|
||||||
|
|
||||||
int32_t Decode(const EncodedImage& input,
|
int32_t Decode(const EncodedImage& input, int64_t render_time_ms) override;
|
||||||
int64_t render_time_ms) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace test
|
} // namespace test
|
||||||
|
|||||||
@ -269,7 +269,7 @@ void FakeEncoder::SetRatesLocked(const RateControlParameters& parameters) {
|
|||||||
uint32_t bitrate = current_rate_settings_.bitrate.GetBitrate(
|
uint32_t bitrate = current_rate_settings_.bitrate.GetBitrate(
|
||||||
spatial_idx, temporal_idx);
|
spatial_idx, temporal_idx);
|
||||||
bitrate = static_cast<uint32_t>(
|
bitrate = static_cast<uint32_t>(
|
||||||
(bitrate* int64_t{max_target_bitrate_kbps_}) /
|
(bitrate * int64_t{max_target_bitrate_kbps_}) /
|
||||||
allocated_bitrate_kbps);
|
allocated_bitrate_kbps);
|
||||||
current_rate_settings_.bitrate.SetBitrate(spatial_idx, temporal_idx,
|
current_rate_settings_.bitrate.SetBitrate(spatial_idx, temporal_idx,
|
||||||
bitrate);
|
bitrate);
|
||||||
|
|||||||
@ -27,8 +27,7 @@ class FakeVp8Decoder : public VideoDecoder {
|
|||||||
|
|
||||||
bool Configure(const Settings& settings) override;
|
bool Configure(const Settings& settings) override;
|
||||||
|
|
||||||
int32_t Decode(const EncodedImage& input,
|
int32_t Decode(const EncodedImage& input, int64_t render_time_ms) override;
|
||||||
int64_t render_time_ms) override;
|
|
||||||
|
|
||||||
int32_t RegisterDecodeCompleteCallback(
|
int32_t RegisterDecodeCompleteCallback(
|
||||||
DecodedImageCallback* callback) override;
|
DecodedImageCallback* callback) override;
|
||||||
|
|||||||
@ -15,7 +15,6 @@
|
|||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
void FuzzOneInput(const uint8_t* data, size_t size) {
|
void FuzzOneInput(const uint8_t* data, size_t size) {
|
||||||
|
|
||||||
// Normally we'd check the integrity first, but those checks are
|
// Normally we'd check the integrity first, but those checks are
|
||||||
// fuzzed separately in stun_validator_fuzzer.cc. We still want to
|
// fuzzed separately in stun_validator_fuzzer.cc. We still want to
|
||||||
// fuzz this target since the integrity checks could be forged by a
|
// fuzz this target since the integrity checks could be forged by a
|
||||||
|
|||||||
@ -23,14 +23,16 @@ void ConfigureCoverageReportPath() {
|
|||||||
dispatch_once(&once_token, ^{
|
dispatch_once(&once_token, ^{
|
||||||
// Writes the profraw file to the Documents directory, where the app has
|
// Writes the profraw file to the Documents directory, where the app has
|
||||||
// write rights.
|
// write rights.
|
||||||
NSArray* paths =
|
NSArray* paths = NSSearchPathForDirectoriesInDomains(
|
||||||
NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
NSDocumentDirectory, NSUserDomainMask, YES);
|
||||||
NSString* documents_directory = [paths firstObject];
|
NSString* documents_directory = [paths firstObject];
|
||||||
NSString* file_name = [documents_directory stringByAppendingPathComponent:@"coverage.profraw"];
|
NSString* file_name = [documents_directory
|
||||||
|
stringByAppendingPathComponent:@"coverage.profraw"];
|
||||||
|
|
||||||
// For documentation, see:
|
// For documentation, see:
|
||||||
// http://clang.llvm.org/docs/SourceBasedCodeCoverage.html
|
// http://clang.llvm.org/docs/SourceBasedCodeCoverage.html
|
||||||
__llvm_profile_set_filename([file_name cStringUsingEncoding:NSUTF8StringEncoding]);
|
__llvm_profile_set_filename(
|
||||||
|
[file_name cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||||
|
|
||||||
// Print the path for easier retrieval.
|
// Print the path for easier retrieval.
|
||||||
NSLog(@"Coverage data at %@.", file_name);
|
NSLog(@"Coverage data at %@.", file_name);
|
||||||
|
|||||||
@ -29,7 +29,8 @@
|
|||||||
self.continueAfterFailure = false;
|
self.continueAfterFailure = false;
|
||||||
|
|
||||||
id appDelegate = UIApplication.sharedApplication.delegate;
|
id appDelegate = UIApplication.sharedApplication.delegate;
|
||||||
XCTAssertTrue([appDelegate conformsToProtocol:@protocol(GoogleTestRunnerDelegate)]);
|
XCTAssertTrue(
|
||||||
|
[appDelegate conformsToProtocol:@protocol(GoogleTestRunnerDelegate)]);
|
||||||
|
|
||||||
id<GoogleTestRunnerDelegate> runnerDelegate =
|
id<GoogleTestRunnerDelegate> runnerDelegate =
|
||||||
static_cast<id<GoogleTestRunnerDelegate>>(appDelegate);
|
static_cast<id<GoogleTestRunnerDelegate>>(appDelegate);
|
||||||
|
|||||||
@ -38,7 +38,8 @@
|
|||||||
// run in a row, this provides an indication of which one is currently running.
|
// run in a row, this provides an indication of which one is currently running.
|
||||||
|
|
||||||
// If enabled, runs unittests using the XCTest test runner.
|
// If enabled, runs unittests using the XCTest test runner.
|
||||||
const char kEnableRunIOSUnittestsWithXCTest[] = "enable-run-ios-unittests-with-xctest";
|
const char kEnableRunIOSUnittestsWithXCTest[] =
|
||||||
|
"enable-run-ios-unittests-with-xctest";
|
||||||
|
|
||||||
static int (*g_test_suite)(void) = NULL;
|
static int (*g_test_suite)(void) = NULL;
|
||||||
static int g_argc;
|
static int g_argc;
|
||||||
@ -97,45 +98,57 @@ static std::optional<std::vector<std::string>> g_metrics_to_plot;
|
|||||||
|
|
||||||
int exitStatus = g_test_suite();
|
int exitStatus = g_test_suite();
|
||||||
|
|
||||||
NSArray<NSString *> *outputDirectories =
|
NSArray<NSString *> *outputDirectories = NSSearchPathForDirectoriesInDomains(
|
||||||
NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
NSDocumentDirectory, NSUserDomainMask, YES);
|
||||||
std::vector<std::unique_ptr<webrtc::test::MetricsExporter>> exporters;
|
std::vector<std::unique_ptr<webrtc::test::MetricsExporter>> exporters;
|
||||||
if (g_export_perf_results_new_api) {
|
if (g_export_perf_results_new_api) {
|
||||||
exporters.push_back(std::make_unique<webrtc::test::StdoutMetricsExporter>());
|
exporters.push_back(
|
||||||
|
std::make_unique<webrtc::test::StdoutMetricsExporter>());
|
||||||
if (g_write_perf_output) {
|
if (g_write_perf_output) {
|
||||||
// Stores data into a proto file under the app's document directory.
|
// Stores data into a proto file under the app's document directory.
|
||||||
NSString *fileName = @"perftest-output.pb";
|
NSString *fileName = @"perftest-output.pb";
|
||||||
if ([outputDirectories count] != 0) {
|
if ([outputDirectories count] != 0) {
|
||||||
NSString *outputPath = [outputDirectories[0] stringByAppendingPathComponent:fileName];
|
NSString *outputPath =
|
||||||
|
[outputDirectories[0] stringByAppendingPathComponent:fileName];
|
||||||
|
|
||||||
exporters.push_back(std::make_unique<webrtc::test::ChromePerfDashboardMetricsExporter>(
|
exporters.push_back(
|
||||||
[NSString stdStringForString:outputPath]));
|
std::make_unique<webrtc::test::ChromePerfDashboardMetricsExporter>(
|
||||||
|
[NSString stdStringForString:outputPath]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!g_webrtc_test_metrics_output_path.empty()) {
|
if (!g_webrtc_test_metrics_output_path.empty()) {
|
||||||
RTC_CHECK_EQ(g_webrtc_test_metrics_output_path.find('/'), std::string::npos)
|
RTC_CHECK_EQ(g_webrtc_test_metrics_output_path.find('/'),
|
||||||
<< "On iOS, --webrtc_test_metrics_output_path must only be a file name.";
|
std::string::npos)
|
||||||
|
<< "On iOS, --webrtc_test_metrics_output_path must only be a file "
|
||||||
|
"name.";
|
||||||
if ([outputDirectories count] != 0) {
|
if ([outputDirectories count] != 0) {
|
||||||
NSString *fileName = [NSString stringWithCString:g_webrtc_test_metrics_output_path.c_str()
|
NSString *fileName = [NSString
|
||||||
encoding:[NSString defaultCStringEncoding]];
|
stringWithCString:g_webrtc_test_metrics_output_path.c_str()
|
||||||
NSString *outputPath = [outputDirectories[0] stringByAppendingPathComponent:fileName];
|
encoding:[NSString defaultCStringEncoding]];
|
||||||
exporters.push_back(std::make_unique<webrtc::test::MetricsSetProtoFileExporter>(
|
NSString *outputPath =
|
||||||
webrtc::test::MetricsSetProtoFileExporter::Options(
|
[outputDirectories[0] stringByAppendingPathComponent:fileName];
|
||||||
[NSString stdStringForString:outputPath])));
|
exporters.push_back(
|
||||||
|
std::make_unique<webrtc::test::MetricsSetProtoFileExporter>(
|
||||||
|
webrtc::test::MetricsSetProtoFileExporter::Options(
|
||||||
|
[NSString stdStringForString:outputPath])));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
exporters.push_back(std::make_unique<webrtc::test::PrintResultProxyMetricsExporter>());
|
exporters.push_back(
|
||||||
|
std::make_unique<webrtc::test::PrintResultProxyMetricsExporter>());
|
||||||
}
|
}
|
||||||
webrtc::test::ExportPerfMetric(*webrtc::test::GetGlobalMetricsLogger(), std::move(exporters));
|
webrtc::test::ExportPerfMetric(*webrtc::test::GetGlobalMetricsLogger(),
|
||||||
|
std::move(exporters));
|
||||||
if (!g_export_perf_results_new_api) {
|
if (!g_export_perf_results_new_api) {
|
||||||
if (g_write_perf_output) {
|
if (g_write_perf_output) {
|
||||||
// Stores data into a proto file under the app's document directory.
|
// Stores data into a proto file under the app's document directory.
|
||||||
NSString *fileName = @"perftest-output.pb";
|
NSString *fileName = @"perftest-output.pb";
|
||||||
if ([outputDirectories count] != 0) {
|
if ([outputDirectories count] != 0) {
|
||||||
NSString *outputPath = [outputDirectories[0] stringByAppendingPathComponent:fileName];
|
NSString *outputPath =
|
||||||
|
[outputDirectories[0] stringByAppendingPathComponent:fileName];
|
||||||
|
|
||||||
if (!webrtc::test::WritePerfResults([NSString stdStringForString:outputPath])) {
|
if (!webrtc::test::WritePerfResults(
|
||||||
|
[NSString stdStringForString:outputPath])) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,9 +13,11 @@
|
|||||||
#include "test/run_test.h"
|
#include "test/run_test.h"
|
||||||
|
|
||||||
// Converting a C++ function pointer to an Objective-C block.
|
// Converting a C++ function pointer to an Objective-C block.
|
||||||
typedef void(^TestBlock)();
|
typedef void (^TestBlock)();
|
||||||
TestBlock functionToBlock(void(*function)()) {
|
TestBlock functionToBlock(void (*function)()) {
|
||||||
return [^(void) { function(); } copy];
|
return [^(void) {
|
||||||
|
function();
|
||||||
|
} copy];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Class calling the test function on the platform specific thread.
|
// Class calling the test function on the platform specific thread.
|
||||||
@ -50,7 +52,7 @@ TestBlock functionToBlock(void(*function)()) {
|
|||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
namespace test {
|
namespace test {
|
||||||
|
|
||||||
void RunTest(void(*test)()) {
|
void RunTest(void (*test)()) {
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
[NSApplication sharedApplication];
|
[NSApplication sharedApplication];
|
||||||
|
|
||||||
@ -63,8 +65,9 @@ void RunTest(void(*test)()) {
|
|||||||
withObject:testBlock];
|
withObject:testBlock];
|
||||||
|
|
||||||
NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
|
NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
|
||||||
while ([testRunner running] && [runLoop runMode:NSDefaultRunLoopMode
|
while ([testRunner running] &&
|
||||||
beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]])
|
[runLoop runMode:NSDefaultRunLoopMode
|
||||||
|
beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]])
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,8 +31,8 @@
|
|||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation CocoaWindow
|
@implementation CocoaWindow
|
||||||
static NSInteger nextXOrigin_;
|
static NSInteger nextXOrigin_;
|
||||||
static NSInteger nextYOrigin_;
|
static NSInteger nextYOrigin_;
|
||||||
|
|
||||||
- (id)initWithTitle:(NSString *)title width:(int)width height:(int)height {
|
- (id)initWithTitle:(NSString *)title width:(int)width height:(int)height {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
@ -67,7 +67,8 @@
|
|||||||
defer:NO];
|
defer:NO];
|
||||||
|
|
||||||
NSRect viewFrame = NSMakeRect(0, 0, width_, height_);
|
NSRect viewFrame = NSMakeRect(0, 0, width_, height_);
|
||||||
NSOpenGLView *view = [[NSOpenGLView alloc] initWithFrame:viewFrame pixelFormat:nil];
|
NSOpenGLView *view = [[NSOpenGLView alloc] initWithFrame:viewFrame
|
||||||
|
pixelFormat:nil];
|
||||||
context_ = [view openGLContext];
|
context_ = [view openGLContext];
|
||||||
|
|
||||||
[[window_ contentView] addSubview:view];
|
[[window_ contentView] addSubview:view];
|
||||||
@ -84,10 +85,10 @@
|
|||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
namespace test {
|
namespace test {
|
||||||
|
|
||||||
VideoRenderer* VideoRenderer::CreatePlatformRenderer(const char* window_title,
|
VideoRenderer *VideoRenderer::CreatePlatformRenderer(const char *window_title,
|
||||||
size_t width,
|
size_t width,
|
||||||
size_t height) {
|
size_t height) {
|
||||||
MacRenderer* renderer = new MacRenderer();
|
MacRenderer *renderer = new MacRenderer();
|
||||||
if (!renderer->Init(window_title, width, height)) {
|
if (!renderer->Init(window_title, width, height)) {
|
||||||
delete renderer;
|
delete renderer;
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -95,20 +96,18 @@ VideoRenderer* VideoRenderer::CreatePlatformRenderer(const char* window_title,
|
|||||||
return renderer;
|
return renderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
MacRenderer::MacRenderer()
|
MacRenderer::MacRenderer() : window_(NULL) {}
|
||||||
: window_(NULL) {}
|
|
||||||
|
|
||||||
MacRenderer::~MacRenderer() {
|
MacRenderer::~MacRenderer() {
|
||||||
GlRenderer::Destroy();
|
GlRenderer::Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MacRenderer::Init(const char* window_title, int width, int height) {
|
bool MacRenderer::Init(const char *window_title, int width, int height) {
|
||||||
window_ = [[CocoaWindow alloc]
|
window_ = [[CocoaWindow alloc]
|
||||||
initWithTitle:[NSString stringWithUTF8String:window_title]
|
initWithTitle:[NSString stringWithUTF8String:window_title]
|
||||||
width:width
|
width:width
|
||||||
height:height];
|
height:height];
|
||||||
if (!window_)
|
if (!window_) return false;
|
||||||
return false;
|
|
||||||
[window_ performSelectorOnMainThread:@selector(createWindow:)
|
[window_ performSelectorOnMainThread:@selector(createWindow:)
|
||||||
withObject:nil
|
withObject:nil
|
||||||
waitUntilDone:YES];
|
waitUntilDone:YES];
|
||||||
@ -119,10 +118,10 @@ bool MacRenderer::Init(const char* window_title, int width, int height) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacRenderer::OnFrame(const VideoFrame& frame) {
|
void MacRenderer::OnFrame(const VideoFrame &frame) {
|
||||||
[window_ makeCurrentContext];
|
[window_ makeCurrentContext];
|
||||||
GlRenderer::OnFrame(frame);
|
GlRenderer::OnFrame(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // test
|
} // namespace test
|
||||||
} // webrtc
|
} // namespace webrtc
|
||||||
|
|||||||
@ -15,7 +15,8 @@
|
|||||||
#import "sdk/objc/native/api/video_capturer.h"
|
#import "sdk/objc/native/api/video_capturer.h"
|
||||||
#import "sdk/objc/native/src/objc_frame_buffer.h"
|
#import "sdk/objc/native/src/objc_frame_buffer.h"
|
||||||
|
|
||||||
@interface RTCTestVideoSourceAdapter : NSObject <RTC_OBJC_TYPE (RTCVideoCapturerDelegate)>
|
@interface RTCTestVideoSourceAdapter
|
||||||
|
: NSObject <RTC_OBJC_TYPE (RTCVideoCapturerDelegate)>
|
||||||
@property(nonatomic) webrtc::test::MacCapturer *capturer;
|
@property(nonatomic) webrtc::test::MacCapturer *capturer;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@ -38,15 +39,18 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
AVCaptureDeviceFormat *SelectClosestFormat(AVCaptureDevice *device, size_t width, size_t height) {
|
AVCaptureDeviceFormat *SelectClosestFormat(AVCaptureDevice *device,
|
||||||
|
size_t width,
|
||||||
|
size_t height) {
|
||||||
NSArray<AVCaptureDeviceFormat *> *formats =
|
NSArray<AVCaptureDeviceFormat *> *formats =
|
||||||
[RTC_OBJC_TYPE(RTCCameraVideoCapturer) supportedFormatsForDevice:device];
|
[RTC_OBJC_TYPE(RTCCameraVideoCapturer) supportedFormatsForDevice:device];
|
||||||
AVCaptureDeviceFormat *selectedFormat = nil;
|
AVCaptureDeviceFormat *selectedFormat = nil;
|
||||||
int currentDiff = INT_MAX;
|
int currentDiff = INT_MAX;
|
||||||
for (AVCaptureDeviceFormat *format in formats) {
|
for (AVCaptureDeviceFormat *format in formats) {
|
||||||
CMVideoDimensions dimension = CMVideoFormatDescriptionGetDimensions(format.formatDescription);
|
CMVideoDimensions dimension =
|
||||||
int diff =
|
CMVideoFormatDescriptionGetDimensions(format.formatDescription);
|
||||||
std::abs((int64_t)width - dimension.width) + std::abs((int64_t)height - dimension.height);
|
int diff = std::abs((int64_t)width - dimension.width) +
|
||||||
|
std::abs((int64_t)height - dimension.height);
|
||||||
if (diff < currentDiff) {
|
if (diff < currentDiff) {
|
||||||
selectedFormat = format;
|
selectedFormat = format;
|
||||||
currentDiff = diff;
|
currentDiff = diff;
|
||||||
@ -74,8 +78,8 @@ MacCapturer::MacCapturer(size_t width,
|
|||||||
[[RTC_OBJC_TYPE(RTCCameraVideoCapturer) alloc] initWithDelegate:adapter];
|
[[RTC_OBJC_TYPE(RTCCameraVideoCapturer) alloc] initWithDelegate:adapter];
|
||||||
capturer_ = (__bridge_retained void *)capturer;
|
capturer_ = (__bridge_retained void *)capturer;
|
||||||
|
|
||||||
AVCaptureDevice *device =
|
AVCaptureDevice *device = [[RTC_OBJC_TYPE(RTCCameraVideoCapturer)
|
||||||
[[RTC_OBJC_TYPE(RTCCameraVideoCapturer) captureDevices] objectAtIndex:capture_device_index];
|
captureDevices] objectAtIndex:capture_device_index];
|
||||||
AVCaptureDeviceFormat *format = SelectClosestFormat(device, width, height);
|
AVCaptureDeviceFormat *format = SelectClosestFormat(device, width, height);
|
||||||
[capturer startCaptureWithDevice:device format:format fps:target_fps];
|
[capturer startCaptureWithDevice:device format:format fps:target_fps];
|
||||||
}
|
}
|
||||||
@ -90,7 +94,8 @@ MacCapturer *MacCapturer::Create(size_t width,
|
|||||||
void MacCapturer::Destroy() {
|
void MacCapturer::Destroy() {
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
#pragma clang diagnostic ignored "-Wunused-variable"
|
#pragma clang diagnostic ignored "-Wunused-variable"
|
||||||
RTCTestVideoSourceAdapter *adapter = (__bridge_transfer RTCTestVideoSourceAdapter *)adapter_;
|
RTCTestVideoSourceAdapter *adapter =
|
||||||
|
(__bridge_transfer RTCTestVideoSourceAdapter *)adapter_;
|
||||||
RTC_OBJC_TYPE(RTCCameraVideoCapturer) *capturer =
|
RTC_OBJC_TYPE(RTCCameraVideoCapturer) *capturer =
|
||||||
(__bridge_transfer RTC_OBJC_TYPE(RTCCameraVideoCapturer) *)capturer_;
|
(__bridge_transfer RTC_OBJC_TYPE(RTCCameraVideoCapturer) *)capturer_;
|
||||||
[capturer stopCapture];
|
[capturer stopCapture];
|
||||||
|
|||||||
@ -113,7 +113,9 @@ class MockNetworkBehaviourInterface : public NetworkBehaviorInterface {
|
|||||||
DequeueDeliverablePackets,
|
DequeueDeliverablePackets,
|
||||||
(int64_t),
|
(int64_t),
|
||||||
(override));
|
(override));
|
||||||
MOCK_METHOD(std::optional<int64_t>, NextDeliveryTimeUs, (),
|
MOCK_METHOD(std::optional<int64_t>,
|
||||||
|
NextDeliveryTimeUs,
|
||||||
|
(),
|
||||||
(const, override));
|
(const, override));
|
||||||
MOCK_METHOD(void,
|
MOCK_METHOD(void,
|
||||||
RegisterDeliveryTimeChangedCallback,
|
RegisterDeliveryTimeChangedCallback,
|
||||||
|
|||||||
@ -380,43 +380,43 @@ void PeerScenarioClient::SetSdpOfferAndGetAnswer(
|
|||||||
std::function<void()> remote_description_set,
|
std::function<void()> remote_description_set,
|
||||||
std::function<void(std::string)> answer_handler) {
|
std::function<void(std::string)> answer_handler) {
|
||||||
if (!signaling_thread_->IsCurrent()) {
|
if (!signaling_thread_->IsCurrent()) {
|
||||||
signaling_thread_->PostTask([this, remote_offer, remote_description_set,
|
signaling_thread_->PostTask(
|
||||||
answer_handler] {
|
[this, remote_offer, remote_description_set, answer_handler] {
|
||||||
SetSdpOfferAndGetAnswer(remote_offer, remote_description_set,
|
SetSdpOfferAndGetAnswer(remote_offer, remote_description_set,
|
||||||
answer_handler);
|
answer_handler);
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RTC_DCHECK_RUN_ON(signaling_thread_);
|
RTC_DCHECK_RUN_ON(signaling_thread_);
|
||||||
peer_connection_->SetRemoteDescription(
|
peer_connection_->SetRemoteDescription(
|
||||||
CreateSessionDescription(SdpType::kOffer, remote_offer),
|
CreateSessionDescription(SdpType::kOffer, remote_offer),
|
||||||
rtc::make_ref_counted<
|
rtc::make_ref_counted<LambdaSetRemoteDescriptionObserver>(
|
||||||
LambdaSetRemoteDescriptionObserver>([this, remote_description_set,
|
[this, remote_description_set, answer_handler](RTCError) {
|
||||||
answer_handler](RTCError) {
|
RTC_DCHECK_RUN_ON(signaling_thread_);
|
||||||
RTC_DCHECK_RUN_ON(signaling_thread_);
|
if (remote_description_set) {
|
||||||
if (remote_description_set) {
|
// Allow the caller to modify transceivers
|
||||||
// Allow the caller to modify transceivers
|
// before creating the answer.
|
||||||
// before creating the answer.
|
remote_description_set();
|
||||||
remote_description_set();
|
}
|
||||||
}
|
peer_connection_->CreateAnswer(
|
||||||
peer_connection_->CreateAnswer(
|
rtc::make_ref_counted<LambdaCreateSessionDescriptionObserver>(
|
||||||
rtc::make_ref_counted<LambdaCreateSessionDescriptionObserver>(
|
[this, answer_handler](
|
||||||
[this, answer_handler](
|
std::unique_ptr<SessionDescriptionInterface> answer) {
|
||||||
std::unique_ptr<SessionDescriptionInterface> answer) {
|
RTC_DCHECK_RUN_ON(signaling_thread_);
|
||||||
RTC_DCHECK_RUN_ON(signaling_thread_);
|
std::string sdp_answer;
|
||||||
std::string sdp_answer;
|
answer->ToString(&sdp_answer);
|
||||||
answer->ToString(&sdp_answer);
|
RTC_LOG(LS_INFO) << sdp_answer;
|
||||||
RTC_LOG(LS_INFO) << sdp_answer;
|
peer_connection_->SetLocalDescription(
|
||||||
peer_connection_->SetLocalDescription(
|
std::move(answer),
|
||||||
std::move(answer),
|
rtc::make_ref_counted<
|
||||||
rtc::make_ref_counted<LambdaSetLocalDescriptionObserver>(
|
LambdaSetLocalDescriptionObserver>(
|
||||||
[answer_handler, sdp_answer](RTCError) {
|
[answer_handler, sdp_answer](RTCError) {
|
||||||
answer_handler(sdp_answer);
|
answer_handler(sdp_answer);
|
||||||
}));
|
}));
|
||||||
})
|
})
|
||||||
.get(),
|
.get(),
|
||||||
PeerConnectionInterface::RTCOfferAnswerOptions());
|
PeerConnectionInterface::RTCOfferAnswerOptions());
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerScenarioClient::SetSdpAnswer(
|
void PeerScenarioClient::SetSdpAnswer(
|
||||||
|
|||||||
@ -24,7 +24,8 @@ namespace test {
|
|||||||
// For iOS, resource files are added to the application bundle in the root
|
// For iOS, resource files are added to the application bundle in the root
|
||||||
// and not in separate folders as is the case for other platforms. This method
|
// and not in separate folders as is the case for other platforms. This method
|
||||||
// therefore removes any prepended folders and uses only the actual file name.
|
// therefore removes any prepended folders and uses only the actual file name.
|
||||||
std::string IOSResourcePath(absl::string_view name, absl::string_view extension) {
|
std::string IOSResourcePath(absl::string_view name,
|
||||||
|
absl::string_view extension) {
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
NSString* path = [NSString stringForAbslStringView:name];
|
NSString* path = [NSString stringForAbslStringView:name];
|
||||||
NSString* fileName = path.lastPathComponent;
|
NSString* fileName = path.lastPathComponent;
|
||||||
@ -46,11 +47,10 @@ std::string IOSRootPath() {
|
|||||||
// For iOS, we don't have access to the output directory. Return the path to the
|
// 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
|
// temporary directory instead. This is mostly used by tests that need to write
|
||||||
// output files to disk.
|
// output files to disk.
|
||||||
std::string IOSOutputPath() {
|
std::string IOSOutputPath() {
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
NSString* tempDir = NSTemporaryDirectory();
|
NSString* tempDir = NSTemporaryDirectory();
|
||||||
if (tempDir == nil)
|
if (tempDir == nil) tempDir = @"/tmp";
|
||||||
tempDir = @"/tmp";
|
|
||||||
return [NSString stdStringForString:tempDir];
|
return [NSString stdStringForString:tempDir];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,7 +52,7 @@ void SimulatedTaskQueue::RunReady(Timestamp at_time) {
|
|||||||
}
|
}
|
||||||
CurrentTaskQueueSetter set_current(this);
|
CurrentTaskQueueSetter set_current(this);
|
||||||
while (!ready_tasks_.empty()) {
|
while (!ready_tasks_.empty()) {
|
||||||
absl::AnyInvocable<void()&&> ready = std::move(ready_tasks_.front());
|
absl::AnyInvocable<void() &&> ready = std::move(ready_tasks_.front());
|
||||||
ready_tasks_.pop_front();
|
ready_tasks_.pop_front();
|
||||||
lock_.Unlock();
|
lock_.Unlock();
|
||||||
std::move(ready)();
|
std::move(ready)();
|
||||||
|
|||||||
@ -1674,13 +1674,13 @@ VideoCodecTester::RunEncodeDecodeTest(
|
|||||||
frame_settings.layers_settings.rbegin()->second;
|
frame_settings.layers_settings.rbegin()->second;
|
||||||
VideoFrame source_frame = video_source.PullFrame(
|
VideoFrame source_frame = video_source.PullFrame(
|
||||||
timestamp_rtp, top_layer.resolution, top_layer.framerate);
|
timestamp_rtp, top_layer.resolution, top_layer.framerate);
|
||||||
encoder.Encode(source_frame, frame_settings,
|
encoder.Encode(
|
||||||
[&decoders,
|
source_frame, frame_settings,
|
||||||
source_frame](const EncodedImage& encoded_frame) {
|
[&decoders, source_frame](const EncodedImage& encoded_frame) {
|
||||||
int sidx = encoded_frame.SpatialIndex().value_or(
|
int sidx = encoded_frame.SpatialIndex().value_or(
|
||||||
encoded_frame.SimulcastIndex().value_or(0));
|
encoded_frame.SimulcastIndex().value_or(0));
|
||||||
decoders.at(sidx)->Decode(encoded_frame, source_frame);
|
decoders.at(sidx)->Decode(encoded_frame, source_frame);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
encoder.Flush();
|
encoder.Flush();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user