Enable iOS AppRTCDemo send side BWE.
BUG= Review URL: https://codereview.webrtc.org/1757173002 Cr-Commit-Position: refs/heads/master@{#11865}
This commit is contained in:
parent
0197363d18
commit
4f735d16ad
@ -637,6 +637,8 @@ if (is_ios) {
|
||||
"objc/RTCCameraPreviewView.m",
|
||||
"objc/RTCDispatcher.h",
|
||||
"objc/RTCDispatcher.m",
|
||||
"objc/RTCFieldTrials.h",
|
||||
"objc/RTCFieldTrials.mm",
|
||||
"objc/RTCFileLogger.h",
|
||||
"objc/RTCFileLogger.mm",
|
||||
"objc/RTCLogging.h",
|
||||
|
||||
@ -36,6 +36,8 @@
|
||||
'objc/NSString+StdString.mm',
|
||||
'objc/RTCDispatcher.h',
|
||||
'objc/RTCDispatcher.m',
|
||||
'objc/RTCFieldTrials.h',
|
||||
'objc/RTCFieldTrials.mm',
|
||||
'objc/RTCFileLogger.h',
|
||||
'objc/RTCFileLogger.mm',
|
||||
'objc/RTCLogging.h',
|
||||
|
||||
21
webrtc/base/objc/RTCFieldTrials.h
Normal file
21
webrtc/base/objc/RTCFieldTrials.h
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright 2016 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 "webrtc/base/objc/RTCMacros.h"
|
||||
|
||||
typedef NS_OPTIONS(NSUInteger, RTCFieldTrialOptions) {
|
||||
RTCFieldTrialOptionsNone = 0,
|
||||
RTCFieldTrialOptionsSendSideBwe = 1 << 0,
|
||||
};
|
||||
|
||||
/** Must be called before any other call into WebRTC. See:
|
||||
* webrtc/system_wrappers/include/field_trial_default.h
|
||||
*/
|
||||
RTC_EXPORT void RTCInitFieldTrials(RTCFieldTrialOptions options);
|
||||
37
webrtc/base/objc/RTCFieldTrials.mm
Normal file
37
webrtc/base/objc/RTCFieldTrials.mm
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright 2016 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.
|
||||
*/
|
||||
|
||||
#import "webrtc/base/objc/RTCFieldTrials.h"
|
||||
|
||||
#include <memory>
|
||||
#include "webrtc/system_wrappers/include/field_trial_default.h"
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "webrtc/base/objc/RTCLogging.h"
|
||||
|
||||
static NSString * const kRTCEnableSendSideBweString =
|
||||
@"WebRTC-SendSideBwe/Enabled/";
|
||||
static std::unique_ptr<char[]> gFieldTrialInitString;
|
||||
|
||||
void RTCInitFieldTrials(RTCFieldTrialOptions options) {
|
||||
NSMutableString *fieldTrialInitString = [NSMutableString string];
|
||||
if (options & RTCFieldTrialOptionsSendSideBwe) {
|
||||
[fieldTrialInitString appendString:kRTCEnableSendSideBweString];
|
||||
}
|
||||
size_t len = fieldTrialInitString.length + 1;
|
||||
gFieldTrialInitString.reset(new char[len]);
|
||||
if (![fieldTrialInitString getCString:gFieldTrialInitString.get()
|
||||
maxLength:len
|
||||
encoding:NSUTF8StringEncoding]) {
|
||||
RTCLogError(@"Failed to convert field trial string.");
|
||||
return;
|
||||
}
|
||||
webrtc::field_trial::InitFieldTrialsFromString(gFieldTrialInitString.get());
|
||||
}
|
||||
@ -10,6 +10,7 @@
|
||||
|
||||
#import "ARDAppDelegate.h"
|
||||
|
||||
#import "webrtc/base/objc/RTCFieldTrials.h"
|
||||
#import "webrtc/base/objc/RTCTracing.h"
|
||||
#import "RTCLogging.h"
|
||||
#import "RTCPeerConnectionFactory.h"
|
||||
@ -24,6 +25,7 @@
|
||||
|
||||
- (BOOL)application:(UIApplication *)application
|
||||
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
RTCInitFieldTrials(RTCFieldTrialOptionsSendSideBwe);
|
||||
[RTCPeerConnectionFactory initializeSSL];
|
||||
RTCSetupInternalTracer();
|
||||
_window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user