Add supportsNativeHandle to the RTCVideoEncoder protocol.

The simulcast_encoder_adapter expects codecs that specify
supports_native_handle to perform resampling/scaling (through
GetEncoderInfo).
This change adds a method to the RTCVideoEncoder to let objc encoders
specify this rather than relying on the default.

Bug: webrtc:13044
Change-Id: I2efcbd42aa4f2048285f451c7b691fdeca111e62
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227641
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Commit-Queue: Peter Hanspers <peterhanspers@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34683}
This commit is contained in:
Peter Hanspers 2021-08-04 17:15:49 +02:00 committed by WebRTC LUCI CQ
parent 954c1d1a0c
commit 7f854bce1f
4 changed files with 13 additions and 1 deletions

View File

@ -79,4 +79,8 @@
return NO;
}
- (BOOL)supportsNativeHandle {
RTC_NOTREACHED();
return NO;
}
@end

View File

@ -50,6 +50,10 @@ RTC_OBJC_EXPORT
scaled, all resolutions comply with 'resolutionAlignment'. */
@property(nonatomic, readonly) BOOL applyAlignmentToAllSimulcastLayers;
/** If YES, the reciever is expected to resample/scale the source texture to the expected output
size. */
@property(nonatomic, readonly) BOOL supportsNativeHandle;
@end
NS_ASSUME_NONNULL_END

View File

@ -537,6 +537,10 @@ NSUInteger GetMaxSampleRate(const webrtc::H264ProfileLevelId &profile_level_id)
return NO;
}
- (BOOL)supportsNativeHandle {
return YES;
}
#pragma mark - Private
- (NSInteger)releaseEncoder {

View File

@ -91,7 +91,6 @@ class ObjCVideoEncoder : public VideoEncoder {
VideoEncoder::EncoderInfo GetEncoderInfo() const override {
EncoderInfo info;
info.supports_native_handle = true;
info.implementation_name = implementation_name_;
RTC_OBJC_TYPE(RTCVideoEncoderQpThresholds) *qp_thresholds = [encoder_ scalingSettings];
@ -100,6 +99,7 @@ class ObjCVideoEncoder : public VideoEncoder {
info.requested_resolution_alignment = encoder_.resolutionAlignment > 0 ?: 1;
info.apply_alignment_to_all_simulcast_layers = encoder_.applyAlignmentToAllSimulcastLayers;
info.supports_native_handle = encoder_.supportsNativeHandle;
info.is_hardware_accelerated = true;
info.has_internal_source = false;
return info;