DCHECK the frame resolution only if the frame buffer is not native.

If the source image has a native handle and the encoder supports
the native handle, the encoder is expected to be able to correctly
sample/scale the source.

And VTCompressionSession can handle this, so DCHECK the frame
resolution only if the frame buffer is not native.

Bug: webrtc:14318
Change-Id: Id19c2f3bd86e9a2e1034d20e0255b4adc04a781f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/270144
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Commit-Queue: Kári Helgason <kthelgason@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37730}
This commit is contained in:
Jaehyun Ko
2022-08-04 19:19:03 +09:00
committed by WebRTC LUCI CQ
parent 7fbab87b60
commit 382a1528ef

View File

@ -388,8 +388,6 @@ NSUInteger GetMaxSampleRate(const webrtc::H264ProfileLevelId &profile_level_id)
- (NSInteger)encode:(RTC_OBJC_TYPE(RTCVideoFrame) *)frame
codecSpecificInfo:(nullable id<RTC_OBJC_TYPE(RTCCodecSpecificInfo)>)codecSpecificInfo
frameTypes:(NSArray<NSNumber *> *)frameTypes {
RTC_DCHECK_EQ(frame.width, _width);
RTC_DCHECK_EQ(frame.height, _height);
if (!_callback || !_compressionSession) {
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
}
@ -437,6 +435,8 @@ NSUInteger GetMaxSampleRate(const webrtc::H264ProfileLevelId &profile_level_id)
if (!pixelBuffer) {
// We did not have a native frame buffer
RTC_DCHECK_EQ(frame.width, _width);
RTC_DCHECK_EQ(frame.height, _height);
pixelBuffer = CreatePixelBuffer(_pixelBufferPool);
if (!pixelBuffer) {
return WEBRTC_VIDEO_CODEC_ERROR;