Implementation for jitter

This commit is contained in:
dijunkun
2023-09-08 17:45:01 +08:00
parent dc11f50d82
commit 79c838629a
9 changed files with 177 additions and 34 deletions

View File

@@ -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);