Skip to content

Commit 85aab6f

Browse files
authored
[BTAudio] Use COM Dangling instead of Revoked (#935)
1 parent 65ccebd commit 85aab6f

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

BluetoothAudio/BluetoothAudio.h

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,24 @@ namespace Plugin {
3636

3737
class ComNotificationSink : public PluginHost::IShell::ICOMLink::INotification {
3838
public:
39-
ComNotificationSink() = delete;
4039
ComNotificationSink(const ComNotificationSink&) = delete;
4140
ComNotificationSink& operator=(const ComNotificationSink&) = delete;
41+
ComNotificationSink(ComNotificationSink&&) = delete;
42+
ComNotificationSink& operator=(ComNotificationSink&&) = delete;
43+
44+
ComNotificationSink() = delete;
45+
4246
ComNotificationSink(BluetoothAudio& parent)
4347
: _parent(parent)
4448
{
4549
}
50+
4651
~ComNotificationSink() = default;
4752

4853
public:
4954
void Dangling(const Core::IUnknown* remote, const uint32_t interfaceId) override
5055
{
51-
Revoked(remote, interfaceId);
52-
}
53-
void Revoked(const Core::IUnknown* remote, const uint32_t interfaceId) override
54-
{
55-
ASSERT(remote != nullptr);
56-
57-
_parent.Revoked(remote, interfaceId);
56+
_parent.Dangling(remote, interfaceId);
5857
}
5958

6059
public:
@@ -101,14 +100,16 @@ namespace Plugin {
101100
}
102101

103102
private:
104-
void Revoked(const Core::IUnknown* remote, const uint32_t interfaceId)
103+
void Dangling(const Core::IUnknown* remote, const uint32_t interfaceId)
105104
{
105+
ASSERT(remote != nullptr);
106+
106107
if (_sink != nullptr) {
107-
_sink->Revoked(remote, interfaceId);
108+
_sink->OnDangling(remote, interfaceId);
108109
}
109110

110111
if (_source != nullptr) {
111-
_source->Revoked(remote, interfaceId);
112+
_source->OnDangling(remote, interfaceId);
112113
}
113114
}
114115

BluetoothAudio/BluetoothAudioSink.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1900,13 +1900,15 @@ namespace Plugin {
19001900
}
19011901

19021902
public:
1903-
void Revoked(const Core::IUnknown* remote, const uint32_t interfaceId VARIABLE_IS_NOT_USED)
1903+
void OnDangling(const Core::IUnknown* remote, const uint32_t interfaceId VARIABLE_IS_NOT_USED)
19041904
{
19051905
// The COM-RPC link has been disconnected abruptly, clean up!
19061906

19071907
if (remote == _callback) {
19081908
TRACE(SinkFlow, (_T("Bluetooth audio sink remote client died; cleaning up the playback session on behalf of the dead")));
19091909

1910+
ASSERT(interfaceId == Exchange::IBluetoothAudio::ISink::ICallback::ID);
1911+
19101912
Callback(nullptr);
19111913
Source(nullptr);
19121914

BluetoothAudio/BluetoothAudioSource.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1195,11 +1195,13 @@ namespace Plugin {
11951195
}
11961196

11971197
public:
1198-
void Revoked(const Core::IUnknown* remote, const uint32_t interfaceId VARIABLE_IS_NOT_USED)
1198+
void OnDangling(const Core::IUnknown* remote, const uint32_t interfaceId VARIABLE_IS_NOT_USED)
11991199
{
12001200
if (remote == _callback) {
12011201
TRACE(Trace::Information, (_T("Remote client died; cleaning up callbaks on behalf of the dead")));
12021202

1203+
ASSERT(interfaceId == Exchange::IBluetoothAudio::ISource::ICallback::ID);
1204+
12031205
Callback(nullptr);
12041206

12051207
_cleanupJob.Submit([this]() {

0 commit comments

Comments
 (0)