blob: dec3a6109075448cba97f505b45e5dc48e535244 [file] [log] [blame]
Anders Carlsson7bca8ca2018-08-30 09:30:29 +02001/*
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#import "RTCVideoEncoderSettings+Private.h"
12
13#import "helpers/NSString+StdString.h"
14
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020015@implementation RTC_OBJC_TYPE (RTCVideoEncoderSettings)
16(Private)
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020017
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020018 - (instancetype)initWithNativeVideoCodec : (const webrtc::VideoCodec *)videoCodec {
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020019 if (self = [super init]) {
20 if (videoCodec) {
21 const char *codecName = CodecTypeToPayloadString(videoCodec->codecType);
22 self.name = [NSString stringWithUTF8String:codecName];
23
24 self.width = videoCodec->width;
25 self.height = videoCodec->height;
26 self.startBitrate = videoCodec->startBitrate;
27 self.maxBitrate = videoCodec->maxBitrate;
28 self.minBitrate = videoCodec->minBitrate;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020029 self.maxFramerate = videoCodec->maxFramerate;
30 self.qpMax = videoCodec->qpMax;
31 self.mode = (RTCVideoCodecMode)videoCodec->mode;
32 }
33 }
34
35 return self;
36}
37
38- (webrtc::VideoCodec)nativeVideoCodec {
39 webrtc::VideoCodec videoCodec;
40 videoCodec.width = self.width;
41 videoCodec.height = self.height;
42 videoCodec.startBitrate = self.startBitrate;
43 videoCodec.maxBitrate = self.maxBitrate;
44 videoCodec.minBitrate = self.minBitrate;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020045 videoCodec.maxBitrate = self.maxBitrate;
46 videoCodec.qpMax = self.qpMax;
47 videoCodec.mode = (webrtc::VideoCodecMode)self.mode;
48
49 return videoCodec;
50}
51
52@end