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

Add a way to toggle the SilenceFilter for each TranscriptionService i… #498

Merged
merged 2 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,13 @@ public AudioMixerMediaDevice getMediaDevice(ReceiveStreamBufferListener listener

return this.mediaDevice;
}

/**
* Returns true if the SilenceFilter should be disabled for this
* TranscriptionService.
*/
public boolean disableSilenceFilter()
{
return false;
}
}
6 changes: 4 additions & 2 deletions src/main/java/org/jitsi/jigasi/transcription/Transcriber.java
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ private enum State
* Whether silenced audio should be filtered out before sending audio to
* a {@link TranscriptionService}.
*/
private boolean filterSilence = shouldFilterSilence();
private boolean filterSilence;

/**
* Create a transcription object which can be used to add and remove
Expand All @@ -218,6 +218,7 @@ public Transcriber(String roomName,
}
this.transcriptionService = service;
addTranscriptionListener(this.transcript);
this.filterSilence = shouldFilterSilence();

configureTranslationManager();
if (isTranslationEnabled())
Expand Down Expand Up @@ -958,6 +959,7 @@ private boolean isTranslationEnabled()
private boolean shouldFilterSilence()
{
return JigasiBundleActivator.getConfigurationService()
.getBoolean(P_NAME_FILTER_SILENCE, FILTER_SILENCE_DEFAULT_VALUE);
.getBoolean(P_NAME_FILTER_SILENCE, FILTER_SILENCE_DEFAULT_VALUE)
&& !this.transcriptionService.disableSilenceFilter();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
*/
package org.jitsi.jigasi.transcription;

import org.eclipse.jetty.websocket.api.*;
import org.jitsi.impl.neomedia.device.*;
import org.jitsi.utils.logging.*;

Expand Down Expand Up @@ -52,6 +51,12 @@ public AudioMixerMediaDevice getMediaDevice(ReceiveStreamBufferListener listener
return this.mediaDevice;
}

@Override
public boolean disableSilenceFilter()
{
return true;
}

/**
* No configuration required yet
*/
Expand Down
Loading