[FFmpeg-devel] [PATCH 3/3] h264: Run VLC init under pthread_once

Hendrik Leppkes h.leppkes at gmail.com
Wed Oct 7 18:28:32 CEST 2015

On Wed, Oct 7, 2015 at 6:10 PM, Derek Buitenhuis
<derek.buitenhuis at gmail.com> wrote:
> On 10/7/2015 4:57 PM, wm4 wrote:
>> A static variable in a header file? This doesn't look right. You should
>> define it in h264.c instead.
> [17:03] <+wm4> Daemon404: what exactly is the point of declaring the init_once in the .h file?
> [17:03] <@Daemon404> i didnt know the right place to put it
> [17:03] <+wm4> h264.c
> [17:03] <@Daemon404> there's no obviously correct place
> [17:04]  * Daemon404 will send the libav patchset once rsync actually finishes and he can run fate
> [17:06] <+wm4> there needs to be exactly one instance of this variable, so it should be in h264.c, unless
>                h264.c is somehow used for freaky preprocessor template stuff (which I think it isn't)
> [17:07] <@Daemon404> and the function it uses isnt from h264.c, which is why i had put it in the .h
> [17:07] <@Daemon404> i have no strong opinion
> Currently moved to h264.c locally.

You could put it right above the pthread_once call, inside the
function even, as long as there is only one place its ever called.
But we should probably come to a more general consensus for functions
that may be called in more than one place, where the variable may even
need to be referenced in a header somewhere so  two files can
reference it - or you create a new wrapper that wraps the pthread_once
for those cases.

- Hendrik

More information about the ffmpeg-devel mailing list