| Index: webrtc/modules/video_capture/windows/sink_filter_ds.cc
|
| diff --git a/webrtc/modules/video_capture/windows/sink_filter_ds.cc b/webrtc/modules/video_capture/windows/sink_filter_ds.cc
|
| index 22171d78767c81b533462493e4821fcd152caef8..4b34e1dc857ae3525c122b3dd14d1f5ca7d401ac 100644
|
| --- a/webrtc/modules/video_capture/windows/sink_filter_ds.cc
|
| +++ b/webrtc/modules/video_capture/windows/sink_filter_ds.cc
|
| @@ -18,7 +18,11 @@
|
| #include <Dvdmedia.h> // VIDEOINFOHEADER2
|
| #include <initguid.h>
|
|
|
| -#define DELETE_RESET(p) { delete (p) ; (p) = NULL ;}
|
| +#define DELETE_RESET(p) \
|
| + { \
|
| + delete (p); \
|
| + (p) = nullptr; \
|
| + }
|
|
|
| DEFINE_GUID(CLSID_SINKFILTER, 0x88cdbbdc, 0xa73b, 0x4afa, 0xac, 0xbf, 0x15, 0xd5,
|
| 0xe2, 0xce, 0x12, 0xc3);
|
| @@ -45,7 +49,7 @@ CaptureInputPin::CaptureInputPin (IN TCHAR * szName,
|
| _requestedCapability(),
|
| _resultingCapability()
|
| {
|
| - _threadHandle = NULL;
|
| + _threadHandle = nullptr;
|
| }
|
|
|
| CaptureInputPin::~CaptureInputPin()
|
| @@ -56,18 +60,19 @@ HRESULT
|
| CaptureInputPin::GetMediaType (IN int iPosition, OUT CMediaType * pmt)
|
| {
|
| // reset the thread handle
|
| - _threadHandle = NULL;
|
| + _threadHandle = nullptr;
|
|
|
| if(iPosition < 0)
|
| return E_INVALIDARG;
|
|
|
| VIDEOINFOHEADER* pvi = (VIDEOINFOHEADER*) pmt->AllocFormatBuffer(
|
| sizeof(VIDEOINFOHEADER));
|
| - if(NULL == pvi)
|
| - {
|
| - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0,
|
| - "CheckMediaType VIDEOINFOHEADER is NULL. Returning...Line:%d\n", __LINE__);
|
| - return(E_OUTOFMEMORY);
|
| + if (nullptr == pvi) {
|
| + WEBRTC_TRACE(
|
| + webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0,
|
| + "CheckMediaType VIDEOINFOHEADER is null. Returning...Line:%d\n",
|
| + __LINE__);
|
| + return (E_OUTOFMEMORY);
|
| }
|
|
|
| ZeroMemory(pvi, sizeof(VIDEOINFOHEADER));
|
| @@ -164,7 +169,7 @@ HRESULT
|
| CaptureInputPin::CheckMediaType ( IN const CMediaType * pMediaType)
|
| {
|
| // reset the thread handle
|
| - _threadHandle = NULL;
|
| + _threadHandle = nullptr;
|
|
|
| const GUID *type = pMediaType->Type();
|
| if (*type != MEDIATYPE_Video)
|
| @@ -174,17 +179,15 @@ CaptureInputPin::CheckMediaType ( IN const CMediaType * pMediaType)
|
|
|
| // Check for the subtypes we support
|
| const GUID *SubType = pMediaType->Subtype();
|
| - if (SubType == NULL)
|
| - {
|
| - return E_INVALIDARG;
|
| + if (SubType == nullptr) {
|
| + return E_INVALIDARG;
|
| }
|
|
|
| if(*formatType == FORMAT_VideoInfo)
|
| {
|
| VIDEOINFOHEADER *pvi = (VIDEOINFOHEADER *) pMediaType->Format();
|
| - if(pvi == NULL)
|
| - {
|
| - return E_INVALIDARG;
|
| + if (pvi == nullptr) {
|
| + return E_INVALIDARG;
|
| }
|
|
|
| // Store the incoming width and height
|
| @@ -250,9 +253,8 @@ CaptureInputPin::CheckMediaType ( IN const CMediaType * pMediaType)
|
| // VIDEOINFOHEADER2 that has dwInterlaceFlags
|
| VIDEOINFOHEADER2 *pvi = (VIDEOINFOHEADER2 *) pMediaType->Format();
|
|
|
| - if(pvi == NULL)
|
| - {
|
| - return E_INVALIDARG;
|
| + if (pvi == nullptr) {
|
| + return E_INVALIDARG;
|
| }
|
|
|
| WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0,
|
| @@ -323,13 +325,12 @@ CaptureInputPin::Receive ( IN IMediaSample * pIMediaSample )
|
| RTC_DCHECK(pIMediaSample);
|
|
|
| // get the thread handle of the delivering thread inc its priority
|
| - if( _threadHandle == NULL)
|
| - {
|
| - HANDLE handle= GetCurrentThread();
|
| - SetThreadPriority(handle, THREAD_PRIORITY_HIGHEST);
|
| - _threadHandle = handle;
|
| + if (_threadHandle == nullptr) {
|
| + HANDLE handle = GetCurrentThread();
|
| + SetThreadPriority(handle, THREAD_PRIORITY_HIGHEST);
|
| + _threadHandle = handle;
|
|
|
| - rtc::SetCurrentThreadName("webrtc_video_capture");
|
| + rtc::SetCurrentThreadName("webrtc_video_capture");
|
| }
|
|
|
| reinterpret_cast <CaptureSinkFilter *>(m_pFilter)->LockReceive();
|
| @@ -340,7 +341,7 @@ CaptureInputPin::Receive ( IN IMediaSample * pIMediaSample )
|
| const LONG length = pIMediaSample->GetActualDataLength();
|
| RTC_DCHECK(length >= 0);
|
|
|
| - unsigned char* pBuffer = NULL;
|
| + unsigned char* pBuffer = nullptr;
|
| if(S_OK != pIMediaSample->GetPointer(&pBuffer))
|
| {
|
| reinterpret_cast <CaptureSinkFilter *>(m_pFilter)->UnlockReceive();
|
| @@ -369,26 +370,22 @@ HRESULT CaptureInputPin::SetMatchingMediaType(
|
| return S_OK;
|
| }
|
| // ----------------------------------------------------------------------------
|
| -CaptureSinkFilter::CaptureSinkFilter (IN TCHAR * tszName,
|
| - IN LPUNKNOWN punk,
|
| - OUT HRESULT * phr,
|
| - VideoCaptureExternal& captureObserver)
|
| - : CBaseFilter(tszName,punk,& m_crtFilter,CLSID_SINKFILTER),
|
| - m_pInput(NULL),
|
| - _captureObserver(captureObserver)
|
| -{
|
| - (* phr) = S_OK;
|
| - m_pInput = new CaptureInputPin(NAME ("VideoCaptureInputPin"),
|
| - this,
|
| - & m_crtFilter,
|
| - phr, L"VideoCapture");
|
| - if (m_pInput == NULL || FAILED (* phr))
|
| - {
|
| - (* phr) = FAILED (* phr) ? (* phr) : E_OUTOFMEMORY;
|
| - goto cleanup;
|
| - }
|
| - cleanup :
|
| - return;
|
| +CaptureSinkFilter::CaptureSinkFilter(IN TCHAR* tszName,
|
| + IN LPUNKNOWN punk,
|
| + OUT HRESULT* phr,
|
| + VideoCaptureExternal& captureObserver)
|
| + : CBaseFilter(tszName, punk, &m_crtFilter, CLSID_SINKFILTER),
|
| + m_pInput(nullptr),
|
| + _captureObserver(captureObserver) {
|
| + (*phr) = S_OK;
|
| + m_pInput = new CaptureInputPin(NAME("VideoCaptureInputPin"), this,
|
| + &m_crtFilter, phr, L"VideoCapture");
|
| + if (m_pInput == nullptr || FAILED(*phr)) {
|
| + (*phr) = FAILED(*phr) ? (*phr) : E_OUTOFMEMORY;
|
| + goto cleanup;
|
| + }
|
| +cleanup:
|
| + return;
|
| }
|
|
|
| CaptureSinkFilter::~CaptureSinkFilter()
|
| @@ -412,7 +409,7 @@ CaptureSinkFilter::GetPin(IN int Index)
|
| }
|
| else
|
| {
|
| - pPin = NULL;
|
| + pPin = nullptr;
|
| }
|
| UnlockFilter ();
|
| return pPin;
|
|
|