From patchwork Sun Apr 12 13:00:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 18890 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 691EA44BD62 for ; Sun, 12 Apr 2020 16:00:13 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 43B8C68B533; Sun, 12 Apr 2020 16:00:13 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D718C68B12A for ; Sun, 12 Apr 2020 16:00:06 +0300 (EEST) Received: by mail-wm1-f43.google.com with SMTP id a81so7451358wmf.5 for ; Sun, 12 Apr 2020 06:00:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jkqxz-net.20150623.gappssmtp.com; s=20150623; h=subject:from:to:references:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=WAbgVC14Ng75Y24qXKl1lizkTt5tQ2ArDwK1oYwUKBk=; b=f8HF0eJnW83thh62SdiTSPnH0hxM8XarPej/8dOKMF28d+n75SeUbn1Jxpkkn7Hr6v QWzrAbtcIJD//JWGI8nCmuokeDLWIfaYxgfck6P8EvVu8wHefWFhZIF4HAB9E5/o5waH W8b8gLgeKG2D2L5Lc+mbu/fdrhSCmWxL0mc4v7ZHUpFmwsNUlF+ZT8NbzSzqpNpBp674 0llcmecaV/3+lTRv3i6Q4WcP8crxAf59F43ywXKBZpYlZMx+kz02ZrcLT5ebpLvG2zSJ In2YIaxJsV+H6LwewW6nEpiRcJlXk7tVFMCM1wDyHzcqXP0FjwuP+Pd+QHYPOZsEQQHe OgDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=WAbgVC14Ng75Y24qXKl1lizkTt5tQ2ArDwK1oYwUKBk=; b=Fma/Ewbrb3UVcXx+U9k/2upAvw1INvlAmGyAy1lKvwp3D5l/aodNwTSWBdVjOBEiK9 hn0yKfoszBeWT8EJ0bH8XeRqMHis5sdJddALR4o8I2Dyfaw+ugv25hXmS5xvTxNVggZm nfpYWEdrm7aaNlgMUgtLDgWh8si+vqJo4GpDOqHb46li4CVltT012aGyFily9UTmM2Fg uy2gN7ilrrjRFmxe8FlISDuSV3bcAeb57RyWiLqvakTp2O/vUtCbxpiFiUYvmys5+T6R tWRbN9t1raNLP5bfCIe63ylDjd2ohjOsK5iVpr5GUX4yj2qytgIJGXGH57JqGQcNhDX8 +gdQ== X-Gm-Message-State: AGi0PubFpV6bKBorGkT5pZ7IdIc4VqUCF2jspPtxSsPg3YTe3DR35IHS DVeVW/vxxvRcBniXojv+Po99htpo4BE= X-Google-Smtp-Source: APiQypKdj1Nw8ewQUaErQDg4vdSGJ3Cu+f5wrPIZuksrSSJfm5SPZum06zNQkzxcw/bc1xwyRfLbEg== X-Received: by 2002:a1c:dc0a:: with SMTP id t10mr13824795wmg.113.1586696405986; Sun, 12 Apr 2020 06:00:05 -0700 (PDT) Received: from [192.168.0.3] (cpc91242-cmbg18-2-0-cust650.5-4.cable.virginm.net. [82.8.130.139]) by smtp.gmail.com with ESMTPSA id z11sm11005547wrv.58.2020.04.12.06.00.05 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 12 Apr 2020 06:00:05 -0700 (PDT) From: Mark Thompson To: ffmpeg-devel@ffmpeg.org References: <1585754282-17489-1-git-send-email-linjie.fu@intel.com> <19ffc023-5365-4d8c-3ecb-242bf9b7d3a8@gmail.com> <9a91d020-e89e-f0f7-74c1-9e4ffa529b59@jkqxz.net> Message-ID: <7cc9c3fc-d8c6-6345-b358-ef3db1215dc6@jkqxz.net> Date: Sun, 12 Apr 2020 14:00:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <9a91d020-e89e-f0f7-74c1-9e4ffa529b59@jkqxz.net> Content-Language: en-US Subject: [FFmpeg-devel] [PATCH] vaapi_decode: Improve logging around codec/profile selection X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- On 12/04/2020 13:14, Mark Thompson wrote: > ... This does rather suggest that the error messages in that file should be clearer, though - it would be nice if it could distinguish between "this codec isn't supported by libavcodec at all", "this codec might work but hasn't built into this libavcodec" and "this codec is supported by libavcodec but not by your hardware". Something like this? libavcodec/vaapi_decode.c | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c index 54a0ecb47a..a191850e36 100644 --- a/libavcodec/vaapi_decode.c +++ b/libavcodec/vaapi_decode.c @@ -429,6 +429,7 @@ static int vaapi_decode_make_config(AVCodecContext *avctx, const AVCodecDescriptor *codec_desc; VAProfile *profile_list = NULL, matched_va_profile, va_profile; int profile_count, exact_match, matched_ff_profile, codec_profile; + int found_codec, found_profile; AVHWDeviceContext *device = (AVHWDeviceContext*)device_ref->data; AVVAAPIDeviceContext *hwctx = device->hwctx; @@ -457,15 +458,19 @@ static int vaapi_decode_make_config(AVCodecContext *avctx, } matched_va_profile = VAProfileNone; + found_codec = found_profile = 0; exact_match = 0; for (i = 0; i < FF_ARRAY_ELEMS(vaapi_profile_map); i++) { int profile_match = 0; if (avctx->codec_id != vaapi_profile_map[i].codec_id) continue; + found_codec = 1; if (avctx->profile == vaapi_profile_map[i].codec_profile || - vaapi_profile_map[i].codec_profile == FF_PROFILE_UNKNOWN) + vaapi_profile_map[i].codec_profile == FF_PROFILE_UNKNOWN) { profile_match = 1; + found_profile = 1; + } va_profile = vaapi_profile_map[i].profile_parser ? vaapi_profile_map[i].profile_parser(avctx) : @@ -487,24 +492,42 @@ static int vaapi_decode_make_config(AVCodecContext *avctx, } av_freep(&profile_list); - if (matched_va_profile == VAProfileNone) { - av_log(avctx, AV_LOG_ERROR, "No support for codec %s " - "profile %d.\n", codec_desc->name, avctx->profile); + if (!found_codec) { + av_log(avctx, AV_LOG_ERROR, "This libavcodec build does not " + "support VAAPI decoding of codec %s.\n", + codec_desc->name); + err = AVERROR(ENOSYS); + goto fail; + } + if (!found_profile && !(avctx->hwaccel_flags & + AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH)) { + // We allow this case with profile-mismatch enabled to support + // things like trying to decode H.264 extended profile. + av_log(avctx, AV_LOG_ERROR, "This libavcodec build does not " + "support VAAPI decoding of codec %s profile %d.\n", + codec_desc->name, avctx->profile); err = AVERROR(ENOSYS); goto fail; } + if (matched_va_profile == VAProfileNone) { + av_log(avctx, AV_LOG_ERROR, "This VAAPI driver does not " + "support decoding of codec %s.\n", + codec_desc->name); + err = AVERROR(EINVAL); + goto fail; + } if (!exact_match) { if (avctx->hwaccel_flags & AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH) { - av_log(avctx, AV_LOG_VERBOSE, "Codec %s profile %d not " - "supported for hardware decode.\n", + av_log(avctx, AV_LOG_WARNING, "This VAAPI driver does not " + "support decoding of codec %s profile %d.\n", codec_desc->name, avctx->profile); av_log(avctx, AV_LOG_WARNING, "Using possibly-" "incompatible profile %d instead.\n", matched_ff_profile); } else { - av_log(avctx, AV_LOG_VERBOSE, "Codec %s profile %d not " - "supported for hardware decode.\n", + av_log(avctx, AV_LOG_ERROR, "This VAAPI driver does not " + "support decoding of codec %s profile %d.\n", codec_desc->name, avctx->profile); err = AVERROR(EINVAL); goto fail;