前言
代码分析
h:\webrtc-20210315\webrtc-20210315\webrtc\webrtc-checkout\src\modules\video_capture\windows\video_capture_ds.cc
VideoCaptureDS::Init
int32_t VideoCaptureDS::Init(const char* deviceUniqueIdUTF8) {
****
// Create the sink filte used for receiving Captured frames.
sink_filter_ = new ComRefCount<CaptureSinkFilter>(this);
hr = _graphBuilder->AddFilter(sink_filter_, SINK_FILTER_NAME);
if (FAILED(hr)) {
RTC_LOG(LS_INFO) << "Failed to add the send filter to the graph.";
return -1;
}
***
***
}
—》 sinkfilter = new ComRefCount
CaptureSinkFilter::CaptureSinkFilter
CaptureSinkFilter::CaptureSinkFilter(VideoCaptureImpl* capture_observer)
: input_pin_(new ComRefCount<CaptureInputPin>(this)),
capture_observer_(capture_observer) {}
CaptureSinkFilter获取数据后,就可以调用captureobserver的函数传递了。
—》
CaptureInputPin::CaptureInputPin(CaptureSinkFilter* filter) {
capture_checker_.Detach();
// No reference held to avoid circular references.
info_.pFilter = filter;
info_.dir = PINDIR_INPUT;
}