ObjC: Fix quality scaling for injected encoders
We missed to implement quality scaling in the original CL https://codereview.webrtc.org/2977213002/. This CL implements it. Note that the ObjC interface for scalingSettings is slightly different from the C++ interface in that we require explicit QP thresholds to turn quality scaling on, i.e. we don't provide default values. I think this is more modular as we want to move codec specific knowledge out from the WebRTC core. I would like to update the C++ webrtc::VideoEncoder interface to do the same in another CL. BUG=webrtc:7924 Review-Url: https://codereview.webrtc.org/2991123002 Cr-Commit-Position: refs/heads/master@{#19202}
This commit is contained in:
@ -54,3 +54,18 @@
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation RTCVideoEncoderQpThresholds
|
||||
|
||||
@synthesize low = _low;
|
||||
@synthesize high = _high;
|
||||
|
||||
- (instancetype)initWithThresholdsLow:(NSInteger)low high:(NSInteger)high {
|
||||
if (self = [super init]) {
|
||||
_low = low;
|
||||
_high = high;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@ -27,6 +27,11 @@ const size_t kDefaultPayloadSize = 1440;
|
||||
|
||||
const char kHighProfileExperiment[] = "WebRTC-H264HighProfile";
|
||||
|
||||
// These thresholds deviate from the default h264 QP thresholds, as they have been found to work
|
||||
// better on devices that support VideoToolbox
|
||||
const int kLowH264QpThreshold = 28;
|
||||
const int kHighH264QpThreshold = 39;
|
||||
|
||||
bool IsHighProfileEnabled() {
|
||||
return webrtc::field_trial::IsEnabled(kHighProfileExperiment);
|
||||
}
|
||||
@ -171,6 +176,11 @@ class H264VideoToolboxDecodeCompleteCallback : public webrtc::DecodedImageCallba
|
||||
return _videoToolboxEncoder->SetRates(bitrateKbit, framerate) == WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
|
||||
- (RTCVideoEncoderQpThresholds *)scalingSettings {
|
||||
return [[RTCVideoEncoderQpThresholds alloc] initWithThresholdsLow:kLowH264QpThreshold
|
||||
high:kHighH264QpThreshold];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
// Decoder.
|
||||
|
||||
Reference in New Issue
Block a user