Make codec multithread-safe again