ObjC: Implement HW codecs in ObjC instead of C++

The current ObjC HW encoder is implemented as a C++
webrtc::VideoEncoder. We then wrap it two times in the following way:
webrtc::VideoEncoder -> RTCVideoEncoder -> webrtc::VideoEncoder.
This was originally done to minimize the code diff when landing the
injectable encoder.

This CL removes the first wrapping and implements the ObjC HW encoder
as a RTCVideoEncoder directly. Similarly, the decoder is implemented
as a RTCVideoDecoder directly.

Based on andersc@ CL: https://codereview.webrtc.org/2978623002/.

BUG=webrtc:7924

Review-Url: https://codereview.webrtc.org/2987413002
Cr-Commit-Position: refs/heads/master@{#19255}
This commit is contained in:
magjed
2017-08-07 06:55:28 -07:00
committed by Commit Bot
parent bea36fdee8
commit 73c0eb5014
23 changed files with 1227 additions and 1480 deletions

View File

@ -25,6 +25,7 @@
@synthesize targetBitrate = _targetBitrate;
@synthesize maxFramerate = _maxFramerate;
@synthesize qpMax = _qpMax;
@synthesize mode = _mode;
- (instancetype)initWithNativeVideoCodec:(const webrtc::VideoCodec *)videoCodec {
if (self = [super init]) {
@ -42,31 +43,11 @@
_targetBitrate = videoCodec->targetBitrate;
_maxFramerate = videoCodec->maxFramerate;
_qpMax = videoCodec->qpMax;
_mode = (RTCVideoCodecMode)videoCodec->mode;
}
}
return self;
}
- (std::unique_ptr<webrtc::VideoCodec>)createNativeVideoEncoderSettings {
auto codecSettings = std::unique_ptr<webrtc::VideoCodec>(new webrtc::VideoCodec);
rtc::Optional<webrtc::VideoCodecType> codecType =
webrtc::PayloadNameToCodecType([NSString stdStringForString:_name]);
if (codecType) {
codecSettings->codecType = codecType.value();
}
codecSettings->width = _width;
codecSettings->height = _height;
codecSettings->startBitrate = _startBitrate;
codecSettings->maxBitrate = _maxBitrate;
codecSettings->minBitrate = _minBitrate;
codecSettings->targetBitrate = _targetBitrate;
codecSettings->maxFramerate = _maxFramerate;
codecSettings->qpMax = _qpMax;
return codecSettings;
}
@end