On 9/9/2019 10:18 PM, lance.lmw...@gmail.com wrote: > From: Limin Wang <lance.lmw...@gmail.com> > > Signed-off-by: Limin Wang <lance.lmw...@gmail.com> > --- > libavcodec/h2645_parse.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavcodec/h2645_parse.c b/libavcodec/h2645_parse.c > index 307e8643e6..403acd2ee1 100644 > --- a/libavcodec/h2645_parse.c > +++ b/libavcodec/h2645_parse.c > @@ -454,7 +454,7 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t > *buf, int length, > } > > if (pkt->nals_allocated < pkt->nb_nals + 1) { > - int new_size = pkt->nals_allocated + 1; > + int new_size = pkt->nb_nals + 1;
No. nals_allocated and nb_nals are two purposely separate values in order to reuse the H2645Packet struct. One keeps track of the allocated size of the NAL buffer, whereas the other keeps track of the amount of NALs used by the current packet. That's why the check immediately above this line makes sure the amount of NALs in the current packet fit in the current size of the NAL buffer, and grows/reallocates it otherwise. > void *tmp = av_realloc_array(pkt->nals, new_size, > sizeof(*pkt->nals)); > > if (!tmp) > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".