forked from Green-Sky/tomato
fix messed up sink cleanup
This commit is contained in:
parent
ee8604b234
commit
050af74ef2
@ -290,20 +290,26 @@ void ToxAVVoIPModel::destroySession(ObjectHandle session) {
|
|||||||
_video_sources.erase(it_vsrc);
|
_video_sources.erase(it_vsrc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (session.all_of<ToxAVCallAudioSink*>()) {
|
if (session.all_of<Components::ToxAVAudioSink>()) {
|
||||||
|
auto asink = session.get<Components::ToxAVAudioSink>().o;
|
||||||
|
if (asink.all_of<ToxAVCallAudioSink*>()) {
|
||||||
std::lock_guard lg{_audio_sinks_mutex};
|
std::lock_guard lg{_audio_sinks_mutex};
|
||||||
auto it = std::find(_audio_sinks.cbegin(), _audio_sinks.cend(), session.get<ToxAVCallAudioSink*>());
|
auto it = std::find(_audio_sinks.cbegin(), _audio_sinks.cend(), asink.get<ToxAVCallAudioSink*>());
|
||||||
if (it != _audio_sinks.cend()) {
|
if (it != _audio_sinks.cend()) {
|
||||||
_audio_sinks.erase(it);
|
_audio_sinks.erase(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (session.all_of<ToxAVCallVideoSink*>()) {
|
}
|
||||||
|
if (session.all_of<Components::ToxAVVideoSink>()) {
|
||||||
|
auto vsink = session.get<Components::ToxAVVideoSink>().o;
|
||||||
|
if (vsink.all_of<ToxAVCallVideoSink*>()) {
|
||||||
std::lock_guard lg{_video_sinks_mutex};
|
std::lock_guard lg{_video_sinks_mutex};
|
||||||
auto it = std::find(_video_sinks.cbegin(), _video_sinks.cend(), session.get<ToxAVCallVideoSink*>());
|
auto it = std::find(_video_sinks.cbegin(), _video_sinks.cend(), vsink.get<ToxAVCallVideoSink*>());
|
||||||
if (it != _video_sinks.cend()) {
|
if (it != _video_sinks.cend()) {
|
||||||
_video_sinks.erase(it);
|
_video_sinks.erase(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// destory sources
|
// destory sources
|
||||||
if (auto* ss = session.try_get<Components::VoIP::StreamSources>(); ss != nullptr) {
|
if (auto* ss = session.try_get<Components::VoIP::StreamSources>(); ss != nullptr) {
|
||||||
@ -331,7 +337,7 @@ void ToxAVVoIPModel::destroySession(ObjectHandle session) {
|
|||||||
void ToxAVVoIPModel::audio_thread_tick(void) {
|
void ToxAVVoIPModel::audio_thread_tick(void) {
|
||||||
//for (const auto& [oc, asink] : _os.registry().view<ToxAVCallAudioSink*>().each()) {
|
//for (const auto& [oc, asink] : _os.registry().view<ToxAVCallAudioSink*>().each()) {
|
||||||
std::lock_guard lg{_audio_sinks_mutex};
|
std::lock_guard lg{_audio_sinks_mutex};
|
||||||
for (const auto& asink : _audio_sinks) {
|
for (const auto* asink : _audio_sinks) {
|
||||||
if (!asink->_writer) {
|
if (!asink->_writer) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -369,7 +375,7 @@ void ToxAVVoIPModel::audio_thread_tick(void) {
|
|||||||
void ToxAVVoIPModel::video_thread_tick(void) {
|
void ToxAVVoIPModel::video_thread_tick(void) {
|
||||||
//for (const auto& [oc, vsink] : _os.registry().view<ToxAVCallVideoSink*>().each()) {
|
//for (const auto& [oc, vsink] : _os.registry().view<ToxAVCallVideoSink*>().each()) {
|
||||||
std::lock_guard lg{_video_sinks_mutex};
|
std::lock_guard lg{_video_sinks_mutex};
|
||||||
for (const auto& vsink : _video_sinks) {
|
for (const auto* vsink : _video_sinks) {
|
||||||
if (!vsink->_writer) {
|
if (!vsink->_writer) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user