mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-26 20:25:34 +08:00
[fix] stop threads when DestroyIceTransmission() called
This commit is contained in:
@@ -83,7 +83,8 @@ int AomAv1Decoder::Decode(
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (img_ = aom_codec_get_frame(&aom_av1_decoder_ctx_, &iter)) {
|
img_ = aom_codec_get_frame(&aom_av1_decoder_ctx_, &iter);
|
||||||
|
if (img_) {
|
||||||
{
|
{
|
||||||
aom_codec_frame_flags_t flags;
|
aom_codec_frame_flags_t flags;
|
||||||
ret = aom_codec_control(&aom_av1_decoder_ctx_, AOMD_GET_FRAME_FLAGS,
|
ret = aom_codec_control(&aom_av1_decoder_ctx_, AOMD_GET_FRAME_FLAGS,
|
||||||
|
|||||||
@@ -956,6 +956,7 @@ void PeerConnection::ProcessIceWorkMsg(const IceWorkMsg &msg) {
|
|||||||
}
|
}
|
||||||
case IceWorkMsg::Type::Destroy: {
|
case IceWorkMsg::Type::Destroy: {
|
||||||
for (auto &user_id_it : ice_transmission_list_) {
|
for (auto &user_id_it : ice_transmission_list_) {
|
||||||
|
LOG_ERROR("Destroy transmission");
|
||||||
user_id_it.second->DestroyIceTransmission();
|
user_id_it.second->DestroyIceTransmission();
|
||||||
}
|
}
|
||||||
ice_transmission_list_.clear();
|
ice_transmission_list_.clear();
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#include "io_statistics.h"
|
#include "io_statistics.h"
|
||||||
|
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
IOStatistics::IOStatistics(
|
IOStatistics::IOStatistics(
|
||||||
std::function<void(uint32_t, uint32_t, uint32_t, uint32_t, uint32_t,
|
std::function<void(uint32_t, uint32_t, uint32_t, uint32_t, uint32_t,
|
||||||
uint32_t, uint32_t, uint32_t)>
|
uint32_t, uint32_t, uint32_t)>
|
||||||
@@ -8,13 +10,7 @@ IOStatistics::IOStatistics(
|
|||||||
interval_ = 1000;
|
interval_ = 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
IOStatistics::~IOStatistics() {
|
IOStatistics::~IOStatistics() {}
|
||||||
running_ = false;
|
|
||||||
cond_var_.notify_one();
|
|
||||||
if (statistics_thread_.joinable()) {
|
|
||||||
statistics_thread_.join();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void IOStatistics::Process() {
|
void IOStatistics::Process() {
|
||||||
while (running_) {
|
while (running_) {
|
||||||
@@ -56,6 +52,14 @@ void IOStatistics::Start() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IOStatistics::Stop() {
|
||||||
|
running_ = false;
|
||||||
|
cond_var_.notify_one();
|
||||||
|
if (statistics_thread_.joinable()) {
|
||||||
|
statistics_thread_.join();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void IOStatistics::UpdateVideoInboundBytes(uint32_t bytes) {
|
void IOStatistics::UpdateVideoInboundBytes(uint32_t bytes) {
|
||||||
video_inbound_bytes_ += bytes;
|
video_inbound_bytes_ += bytes;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ class IOStatistics {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
void Start();
|
void Start();
|
||||||
|
void Stop();
|
||||||
|
|
||||||
void UpdateVideoInboundBytes(uint32_t bytes);
|
void UpdateVideoInboundBytes(uint32_t bytes);
|
||||||
void UpdateVideoOutboundBytes(uint32_t bytes);
|
void UpdateVideoOutboundBytes(uint32_t bytes);
|
||||||
|
|||||||
@@ -22,19 +22,7 @@ IceTransmission::IceTransmission(
|
|||||||
ice_ws_transport_(ice_ws_transmission),
|
ice_ws_transport_(ice_ws_transmission),
|
||||||
on_ice_status_change_(on_ice_status_change) {}
|
on_ice_status_change_(on_ice_status_change) {}
|
||||||
|
|
||||||
IceTransmission::~IceTransmission() {
|
IceTransmission::~IceTransmission() {}
|
||||||
if (rtp_video_sender_) {
|
|
||||||
rtp_video_sender_->Stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rtp_audio_sender_) {
|
|
||||||
rtp_audio_sender_->Stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rtp_data_sender_) {
|
|
||||||
rtp_data_sender_->Stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int IceTransmission::SetLocalCapabilities(
|
int IceTransmission::SetLocalCapabilities(
|
||||||
bool use_trickle_ice, bool use_reliable_ice, bool enable_turn,
|
bool use_trickle_ice, bool use_reliable_ice, bool enable_turn,
|
||||||
@@ -351,6 +339,29 @@ int IceTransmission::DestroyIceTransmission() {
|
|||||||
if (on_ice_status_change_) {
|
if (on_ice_status_change_) {
|
||||||
on_ice_status_change_("closed");
|
on_ice_status_change_("closed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ice_io_statistics_) {
|
||||||
|
ice_io_statistics_->Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rtp_video_receiver_) {
|
||||||
|
rtp_video_receiver_->Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rtp_video_sender_) {
|
||||||
|
rtp_video_sender_->Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rtp_audio_sender_) {
|
||||||
|
rtp_audio_sender_->Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rtp_data_sender_) {
|
||||||
|
rtp_data_sender_->Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_ERROR("threads stoped");
|
||||||
|
|
||||||
return ice_agent_->DestroyIceAgent();
|
return ice_agent_->DestroyIceAgent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user