[FFmpeg-devel] superfluous log messages

Don Moir donmoir at comcast.net
Sat May 12 22:17:59 CEST 2012


>>>> I have some files where it's called over a thousand times over a 
>>>> minutes
>>>> time and still not a big deal. The default behavior hides this for the 
>>>> most
>>>> part, but it still gets called with redundant messages and reduntant
>>>> processing. Also the default behavior is going nowhere in a GUI app so 
>>>> good
>>>> to be able to at least turn the processing for this off by calling
>>>> av_set_log_callback.
>>>
>>>
>>> FWIW, you can just call av_log_set_level(AV_LOG_QUIET); to suppress the
>>> messages, which is what we do in Chrome.
>>>
>>> - dale
>>
>> That stops it in av_log_default_callback after av_log does its thing and 
>> after it calls av_vlog.
>>
>> Still would like to see the NULL check in av_log so it doesn't have to 
>> compute the level etc and doesn't have to make any more function calls.
>>
>> As it stands the NULL check will short circuit in av_vlog so basically 
>> one less function call and one less test for level.
>
> void av_log(void* avcl, int level, const char *fmt, ...)
> {
>    if (av_log_callback) {
>        va_list vl;
>        va_start(vl, fmt);
>        if (avcl) {
>            AVClass* avc = *(AVClass **) avcl ;
>            if (avc->version  >= (50 << 16 | 15 << 8 | 2) &&
>              avc->log_level_offset_offset && level >= AV_LOG_FATAL)
>                  level += *(int *) (((uint8_t *) avcl) + 
> avc->log_level_offset_offset);
>        }
>        // prevent reduntant check for av_log_callback and call to av_vlog
>        av_log_callback(avcl, level, fmt, vl);
>        va_end(vl);
>    }
> }
>

Sorry about sending this, but I forgot to mention that the above modified 
av_log logic is technically more efficient then the current av_log even with 
the addtion of the check for av_log_callback. It removes the double check 
for a avcl/avc null value and removes an additional function call, so should 
not be any objection to putting this in.



More information about the ffmpeg-devel mailing list