recording: block on connect() before calling record()

The Kurento RecorderEndpoint.record() method expects that all elements
have been successfully connected. However if connect() is called non-
blocking, then it might happen that record() is called in parallel, when
the connections haven't been done yet.
pull/651/head
Juan Navarro 2021-09-08 11:26:19 +02:00
parent 3b3fcaa1f0
commit 1b01ffab81
1 changed files with 6 additions and 2 deletions

View File

@ -121,7 +121,11 @@ public class CompositeWrapper {
public void connectPublisherEndpoint(PublisherEndpoint endpoint) throws OpenViduException { public void connectPublisherEndpoint(PublisherEndpoint endpoint) throws OpenViduException {
HubPort hubPort = new HubPort.Builder(composite).build(); HubPort hubPort = new HubPort.Builder(composite).build();
endpoint.connect(hubPort, false);
// Block on this call: connections must have been already finished
// before calling `RecorderEndpoint.record()`.
endpoint.connect(hubPort, true);
String streamId = endpoint.getOwner().getPublisherStreamId(); String streamId = endpoint.getOwner().getPublisherStreamId();
this.hubPorts.put(streamId, hubPort); this.hubPorts.put(streamId, hubPort);
this.publisherEndpoints.put(streamId, endpoint); this.publisherEndpoints.put(streamId, endpoint);
@ -182,4 +186,4 @@ public class CompositeWrapper {
return this.endTime - this.startTime; return this.endTime - this.startTime;
} }
} }