[FFmpeg-devel] [PATCH 3/3] random_seed: Replace a VLA with a heap alloc

Derek Buitenhuis derek.buitenhuis at gmail.com
Sat Sep 8 14:11:58 CEST 2012


On 07/09/2012 9:19 PM, Michael Niedermayer wrote:
>> Wouldn't this be duplicating av_sha_size? I'm not against it, but
>> in general, I am wary of duplicated numbers like this.
> 
> in some sense it would, yes
> but the assert would tell us if it needs to be changed and changes
> are going to be rare

OK, new patch forthcoming.

>> BTW, why is av_sha_size not a constant/define anyway?
> 
> Because changes to the SHA implementation may need a bigger struct and
> the struct is allocated by the user -> it cant be a constant/define
> we want a user app to work with a new SHA with new algo and possibly
> larger struct without needing to recompile the user app.
> the code above is not affected by this problem because it resides
> in the same lib as the sha code so it can use a constant safely
> 
> The alternative design to this would have needed dynamic allocation
> inside the avsha code, which would have restricted the placement
> of the context and increased code complexity and dependancies. Either
> is a compromise.
> Also ive some XTEA optimizations in a branch that need a bigger context
> (for xtea not sha) so the core problem is quite real ...

OK. What Reimar said makes more sense now, too.

- Derek


More information about the ffmpeg-devel mailing list