[FFmpeg-cvslog] avcodec/mediacodecenc: Extract configOBUs from AV1CodecConfigurationRecord
Zhao Zhili
git at videolan.org
Sun Oct 27 06:07:13 EET 2024
ffmpeg | branch: master | Zhao Zhili <zhilizhao at tencent.com> | Sat Oct 5 01:54:21 2024 +0800| [0ee18ff23d923fd423352868c7344a78568b0e3e] | committer: Zhao Zhili
avcodec/mediacodecenc: Extract configOBUs from AV1CodecConfigurationRecord
MediaCodec can generate AV1CodecConfigurationRecord, which shouldn't
be put into packet->data. Skip four bytes and extract configOBUs
if it exist.
Signed-off-by: Zhao Zhili <zhilizhao at tencent.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0ee18ff23d923fd423352868c7344a78568b0e3e
---
libavcodec/mediacodecenc.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c
index e76ea81236..3880ea2fe9 100644
--- a/libavcodec/mediacodecenc.c
+++ b/libavcodec/mediacodecenc.c
@@ -429,6 +429,16 @@ static int mediacodec_receive(AVCodecContext *avctx, AVPacket *pkt)
}
if (out_info.flags & ff_AMediaCodec_getBufferFlagCodecConfig(codec)) {
+ if (avctx->codec_id == AV_CODEC_ID_AV1) {
+ // Skip AV1CodecConfigurationRecord without configOBUs
+ if (out_info.size <= 4) {
+ ff_AMediaCodec_releaseOutputBuffer(codec, index, false);
+ return mediacodec_receive(avctx, pkt);
+ }
+ out_info.size -= 4;
+ out_info.offset += 4;
+ }
+
ret = av_reallocp(&s->extradata, out_info.size);
if (ret)
goto bailout;
More information about the ffmpeg-cvslog
mailing list