Implement OnResolutionChange to objc RTCVideoEncoderSelector
Bug: webrtc:12406 Change-Id: I3335d895ecd207ba9de92397cffa3b80799df4ad Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258700 Reviewed-by: Kári Helgason <kthelgason@webrtc.org> Commit-Queue: Daniel.L (Byoungchan) Lee <daniel.l@hpcnt.com> Cr-Commit-Position: refs/heads/main@{#36589}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
afb246b5a9
commit
61a01af454
@ -27,6 +27,9 @@ RTC_OBJC_EXPORT
|
||||
- (nullable RTC_OBJC_TYPE(RTCVideoCodecInfo) *)encoderForBitrate:(NSInteger)bitrate;
|
||||
- (nullable RTC_OBJC_TYPE(RTCVideoCodecInfo) *)encoderForBrokenEncoder;
|
||||
|
||||
@optional
|
||||
- (nullable RTC_OBJC_TYPE(RTCVideoCodecInfo) *)encoderForResolutionChangeBySize:(CGSize)size;
|
||||
|
||||
@end
|
||||
|
||||
/** RTCVideoEncoderFactory is an Objective-C version of webrtc::VideoEncoderFactory.
|
||||
|
@ -134,6 +134,17 @@ class ObjcVideoEncoderSelector : public VideoEncoderFactory::EncoderSelectorInte
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
absl::optional<SdpVideoFormat> OnResolutionChange(const RenderResolution &resolution) override {
|
||||
if ([selector_ respondsToSelector:@selector(encoderForResolutionChangeBySize:)]) {
|
||||
RTC_OBJC_TYPE(RTCVideoCodecInfo) *info = [selector_
|
||||
encoderForResolutionChangeBySize:CGSizeMake(resolution.Width(), resolution.Height())];
|
||||
if (info) {
|
||||
return [info nativeSdpVideoFormat];
|
||||
}
|
||||
}
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
private:
|
||||
id<RTC_OBJC_TYPE(RTCVideoEncoderSelector)> selector_;
|
||||
};
|
||||
|
Reference in New Issue
Block a user