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;