Skip to content

Commit

Permalink
[VCM] more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyoyuppe committed Apr 12, 2021
1 parent 501ae98 commit b067a91
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ void VideoConferenceModule::onGeneralSettingsChanged()
}
catch (...)
{
//Logger::error("Couldn't get enabled state");
LOG("Couldn't get enabled state");
}
if (enabled)
{
Expand Down Expand Up @@ -262,7 +262,7 @@ void VideoConferenceModule::onModuleSettingsChanged()
}
catch (...)
{
// Improper JSON. TODO: handle the error.
LOG("onModuleSettingsChanged encountered an exception");
}
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="DirectShowUtils.h" />
<ClInclude Include="Logging.h" />
<ClInclude Include="VideoCaptureDevice.h" />
<ClInclude Include="VideoCaptureProxyFilter.h" />
</ItemGroup>
Expand Down
4 changes: 3 additions & 1 deletion src/modules/videoconference/VideoConferenceShared/Logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ std::string toMediaTypeString(GUID subtype);
LogToFile(std::string(functionNameTMPVAR + " enter"), true); \
auto verboseLogOnScopeEnd = wil::scope_exit([&] { \
LogToFile(std::string(functionNameTMPVAR + " exit"), true); \
});
});

#define LOG(str) LogToFile(str, false);
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "MicrophoneDevice.h"

#include "Logging.h"

#include <Functiondiscoverykeys_devpkey.h>

MicrophoneDevice::MicrophoneDevice(wil::com_ptr_nothrow<IMMDevice> device, wil::com_ptr_nothrow<IAudioEndpointVolume> endpoint) :
Expand All @@ -18,6 +20,10 @@ MicrophoneDevice::MicrophoneDevice(wil::com_ptr_nothrow<IMMDevice> device, wil::
{
props->GetValue(PKEY_Device_FriendlyName, &_friendly_name);
}
else
{
LOG("MicrophoneDevice::MicrophoneDevice couldn't open property store");
}
}

MicrophoneDevice::~MicrophoneDevice()
Expand Down Expand Up @@ -75,18 +81,21 @@ std::optional<MicrophoneDevice> MicrophoneDevice::getDefault()
auto deviceEnumerator = wil::CoCreateInstanceNoThrow<MMDeviceEnumerator, IMMDeviceEnumerator>();
if (!deviceEnumerator)
{
LOG("MicrophoneDevice::getDefault MMDeviceEnumerator returned null");
return std::nullopt;
}
wil::com_ptr_nothrow<IMMDevice> captureDevice;
deviceEnumerator->GetDefaultAudioEndpoint(eCapture, eCommunications, &captureDevice);
if (!captureDevice)
{
LOG("MicrophoneDevice::getDefault captureDevice is null");
return std::nullopt;
}
wil::com_ptr_nothrow<IAudioEndpointVolume> microphoneEndpoint;
captureDevice->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_INPROC_SERVER, nullptr, reinterpret_cast<LPVOID*>(&microphoneEndpoint));
if (!microphoneEndpoint)
{
LOG("MicrophoneDevice::getDefault captureDevice is null");
return std::nullopt;
}
return std::make_optional<MicrophoneDevice>(std::move(captureDevice), std::move(microphoneEndpoint));
Expand All @@ -98,13 +107,15 @@ std::vector<MicrophoneDevice> MicrophoneDevice::getAllActive()
auto deviceEnumerator = wil::CoCreateInstanceNoThrow<MMDeviceEnumerator, IMMDeviceEnumerator>();
if (!deviceEnumerator)
{
LOG("MicrophoneDevice::getAllActive MMDeviceEnumerator returned null");
return microphoneDevices;
}

wil::com_ptr_nothrow<IMMDeviceCollection> captureDevices;
deviceEnumerator->EnumAudioEndpoints(eCapture, DEVICE_STATE_ACTIVE, &captureDevices);
if (!captureDevices)
{
LOG("MicrophoneDevice::getAllActive EnumAudioEndpoints returned null");
return microphoneDevices;
}
UINT nDevices = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "VideoCaptureDeviceList.h"
#include "Logging.h"
#include <mfapi.h>
#include <Mfidl.h>

Expand Down Expand Up @@ -44,15 +45,24 @@ HRESULT VideoCaptureDeviceList::EnumerateDevices()
MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE,
MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_GUID);
}

else
{
LOG("VideoCaptureDeviceList::EnumerateDevices(): Couldn't MFCreateAttributes");
}
// Enumerate devices.
if (SUCCEEDED(hr))
{
hr = MFEnumDeviceSources(pAttributes.get(), &m_ppDevices, &m_numberDevices);
}
else
{
LOG("VideoCaptureDeviceList::EnumerateDevices(): Couldn't SetGUID");
}


if (FAILED(hr))
{
LOG("VideoCaptureDeviceList::EnumerateDevices(): MFEnumDeviceSources failed");
return hr;
}

Expand Down

0 comments on commit b067a91

Please sign in to comment.