diff --git a/webrtc/modules/video_capture/objc/device_info.mm b/webrtc/modules/video_capture/objc/device_info.mm index 876dbb2171..85733d143f 100644 --- a/webrtc/modules/video_capture/objc/device_info.mm +++ b/webrtc/modules/video_capture/objc/device_info.mm @@ -19,7 +19,7 @@ #include "webrtc/modules/video_capture/objc/device_info.h" #include "webrtc/modules/video_capture/objc/device_info_objc.h" #include "webrtc/modules/video_capture/video_capture_impl.h" -#include "webrtc/system_wrappers/include/trace.h" +#include "webrtc/rtc_base/logging.h" using namespace webrtc; using namespace videocapturemodule; @@ -30,8 +30,7 @@ static NSArray* camera_presets = @[ ]; #define IOS_UNSUPPORTED() \ - WEBRTC_TRACE(kTraceError, kTraceVideoCapture, 0, \ - "%s is not supported on the iOS platform.", __FUNCTION__); \ + LOG(LS_ERROR) << __FUNCTION__ << " is not supported on the iOS platform."; \ return -1; VideoCaptureModule::DeviceInfo* VideoCaptureImpl::CreateDeviceInfo() { diff --git a/webrtc/modules/video_capture/objc/rtc_video_capture_objc.mm b/webrtc/modules/video_capture/objc/rtc_video_capture_objc.mm index eab9f99814..0bd7a4addf 100644 --- a/webrtc/modules/video_capture/objc/rtc_video_capture_objc.mm +++ b/webrtc/modules/video_capture/objc/rtc_video_capture_objc.mm @@ -20,7 +20,7 @@ #import "webrtc/modules/video_capture/objc/device_info_objc.h" #import "webrtc/modules/video_capture/objc/rtc_video_capture_objc.h" -#include "webrtc/system_wrappers/include/trace.h" +#include "webrtc/rtc_base/logging.h" using namespace webrtc; using namespace webrtc::videocapturemodule; @@ -70,9 +70,8 @@ using namespace webrtc::videocapturemodule; if ([_captureSession canAddOutput:captureOutput]) { [_captureSession addOutput:captureOutput]; } else { - WEBRTC_TRACE(kTraceError, kTraceVideoCapture, 0, - "%s:%s:%d Could not add output to AVCaptureSession ", - __FILE__, __FUNCTION__, __LINE__); + LOG(LS_ERROR) << __FUNCTION__ + << ": Could not add output to AVCaptureSession"; } #ifdef WEBRTC_IOS @@ -243,9 +242,7 @@ using namespace webrtc::videocapturemodule; - (void)onVideoError:(NSNotification*)notification { NSLog(@"onVideoError: %@", notification); // TODO(sjlee): make the specific error handling with this notification. - WEBRTC_TRACE(kTraceError, kTraceVideoCapture, 0, - "%s:%s:%d [AVCaptureSession startRunning] error.", __FILE__, - __FUNCTION__, __LINE__); + LOG(LS_ERROR) << __FUNCTION__ << ": [AVCaptureSession startRunning] error."; } - (BOOL)stopCapture { @@ -307,9 +304,8 @@ using namespace webrtc::videocapturemodule; if (!newCaptureInput) { const char* errorMessage = [[deviceError localizedDescription] UTF8String]; - WEBRTC_TRACE(kTraceError, kTraceVideoCapture, 0, - "%s:%s:%d deviceInputWithDevice error:%s", __FILE__, - __FUNCTION__, __LINE__, errorMessage); + LOG(LS_ERROR) << __FUNCTION__ << ": deviceInputWithDevice error:" + << errorMessage; return NO; } diff --git a/webrtc/modules/video_capture/windows/device_info_ds.cc b/webrtc/modules/video_capture/windows/device_info_ds.cc index 745e4c9c07..22ff2fea51 100644 --- a/webrtc/modules/video_capture/windows/device_info_ds.cc +++ b/webrtc/modules/video_capture/windows/device_info_ds.cc @@ -10,9 +10,11 @@ #include "webrtc/modules/video_capture/windows/device_info_ds.h" +#include // std::hex + #include "webrtc/modules/video_capture/video_capture_config.h" #include "webrtc/modules/video_capture/windows/help_functions_ds.h" -#include "webrtc/system_wrappers/include/trace.h" +#include "webrtc/rtc_base/logging.h" #include #include @@ -69,11 +71,10 @@ DeviceInfoDS::DeviceInfoDS() // apartment (STA). We are then prevented from using STA. // Details: hr = 0x80010106 <=> "Cannot change thread mode after it is set". // - WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCapture, 0, - "VideoCaptureWindowsDSInfo::VideoCaptureWindowsDSInfo " - "CoInitializeEx(NULL, COINIT_APARTMENTTHREADED) => " - "RPC_E_CHANGED_MODE, error 0x%x", - hr); + LOG(LS_INFO) << __FUNCTION__ + << ": CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)" + << " => RPC_E_CHANGED_MODE, error 0x" << std::hex + << hr; } } } @@ -94,8 +95,8 @@ int32_t DeviceInfoDS::Init() IID_ICreateDevEnum, (void **) &_dsDevEnum); if (hr != NOERROR) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Failed to create CLSID_SystemDeviceEnum, error 0x%x", hr); + LOG(LS_INFO) << "Failed to create CLSID_SystemDeviceEnum, error 0x" + << std::hex << hr; return -1; } return 0; @@ -143,9 +144,8 @@ int32_t DeviceInfoDS::GetDeviceInfo( &_dsMonikerDevEnum, 0); if (hr != NOERROR) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Failed to enumerate CLSID_SystemDeviceEnum, error 0x%x." - " No webcam exist?", hr); + LOG(LS_INFO) << "Failed to enumerate CLSID_SystemDeviceEnum, error 0x" + << std::hex << hr << ". No webcam exist?"; return 0; } @@ -187,10 +187,9 @@ int32_t DeviceInfoDS::GetDeviceInfo( NULL); if (convResult == 0) { - WEBRTC_TRACE(webrtc::kTraceError, - webrtc::kTraceVideoCapture, 0, - "Failed to convert device name to UTF8. %d", - GetLastError()); + LOG(LS_INFO) + << "Failed to convert device name to UTF8, " + << "error = " << GetLastError(); return -1; } } @@ -202,9 +201,9 @@ int32_t DeviceInfoDS::GetDeviceInfo( strncpy_s((char *) deviceUniqueIdUTF8, deviceUniqueIdUTF8Length, (char *) deviceNameUTF8, convResult); - WEBRTC_TRACE(webrtc::kTraceError, - webrtc::kTraceVideoCapture, 0, - "Failed to get deviceUniqueIdUTF8 using deviceNameUTF8"); + LOG(LS_INFO) << "Failed to get " + << "deviceUniqueIdUTF8 using " + << "deviceNameUTF8"; } else { @@ -218,10 +217,9 @@ int32_t DeviceInfoDS::GetDeviceInfo( NULL, NULL); if (convResult == 0) { - WEBRTC_TRACE(webrtc::kTraceError, - webrtc::kTraceVideoCapture, 0, - "Failed to convert device name to UTF8. %d", - GetLastError()); + LOG(LS_INFO) << "Failed to convert device " + << "name to UTF8, error = " + << GetLastError(); return -1; } if (productUniqueIdUTF8 @@ -246,9 +244,7 @@ int32_t DeviceInfoDS::GetDeviceInfo( } if (deviceNameLength) { - WEBRTC_TRACE(webrtc::kTraceDebug, - webrtc::kTraceVideoCapture, 0, "%s %s", - __FUNCTION__, deviceNameUTF8); + LOG(LS_INFO) << __FUNCTION__ << " " << deviceNameUTF8; } return index; } @@ -263,8 +259,7 @@ IBaseFilter * DeviceInfoDS::GetDeviceFilter( (int32_t) strlen((char*) deviceUniqueIdUTF8); // UTF8 is also NULL terminated if (deviceUniqueIdUTF8Length > kVideoCaptureUniqueNameLength) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Device name too long"); + LOG(LS_INFO) << "Device name too long"; return NULL; } @@ -274,9 +269,8 @@ IBaseFilter * DeviceInfoDS::GetDeviceFilter( &_dsMonikerDevEnum, 0); if (hr != NOERROR) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Failed to enumerate CLSID_SystemDeviceEnum, error 0x%x." - " No webcam exist?", hr); + LOG(LS_INFO) << "Failed to enumerate CLSID_SystemDeviceEnum, error 0x" + << std::hex << hr << ". No webcam exist?"; return 0; } _dsMonikerDevEnum->Reset(); @@ -323,10 +317,8 @@ IBaseFilter * DeviceInfoDS::GetDeviceFilter( (void**) &captureFilter); if FAILED(hr) { - WEBRTC_TRACE( - webrtc::kTraceError, webrtc::kTraceVideoCapture, - 0, "Failed to bind to the selected capture " - "device %d",hr); + LOG(LS_ERROR) << "Failed to bind to the selected " + << "capture device " << hr; } if (productUniqueIdUTF8 @@ -374,12 +366,11 @@ int32_t DeviceInfoDS::CreateCapabilityMap( (int32_t) strlen((char*) deviceUniqueIdUTF8); if (deviceUniqueIdUTF8Length > kVideoCaptureUniqueNameLength) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Device name too long"); + LOG(LS_INFO) << "Device name too long"; return -1; } - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0, - "CreateCapabilityMap called for device %s", deviceUniqueIdUTF8); + LOG(LS_INFO) << "CreateCapabilityMap called for device " + << deviceUniqueIdUTF8; char productId[kVideoCaptureProductIdLength]; @@ -392,8 +383,7 @@ int32_t DeviceInfoDS::CreateCapabilityMap( IPin* outputCapturePin = GetOutputPin(captureDevice, GUID_NULL); if (!outputCapturePin) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Failed to get capture device output pin"); + LOG(LS_INFO) << "Failed to get capture device output pin"; RELEASE_AND_CLEAR(captureDevice); return -1; } @@ -402,8 +392,7 @@ int32_t DeviceInfoDS::CreateCapabilityMap( (void **) &extDevice); if (SUCCEEDED(hr) && extDevice) { - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0, - "This is an external device"); + LOG(LS_INFO) << "This is an external device"; extDevice->Release(); } @@ -412,8 +401,8 @@ int32_t DeviceInfoDS::CreateCapabilityMap( (void**) &streamConfig); if (FAILED(hr)) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Failed to get IID_IAMStreamConfig interface from capture device"); + LOG(LS_INFO) << "Failed to get IID_IAMStreamConfig interface " + <<"from capture device"; return -1; } @@ -423,8 +412,7 @@ int32_t DeviceInfoDS::CreateCapabilityMap( (void**) &videoControlConfig); if (FAILED(hrVC)) { - WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCapture, 0, - "IID_IAMVideoControl Interface NOT SUPPORTED"); + LOG(LS_INFO) << "IID_IAMVideoControl Interface NOT SUPPORTED"; } AM_MEDIA_TYPE *pmt = NULL; @@ -434,8 +422,7 @@ int32_t DeviceInfoDS::CreateCapabilityMap( hr = streamConfig->GetNumberOfCapabilities(&count, &size); if (FAILED(hr)) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Failed to GetNumberOfCapabilities"); + LOG(LS_INFO) << "Failed to GetNumberOfCapabilities"; RELEASE_AND_CLEAR(videoControlConfig); RELEASE_AND_CLEAR(streamConfig); RELEASE_AND_CLEAR(outputCapturePin); @@ -459,8 +446,7 @@ int32_t DeviceInfoDS::CreateCapabilityMap( if (pmt->majortype == MEDIATYPE_Video && pmt->formattype == FORMAT_VideoInfo2) { - WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCapture, 0, - " Device support FORMAT_VideoInfo2"); + LOG(LS_INFO) << "Device support FORMAT_VideoInfo2"; supportFORMAT_VideoInfo2 = true; VIDEOINFOHEADER2* h = reinterpret_cast (pmt->pbFormat); @@ -472,8 +458,7 @@ int32_t DeviceInfoDS::CreateCapabilityMap( if (pmt->majortype == MEDIATYPE_Video && pmt->formattype == FORMAT_VideoInfo) { - WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCapture, 0, - " Device support FORMAT_VideoInfo2"); + LOG(LS_INFO) << "Device support FORMAT_VideoInfo2"; supportFORMAT_VideoInfo = true; } } @@ -496,8 +481,7 @@ int32_t DeviceInfoDS::CreateCapabilityMap( reinterpret_cast (&caps)); if (FAILED(hr)) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Failed to GetStreamCaps"); + LOG(LS_INFO) << "Failed to GetStreamCaps"; RELEASE_AND_CLEAR(videoControlConfig); RELEASE_AND_CLEAR(streamConfig); RELEASE_AND_CLEAR(outputCapturePin); @@ -567,9 +551,7 @@ int32_t DeviceInfoDS::CreateCapabilityMap( } else // use existing method { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, - 0, - "GetMaxAvailableFrameRate NOT SUPPORTED"); + LOG(LS_INFO) << "GetMaxAvailableFrameRate NOT SUPPORTED"; if (avgTimePerFrame > 0) capability.maxFPS = static_cast (10000000 / avgTimePerFrame); @@ -624,29 +606,25 @@ int32_t DeviceInfoDS::CreateCapabilityMap( } else if (pmt->subtype == MEDIASUBTYPE_HDYC) // Seen used by Declink capture cards. Uses BT. 709 color. Not entiry correct to use UYVY. http://en.wikipedia.org/wiki/YCbCr { - WEBRTC_TRACE(webrtc::kTraceWarning, - webrtc::kTraceVideoCapture, 0, - "Device support HDYC."); + LOG(LS_INFO) << "Device support HDYC."; capability.videoType = VideoType::kUYVY; } else { WCHAR strGuid[39]; StringFromGUID2(pmt->subtype, strGuid, 39); - WEBRTC_TRACE( webrtc::kTraceWarning, - webrtc::kTraceVideoCapture, 0, - "Device support unknown media type %ls, width %d, height %d", - strGuid); + LOG(LS_WARNING) << "Device support unknown media type " + << strGuid << ", width " << capability.width + << ", height " << capability.height; continue; } _captureCapabilities.push_back(capability); _captureCapabilitiesWindows.push_back(capability); - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0, - "Camera capability, width:%d height:%d type:%d fps:%d", - capability.width, capability.height, - static_cast(capability.videoType), - capability.maxFPS); + LOG(LS_INFO) << "Camera capability, width:" << capability.width + << " height:" << capability.height << " type:" + << static_cast(capability.videoType) << " fps:" + << capability.maxFPS; } DeleteMediaType(pmt); pmt = NULL; @@ -662,8 +640,7 @@ int32_t DeviceInfoDS::CreateCapabilityMap( _lastUsedDeviceNameLength + 1); memcpy(_lastUsedDeviceName, deviceUniqueIdUTF8, _lastUsedDeviceNameLength+ 1); - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0, - "CreateCapabilityMap %d", _captureCapabilities.size()); + LOG(LS_INFO) << "CreateCapabilityMap " << _captureCapabilities.size(); return static_cast(_captureCapabilities.size()); } @@ -683,8 +660,7 @@ void DeviceInfoDS::GetProductId(const char* devicePath, if (!startPos) { strncpy_s((char*) productUniqueIdUTF8, productUniqueIdUTF8Length, "", 1); - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, -1, - "Failed to get the product Id"); + LOG(LS_INFO) << "Failed to get the product Id"; return; } startPos += 4; @@ -693,8 +669,7 @@ void DeviceInfoDS::GetProductId(const char* devicePath, if (!pos || pos >= (char*) devicePath + strlen((char*) devicePath)) { strncpy_s((char*) productUniqueIdUTF8, productUniqueIdUTF8Length, "", 1); - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, -1, - "Failed to get the product Id"); + LOG(LS_INFO) << "Failed to get the product Id"; return; } // Find the second occurrence. @@ -709,8 +684,7 @@ void DeviceInfoDS::GetProductId(const char* devicePath, else { strncpy_s((char*) productUniqueIdUTF8, productUniqueIdUTF8Length, "", 1); - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, -1, - "Failed to get the product Id"); + LOG(LS_INFO) << "Failed to get the product Id"; } } diff --git a/webrtc/modules/video_capture/windows/sink_filter_ds.cc b/webrtc/modules/video_capture/windows/sink_filter_ds.cc index 173b05f988..58e1bfc940 100644 --- a/webrtc/modules/video_capture/windows/sink_filter_ds.cc +++ b/webrtc/modules/video_capture/windows/sink_filter_ds.cc @@ -10,10 +10,12 @@ #include "webrtc/modules/video_capture/windows/sink_filter_ds.h" +#include // std::hex + #include "webrtc/modules/video_capture/windows/help_functions_ds.h" #include "webrtc/rtc_base/checks.h" +#include "webrtc/rtc_base/logging.h" #include "webrtc/rtc_base/platform_thread.h" -#include "webrtc/system_wrappers/include/trace.h" #include // VIDEOINFOHEADER2 #include @@ -65,8 +67,7 @@ CaptureInputPin::GetMediaType (IN int iPosition, OUT CMediaType * pmt) sizeof(VIDEOINFOHEADER)); if(NULL == pvi) { - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0, - "CheckMediaType VIDEOINFOHEADER is NULL. Returning...Line:%d\n", __LINE__); + LOG(LS_INFO) << "CheckMediaType VIDEOINFOHEADER is NULL. Returning."; return(E_OUTOFMEMORY); } @@ -148,10 +149,10 @@ CaptureInputPin::GetMediaType (IN int iPosition, OUT CMediaType * pmt) return VFW_S_NO_MORE_ITEMS; } pmt->SetSampleSize(pvi->bmiHeader.biSizeImage); - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0, - "GetMediaType position %d, width %d, height %d, biCompression 0x%x", - iPosition, _requestedCapability.width, - _requestedCapability.height,pvi->bmiHeader.biCompression); + LOG(LS_INFO) << "GetMediaType position " << iPosition << ", width " + << _requestedCapability.width << ", height " + << _requestedCapability.height << ", biCompression 0x" + << std::hex << pvi->bmiHeader.biCompression; return NOERROR; } @@ -197,10 +198,10 @@ CaptureInputPin::CheckMediaType ( IN const CMediaType * pMediaType) _resultingCapability.height = abs(pvi->bmiHeader.biHeight); } - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0, - "CheckMediaType width:%d height:%d Compression:0x%x\n", - pvi->bmiHeader.biWidth,pvi->bmiHeader.biHeight, - pvi->bmiHeader.biCompression); + LOG(LS_INFO) << "CheckMediaType width:" << pvi->bmiHeader.biWidth + << " height:" << pvi->bmiHeader.biHeight + << " Compression:0x" << std::hex + << pvi->bmiHeader.biCompression; if(*SubType == MEDIASUBTYPE_MJPG && pvi->bmiHeader.biCompression == MAKEFOURCC('M','J','P','G')) @@ -250,10 +251,10 @@ CaptureInputPin::CheckMediaType ( IN const CMediaType * pMediaType) return E_INVALIDARG; } - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0, - "CheckMediaType width:%d height:%d Compression:0x%x\n", - pvi->bmiHeader.biWidth,pvi->bmiHeader.biHeight, - pvi->bmiHeader.biCompression); + LOG(LS_INFO) << "CheckMediaType width:" << pvi->bmiHeader.biWidth + << " height:" << pvi->bmiHeader.biHeight + << " Compression:0x" << std::hex + << pvi->bmiHeader.biCompression; _resultingCapability.width = pvi->bmiHeader.biWidth; diff --git a/webrtc/modules/video_capture/windows/video_capture_ds.cc b/webrtc/modules/video_capture/windows/video_capture_ds.cc index 9bb928d546..46747ba157 100644 --- a/webrtc/modules/video_capture/windows/video_capture_ds.cc +++ b/webrtc/modules/video_capture/windows/video_capture_ds.cc @@ -13,7 +13,7 @@ #include "webrtc/modules/video_capture/video_capture_config.h" #include "webrtc/modules/video_capture/windows/help_functions_ds.h" #include "webrtc/modules/video_capture/windows/sink_filter_ds.h" -#include "webrtc/system_wrappers/include/trace.h" +#include "webrtc/rtc_base/logging.h" #include // VIDEOINFOHEADER2 @@ -76,8 +76,7 @@ int32_t VideoCaptureDS::Init(const char* deviceUniqueIdUTF8) _captureFilter = _dsInfo.GetDeviceFilter(deviceUniqueIdUTF8); if (!_captureFilter) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Failed to create capture filter."); + LOG(LS_INFO) << "Failed to create capture filter."; return -1; } @@ -87,8 +86,7 @@ int32_t VideoCaptureDS::Init(const char* deviceUniqueIdUTF8) (void **) &_graphBuilder); if (FAILED(hr)) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Failed to create graph builder."); + LOG(LS_INFO) << "Failed to create graph builder."; return -1; } @@ -96,15 +94,13 @@ int32_t VideoCaptureDS::Init(const char* deviceUniqueIdUTF8) (void **) &_mediaControl); if (FAILED(hr)) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Failed to create media control builder."); + LOG(LS_INFO) << "Failed to create media control builder."; return -1; } hr = _graphBuilder->AddFilter(_captureFilter, CAPTURE_FILTER_NAME); if (FAILED(hr)) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Failed to add the capture device to the graph."); + LOG(LS_INFO) << "Failed to add the capture device to the graph."; return -1; } @@ -115,8 +111,7 @@ int32_t VideoCaptureDS::Init(const char* deviceUniqueIdUTF8) *this); if (hr != S_OK) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Failed to create send filter"); + LOG(LS_INFO) << "Failed to create send filter"; return -1; } _sinkFilter->AddRef(); @@ -124,8 +119,7 @@ int32_t VideoCaptureDS::Init(const char* deviceUniqueIdUTF8) hr = _graphBuilder->AddFilter(_sinkFilter, SINK_FILTER_NAME); if (FAILED(hr)) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Failed to add the send filter to the graph."); + LOG(LS_INFO) << "Failed to add the send filter to the graph."; return -1; } _inputSendPin = GetInputPin(_sinkFilter); @@ -139,13 +133,13 @@ int32_t VideoCaptureDS::Init(const char* deviceUniqueIdUTF8) hr = _mediaControl->Pause(); if (FAILED(hr)) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Failed to Pause the Capture device. Is it already occupied? %d.", - hr); + LOG(LS_INFO) + << "Failed to Pause the Capture device. Is it already occupied? " + << hr; return -1; } - WEBRTC_TRACE(webrtc::kTraceStateInfo, webrtc::kTraceVideoCapture, 0, - "Capture device '%s' initialized.", deviceUniqueIdUTF8); + LOG(LS_INFO) << "Capture device '" << deviceUniqueIdUTF8 + << "' initialized."; return 0; } @@ -166,8 +160,7 @@ int32_t VideoCaptureDS::StartCapture( HRESULT hr = _mediaControl->Run(); if (FAILED(hr)) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Failed to start the Capture device."); + LOG(LS_INFO) << "Failed to start the Capture device."; return -1; } return 0; @@ -180,8 +173,7 @@ int32_t VideoCaptureDS::StopCapture() HRESULT hr = _mediaControl->Pause(); if (FAILED(hr)) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Failed to stop the capture graph. %d", hr); + LOG(LS_INFO) << "Failed to stop the capture graph. " << hr; return -1; } return 0; @@ -192,11 +184,9 @@ bool VideoCaptureDS::CaptureStarted() HRESULT hr = _mediaControl->GetState(1000, &state); if (hr != S_OK && hr != VFW_S_CANT_CUE) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Failed to get the CaptureStarted status"); + LOG(LS_INFO) << "Failed to get the CaptureStarted status"; } - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCapture, 0, - "CaptureStarted %d", state); + LOG(LS_INFO) << "CaptureStarted " << state; return state == State_Running; } @@ -249,8 +239,7 @@ int32_t VideoCaptureDS::SetCameraOutput( (void**) &streamConfig); if (hr) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Can't get the Capture format settings."); + LOG(LS_INFO) << "Can't get the Capture format settings."; return -1; } @@ -300,8 +289,7 @@ int32_t VideoCaptureDS::SetCameraOutput( if (FAILED(hr)) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Failed to set capture device output format"); + LOG(LS_INFO) << "Failed to set capture device output format"; return -1; } @@ -316,8 +304,7 @@ int32_t VideoCaptureDS::SetCameraOutput( } if (hr != S_OK) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Failed to connect the Capture graph %d", hr); + LOG(LS_INFO) << "Failed to connect the Capture graph " << hr; return -1; } return 0; @@ -337,9 +324,9 @@ int32_t VideoCaptureDS::DisconnectGraph() } if (hr != S_OK) { - WEBRTC_TRACE( webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Failed to Stop the Capture device for reconfiguration %d", - hr); + LOG(LS_ERROR) + << "Failed to Stop the Capture device for reconfiguration " + << hr; return -1; } return 0; @@ -354,38 +341,33 @@ HRESULT VideoCaptureDS::ConnectDVCamera() IID_IBaseFilter, (void **) &_dvFilter); if (hr != S_OK) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Failed to create the dv decoder: %x", hr); + LOG(LS_INFO) << "Failed to create the dv decoder: " << hr; return hr; } hr = _graphBuilder->AddFilter(_dvFilter, L"VideoDecoderDV"); if (hr != S_OK) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Failed to add the dv decoder to the graph: %x", hr); + LOG(LS_INFO) << "Failed to add the dv decoder to the graph: " << hr; return hr; } _inputDvPin = GetInputPin(_dvFilter); if (_inputDvPin == NULL) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Failed to get input pin from DV decoder"); + LOG(LS_INFO) << "Failed to get input pin from DV decoder"; return -1; } _outputDvPin = GetOutputPin(_dvFilter, GUID_NULL); if (_outputDvPin == NULL) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Failed to get output pin from DV decoder"); + LOG(LS_INFO) << "Failed to get output pin from DV decoder"; return -1; } } hr = _graphBuilder->ConnectDirect(_outputCapturePin, _inputDvPin, NULL); if (hr != S_OK) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Failed to connect capture device to the dv devoder: %x", - hr); + LOG(LS_INFO) << "Failed to connect capture device to the dv devoder: " + << hr; return hr; } @@ -394,14 +376,13 @@ HRESULT VideoCaptureDS::ConnectDVCamera() { if (hr == HRESULT_FROM_WIN32(ERROR_TOO_MANY_OPEN_FILES)) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Failed to connect the capture device, busy"); + LOG(LS_INFO) << "Failed to connect the capture device, busy"; } else { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, 0, - "Failed to connect capture device to the send graph: 0x%x", - hr); + LOG(LS_INFO) + << "Failed to connect capture device to the send graph: " + << hr; } return hr; }