public class VoiceVerifyStreamOpus extends VoiceSdkNativePeer
This class serves as gateway to native Voice SDK implementation and allocates resources on native heap.
To release the allocated memory, AutoCloseable.close()
method should be invoked when the instance is no longer needed.
Any method that delegates to native call may throw VoiceSdkEngineException
nativeId
Constructor and Description |
---|
VoiceVerifyStreamOpus(VoiceTemplateFactory voiceTemplateFactory,
VoiceTemplateMatcher voiceTemplateMatcher,
VoiceTemplate voiceTemplate,
int sampleRate) |
VoiceVerifyStreamOpus(VoiceTemplateFactory voiceTemplateFactory,
VoiceTemplateMatcher voiceTemplateMatcher,
VoiceTemplate voiceTemplate,
int sampleRate,
int audioContextLengthSeconds)
Sole constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addPacket(byte[] bytes)
Adds Opus packet for processing.
|
void |
finalizeStream()
Finalizes input audio stream to process remaining audio
samples and produce result if it's possible
|
VerifyStreamResult |
getVerifyResult()
Retrieves one verify results from stream queue.
|
java.util.List<VerifyStreamResult> |
getVerifyResults()
Fetches accumulated list of verify results, removing them from stream queue.
|
boolean |
hasVerifyResults()
Checks if any verify results are present in stream queue
|
protected static long |
init(VoiceTemplateFactory voiceTemplateFactory,
VoiceTemplateMatcher voiceTemplateMatcher,
VoiceTemplate voiceTemplate,
int sampleRate,
int audioContextLengthSeconds) |
protected void |
release()
This method should release resources on native layer (indirectly using nativeId)
|
void |
reset()
Resets internal stream state
|
close, equals, finalize, hashCode
public VoiceVerifyStreamOpus(VoiceTemplateFactory voiceTemplateFactory, VoiceTemplateMatcher voiceTemplateMatcher, VoiceTemplate voiceTemplate, int sampleRate, int audioContextLengthSeconds)
VoiceTemplateFactory.getMinimumAudioSampleRate()
.
Voice template matcher, voice template factory and voice template should have the same init data ID.voiceTemplateFactory
- Voice template factory instancevoiceTemplateMatcher
- Voice template matcher instancevoiceTemplate
- Reference voice template to match withsampleRate
- Input audio stream sampling frequency in Hz.
Must be one of 16000, 24000 or 48000.audioContextLengthSeconds
- Length of audio context for voice verification in seconds,
must be at least 3 seconds, default is 10VoiceSdkEngineException
- wraps native exceptionspublic VoiceVerifyStreamOpus(VoiceTemplateFactory voiceTemplateFactory, VoiceTemplateMatcher voiceTemplateMatcher, VoiceTemplate voiceTemplate, int sampleRate)
public void addPacket(byte[] bytes)
bytes
- Array containing single Opus packet. It is expected that packet contains data for single mono stream.VoiceSdkEngineException
- wraps native exceptionspublic void reset()
VoiceSdkEngineException
- wraps native exceptionspublic void finalizeStream()
VoiceSdkEngineException
- wraps native exceptionspublic boolean hasVerifyResults()
VoiceSdkEngineException
- wraps native exceptionspublic VerifyStreamResult getVerifyResult()
VoiceSdkEngineException
- wraps native exceptionspublic java.util.List<VerifyStreamResult> getVerifyResults()
VoiceSdkEngineException
- wraps native exceptionsprotected static long init(VoiceTemplateFactory voiceTemplateFactory, VoiceTemplateMatcher voiceTemplateMatcher, VoiceTemplate voiceTemplate, int sampleRate, int audioContextLengthSeconds)
protected void release()
VoiceSdkNativePeer
release
in class VoiceSdkNativePeer