[FFmpeg-cvslog] avcodec/mediacodecdec: do not abort when H264/HEVC extradata extraction fails
sfan5
git at videolan.org
Sun Feb 14 13:51:08 EET 2021
ffmpeg | branch: master | sfan5 <sfan5 at live.de> | Fri Feb 12 23:47:46 2021 +0100| [6f80953554b07635d3b52f76b03807d198a5e9d0] | committer: Jan Ekström
avcodec/mediacodecdec: do not abort when H264/HEVC extradata extraction fails
Although rare, extradata can be present but empty and extraction will fail.
However Android also supports passing codec-specific data inline and
will likely play such a stream anyway. So there's no reason to abort
initialization before we know for sure.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6f80953554b07635d3b52f76b03807d198a5e9d0
---
libavcodec/mediacodecdec.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
index ac1725e466..ad592d14a3 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:
More information about the ffmpeg-cvslog
mailing list