webrtcendpoint: Protect object against race conditions

Change-Id: I3ab14a4989fe924f0273a754b4465263747cd1f3