mirror of
https://github.com/modelscope/FunASR
synced 2025-09-15 14:48:36 +08:00
add clearqueue for audio
This commit is contained in:
parent
9256fc69e6
commit
3d4398a362
@ -58,6 +58,7 @@ class Audio {
|
||||
Audio(int model_sample_rate,int data_type);
|
||||
Audio(int model_sample_rate,int data_type, int size);
|
||||
~Audio();
|
||||
void ClearQueue(std::queue<AudioFrame*>& q);
|
||||
void Disp();
|
||||
void WavResample(int32_t sampling_rate, const float *waveform, int32_t n);
|
||||
bool LoadWav(const char* buf, int n_len, int32_t* sampling_rate);
|
||||
|
||||
@ -228,6 +228,17 @@ Audio::~Audio()
|
||||
if (speech_char != NULL) {
|
||||
free(speech_char);
|
||||
}
|
||||
ClearQueue(frame_queue);
|
||||
ClearQueue(asr_online_queue);
|
||||
ClearQueue(asr_offline_queue);
|
||||
}
|
||||
|
||||
void Audio::ClearQueue(std::queue<AudioFrame*>& q) {
|
||||
while (!q.empty()) {
|
||||
AudioFrame* frame = q.front();
|
||||
delete frame;
|
||||
q.pop();
|
||||
}
|
||||
}
|
||||
|
||||
void Audio::Disp()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user