[vlc-commits] videotoolbox: fallback to other decoders in case of critical failure
Thomas Guillem
git at videolan.org
Fri Jan 20 14:47:29 CET 2017
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Jan 20 14:29:47 2017 +0100| [29b10f0b9e0f35046240db7dbffb4460b59a73f7] | committer: Thomas Guillem
videotoolbox: fallback to other decoders in case of critical failure
Fix #16048
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=29b10f0b9e0f35046240db7dbffb4460b59a73f7
---
modules/codec/videotoolbox.m | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
index bf65c59..d52cc9e 100644
--- a/modules/codec/videotoolbox.m
+++ b/modules/codec/videotoolbox.m
@@ -706,6 +706,10 @@ static int OpenDecoder(vlc_object_t *p_this)
if (p_dec->fmt_in.i_cat != VIDEO_ES)
return VLC_EGENERIC;
+ /* Fail if this module already failed to decode this ES */
+ if (var_Type(p_dec, "videotoolbox-failed") != 0)
+ return VLC_EGENERIC;
+
/* check quickly if we can digest the offered data */
CMVideoCodecType codec;
codec = CodecPrecheck(p_dec);
@@ -1102,7 +1106,7 @@ static picture_t *DecodeBlock(decoder_t *p_dec, block_t **pp_block)
msg_Err(p_dec, "decoder failure: invalid SPS/PPS");
else if (status == -6661) {
msg_Err(p_dec, "decoder failure: invalid argument");
- p_dec->b_error = true;
+ goto reload;
} else if (status == -8969 || status == -12909) {
msg_Err(p_dec, "decoder failure: bad data (%i)", status);
StopVideoToolbox(p_dec);
@@ -1119,6 +1123,16 @@ static picture_t *DecodeBlock(decoder_t *p_dec, block_t **pp_block)
skip:
block_Release(p_block);
return NULL;
+
+reload:
+ /* Add an empty variable so that videotoolbox won't be loaded again for
+ * this ES */
+ if (var_Create(p_dec, "videotoolbox-failed", VLC_VAR_VOID) == VLC_SUCCESS)
+ decoder_RequestReload(p_dec);
+ else
+ p_dec->b_error = true;
+ block_Release(p_block);
+ return NULL;
}
static void UpdateVideoFormat(decoder_t *p_dec, NSDictionary *attachmentDict)
More information about the vlc-commits
mailing list