[FFmpeg-devel] superfluous log messages

Don Moir donmoir at comcast.net
Fri May 11 21:33:40 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);
    }
}




More information about the ffmpeg-devel mailing list