[vlc-commits] videotoolbox: restart in case of kVTVideoDecoderBadDataErr
Thomas Guillem
git at videolan.org
Wed Mar 29 15:49:46 CEST 2017
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Mar 27 16:52:33 2017 +0200| [2ff6ca74d6e400eb588517a6a6da273c3151f6fe] | committer: Thomas Guillem
videotoolbox: restart in case of kVTVideoDecoderBadDataErr
Restart and try to decode the same block again.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2ff6ca74d6e400eb588517a6a6da273c3151f6fe
---
modules/codec/videotoolbox.m | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
index 60cef74..0a30c5b 100644
--- a/modules/codec/videotoolbox.m
+++ b/modules/codec/videotoolbox.m
@@ -436,7 +436,7 @@ static void StopVideoToolbox(decoder_t *p_dec, bool b_reset_format)
}
}
-static void RestartVideoToolbox(decoder_t *p_dec, bool b_reset_format)
+static int RestartVideoToolbox(decoder_t *p_dec, bool b_reset_format)
{
decoder_sys_t *p_sys = p_dec->p_sys;
@@ -445,9 +445,7 @@ static void RestartVideoToolbox(decoder_t *p_dec, bool b_reset_format)
if (p_sys->session != nil)
StopVideoToolbox(p_dec, b_reset_format);
- if (StartVideoToolbox(p_dec) != VLC_SUCCESS) {
- msg_Warn(p_dec, "Decoder session restart failed");
- }
+ return StartVideoToolbox(p_dec);
}
#pragma mark - module open and close
@@ -1064,7 +1062,6 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
OSStatus status =
VTDecompressionSessionDecodeFrame(p_sys->session, sampleBuffer,
decoderFlags, NULL, &flagOut);
- CFRelease(sampleBuffer);
if (HandleVTStatus(p_dec, status) == VLC_SUCCESS)
p_sys->b_vt_feed = true;
else
@@ -1081,7 +1078,14 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
break;
case -8969 /* codecBadDataErr */:
case kVTVideoDecoderBadDataErr:
- StopVideoToolbox(p_dec, true);
+ if (RestartVideoToolbox(p_dec, true) == VLC_SUCCESS)
+ {
+ status = VTDecompressionSessionDecodeFrame(p_sys->session,
+ sampleBuffer, decoderFlags, NULL, &flagOut);
+
+ if (status != 0)
+ StopVideoToolbox(p_dec, true);
+ }
break;
case -8960 /* codecErr */:
case kVTVideoDecoderMalfunctionErr:
@@ -1090,6 +1094,7 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
break;
}
}
+ CFRelease(sampleBuffer);
skip:
block_Release(p_block);
More information about the vlc-commits
mailing list