Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: webrtc/sdk/objc/Framework/Classes/RTCFieldTrials.mm

Issue 2583643002: iOS: Add trendline filter to field trials. (Closed)
Patch Set: Remove extra space. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #import "WebRTC/RTCFieldTrials.h" 11 #import "WebRTC/RTCFieldTrials.h"
12 12
13 #include <memory> 13 #include <memory>
14 14
15 #import "WebRTC/RTCLogging.h" 15 #import "WebRTC/RTCLogging.h"
16 16
17 #include "webrtc/system_wrappers/include/field_trial_default.h" 17 #include "webrtc/system_wrappers/include/field_trial_default.h"
18 18
19 static NSString * const kRTCEnableImprovedBitrateEstimateString = 19 NSString * const kRTCFieldTrialAudioSendSideBweKey = @"WebRTC-Audio-SendSideBwe" ;
20 @"WebRTC-ImprovedBitrateEstimate/Enabled/"; 20 NSString * const kRTCFieldTrialFlexFec03Key = @"WebRTC-FlexFEC-03";
21 static NSString * const kRTCEnableAudioSendSideBweString = 21 NSString * const kRTCFieldTrialImprovedBitrateEstimateKey = @"WebRTC-ImprovedBit rateEstimate";
22 @"WebRTC-Audio-SendSideBwe/Enabled/"; 22 NSString * const kRTCFieldTrialTrendlineFilterKey = @"WebRTC-BweTrendlineFilter" ;
23 static NSString * const kRTCEnableFlexFec03String = 23 NSString * const kRTCFieldTrialEnabledValue = @"Enabled";
24 @"WebRTC-FlexFEC-03/Enabled/"; 24
25 static std::unique_ptr<char[]> gFieldTrialInitString; 25 static std::unique_ptr<char[]> gFieldTrialInitString;
26 26
27 void RTCInitFieldTrials(RTCFieldTrialOptions options) { 27 NSString *RTCFieldTrialTrendlineFilterValue(
28 size_t windowSize, double smoothingCoeff, double thresholdGain) {
29 NSString *format = @"Enabled-%zu,%lf,%lf";
30 return [NSString stringWithFormat:format, windowSize, smoothingCoeff, threshol dGain];
31 }
32
33 void RTCInitFieldTrialDictionary(NSDictionary<NSString *, NSString *> *fieldTria ls) {
34 if (!fieldTrials) {
35 RTCLogWarning(@"No fieldTrials provided.");
36 return;
37 }
38 // Assemble the keys and values into the field trial string.
39 // We don't perform any extra format checking. That should be done by the unde rlying WebRTC calls.
28 NSMutableString *fieldTrialInitString = [NSMutableString string]; 40 NSMutableString *fieldTrialInitString = [NSMutableString string];
29 if (options & RTCFieldTrialOptionsImprovedBitrateEstimate) { 41 for (NSString *key in fieldTrials) {
30 [fieldTrialInitString appendString:kRTCEnableImprovedBitrateEstimateString]; 42 NSString *fieldTrialEntry = [NSString stringWithFormat:@"%@/%@/", key, field Trials[key]];
31 } 43 [fieldTrialInitString appendString:fieldTrialEntry];
32 if (options & RTCFieldTrialOptionsAudioSendSideBwe) {
33 [fieldTrialInitString appendString:kRTCEnableAudioSendSideBweString];
34 }
35 if (options & RTCFieldTrialOptionsFlexFec03) {
36 [fieldTrialInitString appendString:kRTCEnableFlexFec03String];
37 } 44 }
38 size_t len = fieldTrialInitString.length + 1; 45 size_t len = fieldTrialInitString.length + 1;
39 gFieldTrialInitString.reset(new char[len]); 46 gFieldTrialInitString.reset(new char[len]);
40 if (![fieldTrialInitString getCString:gFieldTrialInitString.get() 47 if (![fieldTrialInitString getCString:gFieldTrialInitString.get()
41 maxLength:len 48 maxLength:len
42 encoding:NSUTF8StringEncoding]) { 49 encoding:NSUTF8StringEncoding]) {
43 RTCLogError(@"Failed to convert field trial string."); 50 RTCLogError(@"Failed to convert field trial string.");
44 return; 51 return;
45 } 52 }
46 webrtc::field_trial::InitFieldTrialsFromString(gFieldTrialInitString.get()); 53 webrtc::field_trial::InitFieldTrialsFromString(gFieldTrialInitString.get());
47 } 54 }
OLDNEW
« no previous file with comments | « webrtc/examples/objc/AppRTCMobile/ios/ARDAppDelegate.m ('k') | webrtc/sdk/objc/Framework/Headers/WebRTC/RTCFieldTrials.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698