ice/turn transport: make sure PJSIP is initialized before it's used

Using PJSIP functions without calling pj_init first can lead to subtle
non-deterministic bugs.

GitLab: #18
Change-Id: I9364fd247165c0ce19a8d0d42575fb66651b54a3
diff --git a/src/ice_transport.cpp b/src/ice_transport.cpp
index d9beef8..1edf00c 100644
--- a/src/ice_transport.cpp
+++ b/src/ice_transport.cpp
@@ -1799,7 +1799,12 @@
 //==============================================================================
 
 IceTransportFactory::IceTransportFactory(const std::shared_ptr<Logger>& logger)
-    : cp_(new pj_caching_pool(),
+    : pjInitLock_()
+    // Warning: pj_caching_pool_destroy will segfault if it's called before
+    // pj_caching_pool_init. Hence, any member which appears in the initializer
+    // list and whose constructor can fail (such as pjInitLock_) must be constructed
+    // before cp_ (which means it must be declared before cp_ in the class definition).
+    , cp_(new pj_caching_pool(),
           [](pj_caching_pool* p) {
               pj_caching_pool_destroy(p);
               delete p;