call dispose on pub and track
This commit is contained in:
@@ -157,7 +157,10 @@ class LocalParticipant extends Participant {
|
||||
Future<void> unpublishTrack(String trackSid, {bool notify = true}) async {
|
||||
logger.finer('Unpublish track sid: $trackSid, notify: $notify');
|
||||
final pub = trackPublications.remove(trackSid);
|
||||
if (pub is! LocalTrackPublication) return;
|
||||
if (pub is! LocalTrackPublication) {
|
||||
await pub?.dispose();
|
||||
return;
|
||||
}
|
||||
|
||||
final track = pub.track;
|
||||
if (track != null) {
|
||||
@@ -185,6 +188,8 @@ class LocalParticipant extends Participant {
|
||||
publication: pub,
|
||||
));
|
||||
}
|
||||
|
||||
await pub.dispose();
|
||||
}
|
||||
|
||||
/// Publish a new data payload to the room.
|
||||
|
||||
@@ -158,7 +158,14 @@ class RemoteParticipant extends Participant {
|
||||
Future<void> unpublishTrack(String trackSid, {bool notify = true}) async {
|
||||
logger.finer('Unpublish track sid: $trackSid, notify: $notify');
|
||||
final pub = trackPublications.remove(trackSid);
|
||||
if (pub is! RemoteTrackPublication) return;
|
||||
|
||||
if (pub is! RemoteTrackPublication) {
|
||||
// no publication exists for trackSid
|
||||
// or publication is not RemoteTrackPublication
|
||||
// logger.warning('pub is not RemoteTrackPublication');
|
||||
await pub?.dispose();
|
||||
return;
|
||||
}
|
||||
|
||||
final track = pub.track;
|
||||
// if has track
|
||||
@@ -177,5 +184,7 @@ class RemoteParticipant extends Participant {
|
||||
publication: pub,
|
||||
));
|
||||
}
|
||||
|
||||
await pub.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user