Message ID | DB6PR0901MB1495AC3DF11A248662226354EC8B9@DB6PR0901MB1495.eurprd09.prod.outlook.com |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,v3] avcodec/mediacodecdec: Do not abort when H264/HEVC extradata extraction fails | expand |
Context | Check | Description |
---|---|---|
andriy/x86_make | success | Make finished |
andriy/x86_make_fate | success | Make fate finished |
andriy/PPC64_make | success | Make finished |
andriy/PPC64_make_fate | success | Make fate finished |
On Sat, Feb 13, 2021 at 12:48 AM sfan5 <sfan5@live.de> wrote: > > 12.02.21 - 21:43 - Andreas Rheinhardt: > > sfan5: > >> Hi, > >> > >> > >> attached v2 patch after discussion on IRC with JEEB (as he already > >> mentioned). > >> > >> Only change is that the log level turns to debug when missing parameter > >> sets are within spec (cf. 14496-15). > >> > >> > >> - 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; > >> } > > warn = is_avc && (avctx->codec_tag == MKTAG('a','v','c','1') || > > avctx->codec_tag == MKTAG('a','v','c','2') > > is what you (should) want. > > > > - Andreas > > Thanks for pointing that out, you're correct. > > here's v3: After some brief discussion on IRC, this looks good to me :) . Jan
On Sat, Feb 13, 2021 at 4:31 PM Jan Ekström <jeebjp@gmail.com> wrote: > > On Sat, Feb 13, 2021 at 12:48 AM sfan5 <sfan5@live.de> wrote: > > > > 12.02.21 - 21:43 - Andreas Rheinhardt: > > > sfan5: > > >> Hi, > > >> > > >> > > >> attached v2 patch after discussion on IRC with JEEB (as he already > > >> mentioned). > > >> > > >> Only change is that the log level turns to debug when missing parameter > > >> sets are within spec (cf. 14496-15). > > >> > > >> > > >> - 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; > > >> } > > > warn = is_avc && (avctx->codec_tag == MKTAG('a','v','c','1') || > > > avctx->codec_tag == MKTAG('a','v','c','2') > > > is what you (should) want. > > > > > > - Andreas > > > > Thanks for pointing that out, you're correct. > > > > here's v3: > > After some brief discussion on IRC, this looks good to me :) . > Applied as 6f80953554b07635d3b52f76b03807d198a5e9d0 with the indentation of the log message and the initial capital letter of the commit message fixed. Jan
diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c index ac1725e466..f5d13b171e 100644 --- a/libavcodec/mediacodecdec.c +++ b/libavcodec/mediacodecdec.c @@ -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: