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

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

Issue 2650343006: Pass network config constraint as base64 to avoid mangling bytes (Closed)
Patch Set: Update Created 3 years, 10 months 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
« no previous file with comments | « no previous file | webrtc/sdk/objc/Framework/Headers/WebRTC/RTCMediaConstraints.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 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
(...skipping 14 matching lines...) Expand all
25 NSString * const kRTCMediaConstraintsMinHeight = 25 NSString * const kRTCMediaConstraintsMinHeight =
26 @(webrtc::MediaConstraintsInterface::kMinHeight); 26 @(webrtc::MediaConstraintsInterface::kMinHeight);
27 NSString * const kRTCMediaConstraintsMaxHeight = 27 NSString * const kRTCMediaConstraintsMaxHeight =
28 @(webrtc::MediaConstraintsInterface::kMaxHeight); 28 @(webrtc::MediaConstraintsInterface::kMaxHeight);
29 NSString * const kRTCMediaConstraintsMinFrameRate = 29 NSString * const kRTCMediaConstraintsMinFrameRate =
30 @(webrtc::MediaConstraintsInterface::kMinFrameRate); 30 @(webrtc::MediaConstraintsInterface::kMinFrameRate);
31 NSString * const kRTCMediaConstraintsMaxFrameRate = 31 NSString * const kRTCMediaConstraintsMaxFrameRate =
32 @(webrtc::MediaConstraintsInterface::kMaxFrameRate); 32 @(webrtc::MediaConstraintsInterface::kMaxFrameRate);
33 NSString * const kRTCMediaConstraintsLevelControl = 33 NSString * const kRTCMediaConstraintsLevelControl =
34 @(webrtc::MediaConstraintsInterface::kLevelControl); 34 @(webrtc::MediaConstraintsInterface::kLevelControl);
35 NSString * const kRTCMediaConstraintsAudioNetworkAdaptorConfig =
36 @(webrtc::MediaConstraintsInterface::kAudioNetworkAdaptorConfig);
35 37
36 NSString * const kRTCMediaConstraintsValueTrue = 38 NSString * const kRTCMediaConstraintsValueTrue =
37 @(webrtc::MediaConstraintsInterface::kValueTrue); 39 @(webrtc::MediaConstraintsInterface::kValueTrue);
38 NSString * const kRTCMediaConstraintsValueFalse = 40 NSString * const kRTCMediaConstraintsValueFalse =
39 @(webrtc::MediaConstraintsInterface::kValueFalse); 41 @(webrtc::MediaConstraintsInterface::kValueFalse);
40 42
41 namespace webrtc { 43 namespace webrtc {
42 44
43 MediaConstraints::~MediaConstraints() {} 45 MediaConstraints::~MediaConstraints() {}
44 46
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 + (webrtc::MediaConstraintsInterface::Constraints) 104 + (webrtc::MediaConstraintsInterface::Constraints)
103 nativeConstraintsForConstraints: 105 nativeConstraintsForConstraints:
104 (NSDictionary<NSString *, NSString *> *)constraints { 106 (NSDictionary<NSString *, NSString *> *)constraints {
105 webrtc::MediaConstraintsInterface::Constraints nativeConstraints; 107 webrtc::MediaConstraintsInterface::Constraints nativeConstraints;
106 for (NSString *key in constraints) { 108 for (NSString *key in constraints) {
107 NSAssert([key isKindOfClass:[NSString class]], 109 NSAssert([key isKindOfClass:[NSString class]],
108 @"%@ is not an NSString.", key); 110 @"%@ is not an NSString.", key);
109 NSString *value = [constraints objectForKey:key]; 111 NSString *value = [constraints objectForKey:key];
110 NSAssert([value isKindOfClass:[NSString class]], 112 NSAssert([value isKindOfClass:[NSString class]],
111 @"%@ is not an NSString.", value); 113 @"%@ is not an NSString.", value);
112 nativeConstraints.push_back(webrtc::MediaConstraintsInterface::Constraint( 114 if ([kRTCMediaConstraintsAudioNetworkAdaptorConfig isEqualToString:key]) {
113 key.stdString, value.stdString)); 115 // This value is base64 encoded.
116 NSData *charData = [[NSData alloc] initWithBase64EncodedString:value optio ns:0];
117 std::string configValue =
118 std::string(reinterpret_cast<const char *>(charData.bytes), charData.l ength);
119 nativeConstraints.push_back(webrtc::MediaConstraintsInterface::Constraint(
120 key.stdString, configValue));
121 } else {
122 nativeConstraints.push_back(webrtc::MediaConstraintsInterface::Constraint(
123 key.stdString, value.stdString));
124 }
114 } 125 }
115 return nativeConstraints; 126 return nativeConstraints;
116 } 127 }
117 128
118 @end 129 @end
OLDNEW
« no previous file with comments | « no previous file | webrtc/sdk/objc/Framework/Headers/WebRTC/RTCMediaConstraints.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698