您当前的位置: 首页 > 

令狐掌门

暂无认证

  • 1浏览

    0关注

    513博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

WebRTC引用计数、智能指针的使用与代码分析

令狐掌门 发布时间:2022-01-29 13:15:31 ,浏览量:1

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
关注
打赏
1652240117
查看更多评论
立即登录/注册

微信扫码登录

0.0390s