mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
fix(toxcall): handle Null sink correctly
This was introduced in 82a4f1b412
This commit is contained in:
parent
3d2dbb63b2
commit
bf3921ce94
|
@ -133,14 +133,15 @@ ToxFriendCall::ToxFriendCall(uint32_t FriendNum, bool VideoEnabled, CoreAV& av,
|
||||||
this->av->sendCallAudio(this->friendId, pcm, samples, chans, rate);
|
this->av->sendCallAudio(this->friendId, pcm, samples, chans, rate);
|
||||||
});
|
});
|
||||||
|
|
||||||
audioSrcInvalid = QObject::connect(audioSource.get(), &IAudioSource::invalidated,
|
connect(audioSource.get(), &IAudioSource::invalidated, this, &ToxFriendCall::onAudioSourceInvalidated);
|
||||||
[this]() { this->onAudioSourceInvalidated(); });
|
|
||||||
|
|
||||||
if (!audioInConn) {
|
if (!audioInConn) {
|
||||||
qDebug() << "Audio input connection not working";
|
qDebug() << "Audio input connection not working";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sink) {
|
||||||
audioSinkInvalid = sink->connectTo_invalidated(this, [this]() { this->onAudioSinkInvalidated(); });
|
audioSinkInvalid = sink->connectTo_invalidated(this, [this]() { this->onAudioSinkInvalidated(); });
|
||||||
|
}
|
||||||
|
|
||||||
// register video
|
// register video
|
||||||
if (videoEnabled) {
|
if (videoEnabled) {
|
||||||
|
@ -176,15 +177,17 @@ void ToxFriendCall::onAudioSourceInvalidated()
|
||||||
});
|
});
|
||||||
audioSource = std::move(newSrc);
|
audioSource = std::move(newSrc);
|
||||||
|
|
||||||
audioSrcInvalid = QObject::connect(audioSource.get(), &IAudioSource::invalidated,
|
connect(audioSource.get(), &IAudioSource::invalidated, this, &ToxFriendCall::onAudioSourceInvalidated);
|
||||||
[this]() { this->onAudioSourceInvalidated(); });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToxFriendCall::onAudioSinkInvalidated()
|
void ToxFriendCall::onAudioSinkInvalidated()
|
||||||
{
|
{
|
||||||
auto newSink = audio.makeSink();
|
auto newSink = audio.makeSink();
|
||||||
|
|
||||||
|
if (newSink) {
|
||||||
audioSinkInvalid = newSink->connectTo_invalidated(this, [this]() { this->onAudioSinkInvalidated(); });
|
audioSinkInvalid = newSink->connectTo_invalidated(this, [this]() { this->onAudioSinkInvalidated(); });
|
||||||
|
}
|
||||||
|
|
||||||
sink = std::move(newSink);
|
sink = std::move(newSink);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +279,12 @@ void ToxGroupCall::removePeer(ToxPk peerId)
|
||||||
void ToxGroupCall::addPeer(ToxPk peerId)
|
void ToxGroupCall::addPeer(ToxPk peerId)
|
||||||
{
|
{
|
||||||
std::unique_ptr<IAudioSink> newSink = audio.makeSink();
|
std::unique_ptr<IAudioSink> newSink = audio.makeSink();
|
||||||
QMetaObject::Connection con = newSink->connectTo_invalidated(this, [this, peerId]() { this->onAudioSinkInvalidated(peerId); });
|
|
||||||
|
QMetaObject::Connection con;
|
||||||
|
|
||||||
|
if (newSink) {
|
||||||
|
con = newSink->connectTo_invalidated(this, [this, peerId]() { this->onAudioSinkInvalidated(peerId); });
|
||||||
|
}
|
||||||
|
|
||||||
peers.emplace(peerId, std::move(newSink));
|
peers.emplace(peerId, std::move(newSink));
|
||||||
sinkInvalid.insert({peerId, con});
|
sinkInvalid.insert({peerId, con});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user