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:
@ -757,6 +757,8 @@ void H264VideoToolboxEncoder::OnEncodedFrame(
|
||||
bitrate_adjuster_.Update(frame._length);
|
||||
}
|
||||
|
||||
// TODO(magjed): This function is not used by RTCVideoEncoderH264, but this whole file will be
|
||||
// removed soon and inlined as ObjC.
|
||||
VideoEncoder::ScalingSettings H264VideoToolboxEncoder::GetScalingSettings()
|
||||
const {
|
||||
return VideoEncoder::ScalingSettings(true, internal::kLowH264QpThreshold,
|
||||
|
||||
@ -111,6 +111,13 @@ class ObjCVideoEncoder : public VideoEncoder {
|
||||
|
||||
bool SupportsNativeHandle() const { return true; }
|
||||
|
||||
VideoEncoder::ScalingSettings GetScalingSettings() const {
|
||||
RTCVideoEncoderQpThresholds* qp_thresholds = [encoder_ scalingSettings];
|
||||
return qp_thresholds ?
|
||||
ScalingSettings(true /* enabled */, qp_thresholds.low, qp_thresholds.high) :
|
||||
ScalingSettings(false /* enabled */);
|
||||
}
|
||||
|
||||
private:
|
||||
id<RTCVideoEncoder> encoder_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user