webrtc的内存管理采用了内存技术计数,所有的class在创建销毁对象时,不使用new delete,全部使用引用计数与自定义的智能指针来处理。例如下面的类
DtlsTransportInterface
// A DTLS transport, as represented to the outside world.
// This object is created on the network thread, and can only be
// accessed on that thread, except for functions explicitly marked otherwise.
// References can be held by other threads, and destruction can therefore
// be initiated by other threads.
class DtlsTransportInterface : public rtc::RefCountInterface {
public:
// Returns a pointer to the ICE transport that is owned by the DTLS transport.
virtual rtc::scoped_refptr ice_transport() = 0;
// Returns information on the state of the DtlsTransport.
// This function can be called from other threads.
virtual DtlsTransportInformation Information() = 0;
// Observer management.
virtual void RegisterObserver(DtlsTransportObserverInterface* observer