]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/h264_metadata_bsf.c
avutil/buffer: Switch AVBuffer API to size_t
[ffmpeg] / libavcodec / h264_metadata_bsf.c
index 6673a32601629915402057ebf879a5cf356c9bb6..ef74cba56037a73512bb1552967a000a8ec34984 100644 (file)
@@ -371,7 +371,7 @@ static int h264_metadata_handle_display_orientation(AVBSFContext *bsf,
         H264RawSEIDisplayOrientation *disp =
             &ctx->display_orientation_payload;
         uint8_t *data;
-        int size;
+        size_t size;
         int write = 0;
 
         data = av_packet_get_side_data(pkt, AV_PKT_DATA_DISPLAYMATRIX, &size);
@@ -462,11 +462,11 @@ static int h264_metadata_update_fragment(AVBSFContext *bsf, AVPacket *pkt,
     int err, i, has_sps, seek_point;
 
     // If an AUD is present, it must be the first NAL unit.
-    if (au->units[0].type == H264_NAL_AUD) {
+    if (au->nb_units && au->units[0].type == H264_NAL_AUD) {
         if (ctx->aud == BSF_ELEMENT_REMOVE)
             ff_cbs_delete_unit(au, 0);
     } else {
-        if (ctx->aud == BSF_ELEMENT_INSERT) {
+        if (pkt && ctx->aud == BSF_ELEMENT_INSERT) {
             err = h264_metadata_insert_aud(bsf, au);
             if (err < 0)
                 return err;