Commit 604ef756 authored by Thomas Guillem's avatar Thomas Guillem Committed by Jean-Baptiste Kempf

mediacodec/omxil: use same blacklist

A crashing decoder via MediaCodec has a lot of chances to crash via omxil.
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 82657449
......@@ -390,28 +390,6 @@ end:
return ret;
}
static bool codec_is_blacklisted( const char *p_name, unsigned int i_name_len )
{
static const char *blacklisted_codecs[] = {
/* software decoders */
"OMX.google.",
/* crashes mediaserver */
"OMX.MTK.VIDEO.DECODER.MPEG4",
/* Not working or crashing (Samsung) */
"OMX.SEC.vp8.dec",
NULL,
};
for( const char **pp_bl_codecs = blacklisted_codecs; *pp_bl_codecs != NULL;
pp_bl_codecs++ )
{
if( !strncmp( p_name, *pp_bl_codecs,
__MIN( strlen(*pp_bl_codecs), i_name_len ) ) )
return true;
}
return false;
}
/*****************************************************************************
* OpenDecoder: Create the decoder instance
*****************************************************************************/
......@@ -499,7 +477,7 @@ static int OpenDecoder(vlc_object_t *p_this)
name_ptr = (*env)->GetStringUTFChars(env, name, NULL);
found = false;
if (codec_is_blacklisted( name_ptr, name_len))
if (OMXCodec_IsBlacklisted( name_ptr, name_len))
goto loopclean;
for (int j = 0; j < num_types && !found; j++) {
jobject type = (*env)->GetObjectArrayElement(env, types, j);
......
......@@ -1109,40 +1109,7 @@ static int OpenGeneric( vlc_object_t *p_this, bool b_encode )
for(i = 0; i < p_sys->components; i++)
{
#ifdef __ANDROID__
/* ignore OpenCore software codecs */
if (!strncmp(p_sys->ppsz_components[i], "OMX.PV.", 7))
continue;
/* The same sw codecs, renamed in ICS (perhaps also in honeycomb) */
if (!strncmp(p_sys->ppsz_components[i], "OMX.google.", 11))
continue;
/* This one has been seen on HTC One V - it behaves like it works,
* but FillBufferDone returns buffers filled with 0 bytes. The One V
* has got a working OMX.qcom.video.decoder.avc instead though. */
if (!strncmp(p_sys->ppsz_components[i], "OMX.ARICENT.", 12))
continue;
/* Codecs with DRM, that don't output plain YUV data but only
* support direct rendering where the output can't be intercepted. */
if (strstr(p_sys->ppsz_components[i], ".secure"))
continue;
/* Use VC1 decoder for WMV3 for now */
if (!strcmp(p_sys->ppsz_components[i], "OMX.SEC.WMV.Decoder"))
continue;
/* This decoder does work, but has an insane latency (leading to errors
* about "main audio output playback way too late" and dropped frames).
* At least Samsung Galaxy S III (where this decoder is present) has
* got another one, OMX.SEC.mp3.dec, that works well and has a
* sensible latency. (Also, even if that one isn't found, in general,
* using SW codecs is usually more than fast enough for MP3.) */
if (!strcmp(p_sys->ppsz_components[i], "OMX.SEC.MP3.Decoder"))
continue;
/* This codec should be able to handle both VC1 and WMV3, but
* for VC1 it doesn't output any buffers at all (in the way we use
* it) and for WMV3 it outputs plain black buffers. Thus ignore
* it until we can make it work properly. */
if (!strcmp(p_sys->ppsz_components[i], "OMX.Nvidia.vc1.decode"))
continue;
/* This codec doesn't work or crashes */
if (!strcmp(p_sys->ppsz_components[i], "OMX.SEC.vp8.dec"))
if (OMXCodec_IsBlacklisted(p_sys->ppsz_components[i], strlen(p_sys->ppsz_components[i])))
continue;
#endif
omx_error = InitialiseComponent(p_dec, p_sys->ppsz_components[i],
......
......@@ -221,6 +221,11 @@ const char *ErrorToString(OMX_ERRORTYPE error);
void PrintOmx(decoder_t *p_dec, OMX_HANDLETYPE omx_handle, OMX_U32 i_port);
/*****************************************************************************
* Utility functions
*****************************************************************************/
bool OMXCodec_IsBlacklisted( const char *p_name, unsigned int i_name_len );
/*****************************************************************************
* fourcc -> omx id mapping
*****************************************************************************/
......
......@@ -306,6 +306,72 @@ int IgnoreOmxDecoderPadding(const char *name)
return 0;
}
/*****************************************************************************
* Utility functions
*****************************************************************************/
bool OMXCodec_IsBlacklisted( const char *p_name, unsigned int i_name_len )
{
static const char *blacklisted_prefix[] = {
/* ignore OpenCore software codecs */
"OMX.PV.",
/* The same sw codecs, renamed in ICS (perhaps also in honeycomb) */
"OMX.google.",
/* This one has been seen on HTC One V - it behaves like it works,
* but FillBufferDone returns buffers filled with 0 bytes. The One V
* has got a working OMX.qcom.video.decoder.avc instead though. */
"OMX.ARICENT.",
/* Use VC1 decoder for WMV3 for now */
"OMX.SEC.WMV.Decoder",
/* This decoder does work, but has an insane latency (leading to errors
* about "main audio output playback way too late" and dropped frames).
* At least Samsung Galaxy S III (where this decoder is present) has
* got another one, OMX.SEC.mp3.dec, that works well and has a
* sensible latency. (Also, even if that one isn't found, in general,
* using SW codecs is usually more than fast enough for MP3.) */
"OMX.SEC.MP3.Decoder",
/* This codec should be able to handle both VC1 and WMV3, but
* for VC1 it doesn't output any buffers at all (in the way we use
* it) and for WMV3 it outputs plain black buffers. Thus ignore
* it until we can make it work properly. */
"OMX.Nvidia.vc1.decode",
/* crashes mediaserver */
"OMX.MTK.VIDEO.DECODER.MPEG4",
/* Not working or crashing (Samsung) */
"OMX.SEC.vp8.dec",
NULL
};
static const char *blacklisted_suffix[] = {
/* Codecs with DRM, that don't output plain YUV data but only
* support direct rendering where the output can't be intercepted. */
".secure",
NULL
};
/* p_name is not '\0' terminated */
for( const char **pp_bl_prefix = blacklisted_prefix; *pp_bl_prefix != NULL;
pp_bl_prefix++ )
{
if( !strncmp( p_name, *pp_bl_prefix,
__MIN( strlen(*pp_bl_prefix), i_name_len ) ) )
return true;
}
for( const char **pp_bl_suffix = blacklisted_suffix; *pp_bl_suffix != NULL;
pp_bl_suffix++ )
{
size_t i_suffix_len = strlen( *pp_bl_suffix );
if( i_name_len > i_suffix_len
&& !strncmp( p_name + i_name_len - i_suffix_len, *pp_bl_suffix,
i_suffix_len ) )
return true;
}
return false;
}
/*****************************************************************************
* Logging utility functions
*****************************************************************************/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment