Compare commits
2 commits
master
...
work/fix-s
Author | SHA1 | Date | |
---|---|---|---|
|
d618bac26c | ||
|
4510762af5 |
1 changed files with 14 additions and 7 deletions
|
@ -227,6 +227,15 @@ SystemvolumePlugin::SystemvolumePlugin(QObject *parent, const QVariantList &args
|
||||||
SystemvolumePlugin::~SystemvolumePlugin()
|
SystemvolumePlugin::~SystemvolumePlugin()
|
||||||
{
|
{
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
QSet<IAudioEndpointVolume*> endpoints;
|
||||||
|
for (auto &entry : sinkList.toStdMap()) {
|
||||||
|
endpoint->UnRegisterControlChangeNotify(entry.second);
|
||||||
|
endpoint->Release();
|
||||||
|
endpoints.insert(entry.first);
|
||||||
|
}
|
||||||
|
for (IAudioEndpointVolume* endpoint : endpoints) {
|
||||||
|
endpoint->Release();
|
||||||
|
}
|
||||||
deviceEnumerator->UnregisterEndpointNotificationCallback(deviceCallback);
|
deviceEnumerator->UnregisterEndpointNotificationCallback(deviceCallback);
|
||||||
deviceEnumerator->Release();
|
deviceEnumerator->Release();
|
||||||
deviceEnumerator = nullptr;
|
deviceEnumerator = nullptr;
|
||||||
|
@ -404,14 +413,12 @@ bool SystemvolumePlugin::receivePacket(const NetworkPacket &np)
|
||||||
} else {
|
} else {
|
||||||
QString name = np.get<QString>(QStringLiteral("name"));
|
QString name = np.get<QString>(QStringLiteral("name"));
|
||||||
|
|
||||||
if (sinkList.contains(name)) {
|
auto sinkListIterator = this->sinkList.find(name);
|
||||||
// unregister ControlChangeNotify before doing any changes to a sink
|
if (sinkListIterator != this->sinkList.end()) {
|
||||||
HRESULT unregisterSuccess = E_POINTER;
|
|
||||||
auto sinkListIterator = this->sinkList.find(name);
|
|
||||||
auto &sink = sinkListIterator.value();
|
auto &sink = sinkListIterator.value();
|
||||||
if (!(sinkListIterator == this->sinkList.end())) {
|
|
||||||
unregisterSuccess = sink.first->UnregisterControlChangeNotify(sink.second);
|
// unregister ControlChangeNotify before doing any changes to a sink
|
||||||
}
|
HRESULT unregisterSuccess = sink.first->UnregisterControlChangeNotify(sink.second);
|
||||||
|
|
||||||
if (np.has(QStringLiteral("volume"))) {
|
if (np.has(QStringLiteral("volume"))) {
|
||||||
float currentVolume;
|
float currentVolume;
|
||||||
|
|
Loading…
Reference in a new issue