熟悉Proxy.h

2019-08-15  本文已影响0人  大飞_2048

由使用聊起

    rtc::scoped_refptr<webrtc::ObjCVideoTrackSource> objCVideoTrackSource(
         new rtc::RefCountedObject<webrtc::ObjCVideoTrackSource>());
       VideoTrackSourceProxy::Create( signalingThread, workerThread, objCVideoTrackSource)];

Proxy.h实现粘贴如下:

image.png
#define BEGIN_PROXY_MAP(c)                                                    \
  PROXY_MAP_BOILERPLATE(c)                                                    \
  WORKER_PROXY_MAP_BOILERPLATE(c)                                             \
  REFCOUNTED_PROXY_MAP_BOILERPLATE(c)                                         \
 public:                                                                      \
  static rtc::scoped_refptr<c##ProxyWithInternal> Create(                     \
      rtc::Thread* signaling_thread, rtc::Thread* worker_thread,              \
      INTERNAL_CLASS* c) {                                                    \
    return new rtc::RefCountedObject<c##ProxyWithInternal>(signaling_thread,  \
                                                           worker_thread, c); \
  }

参数: Create () 静态函数
INTERNAL_CLASS 类型 = VideoTrackSourceInterface
c##ProxyWithInternal = VideoTrackSourceProxyWithInternal

由PROXY_MAP_BOILERPLATE 展开可以得到: image.png
上一篇下一篇

猜你喜欢

热点阅读