Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transcribing backend flag #519

Merged
merged 5 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 2 additions & 36 deletions src/main/java/org/jitsi/jigasi/AudioModeration.java
Original file line number Diff line number Diff line change
Expand Up @@ -468,43 +468,9 @@ public void mute()
/**
* The xmpp provider for JvbConference has registered after connecting.
*/
public void xmppProviderRegistered()
void setAvModerationAddress(String address)
{
// we are here in the RegisterThread, and it is safe to query and wait
// Uses disco info to discover the AV moderation address.
// we need to query the domain part extracted from room jid
if (this.callContext.getRoomJidDomain() != null)
{
try
{
long startQuery = System.currentTimeMillis();

// in case when running unittests
if (this.jvbConference.getConnection() == null)
{
return;
}

DiscoverInfo info = ServiceDiscoveryManager.getInstanceFor(this.jvbConference.getConnection())
.discoverInfo(JidCreate.domainBareFrom(this.callContext.getRoomJidDomain()));

DiscoverInfo.Identity avIdentity =
info.getIdentities().stream().
filter(di -> di.getCategory().equals("component") && di.getType().equals("av_moderation"))
.findFirst().orElse(null);

if (avIdentity != null)
{
this.avModerationAddress = avIdentity.getName();
logger.info(String.format("%s Discovered %s for %oms.",
this.callContext, this.avModerationAddress, System.currentTimeMillis() - startQuery));
}
}
catch(Exception e)
{
logger.error("Error querying for av moderation address", e);
}
}
this.avModerationAddress = address;

if (this.avModerationAddress != null)
{
Expand Down
53 changes: 46 additions & 7 deletions src/main/java/org/jitsi/jigasi/JvbConference.java
Original file line number Diff line number Diff line change
Expand Up @@ -660,14 +660,9 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt)

private synchronized void registrationStateChangedInternal(RegistrationStateChangeEvent evt)
{
if (started
&& mucRoom == null
&& evt.getNewState() == RegistrationState.REGISTERED)
if (started && mucRoom == null && evt.getNewState() == RegistrationState.REGISTERED)
{
if (this.getAudioModeration() != null)
{
this.getAudioModeration().xmppProviderRegistered();
}
discoverComponentAddresses();

// Join the MUC
joinConferenceRoom();
Expand Down Expand Up @@ -729,6 +724,50 @@ else if (evt.getNewState() == RegistrationState.CONNECTION_FAILED)
}
}

/**
* Disco info the addresses, the query is cached and will be returned from cache
* once we retrieve it.
*/
private void discoverComponentAddresses()
{
// we are here in the RegisterThread, and it is safe to query and wait
// Uses disco info to discover the AV moderation address.
// we need to query the domain part extracted from room jid
if (this.callContext.getRoomJidDomain() != null)
{
try
{
long startQuery = System.currentTimeMillis();

// in case when running unittests
if (this.getConnection() == null)
{
return;
}

DiscoverInfo info = ServiceDiscoveryManager.getInstanceFor(this.getConnection())
.discoverInfo(JidCreate.domainBareFrom(this.callContext.getRoomJidDomain()));

DiscoverInfo.Identity avIdentity = info.getIdentities().stream().
filter(di -> di.getCategory().equals("component") && di.getType().equals("av_moderation"))
.findFirst().orElse(null);

if (avIdentity != null && this.getAudioModeration() != null)
{
String avModerationAddress = avIdentity.getName();
this.getAudioModeration().setAvModerationAddress(avModerationAddress);
bgrozev marked this conversation as resolved.
Show resolved Hide resolved

logger.info(String.format("%s Discovered %s for %oms.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really care about this message only for avModarationAddress? I suggest either remove it or move it out of the "if" to be printed right after the discoverInfo call

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove that and move the print after, I just kept it when moving the stuff.

this.callContext, avModerationAddress, System.currentTimeMillis() - startQuery));
}
}
catch(Exception e)
{
logger.error("Error querying for av moderation address", e);
}
}
}

/**
* Returns <tt>true</tt> if we are currently in JVB conference room.
* @return <tt>true</tt> if we are currently in JVB conference room.
Expand Down