| 1830 | } |
| 1831 | |
| 1832 | void Talker::vocoderWorkerLoop() { |
| 1833 | BackendConfig backendConfig; |
| 1834 | auto forwardType = backend_type_convert(mConfig->backend_type(true)); |
| 1835 | int numThread = mConfig->thread_num(true); |
| 1836 | auto executor = Express::Executor::newExecutor(forwardType, backendConfig, numThread); |
| 1837 | Express::ExecutorScope scope(executor); |
| 1838 | mBigvgan_async.reset(Module::clone(mBigvgan.get())); |
| 1839 | |
| 1840 | while (true) { |
| 1841 | WavChunk chunk; |
| 1842 | { |
| 1843 | std::unique_lock<std::mutex> lock(mMelQueueMutex); |
| 1844 | mMelQueueCond.wait(lock, [this] { |
| 1845 | return !mMelQueue.empty() || !mWavWorkerRunning; |
| 1846 | }); |
| 1847 | if (!mWavWorkerRunning && mMelQueue.empty()) { |
| 1848 | break; |
| 1849 | } |
| 1850 | if (mMelQueue.empty()) { |
| 1851 | continue; |
| 1852 | } |
| 1853 | chunk = std::move(mMelQueue.front()); |
| 1854 | mMelQueue.pop(); |
| 1855 | } |
| 1856 | |
| 1857 | processWavChunk(chunk); |
| 1858 | |
| 1859 | if (chunk.is_last) { |
| 1860 | mWavLastDone.store(true); |
| 1861 | mWavQueueCond.notify_all(); |
| 1862 | } |
| 1863 | } |
| 1864 | |
| 1865 | mBigvgan_async.reset(); |
| 1866 | } |
| 1867 | |
| 1868 | VARP Talker::ditForwardAsync(const int codec_size, const int* codec_tokens, const float* initial_noise) { |
| 1869 | auto code = _Const(codec_tokens, {1, codec_size}, NCHW, halide_type_of<int>()); |
nothing calls this directly
no test coverage detected