mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-10-24 07:28:29 -04:00
[EGD-5086] Fix voice not starting when calling
Due to a race condition between source and sink voice is not always starting when calling. Introduce audio stream connections to avoid race condition and improve handling of audio start and stop operations. Signed-off-by: Marcin Smoczyński <smoczynski.marcin@gmail.com>
This commit is contained in:
1 parent
7dee85f011
commit
40bf381eca
32 files changed
+647
-477
No files matched your search
@@ -121,10 +121,11 @@ namespace audio
|
||||
memcpy(pcm, &workerBuffer[0], samplecount * 2 * sizeof(int16_t));
|
||||
}
|
||||
|
||||
void Decoder::startDecodingWorker(Stream &audioStream, DecoderWorker::EndOfFileCallback endOfFileCallback)
|
||||
void Decoder::startDecodingWorker(DecoderWorker::EndOfFileCallback endOfFileCallback)
|
||||
{
|
||||
assert(_stream != nullptr);
|
||||
if (!audioWorker) {
|
||||
audioWorker = std::make_unique<DecoderWorker>(audioStream, this, endOfFileCallback);
|
||||
audioWorker = std::make_unique<DecoderWorker>(_stream, this, endOfFileCallback);
|
||||
audioWorker->init();
|
||||
audioWorker->run();
|
||||
}
|
||||
@@ -141,4 +142,19 @@ namespace audio
|
||||
audioWorker = nullptr;
|
||||
}
|
||||
|
||||
void Decoder::onDataReceive()
|
||||
{
|
||||
audioWorker->enablePlayback();
|
||||
}
|
||||
|
||||
void Decoder::enableInput()
|
||||
{
|
||||
audioWorker->enablePlayback();
|
||||
}
|
||||
|
||||
void Decoder::disableInput()
|
||||
{
|
||||
audioWorker->disablePlayback();
|
||||
}
|
||||
|
||||
} // namespace audio
|
||||
Reference in new issue
Block a user