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

Unified Diff: webrtc/api/objc/RTCRtpEncodingParameters.mm

Issue 1854393002: Objective C API to read and set RtpParameters (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added a missing blank line Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/api/objc/RTCRtpEncodingParameters.mm
diff --git a/webrtc/api/objc/RTCRtpEncodingParameters.mm b/webrtc/api/objc/RTCRtpEncodingParameters.mm
new file mode 100644
index 0000000000000000000000000000000000000000..09c53133deb36b867e9c9dfd80e02c87bf4380c0
--- /dev/null
+++ b/webrtc/api/objc/RTCRtpEncodingParameters.mm
@@ -0,0 +1,49 @@
+/*
+ * 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 "RTCRtpEncodingParameters+Private.h"
+
+@implementation RTCRtpEncodingParameters
+
+@synthesize isActive = _isActive;
+@synthesize maxBitrateBps = _maxBitrateBps;
+
+static const int kBitrateUnlimited = -1;
+
+- (webrtc::RtpEncodingParameters)nativeParameters {
+ webrtc::RtpEncodingParameters parameters;
+ parameters.active = _isActive;
+ if (_maxBitrateBps != nil) {
+ parameters.max_bitrate_bps = [_maxBitrateBps intValue];
tkchin_webrtc 2016/04/06 22:04:48 dot syntax for properties
skvlad 2016/04/08 19:33:18 Done.
+ }
+ return parameters;
+}
+
+- (instancetype)initWithNativeParameters:
+ (const webrtc::RtpEncodingParameters &)nativeParameters {
+ if ([self init]) {
+ _isActive = nativeParameters.active;
+ //TODO(skvlad): Replace with rtc::Optional once the C++ code is updated.
tkchin_webrtc 2016/04/06 22:04:48 nit: space after. // TODO
skvlad 2016/04/08 19:33:19 Done.
+ if (nativeParameters.max_bitrate_bps != kBitrateUnlimited) {
+ _maxBitrateBps =
+ [NSNumber numberWithInt:nativeParameters.max_bitrate_bps];
+ } else {
+ _maxBitrateBps = nil;
tkchin_webrtc 2016/04/06 22:04:48 not needed. ivar objects are initialized to nil
skvlad 2016/04/08 19:33:19 Done. I thought this made it clearer that the valu
+ }
+ }
+ return self;
+}
+
+- (instancetype)init {
tkchin_webrtc 2016/04/06 22:04:48 this should be declared after static const int kBi
skvlad 2016/04/08 19:33:19 Done.
+ self = [super init];
+ return self;
+}
+
+@end

Powered by Google App Engine
This is Rietveld 408576698