[FFmpeg-devel] [PATCH v3 11/12] vaapi_encode_h264: Don't include AUD with slice header
Mark Thompson
sw at jkqxz.net
Sun Feb 10 21:47:04 EET 2019
Always write it as a RawData block, even if there is no SEI as well.
---
libavcodec/vaapi_encode_h264.c | 40 +++++++++++++++-------------------
1 file changed, 17 insertions(+), 23 deletions(-)
diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
index fb55eb7779..b65ee4bec0 100644
--- a/libavcodec/vaapi_encode_h264.c
+++ b/libavcodec/vaapi_encode_h264.c
@@ -187,13 +187,6 @@ static int vaapi_encode_h264_write_slice_header(AVCodecContext *avctx,
CodedBitstreamFragment *au = &priv->current_access_unit;
int err;
- if (priv->aud_needed) {
- err = vaapi_encode_h264_add_nal(avctx, au, &priv->raw_aud);
- if (err < 0)
- goto fail;
- priv->aud_needed = 0;
- }
-
err = vaapi_encode_h264_add_nal(avctx, au, &priv->raw_slice);
if (err < 0)
goto fail;
@@ -213,16 +206,16 @@ static int vaapi_encode_h264_write_extra_header(AVCodecContext *avctx,
CodedBitstreamFragment *au = &priv->current_access_unit;
int err, i;
+ if (priv->aud_needed) {
+ err = vaapi_encode_h264_add_nal(avctx, au, &priv->raw_aud);
+ if (err < 0)
+ goto fail;
+ priv->aud_needed = 0;
+ }
+
if (priv->sei_needed) {
H264RawSEI *sei = &priv->raw_sei;
- if (priv->aud_needed) {
- err = vaapi_encode_h264_add_nal(avctx, au, &priv->raw_aud);
- if (err < 0)
- goto fail;
- priv->aud_needed = 0;
- }
-
*sei = (H264RawSEI) {
.nal_unit_header = {
.nal_unit_type = H264_NAL_SEI,
@@ -260,15 +253,6 @@ static int vaapi_encode_h264_write_extra_header(AVCodecContext *avctx,
goto fail;
priv->sei_needed = 0;
- err = vaapi_encode_h264_write_access_unit(avctx, data, data_len, au);
- if (err < 0)
- goto fail;
-
- ff_cbs_fragment_uninit(priv->cbc, au);
-
- *type = VAEncPackedHeaderRawData;
- return 0;
-
#if !CONFIG_VAAPI_1
} else if (priv->sei_cbr_workaround_needed) {
// Insert a zero-length header using the old SEI type. This is
@@ -285,6 +269,16 @@ static int vaapi_encode_h264_write_extra_header(AVCodecContext *avctx,
return AVERROR_EOF;
}
+
+ err = vaapi_encode_h264_write_access_unit(avctx, data, data_len, au);
+ if (err < 0)
+ goto fail;
+
+ ff_cbs_fragment_uninit(priv->cbc, au);
+
+ *type = VAEncPackedHeaderRawData;
+ return 0;
+
fail:
ff_cbs_fragment_uninit(priv->cbc, au);
return err;
--
2.19.2
More information about the ffmpeg-devel
mailing list