Refactor CodecInitializer to ensure that codec is initialized only once