mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-26 20:25:34 +08:00
Fix crash caused by remote desk client leaves
This commit is contained in:
@@ -589,8 +589,8 @@ int NvDecoder::HandlePictureDisplay(CUVIDPARSERDISPINFO *pDispInfo) {
|
||||
if (result == CUDA_SUCCESS &&
|
||||
(DecodeStatus.decodeStatus == cuvidDecodeStatus_Error ||
|
||||
DecodeStatus.decodeStatus == cuvidDecodeStatus_Error_Concealed)) {
|
||||
printf("Decode Error occurred for picture %d\n",
|
||||
m_nPicNumInDecodeOrder[pDispInfo->picture_index]);
|
||||
// printf("Decode Error occurred for picture %d\n",
|
||||
// m_nPicNumInDecodeOrder[pDispInfo->picture_index]);
|
||||
}
|
||||
|
||||
uint8_t *pDecodedFrame = nullptr;
|
||||
|
||||
@@ -49,7 +49,7 @@ int VideoDecoder::Decode(const uint8_t *pData, int nSize) {
|
||||
}
|
||||
|
||||
if ((*(pData + 4) & 0x1f) == 0x07) {
|
||||
LOG_WARN("Receive key frame");
|
||||
// LOG_WARN("Receive key frame");
|
||||
}
|
||||
|
||||
if (SAVE_ENCODER_STREAM) {
|
||||
|
||||
@@ -129,6 +129,12 @@ void PeerConnection::ProcessSignal(const std::string &signal) {
|
||||
user_id_list_ = j["user_id_list"];
|
||||
std::string transmission_id = j["transmission_id"];
|
||||
|
||||
if (user_id_list_.empty()) {
|
||||
LOG_WARN("Wait for host create transmission [{}]", transmission_id);
|
||||
RequestTransmissionMemberList(transmission_id);
|
||||
break;
|
||||
}
|
||||
|
||||
LOG_INFO("Transmission [{}] members: [", transmission_id);
|
||||
for (auto user_id : user_id_list_) {
|
||||
LOG_INFO("{}", user_id);
|
||||
|
||||
@@ -83,10 +83,17 @@ IceTransmission::~IceTransmission() {
|
||||
delete ice_agent_;
|
||||
ice_agent_ = nullptr;
|
||||
}
|
||||
|
||||
if (kcp_update_thread_ && kcp_update_thread_->joinable()) {
|
||||
kcp_update_thread_->join();
|
||||
}
|
||||
|
||||
delete kcp_update_thread_;
|
||||
kcp_update_thread_ = nullptr;
|
||||
}
|
||||
|
||||
int IceTransmission::InitIceTransmission(std::string &ip, int port) {
|
||||
std::thread kcp_update_thread([this]() {
|
||||
kcp_update_thread_ = new std::thread([this]() {
|
||||
int ret = 0;
|
||||
ikcpcb *kcp = ikcp_create(0x11223344, (void *)this);
|
||||
ikcp_setoutput(
|
||||
@@ -145,7 +152,6 @@ int IceTransmission::InitIceTransmission(std::string &ip, int port) {
|
||||
|
||||
ikcp_release(kcp);
|
||||
});
|
||||
kcp_update_thread.detach();
|
||||
|
||||
ice_agent_ = new IceAgent(ip, port);
|
||||
|
||||
@@ -302,7 +308,6 @@ int IceTransmission::SendAnswer() {
|
||||
|
||||
int IceTransmission::SendData(const char *data, size_t size) {
|
||||
if (JUICE_STATE_COMPLETED == state_) {
|
||||
LOG_ERROR("Send size: {}", size);
|
||||
send_ringbuffer_.push(std::move(RingBuffer::Data(data, size)));
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -70,6 +70,7 @@ class IceTransmission {
|
||||
RingBuffer send_ringbuffer_;
|
||||
RingBuffer recv_ringbuffer_;
|
||||
bool kcp_stop_ = false;
|
||||
std::thread *kcp_update_thread_ = nullptr;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user