openvidu-server: cancel KMS webrtc stats gathering for MediaEndpoint

pull/255/head
pabloFuente 2019-03-07 13:14:32 +01:00
parent 87e39e8a01
commit 77a5349487
2 changed files with 11 additions and 0 deletions

View File

@ -376,6 +376,10 @@ public class KurentoParticipant extends Participant {
} }
publisher.unregisterErrorListeners(); publisher.unregisterErrorListeners();
if (publisher.kmsWebrtcStatsThread != null) {
publisher.kmsWebrtcStatsThread.cancel(true);
}
for (MediaElement el : publisher.getMediaElements()) { for (MediaElement el : publisher.getMediaElements()) {
releaseElement(getParticipantPublicId(), el); releaseElement(getParticipantPublicId(), el);
} }
@ -393,7 +397,12 @@ public class KurentoParticipant extends Participant {
private void releaseSubscriberEndpoint(String senderName, SubscriberEndpoint subscriber, String reason) { private void releaseSubscriberEndpoint(String senderName, SubscriberEndpoint subscriber, String reason) {
if (subscriber != null) { if (subscriber != null) {
subscriber.unregisterErrorListeners(); subscriber.unregisterErrorListeners();
if (subscriber.kmsWebrtcStatsThread != null) {
subscriber.kmsWebrtcStatsThread.cancel(true);
}
releaseElement(senderName, subscriber.getEndpoint()); releaseElement(senderName, subscriber.getEndpoint());
if (!ProtocolElements.RECORDER_PARTICIPANT_PUBLICID.equals(this.getParticipantPublicId())) { if (!ProtocolElements.RECORDER_PARTICIPANT_PUBLICID.equals(this.getParticipantPublicId())) {

View File

@ -22,6 +22,7 @@ import java.util.List;
import java.util.Queue; import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Future;
import org.kurento.client.Continuation; import org.kurento.client.Continuation;
import org.kurento.client.ErrorEvent; import org.kurento.client.ErrorEvent;
@ -87,6 +88,7 @@ public abstract class MediaEndpoint {
public String selectedLocalIceCandidate; public String selectedLocalIceCandidate;
public String selectedRemoteIceCandidate; public String selectedRemoteIceCandidate;
public Queue<KmsEvent> kmsEvents = new ConcurrentLinkedQueue<>(); public Queue<KmsEvent> kmsEvents = new ConcurrentLinkedQueue<>();
public Future<?> kmsWebrtcStatsThread;
/** /**
* Constructor to set the owner, the endpoint's name and the media pipeline. * Constructor to set the owner, the endpoint's name and the media pipeline.