Keep normal capture lifecycle synchronous after healthy input
This commit is contained in:
1 parent
fef4d9c9a0
commit
43e7829ec0
2 files changed
+9
-5
No files matched your search
@@ -129,7 +129,8 @@ void CallAudioEngine::setPlaybackDevice(const QString& id) {
|
||||
void CallAudioEngine::setCaptureDevice(const QString& id) {
|
||||
if (id == m_captureId) return;
|
||||
m_captureId = id;
|
||||
m_capture.closeAsync(); m_voice.stopCapture(); m_capture.retryNow();
|
||||
if (!m_capture.closing()) m_capture.close();
|
||||
m_voice.stopCapture(); m_capture.retryNow();
|
||||
m_captureError.clear(); emit captureErrorChanged();
|
||||
if (m_active) { call_audio_reset_io(m_callId.load(), 0); recoverDevices(); }
|
||||
}
|
||||
@@ -137,7 +138,8 @@ void CallAudioEngine::setCaptureDevice(const QString& id) {
|
||||
void CallAudioEngine::beginEnd(quint64 callId) {
|
||||
if (!m_active || m_callId != callId || m_ending) return;
|
||||
m_ending = true;
|
||||
m_capture.closeAsync(); m_voice.stopCapture();
|
||||
if (!m_capture.closing()) m_capture.close();
|
||||
m_voice.stopCapture();
|
||||
call_audio_begin_end(callId);
|
||||
uint64_t generation = m_generation;
|
||||
QTimer::singleShot(500, this, [this, generation]() { if (m_generation == generation) stop(); });
|
||||
@@ -146,7 +148,8 @@ void CallAudioEngine::beginEnd(quint64 callId) {
|
||||
void CallAudioEngine::stop() {
|
||||
++m_generation;
|
||||
m_active = false;
|
||||
m_capture.closeAsync(); m_voice.stopCapture();
|
||||
if (!m_capture.closing()) m_capture.close();
|
||||
m_voice.stopCapture();
|
||||
SoundManager::instance()->detachVoice(&m_voice); m_outputAttached = false;
|
||||
m_voice.stop();
|
||||
if (m_capture.closing()) m_recoveryTimer.start();
|
||||
|
||||
@@ -48,7 +48,8 @@ RadioAudioEngine::RadioAudioEngine() {
|
||||
auto* manager = SoundManager::instance();
|
||||
if (m_captureId != manager->captureDevice()) {
|
||||
m_captureId = manager->captureDevice();
|
||||
m_capture.closeAsync(); m_captureError.clear();
|
||||
if (!m_capture.closing()) m_capture.close();
|
||||
m_captureError.clear();
|
||||
emit stateChanged();
|
||||
}
|
||||
if (m_playbackId != manager->playbackDevice()) {
|
||||
@@ -290,7 +291,7 @@ void RadioAudioEngine::pauseDevices() {
|
||||
|
||||
void RadioAudioEngine::stop() {
|
||||
m_recoveryTimer.stop();
|
||||
m_capture.closeAsync();
|
||||
if (!m_capture.closing()) m_capture.close();
|
||||
SoundManager::instance()->detachVoice(&m_voice); m_outputAttached = false;
|
||||
m_voice.stop();
|
||||
m_microphone.release();
|
||||
|
||||
Reference in new issue
Block a user