public class VadDumpUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private int |
count
Segment count
|
private java.lang.String |
filePath
File path for dump
|
private int |
frameCount
Frame count
|
private java.io.PrintWriter |
labelFile
Label file writer
|
private java.lang.String |
rootPath
Root path for dump
|
private int |
sessionCount
Session count
|
private java.io.FileOutputStream |
sourceFile
Source file output stream
|
private java.io.FileOutputStream |
vadFile
VAD file output stream
|
private java.io.PrintWriter |
vadInfoFile
VAD info file writer
|
private AgoraAudioVadV2 |
vadInstance
VAD instance for adaptive threshold info
|
private java.util.concurrent.ExecutorService |
writeFileExecutorService
Executor service for file writing
|
| Constructor and Description |
|---|
VadDumpUtils(java.lang.String path)
Constructs VadDumpUtils with path.
|
VadDumpUtils(java.lang.String path,
AgoraAudioVadV2 vadInstance)
Constructs VadDumpUtils with path and VAD instance.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
closeVadFile()
Closes the current VAD file and logs adaptive threshold info.
|
private void |
createVadFile()
Creates a new VAD file for the current session.
|
private void |
createVadInfoFile()
Creates the VAD info file.
|
private java.lang.String |
getStateName(Constants.VadState state)
Get state name for better readability
|
private boolean |
open()
Opens source and label files.
|
void |
release()
Releases all resources and closes all files.
|
void |
setVadInstance(AgoraAudioVadV2 vadInstance)
Set VAD instance for adaptive threshold info dumping.
|
void |
write(AudioFrame frame,
byte[] vadResultBytes,
Constants.VadState vadResultState)
Writes audio frame and VAD result to dump files.
|
private java.lang.String filePath
private java.lang.String rootPath
private int count
private int frameCount
private int sessionCount
private java.io.FileOutputStream sourceFile
private java.io.PrintWriter labelFile
private java.io.FileOutputStream vadFile
private java.io.PrintWriter vadInfoFile
private final java.util.concurrent.ExecutorService writeFileExecutorService
private AgoraAudioVadV2 vadInstance
public VadDumpUtils(java.lang.String path)
path - The dump pathpublic VadDumpUtils(java.lang.String path,
AgoraAudioVadV2 vadInstance)
path - The dump pathvadInstance - The VAD instance for adaptive threshold trackingpublic void setVadInstance(AgoraAudioVadV2 vadInstance)
vadInstance - the VAD instance to use for threshold trackingprivate void createVadInfoFile()
private void createVadFile()
private void closeVadFile()
private boolean open()
public void write(AudioFrame frame, byte[] vadResultBytes, Constants.VadState vadResultState)
frame - The audio framevadResultBytes - The VAD result bytesvadResultState - The VAD result stateprivate java.lang.String getStateName(Constants.VadState state)
state - the VAD statepublic void release()