Exclude retiring capture sessions from new subscriptions
This commit is contained in:
1 parent
9629e9311c
commit
543c9decba
1 file changed
+3
-2
@@ -16,7 +16,7 @@ struct AudioCapture::Session {
|
||||
AudioDevice device;
|
||||
QString key;
|
||||
std::array<Slot, 2> consumers;
|
||||
bool streamProfile = false;
|
||||
bool streamProfile = false, retiring = false;
|
||||
int requestedChannels = 1, channels = 1;
|
||||
uint64_t tag = 0;
|
||||
QElapsedTimer clock;
|
||||
@@ -108,7 +108,7 @@ bool AudioCapture::open(const QString& input, Role role, int channels, uint64_t
|
||||
for (auto it = sessions.begin(); it != sessions.end();) {
|
||||
auto session = it->lock();
|
||||
if (!session) { it = sessions.erase(it); continue; }
|
||||
if (session->key == key) m_session = session;
|
||||
if (!session->retiring && session->key == key) m_session = session;
|
||||
++it;
|
||||
}
|
||||
if (!m_session) { m_session = std::make_shared<Session>(key); sessions.push_back(m_session); }
|
||||
@@ -151,6 +151,7 @@ void AudioCapture::closeAsync() {
|
||||
if (m_closeThread.joinable()) m_closeThread.join();
|
||||
auto session = detach();
|
||||
if (!session) return;
|
||||
if (session.use_count() == 1) session->retiring = true;
|
||||
m_closeDone.store(false, std::memory_order_release);
|
||||
DEBUG_INFO(DEBUG_CATEGORY_CALL, "capture: asynchronous close started shared=%d", session.use_count() > 1);
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user