Fix races in default av_log handler