Repository navigation
Expand file tree
/
Copy pathVocoderTask.h
More file actions
52 lines (37 loc) · 1.73 KB
/
Copy pathVocoderTask.h
File metadata and controls
52 lines (37 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef DSINFER_INFERENCEINTERPRETERS_VOCODER_VOCODERTASK_H
#define DSINFER_INFERENCEINTERPRETERS_VOCODER_VOCODERTASK_H
#include <memory>
#include <shared_mutex>
#include <dsinfer/Api/Inferences/Vocoder/1/VocoderApiL1.h>
namespace ds {
class InferenceDriver;
class InferenceSession;
class VocoderInference;
/// Executes one vocoder inference model behind its typed executive.
class VocoderTask : public srt::ITask {
public:
using ITask::start;
using ITask::startAsync;
explicit VocoderTask(VocoderInference &inference);
~VocoderTask();
srt::Expected<void> initialize(const srt::TaskInitArgs &args) override;
srt::Expected<void> initialize(const Api::Vocoder::L1::InitArgs &args);
srt::Expected<std::unique_ptr<Api::Vocoder::L1::Result>>
start(const Api::Vocoder::L1::StartInput &input);
srt::Expected<void> startAsync(std::shared_ptr<const Api::Vocoder::L1::StartInput> input,
Api::Vocoder::L1::Executive::AsyncCallback callback);
protected:
srt::Expected<std::unique_ptr<srt::TaskResult>>
execute(const srt::TaskStartInput &input, const srt::TaskStopToken &token) override;
srt::Expected<void> quit() override;
srt::Expected<void> wait() override;
State classifyOutcome(const srt::Expected<std::unique_ptr<srt::TaskResult>> &outcome,
bool stopRequested) noexcept override;
private:
VocoderInference *m_inference;
InferenceDriver *m_driver = nullptr;
std::unique_ptr<InferenceSession> m_session;
mutable std::shared_mutex m_mutex;
};
}
#endif // DSINFER_INFERENCEINTERPRETERS_VOCODER_VOCODERTASK_H