webrtcendpoint: check caps != NULL before use them

This fix that the tests fails sometimes

Change-Id: I527d4d7acc930327f98f211aa1fa47d084839aae