From 4b07059139178636809b3d9eee961da0b9c92437 Mon Sep 17 00:00:00 2001 From: Yura Yaroshevich Date: Fri, 10 Jan 2020 12:25:24 +0300 Subject: [PATCH] [iOS] Reset VT session when H264 encoder malfunction error happen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: webrtc:11268 Change-Id: I764eb37a386075838e981c6d5b820e25d77f1a80 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/165395 Commit-Queue: Kári Helgason Reviewed-by: Kári Helgason Cr-Commit-Position: refs/heads/master@{#30209} --- sdk/objc/components/video_codec/RTCVideoEncoderH264.mm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm b/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm index 4028e7acee..6584c88c61 100644 --- a/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm +++ b/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm @@ -501,6 +501,13 @@ NSUInteger GetMaxSampleRate(const webrtc::H264::ProfileLevelId &profile_level_id RTC_LOG(LS_ERROR) << "Invalid compression session, resetting."; [self resetCompressionSessionWithPixelFormat:[self pixelFormatOfFrame:frame]]; + return WEBRTC_VIDEO_CODEC_NO_OUTPUT; + } else if (status == kVTVideoEncoderMalfunctionErr) { + // Sometimes the encoder malfunctions and needs to be restarted. + RTC_LOG(LS_ERROR) + << "Encountered video encoder malfunction error. Resetting compression session."; + [self resetCompressionSessionWithPixelFormat:[self pixelFormatOfFrame:frame]]; + return WEBRTC_VIDEO_CODEC_NO_OUTPUT; } else if (status != noErr) { RTC_LOG(LS_ERROR) << "Failed to encode frame with code: " << status;