openvidu-server: change getStats strategy

pull/431/head
pabloFuente 2020-04-06 17:33:50 +02:00
parent ce90918274
commit daec96f465
3 changed files with 5 additions and 11 deletions

View File

@ -402,9 +402,7 @@ public class KurentoParticipant extends Participant {
} }
publisher.unregisterErrorListeners(); publisher.unregisterErrorListeners();
if (publisher.kmsWebrtcStatsThread != null) { publisher.cancelStatsLoop.set(true);
publisher.kmsWebrtcStatsThread.cancel(true);
}
for (MediaElement el : publisher.getMediaElements()) { for (MediaElement el : publisher.getMediaElements()) {
releaseElement(getParticipantPublicId(), el); releaseElement(getParticipantPublicId(), el);
@ -427,9 +425,7 @@ public class KurentoParticipant extends Participant {
if (subscriber != null) { if (subscriber != null) {
subscriber.unregisterErrorListeners(); subscriber.unregisterErrorListeners();
if (subscriber.kmsWebrtcStatsThread != null) { subscriber.cancelStatsLoop.set(true);
subscriber.kmsWebrtcStatsThread.cancel(true);
}
releaseElement(senderName, subscriber.getEndpoint()); releaseElement(senderName, subscriber.getEndpoint());

View File

@ -972,9 +972,7 @@ public class KurentoSessionManager extends SessionManager {
final PassThrough passThru = publisher.disconnectFromPassThrough(); final PassThrough passThru = publisher.disconnectFromPassThrough();
// 2) Destroy the broken PublisherEndpoint and nothing else // 2) Destroy the broken PublisherEndpoint and nothing else
if (publisher.kmsWebrtcStatsThread != null) { publisher.cancelStatsLoop.set(true);
publisher.kmsWebrtcStatsThread.cancel(true);
}
kParticipant.releaseElement(participant.getParticipantPublicId(), publisher.getEndpoint()); kParticipant.releaseElement(participant.getParticipantPublicId(), publisher.getEndpoint());
// 3) Create a new PublisherEndpoint connecting it to the previous PassThrough // 3) Create a new PublisherEndpoint connecting it to the previous PassThrough

View File

@ -22,7 +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 java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import org.kurento.client.BaseRtpEndpoint; import org.kurento.client.BaseRtpEndpoint;
@ -94,9 +94,9 @@ public abstract class MediaEndpoint {
public String selectedRemoteIceCandidate; public String selectedRemoteIceCandidate;
public Queue<KmsEvent> kmsEvents = new ConcurrentLinkedQueue<>(); public Queue<KmsEvent> kmsEvents = new ConcurrentLinkedQueue<>();
public Future<?> kmsWebrtcStatsThread;
public Runnable kmsWebrtcStatsRunnable; public Runnable kmsWebrtcStatsRunnable;
public AtomicInteger statsNotFoundErrors = new AtomicInteger(0); public AtomicInteger statsNotFoundErrors = new AtomicInteger(0);
public AtomicBoolean cancelStatsLoop = new AtomicBoolean(false);
/** /**
* 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.