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

Unified Diff: webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec.mm

Issue 2977213002: Reland of Injectable Obj-C video codecs (Closed)
Patch Set: Add checks to make sure destroy is called Created 3 years, 5 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/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec.mm
diff --git a/webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec.mm b/webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec.mm
new file mode 100644
index 0000000000000000000000000000000000000000..f627ba87e8d27d7aa1bfb40f9941c742ed7f3c79
--- /dev/null
+++ b/webrtc/sdk/objc/Framework/Classes/PeerConnection/RTCVideoCodec.mm
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2017 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/RTCVideoCodec.h"
+
+#import "NSString+StdString.h"
+#import "RTCVideoCodec+Private.h"
+#import "WebRTC/RTCVideoCodecFactory.h"
+
+@implementation RTCVideoCodecInfo
+
+@synthesize payload = _payload;
+@synthesize name = _name;
+@synthesize parameters = _parameters;
+
+- (instancetype)initWithPayload:(NSInteger)payload
+ name:(NSString *)name
+ parameters:(NSDictionary<NSString *, NSString *> *)parameters {
+ if (self = [super init]) {
+ _payload = payload;
+ _name = name;
+ _parameters = parameters;
+ }
+
+ return self;
+}
+
+- (instancetype)initWithVideoCodec:(cricket::VideoCodec)videoCodec {
Chuck 2017/07/21 15:59:48 initWithNativeVideoCodec
+ NSMutableDictionary *params = [NSMutableDictionary dictionary];
+ for (auto it = videoCodec.params.begin(); it != videoCodec.params.end(); ++it) {
+ [params setObject:[NSString stringForStdString:it->second]
+ forKey:[NSString stringForStdString:it->first]];
+ }
+ return [self initWithPayload:videoCodec.id
+ name:[NSString stringForStdString:videoCodec.name]
+ parameters:params];
+}
+
+- (cricket::VideoCodec)toCpp {
Chuck 2017/07/21 15:59:48 nativeVideoCodec
+ cricket::VideoCodec codec([NSString stdStringForString:_name]);
+ for (NSString *paramKey in _parameters.allKeys) {
+ codec.SetParam([NSString stdStringForString:paramKey],
+ [NSString stdStringForString:_parameters[paramKey]]);
+ }
+
+ return codec;
+}
+
+@end

Powered by Google App Engine
This is Rietveld 408576698