Defer new shared subscribers during microphone buffer resizing
This commit is contained in:
1 parent
9aa4a1f9de
commit
785a42afcd
2 files changed
+9
-1
No files matched your search
@@ -123,6 +123,10 @@ bool AudioCapture::open(const QString& input, Role role, int channels, uint64_t
|
||||
}
|
||||
if (!m_session) { m_session = std::make_shared<Session>(key); sessions.push_back(m_session); }
|
||||
auto& session = *m_session;
|
||||
if (session.device.closing()) {
|
||||
DEBUG_WARN(DEBUG_CATEGORY_CALL, "capture: shared input is resizing its buffer; new subscription deferred");
|
||||
m_session.reset(); return false;
|
||||
}
|
||||
auto& slot = session.consumers[role == Role::Stream ? 0 : 1];
|
||||
if (slot.client) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_CALL, "capture: duplicate consumer role=%s", role == Role::Stream ? "stream" : "radio");
|
||||
|
||||
@@ -381,7 +381,11 @@ static void adaptive_buffers(SoundManager* manager) {
|
||||
REQUIRE(call->captureError().isEmpty() && radio->captureError().isEmpty() && radio->captureAvailable());
|
||||
pump(4500); slowCaptureClose = true;
|
||||
inject_capture_glitch(); pump(250); inject_capture_glitch(); pump(250);
|
||||
QElapsedTimer elapsed; elapsed.start(); call->stop(); radio->stop();
|
||||
QElapsedTimer elapsed; elapsed.start();
|
||||
AudioCapture incoming;
|
||||
REQUIRE(!incoming.open({}, AudioCapture::Role::Stream, 2, 75, [](int, int) { return true; }, [] {}, [](const auto&) {}));
|
||||
REQUIRE(!incoming.subscribed() && elapsed.elapsed() < 300);
|
||||
elapsed.restart(); call->stop(); radio->stop();
|
||||
REQUIRE(elapsed.elapsed() < 300); // Stop не ждёт выполняющееся закрытие для изменения буфера.
|
||||
pump(900); slowCaptureClose = false;
|
||||
REQUIRE(call->start(72) == 0 && radio->start(73) == 0); pump(100);
|
||||
|
||||
Reference in new issue
Block a user