Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/sanear.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/AudioDevicePush.cpp')
-rw-r--r--src/AudioDevicePush.cpp34
1 files changed, 1 insertions, 33 deletions
diff --git a/src/AudioDevicePush.cpp b/src/AudioDevicePush.cpp
index 8b75032..96ac526 100644
--- a/src/AudioDevicePush.cpp
+++ b/src/AudioDevicePush.cpp
@@ -3,17 +3,6 @@
namespace SaneAudioRenderer
{
- namespace
- {
- template <class T>
- bool IsLastInstance(T& smartPointer)
- {
- bool ret = (smartPointer.GetInterfacePtr()->AddRef() == 2);
- smartPointer.GetInterfacePtr()->Release();
- return ret;
- }
- }
-
AudioDevicePush::AudioDevicePush(std::shared_ptr<AudioDeviceBackend> backend)
: m_woken(TRUE/*manual reset*/)
{
@@ -39,28 +28,7 @@ namespace SaneAudioRenderer
if (m_thread.joinable())
m_thread.join();
- auto areLastInstances = [this]
- {
- if (!m_backend.unique())
- return false;
-
- if (m_backend->audioClock && !IsLastInstance(m_backend->audioClock))
- return false;
-
- m_backend->audioClock = nullptr;
-
- if (m_backend->audioRenderClient && !IsLastInstance(m_backend->audioRenderClient))
- return false;
-
- m_backend->audioRenderClient = nullptr;
-
- if (m_backend->audioClient && !IsLastInstance(m_backend->audioClient))
- return false;
-
- return true;
- };
- assert(areLastInstances());
-
+ assert(CheckLastInstances());
m_backend = nullptr;
}