mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-27 04:35:34 +08:00
Fix crash caused by multi threads during program termination
This commit is contained in:
@@ -3,14 +3,15 @@
|
||||
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <queue>
|
||||
#include <thread>
|
||||
|
||||
#include "frame.h"
|
||||
#include "ringbuffer.h"
|
||||
#include "rtp_video_session.h"
|
||||
#include "thread_base.h"
|
||||
|
||||
class RtpVideoReceiver {
|
||||
class RtpVideoReceiver : public ThreadBase {
|
||||
public:
|
||||
RtpVideoReceiver();
|
||||
~RtpVideoReceiver();
|
||||
@@ -23,13 +24,16 @@ class RtpVideoReceiver {
|
||||
on_receive_complete_frame_ = on_receive_complete_frame;
|
||||
}
|
||||
|
||||
void Start();
|
||||
void Stop();
|
||||
|
||||
private:
|
||||
bool CheckIsFrameCompleted(RtpPacket& rtp_packet);
|
||||
void Process();
|
||||
|
||||
// private:
|
||||
// void OnReceiveFrame(uint8_t* payload) {}
|
||||
|
||||
private:
|
||||
bool Process() override;
|
||||
|
||||
private:
|
||||
std::map<uint16_t, RtpPacket> incomplete_frame_list_;
|
||||
uint8_t* nv12_data_ = nullptr;
|
||||
@@ -37,8 +41,9 @@ class RtpVideoReceiver {
|
||||
uint32_t last_complete_frame_ts_ = 0;
|
||||
|
||||
RingBuffer<VideoFrame> compelete_video_frame_queue_;
|
||||
std::thread* jitter_thread_ = nullptr;
|
||||
bool start_ = false;
|
||||
|
||||
bool stop_ = true;
|
||||
std::mutex mutex_;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user