X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fmediacodecdec.c;h=1cebb3d76d14f4e27ac567c8fd61b874a68aef6a;hb=90262f3fb4afe4b903888e45cc40e2116cb69683;hp=f5771bffb1f34140ae5bcfe96bb3fbb2683f74eb;hpb=8a3623e2fbde8cb2da3235bf9e230f3512a31c34;p=ffmpeg diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c index f5771bffb1f..1cebb3d76d1 100644 --- a/libavcodec/mediacodecdec.c +++ b/libavcodec/mediacodecdec.c @@ -34,7 +34,7 @@ #include "decode.h" #include "h264_parse.h" #include "hevc_parse.h" -#include "hwaccel.h" +#include "hwconfig.h" #include "internal.h" #include "mediacodec_wrapper.h" #include "mediacodecdec_common.h" @@ -167,8 +167,11 @@ static int h264_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format) ff_AMediaFormat_setBuffer(format, "csd-1", (void*)data, data_size); av_freep(&data); } else { - av_log(avctx, AV_LOG_ERROR, "Could not extract PPS/SPS from extradata"); - ret = AVERROR_INVALIDDATA; + const int warn = is_avc && (avctx->codec_tag == MKTAG('a','v','c','1') || + avctx->codec_tag == MKTAG('a','v','c','2')); + av_log(avctx, warn ? AV_LOG_WARNING : AV_LOG_DEBUG, + "Could not extract PPS/SPS from extradata\n"); + ret = 0; } done: @@ -254,8 +257,10 @@ static int hevc_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format) av_freep(&data); } else { - av_log(avctx, AV_LOG_ERROR, "Could not extract VPS/PPS/SPS from extradata"); - ret = AVERROR_INVALIDDATA; + const int warn = is_nalff && avctx->codec_tag == MKTAG('h','v','c','1'); + av_log(avctx, warn ? AV_LOG_WARNING : AV_LOG_DEBUG, + "Could not extract VPS/PPS/SPS from extradata\n"); + ret = 0; } done: @@ -486,7 +491,7 @@ static void mediacodec_decode_flush(AVCodecContext *avctx) ff_mediacodec_dec_flush(avctx, s->ctx); } -static const AVCodecHWConfigInternal *mediacodec_hw_configs[] = { +static const AVCodecHWConfigInternal *const mediacodec_hw_configs[] = { &(const AVCodecHWConfigInternal) { .public = { .pix_fmt = AV_PIX_FMT_MEDIACODEC, @@ -517,7 +522,7 @@ static const AVClass ff_##short_name##_mediacodec_dec_class = { \ #define DECLARE_MEDIACODEC_VDEC(short_name, full_name, codec_id, bsf) \ DECLARE_MEDIACODEC_VCLASS(short_name) \ -AVCodec ff_##short_name##_mediacodec_decoder = { \ +const AVCodec ff_ ## short_name ## _mediacodec_decoder = { \ .name = #short_name "_mediacodec", \ .long_name = NULL_IF_CONFIG_SMALL(full_name " Android MediaCodec decoder"), \ .type = AVMEDIA_TYPE_VIDEO, \