Permalink
Browse files

Merge pull request #4416 from wsoltys/suspending

[WIN32] changed: don't call CAEFactory::DeviceChange() when PBT_APMSUSPEND was sent.
  • Loading branch information...
2 parents 47df04a + 00bc789 commit 41206e56dc369fd3456b0799e6dee3b809f8c2ea @jmarshallnz jmarshallnz committed Mar 14, 2014
Showing with 12 additions and 4 deletions.
  1. +1 −0 xbmc/powermanagement/windows/Win32PowerSyscall.h
  2. +11 −4 xbmc/win32/IMMNotificationClient.h
View
1 xbmc/powermanagement/windows/Win32PowerSyscall.h
@@ -45,6 +45,7 @@ class CWin32PowerSyscall : public IPowerSyscall
static void SetOnResume() { m_OnResume = true; }
static void SetOnSuspend() { m_OnSuspend = true; }
+ static bool IsSuspending() { return m_OnSuspend; }
private:
View
15 xbmc/win32/IMMNotificationClient.h
@@ -24,6 +24,7 @@
#include "system.h" // for SAFE_RELEASE
#include "utils/log.h"
#include "cores/AudioEngine/AEFactory.h"
+#include "powermanagement/windows/Win32PowerSyscall.h"
class CMMNotificationClient : public IMMNotificationClient
{
@@ -107,7 +108,7 @@ class CMMNotificationClient : public IMMNotificationClient
break;
case eCommunications:
pszRole = "eCommunications";
- CAEFactory::DeviceChange();
+ NotifyAE();
break;
}
@@ -118,14 +119,14 @@ class CMMNotificationClient : public IMMNotificationClient
HRESULT STDMETHODCALLTYPE OnDeviceAdded(LPCWSTR pwstrDeviceId)
{
CLog::Log(LOGDEBUG, "%s: Added device: %s", __FUNCTION__, pwstrDeviceId);
- CAEFactory::DeviceChange();
+ NotifyAE();
return S_OK;
}
HRESULT STDMETHODCALLTYPE OnDeviceRemoved(LPCWSTR pwstrDeviceId)
{
CLog::Log(LOGDEBUG, "%s: Removed device: %s", __FUNCTION__, pwstrDeviceId);
- CAEFactory::DeviceChange();
+ NotifyAE();
return S_OK;
}
@@ -149,7 +150,7 @@ class CMMNotificationClient : public IMMNotificationClient
break;
}
CLog::Log(LOGDEBUG, "%s: New device state is DEVICE_STATE_%s", __FUNCTION__, pszState);
- CAEFactory::DeviceChange();
+ NotifyAE();
return S_OK;
}
@@ -164,4 +165,10 @@ class CMMNotificationClient : public IMMNotificationClient
key.pid);
return S_OK;
}
+
+ void STDMETHODCALLTYPE NotifyAE()
+ {
+ if(!CWin32PowerSyscall::IsSuspending())
+ CAEFactory::DeviceChange();
+ }
};

0 comments on commit 41206e5

Please sign in to comment.