[FFmpeg-devel] [PATCH 4/5] libavcodec: write out user data unregistered SEI for nvenc

Brad Hards bradh at frogmouth.net
Sat May 1 02:30:50 EEST 2021


On Saturday, 1 May 2021 1:27:44 AM AEST Timo Rothenpieler wrote:
> On 30.04.2021 13:34, Brad Hards wrote:
> > +        num_unregistered_sei = av_frame_num_side_data(frame,
> > AV_FRAME_DATA_SEI_UNREGISTERED); +        for (int i = 0; i <
> > num_unregistered_sei; i++) {
> 
> redefines i from above. Not sure if that's even valid.
Will fix.

> > +            sd = av_frame_get_side_data_n(frame,
> > AV_FRAME_DATA_SEI_UNREGISTERED, i); +            if (sd) {
> > +                sei_data[sei_count].payloadSize = sd->size;
> > +                sei_data[sei_count].payloadType =
> > SEI_TYPE_USER_DATA_UNREGISTERED; +               
> > sei_data[sei_count].payload = av_memdup(sd->data, sd->size); +           
> >     sei_count ++;
> > +                if (sei_count >= 8) {
> > +                    break;
> > +                }
> > +            }
> > +        }
> 
> I'm not at all a fan of writing an arbitrary amount of stuff into a
> small fixed size array.
I don't understand this comment. The existing code defines a fixed size array, 
and I don't want to change it because I couldn't find an authoritative source 
as to why that size or approach. I assume it could be a hardware limitation on 
at least some versions.
So I've tried to follow the existing approach, and ensure that the loop never 
exceeds the available space by tracking the count.
Am I missing something?

Brad





More information about the ffmpeg-devel mailing list