| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2017 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/RTCVideoCodec.h" | 11 #import "WebRTC/RTCVideoCodec.h" |
| 12 | 12 |
| 13 #import "NSString+StdString.h" | 13 #import "NSString+StdString.h" |
| 14 #import "RTCVideoCodec+Private.h" | 14 #import "RTCVideoCodec+Private.h" |
| 15 #import "WebRTC/RTCVideoCodecFactory.h" | 15 #import "WebRTC/RTCVideoCodecFactory.h" |
| 16 | 16 |
| 17 @implementation RTCVideoCodecInfo | 17 @implementation RTCVideoCodecInfo |
| 18 | 18 |
| 19 @synthesize payload = _payload; | 19 @synthesize payload = _payload; |
| 20 @synthesize name = _name; | 20 @synthesize name = _name; |
| 21 @synthesize parameters = _parameters; | 21 @synthesize parameters = _parameters; |
| 22 | 22 |
| 23 - (instancetype)initWithPayload:(NSInteger)payload | 23 - (instancetype)initWithName:(NSString *)name |
| 24 name:(NSString *)name | 24 parameters:(nullable NSDictionary<NSString *, NSString *> *)pa
rameters { |
| 25 parameters:(NSDictionary<NSString *, NSString *> *)paramete
rs { | |
| 26 if (self = [super init]) { | 25 if (self = [super init]) { |
| 27 _payload = payload; | 26 _payload = 0; |
| 28 _name = name; | 27 _name = name; |
| 29 _parameters = parameters; | 28 _parameters = (parameters ? parameters : @{}); |
| 30 } | 29 } |
| 31 | 30 |
| 32 return self; | 31 return self; |
| 33 } | 32 } |
| 34 | 33 |
| 35 - (instancetype)initWithNativeVideoCodec:(cricket::VideoCodec)videoCodec { | 34 - (instancetype)initWithNativeVideoCodec:(cricket::VideoCodec)videoCodec { |
| 36 NSMutableDictionary *params = [NSMutableDictionary dictionary]; | 35 NSMutableDictionary *params = [NSMutableDictionary dictionary]; |
| 37 for (auto it = videoCodec.params.begin(); it != videoCodec.params.end(); ++it)
{ | 36 for (auto it = videoCodec.params.begin(); it != videoCodec.params.end(); ++it)
{ |
| 38 [params setObject:[NSString stringForStdString:it->second] | 37 [params setObject:[NSString stringForStdString:it->second] |
| 39 forKey:[NSString stringForStdString:it->first]]; | 38 forKey:[NSString stringForStdString:it->first]]; |
| 40 } | 39 } |
| 41 return [self initWithPayload:videoCodec.id | 40 return [self initWithPayload:videoCodec.id |
| 42 name:[NSString stringForStdString:videoCodec.name] | 41 name:[NSString stringForStdString:videoCodec.name] |
| 43 parameters:params]; | 42 parameters:params]; |
| 44 } | 43 } |
| 45 | 44 |
| 45 - (instancetype)initWithPayload:(NSInteger)payload |
| 46 name:(NSString *)name |
| 47 parameters:(NSDictionary<NSString *, NSString *> *)paramete
rs { |
| 48 if (self = [self initWithName:name parameters:parameters]) { |
| 49 _payload = payload; |
| 50 } |
| 51 |
| 52 return self; |
| 53 } |
| 54 |
| 46 - (cricket::VideoCodec)nativeVideoCodec { | 55 - (cricket::VideoCodec)nativeVideoCodec { |
| 47 cricket::VideoCodec codec([NSString stdStringForString:_name]); | 56 cricket::VideoCodec codec([NSString stdStringForString:_name]); |
| 48 for (NSString *paramKey in _parameters.allKeys) { | 57 for (NSString *paramKey in _parameters.allKeys) { |
| 49 codec.SetParam([NSString stdStringForString:paramKey], | 58 codec.SetParam([NSString stdStringForString:paramKey], |
| 50 [NSString stdStringForString:_parameters[paramKey]]); | 59 [NSString stdStringForString:_parameters[paramKey]]); |
| 51 } | 60 } |
| 52 | 61 |
| 53 return codec; | 62 return codec; |
| 54 } | 63 } |
| 55 | 64 |
| 56 @end | 65 @end |
| 57 | 66 |
| 58 @implementation RTCVideoEncoderQpThresholds | 67 @implementation RTCVideoEncoderQpThresholds |
| 59 | 68 |
| 60 @synthesize low = _low; | 69 @synthesize low = _low; |
| 61 @synthesize high = _high; | 70 @synthesize high = _high; |
| 62 | 71 |
| 63 - (instancetype)initWithThresholdsLow:(NSInteger)low high:(NSInteger)high { | 72 - (instancetype)initWithThresholdsLow:(NSInteger)low high:(NSInteger)high { |
| 64 if (self = [super init]) { | 73 if (self = [super init]) { |
| 65 _low = low; | 74 _low = low; |
| 66 _high = high; | 75 _high = high; |
| 67 } | 76 } |
| 68 return self; | 77 return self; |
| 69 } | 78 } |
| 70 | 79 |
| 71 @end | 80 @end |
| OLD | NEW |