[iOS] Reset VT session when H264 decoder malfunction error happen

Bug: webrtc:11268
Change-Id: I6932cfbe53dc7b922a90604de799f259526b4c8f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/165785
Commit-Queue: Kári Helgason <kthelgason@webrtc.org>
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30236}
This commit is contained in:
Yura Yaroshevich
2020-01-13 15:45:58 +03:00
committed by Commit Bot
parent 6ea2c6ae87
commit e270ff1c41

View File

@ -147,8 +147,11 @@ void decompressionOutputCallback(void *decoderRef,
_decompressionSession, sampleBuffer, decodeFlags, frameDecodeParams.release(), nullptr);
#if defined(WEBRTC_IOS)
// Re-initialize the decoder if we have an invalid session while the app is
// active and retry the decode request.
if (status == kVTInvalidSessionErr && [self resetDecompressionSession] == WEBRTC_VIDEO_CODEC_OK) {
// active or decoder malfunctions and retry the decode request.
if ((status == kVTInvalidSessionErr || status == kVTVideoDecoderMalfunctionErr) &&
[self resetDecompressionSession] == WEBRTC_VIDEO_CODEC_OK) {
RTC_LOG(LS_INFO) << "Failed to decode frame with code: " << status
<< " retrying decode after decompression session reset";
frameDecodeParams.reset(new RTCFrameDecodeParams(_callback, inputImage.timeStamp));
status = VTDecompressionSessionDecodeFrame(
_decompressionSession, sampleBuffer, decodeFlags, frameDecodeParams.release(), nullptr);