Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
f5556fb0 by Steve Lhomme at 2024-02-16T07:53:45+00:00
vpx_alpha: fix infinite loop when opening sub decoders
- - - - -
bc8308fd by Steve Lhomme at 2024-02-16T07:53:45+00:00
codec: fix i_level -1 detected as VPx with alpha
- - - - -
11 changed files:
- modules/codec/avcodec/fourcc.c
- modules/codec/gstreamer/gstdecode.c
- modules/codec/omxil/mediacodec.c
- modules/codec/omxil/utils.c
- modules/codec/vpx.c
- modules/codec/vpx_alpha.c
- modules/hw/mmal/codec.c
- modules/hw/nvdec/nvdec.c
- modules/packetizer/avparser.c
- modules/stream_out/chromecast/cast.cpp
- modules/stream_out/rtpfmt.c
Changes:
=====================================
modules/codec/avcodec/fourcc.c
=====================================
@@ -563,9 +563,9 @@ bool GetFfmpegCodec( const es_format_t *es,
const struct vlc_avcodec_fourcc *base;
size_t count;
- if (es->i_codec == VLC_CODEC_VP8 && es->i_level) // contains alpha
extradata
+ if (es->i_codec == VLC_CODEC_VP8 && es->i_level != 0 && es->i_level != -1)
// contains alpha extradata
return false;
- if (es->i_codec == VLC_CODEC_VP9 && es->i_level) // contains alpha
extradata
+ if (es->i_codec == VLC_CODEC_VP9 && es->i_level != 0 && es->i_level != -1)
// contains alpha extradata
return false;
switch( es->i_cat )
=====================================
modules/codec/gstreamer/gstdecode.c
=====================================
@@ -408,12 +408,12 @@ static GstStructure* vlc_to_gst_fmt( const es_format_t
*p_fmt )
"systemstream", G_TYPE_BOOLEAN, FALSE, NULL );
break;
case VLC_CODEC_VP8:
- if (p_fmt->i_level) // contains alpha extradata
+ if (p_fmt->i_level != 0 && p_fmt->i_level != -1) // contains alpha
extradata
return NULL;
p_str = gst_structure_new_empty( "video/x-vp8" );
break;
case VLC_CODEC_VP9:
- if (p_fmt->i_level) // contains alpha extradata
+ if (p_fmt->i_level != 0 && p_fmt->i_level != -1) // contains alpha
extradata
return NULL;
p_str = gst_structure_new_empty( "video/x-vp9" );
break;
=====================================
modules/codec/omxil/mediacodec.c
=====================================
@@ -809,11 +809,11 @@ static int OpenDecoder(vlc_object_t *p_this,
pf_MediaCodecApi_init pf_init)
case VLC_CODEC_WMV3: mime = "video/x-ms-wmv"; break;
case VLC_CODEC_VC1: mime = "video/wvc1"; break;
case VLC_CODEC_VP8:
- if (p_dec->fmt_in->i_level) // contains alpha extradata
+ if (p_dec->fmt_in->i_level != 0 && p_dec->fmt_in->i_level != -1)
// contains alpha extradata
return VLC_ENOTSUP;
mime = "video/x-vnd.on2.vp8"; break;
case VLC_CODEC_VP9:
- if (p_dec->fmt_in->i_level) // contains alpha extradata
+ if (p_dec->fmt_in->i_level != 0 && p_dec->fmt_in->i_level != -1)
// contains alpha extradata
return VLC_ENOTSUP;
mime = "video/x-vnd.on2.vp9"; break;
}
=====================================
modules/codec/omxil/utils.c
=====================================
@@ -598,9 +598,9 @@ OMX_VIDEO_CODINGTYPE GetOmxVideoFormat( const es_format_t
*es )
for( size_t i = 0; i < ARRAY_SIZE(video_format_table); i++ )
if( video_format_table[i].i_fourcc == i_fourcc )
{
- if (es->i_codec == VLC_CODEC_VP8 && es->i_level) // contains alpha
extradata
+ if (es->i_codec == VLC_CODEC_VP8 && es->i_level != 0 &&
es->i_level != -1) // contains alpha extradata
continue;
- if (es->i_codec == VLC_CODEC_VP9 && es->i_level) // contains alpha
extradata
+ if (es->i_codec == VLC_CODEC_VP9 && es->i_level != 0 &&
es->i_level != -1) // contains alpha extradata
continue;
return video_format_table[i].i_codec;
@@ -628,9 +628,9 @@ static const char *GetOmxVideoRole( const es_format_t *es )
for( size_t i = 0; i < ARRAY_SIZE(video_format_table); i++ )
if( video_format_table[i].i_fourcc == i_fourcc )
{
- if (es->i_codec == VLC_CODEC_VP8 && es->i_level) // contains alpha
extradata
+ if (es->i_codec == VLC_CODEC_VP8 && es->i_level != 0 &&
es->i_level != -1) // contains alpha extradata
continue;
- if (es->i_codec == VLC_CODEC_VP9 && es->i_level) // contains alpha
extradata
+ if (es->i_codec == VLC_CODEC_VP9 && es->i_level != 0 &&
es->i_level != -1) // contains alpha extradata
continue;
return video_format_table[i].psz_role;
=====================================
modules/codec/vpx.c
=====================================
@@ -310,7 +310,7 @@ static int OpenDecoder(vlc_object_t *p_this)
{
#ifdef ENABLE_VP8_DECODER
case VLC_CODEC_VP8:
- if (dec->fmt_in->i_level) // contains alpha extradata
+ if (dec->fmt_in->i_level != 0 && dec->fmt_in->i_level != -1) //
contains alpha extradata
return VLC_ENOTSUP;
// fallthrough
case VLC_CODEC_WEBP:
@@ -321,7 +321,7 @@ static int OpenDecoder(vlc_object_t *p_this)
#endif
#ifdef ENABLE_VP9_DECODER
case VLC_CODEC_VP9:
- if (dec->fmt_in->i_level) // contains alpha extradata
+ if (dec->fmt_in->i_level != 0 && dec->fmt_in->i_level != -1) //
contains alpha extradata
return VLC_ENOTSUP;
// fallthrough
case VLC_CODEC_VP9ALPHA_ES:
@@ -413,7 +413,7 @@ static int OpenEncoder(vlc_object_t *p_this)
{
#ifdef ENABLE_VP8_ENCODER
case VLC_CODEC_VP8:
- if (p_enc->fmt_out.i_level) // contains alpha extradata
+ if (p_enc->fmt_out.i_level != 0 && p_enc->fmt_out.i_level != -1) //
contains alpha extradata
return VLC_ENOTSUP;
// fallthrough
case VLC_CODEC_WEBP:
@@ -423,7 +423,7 @@ static int OpenEncoder(vlc_object_t *p_this)
#endif
#ifdef ENABLE_VP9_ENCODER
case VLC_CODEC_VP9:
- if (p_enc->fmt_out.i_level) // contains alpha extradata
+ if (p_enc->fmt_out.i_level != 0 && p_enc->fmt_out.i_level != -1) //
contains alpha extradata
return VLC_ENOTSUP;
iface = &vpx_codec_vp9_cx_algo;
vp_version = 9;
=====================================
modules/codec/vpx_alpha.c
=====================================
@@ -438,7 +438,7 @@ int OpenDecoder(vlc_object_t *o)
decoder_t *dec = container_of(o, decoder_t, obj);
if (dec->fmt_in->i_codec != VLC_CODEC_VP8 && dec->fmt_in->i_codec !=
VLC_CODEC_VP9)
return VLC_ENOTSUP;
- if (dec->fmt_in->i_level == 0)
+ if (dec->fmt_in->i_level == 0 || dec->fmt_in->i_level == -1)
return VLC_ENOTSUP;
vpx_alpha *p_sys = vlc_obj_calloc(o, 1, sizeof(*p_sys));
@@ -461,6 +461,7 @@ int OpenDecoder(vlc_object_t *o)
fmt.i_codec = VLC_CODEC_VP8;
else
fmt.i_codec = VLC_CODEC_VP9;
+ fmt.i_level = 0;
decoder_Init( &p_sys->opaque->dec, &p_sys->opaque->fmt_in, &fmt );
vlc_picture_chain_Init(&p_sys->opaque->decoded);
es_format_Init(&p_sys->opaque->fmt_out, VIDEO_ES, 0);
=====================================
modules/hw/mmal/codec.c
=====================================
@@ -151,7 +151,7 @@ static MMAL_FOURCC_T vlc_to_mmal_es_fourcc(const
es_format_t *es)
case VLC_CODEC_VP6:
return MMAL_ENCODING_VP6;
case VLC_CODEC_VP8:
- if (es->i_level) // contains alpha extradata
+ if (es->i_level != 0 && es->i_level != -1) // contains alpha extradata
return 0;
return MMAL_ENCODING_VP8;
case VLC_CODEC_WMV1:
=====================================
modules/hw/nvdec/nvdec.c
=====================================
@@ -815,7 +815,7 @@ static int OpenDecoder(vlc_object_t *p_this)
case VLC_CODEC_MP4V:
break;
case VLC_CODEC_VP8:
- if (p_dec->fmt_in->i_level) // contains alpha extradata
+ if (p_dec->fmt_in->i_level != 0 && p_dec->fmt_in->i_level != -1)
// contains alpha extradata
goto early_exit;
break;
case VLC_CODEC_VP9:
@@ -824,7 +824,7 @@ static int OpenDecoder(vlc_object_t *p_this)
msg_Warn(p_dec, "Unsupported VP9 profile %d",
p_dec->fmt_in->i_profile);
goto early_exit;
}
- if (p_dec->fmt_in->i_level) // contains alpha extradata
+ if (p_dec->fmt_in->i_level != 0 && p_dec->fmt_in->i_level != -1)
// contains alpha extradata
goto early_exit;
break;
default:
=====================================
modules/packetizer/avparser.c
=====================================
@@ -88,7 +88,7 @@ int avparser_OpenPacketizer( vlc_object_t *p_this )
/* Restrict to VP9 for now */
if( p_dec->fmt_in->i_codec != VLC_CODEC_VP9 )
return VLC_ENOTSUP;
- if( p_dec->fmt_in->i_level ) // contains alpha extradata
+ if( p_dec->fmt_in->i_level != 0 && p_dec->fmt_in->i_level != -1 ) //
contains alpha extradata
return VLC_ENOTSUP;
enum AVCodecID i_avcodec_id;
=====================================
modules/stream_out/chromecast/cast.cpp
=====================================
@@ -773,11 +773,11 @@ bool sout_stream_sys_t::canDecodeVideo( const es_format_t
*es ) const
case VLC_CODEC_HEVC:
return true;
case VLC_CODEC_VP8:
- if (es->i_level) // contains alpha extradata
+ if (es->i_level != 0 && es->i_level != -1) // contains alpha
extradata
return false;
return true;
case VLC_CODEC_VP9:
- if (es->i_level) // contains alpha extradata
+ if (es->i_level != 0 && es->i_level != -1) // contains alpha
extradata
return false;
return true;
default:
=====================================
modules/stream_out/rtpfmt.c
=====================================
@@ -644,7 +644,7 @@ int rtp_get_fmt( vlc_object_t *obj, const es_format_t
*p_fmt, const char *mux,
rtp_fmt->fmtp = strdup( "sprop-stereo=1" );
break;
case VLC_CODEC_VP8:
- if (p_fmt->i_level) // contains alpha extradata
+ if (p_fmt->i_level != 0 && p_fmt->i_level != -1) // contains alpha
extradata
return VLC_ENOTSUP;
rtp_fmt->ptname = "VP8";
rtp_fmt->pf_packetize = rtp_packetize_vp8;
View it on GitLab:
https://code.videolan.org/videolan/vlc/-/compare/3795469da9a2c45524fe68410e19c5c3ad505092...bc8308fd6ebce15e3f2781e181746212eeba60d0
--
View it on GitLab:
https://code.videolan.org/videolan/vlc/-/compare/3795469da9a2c45524fe68410e19c5c3ad505092...bc8308fd6ebce15e3f2781e181746212eeba60d0
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits