Add resolution alignment properties to RTCVideoEncoder protocol.

With this change, RTCVideoEncoder can specify:
- requested_resolution_alignment,
- apply_alignment_to_all_simulcast_layers
in the same way scaling_settings is specified.

Change-Id: I3de79a2eabaae581d6a9f2ef3e39496b9545a4f5

Bug: webrtc:12829
Change-Id: I3de79a2eabaae581d6a9f2ef3e39496b9545a4f5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/220933
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Reviewed-by: Abby Yeh <abbyyeh@webrtc.org>
Commit-Queue: Peter Hanspers <peterhanspers@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34196}
This commit is contained in:
Peter Hanspers 2021-06-01 07:31:00 +02:00 committed by WebRTC LUCI CQ
parent aaa835c7b6
commit 5981bf2eb6
4 changed files with 27 additions and 0 deletions

View File

@ -69,4 +69,14 @@
return nil;
}
- (NSInteger)resolutionAlignment {
RTC_NOTREACHED();
return 1;
}
- (BOOL)applyAlignmentToAllSimulcastLayers {
RTC_NOTREACHED();
return NO;
}
@end

View File

@ -43,6 +43,13 @@ RTC_OBJC_EXPORT
* disables quality scaling. */
- (nullable RTC_OBJC_TYPE(RTCVideoEncoderQpThresholds) *)scalingSettings;
/** Resolutions should be aligned to this value. */
@property(nonatomic, readonly) NSInteger resolutionAlignment;
/** If enabled, resolution alignment is applied to all simulcast layers simultaneously so that when
scaled, all resolutions comply with 'resolutionAlignment'. */
@property(nonatomic, readonly) BOOL applyAlignmentToAllSimulcastLayers;
@end
NS_ASSUME_NONNULL_END

View File

@ -529,6 +529,14 @@ NSUInteger GetMaxSampleRate(const webrtc::H264ProfileLevelId &profile_level_id)
return WEBRTC_VIDEO_CODEC_OK;
}
- (NSInteger)resolutionAlignment {
return 1;
}
- (BOOL)applyAlignmentToAllSimulcastLayers {
return NO;
}
#pragma mark - Private
- (NSInteger)releaseEncoder {

View File

@ -95,6 +95,8 @@ class ObjCVideoEncoder : public VideoEncoder {
info.scaling_settings = qp_thresholds ? ScalingSettings(qp_thresholds.low, qp_thresholds.high) :
ScalingSettings::kOff;
info.requested_resolution_alignment = encoder_.resolutionAlignment > 0 ?: 1;
info.apply_alignment_to_all_simulcast_layers = encoder_.applyAlignmentToAllSimulcastLayers;
info.is_hardware_accelerated = true;
info.has_internal_source = false;
return info;