mirror of https://github.com/OpenVidu/openvidu.git
openvidu-test-e2e: atomic get subscriber video codec function
parent
045474ee63
commit
52655a6ad9
|
|
@ -4358,14 +4358,16 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
||||||
|
|
||||||
private String getSubscriberVideoCodec(OpenViduTestappUser user, WebElement subscriberVideo) {
|
private String getSubscriberVideoCodec(OpenViduTestappUser user, WebElement subscriberVideo) {
|
||||||
waitUntilVideoLayersNotEmpty(user, subscriberVideo);
|
waitUntilVideoLayersNotEmpty(user, subscriberVideo);
|
||||||
// The "codec" field is derived from a separate "codec" stats report matched by
|
final java.util.concurrent.atomic.AtomicReference<String> codec = new java.util.concurrent.atomic.AtomicReference<>();
|
||||||
// codecId. In Firefox it may appear a few stat cycles after frames already
|
this.waitUntilAux(user, subscriberVideo, () -> {
|
||||||
// flow, so wait for it to exist instead of reading it early to avoid a NPE.
|
JsonElement codecElement = getLayersAsJsonArray(user, subscriberVideo).get(0).getAsJsonObject().get("codec");
|
||||||
this.waitUntilAux(user, subscriberVideo,
|
if (codecElement != null && !codecElement.isJsonNull()) {
|
||||||
() -> getLayersAsJsonArray(user, subscriberVideo).get(0).getAsJsonObject().get("codec") != null,
|
codec.set(codecElement.getAsString());
|
||||||
"Timeout waiting for codec to exist");
|
return true;
|
||||||
JsonArray json = this.getLayersAsJsonArray(user, subscriberVideo);
|
}
|
||||||
return json.get(0).getAsJsonObject().get("codec").getAsString();
|
return false;
|
||||||
|
}, "Timeout waiting for codec to exist");
|
||||||
|
return codec.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If rid is null, retrieve the first layer
|
// If rid is null, retrieve the first layer
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue