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:
magjed
2017-08-01 08:07:59 -07:00
committed by Commit Bot
parent 822ff2b794
commit 5dfac33dfd
5 changed files with 54 additions and 0 deletions

View File

@ -104,6 +104,17 @@ RTC_EXPORT
@end
/** QP thresholds for encoder. Corresponds to webrtc::VideoEncoder::QpThresholds. */
RTC_EXPORT
@interface RTCVideoEncoderQpThresholds : NSObject
- (instancetype)initWithThresholdsLow:(NSInteger)low high:(NSInteger)high;
@property(nonatomic, readonly) NSInteger low;
@property(nonatomic, readonly) NSInteger high;
@end
/** Protocol for encoder implementations. */
RTC_EXPORT
@protocol RTCVideoEncoder <NSObject>
@ -118,6 +129,13 @@ RTC_EXPORT
frameTypes:(NSArray<NSNumber *> *)frameTypes;
- (BOOL)setBitrate:(uint32_t)bitrateKbit framerate:(uint32_t)framerate;
/** Returns QP scaling settings for encoder. The quality scaler adjusts the resolution in order to
* keep the QP from the encoded images within the given range. Returning nil from this function
* disables quality scaling. */
- (RTCVideoEncoderQpThresholds *)scalingSettings;
// TODO(andersc): Add implementationName method.
@end
/** Protocol for decoder implementations. */
@ -135,6 +153,8 @@ RTC_EXPORT
codecSpecificInfo:(__nullable id<RTCCodecSpecificInfo>)info
renderTimeMs:(int64_t)renderTimeMs;
// TODO(andersc): Add implementationName method.
@end
NS_ASSUME_NONNULL_END