mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-27 04:35:34 +08:00
Implementation for jitter
This commit is contained in:
@@ -69,6 +69,15 @@ int IceTransmission::InitIceTransmission(std::string &ip, int port) {
|
||||
remote_user_id_.size());
|
||||
});
|
||||
|
||||
rtp_video_sender_ = new RtpVideoSender();
|
||||
rtp_video_sender_->SetRtpPacketSendFunc([this](
|
||||
RtpPacket &rtp_packet) -> void {
|
||||
if (ice_agent_) {
|
||||
LOG_ERROR("Send rtp packet {}", rtp_packet.Size());
|
||||
ice_agent_->Send((const char *)rtp_packet.Buffer(), rtp_packet.Size());
|
||||
}
|
||||
});
|
||||
|
||||
ice_agent_ = new IceAgent(ip, port);
|
||||
|
||||
ice_agent_->CreateIceAgent(
|
||||
@@ -213,9 +222,10 @@ int IceTransmission::SendData(const char *data, size_t size) {
|
||||
std::vector<RtpPacket> packets;
|
||||
|
||||
rtp_video_session_->Encode((uint8_t *)data, size, packets);
|
||||
for (auto &packet : packets) {
|
||||
ice_agent_->Send((const char *)packet.Buffer(), packet.Size());
|
||||
}
|
||||
rtp_video_sender_->Enqueue(packets);
|
||||
// for (auto &packet : packets) {
|
||||
// ice_agent_->Send((const char *)packet.Buffer(), packet.Size());
|
||||
// }
|
||||
|
||||
// std::vector<RtpPacket> packets =
|
||||
// rtp_video_session_->Encode((uint8_t *)(data), size);
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "ringbuffer.h"
|
||||
#include "rtp_packet.h"
|
||||
#include "rtp_video_receiver.h"
|
||||
#include "rtp_video_sender.h"
|
||||
#include "rtp_video_session.h"
|
||||
#include "ws_transmission.h"
|
||||
|
||||
@@ -72,15 +73,13 @@ class IceTransmission {
|
||||
private:
|
||||
// ikcpcb *kcp_ = nullptr;
|
||||
char kcp_complete_buffer_[2560 * 1440 * 4];
|
||||
std::mutex mtx_;
|
||||
RingBuffer<RtpPacket> send_ringbuffer_;
|
||||
RingBuffer<RtpPacket> recv_ringbuffer_;
|
||||
bool kcp_stop_ = false;
|
||||
std::thread *kcp_update_thread_ = nullptr;
|
||||
|
||||
private:
|
||||
RtpVideoSession *rtp_video_session_ = nullptr;
|
||||
RtpVideoReceiver *rtp_video_receiver_ = nullptr;
|
||||
RtpVideoSender *rtp_video_sender_ = nullptr;
|
||||
uint8_t *rtp_payload_ = nullptr;
|
||||
RtpPacket pop_packet_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user