}
if (i < 0) {
// No VCL units; just put it at the end.
- position = -1;
+ position = au->nb_units;
} else {
position = i + 1;
}
if (!desc)
return AVERROR(EINVAL);
- if (payload_buf) {
- payload_ref = av_buffer_ref(payload_buf);
- if (!payload_ref)
- return AVERROR(ENOMEM);
- } else {
- payload_ref = NULL;
- }
-
// Find an existing SEI unit or make a new one to add to.
err = cbs_sei_get_unit(ctx, au, prefix, &unit);
if (err < 0)
if (err < 0)
return err;
+ if (payload_buf) {
+ payload_ref = av_buffer_ref(payload_buf);
+ if (!payload_ref)
+ return AVERROR(ENOMEM);
+ } else {
+ payload_ref = NULL;
+ }
+
message = &list->messages[list->nb_messages - 1];
message->payload_type = payload_type;