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:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user