mirror of
				https://github.com/kunkundi/crossdesk.git
				synced 2025-10-26 20:25:34 +08:00 
			
		
		
		
	[fix] fix unused variables and type conversions
This commit is contained in:
		| @@ -51,10 +51,10 @@ uint8_t **FecEncoder::Encode(const char *data, size_t len) { | ||||
|   uint8_t **fec_packets = nullptr; | ||||
|  | ||||
|   unsigned int last_packet_size = len % max_size_of_packet_; | ||||
|   unsigned int num_of_source_packets = | ||||
|       len / max_size_of_packet_ + (last_packet_size ? 1 : 0); | ||||
|   unsigned int num_of_total_packets = | ||||
|       (unsigned int)floor((double)num_of_source_packets / code_rate_); | ||||
|   uint8_t num_of_source_packets = | ||||
|       (uint8_t)(len / max_size_of_packet_) + (last_packet_size ? 1 : 0); | ||||
|   uint8_t num_of_total_packets = | ||||
|       (uint8_t)floor((double)num_of_source_packets / code_rate_); | ||||
|  | ||||
|   fec_params_->nb_source_symbols = num_of_source_packets; | ||||
|   fec_params_->nb_repair_symbols = num_of_total_packets - num_of_source_packets; | ||||
| @@ -74,8 +74,8 @@ uint8_t **FecEncoder::Encode(const char *data, size_t len) { | ||||
|     return nullptr; | ||||
|   } | ||||
|  | ||||
|   for (unsigned int esi = 0; esi < num_of_source_packets; esi++) { | ||||
|     if (esi != num_of_source_packets - 1) { | ||||
|   for (int esi = 0; esi < num_of_source_packets; esi++) { | ||||
|     if (esi != (num_of_source_packets - 1)) { | ||||
|       fec_packets[esi] = | ||||
|           (uint8_t *)calloc(max_size_of_packet_, sizeof(uint8_t)); | ||||
|       if (nullptr == fec_packets[esi]) { | ||||
| @@ -126,12 +126,12 @@ int FecEncoder::ReleaseFecPackets(uint8_t **fec_packets, size_t len) { | ||||
|     return -1; | ||||
|   } | ||||
|   unsigned int last_packet_size = len % max_size_of_packet_; | ||||
|   unsigned int num_of_source_packets = | ||||
|       len / max_size_of_packet_ + (last_packet_size ? 1 : 0); | ||||
|   unsigned int num_of_total_packets = | ||||
|       (unsigned int)floor((double)num_of_source_packets / code_rate_); | ||||
|   uint8_t num_of_source_packets = | ||||
|       (uint8_t)(len / max_size_of_packet_) + (last_packet_size ? 1 : 0); | ||||
|   uint8_t num_of_total_packets = | ||||
|       (uint8_t)floor((double)num_of_source_packets / code_rate_); | ||||
|  | ||||
|   for (unsigned int esi = 0; esi < num_of_total_packets; esi++) { | ||||
|   for (int esi = 0; esi < num_of_total_packets; esi++) { | ||||
|     if (fec_packets[esi]) { | ||||
|       free(fec_packets[esi]); | ||||
|     } | ||||
| @@ -142,12 +142,12 @@ int FecEncoder::ReleaseFecPackets(uint8_t **fec_packets, size_t len) { | ||||
| } | ||||
|  | ||||
| void FecEncoder::GetFecPacketsParams(unsigned int source_length, | ||||
|                                      unsigned int &num_of_total_packets, | ||||
|                                      unsigned int &num_of_source_packets, | ||||
|                                      uint8_t &num_of_total_packets, | ||||
|                                      uint8_t &num_of_source_packets, | ||||
|                                      unsigned int &last_packet_size) { | ||||
|   last_packet_size = source_length % max_size_of_packet_; | ||||
|   num_of_source_packets = | ||||
|       source_length / max_size_of_packet_ + (last_packet_size ? 1 : 0); | ||||
|   num_of_source_packets = (uint8_t)(source_length / max_size_of_packet_) + | ||||
|                           (last_packet_size ? 1 : 0); | ||||
|   num_of_total_packets = | ||||
|       (unsigned int)floor((double)num_of_source_packets / code_rate_); | ||||
|       (uint8_t)floor((double)num_of_source_packets / code_rate_); | ||||
| } | ||||
| @@ -29,8 +29,8 @@ class FecEncoder { | ||||
|   uint8_t **Encode(const char *data, size_t len); | ||||
|   int ReleaseFecPackets(uint8_t **fec_packets, size_t len); | ||||
|   void GetFecPacketsParams(unsigned int source_length, | ||||
|                            unsigned int &num_of_total_packets, | ||||
|                            unsigned int &num_of_source_packets, | ||||
|                            uint8_t &num_of_total_packets, | ||||
|                            uint8_t &num_of_source_packets, | ||||
|                            unsigned int &last_packet_size); | ||||
|  | ||||
|  private: | ||||
|   | ||||
| @@ -119,7 +119,7 @@ DLLAPI int SendVideoFrame(PeerPtr* peer_ptr, const XVideoFrame* video_frame); | ||||
|  | ||||
| DLLAPI int SendAudioFrame(PeerPtr* peer_ptr, const char* data, size_t size); | ||||
|  | ||||
| DLLAPI int SendData(PeerPtr* peer_ptr, const char* data, size_t size); | ||||
| DLLAPI int SendDataFrame(PeerPtr* peer_ptr, const char* data, size_t size); | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
|   | ||||
| @@ -11,14 +11,7 @@ using nlohmann::json; | ||||
|  | ||||
| PeerConnection::PeerConnection() {} | ||||
|  | ||||
| PeerConnection::~PeerConnection() { | ||||
|   if (nv12_data_) { | ||||
|     delete nv12_data_; | ||||
|     nv12_data_ = nullptr; | ||||
|   } | ||||
|  | ||||
|   user_data_ = nullptr; | ||||
| } | ||||
| PeerConnection::~PeerConnection() { user_data_ = nullptr; } | ||||
|  | ||||
| int PeerConnection::Init(PeerConnectionParams params, | ||||
|                          const std::string &user_id) { | ||||
| @@ -190,30 +183,6 @@ int PeerConnection::Init(PeerConnectionParams params, | ||||
|     } | ||||
|   }; | ||||
|  | ||||
|   on_net_status_report_ = [this]( | ||||
|                               const std::string &user_id, | ||||
|                               IceTransmission::TraversalType mode, | ||||
|                               const uint64_t video_in, const uint64_t video_out, | ||||
|                               const uint64_t audio_in, const uint64_t audio_out, | ||||
|                               const uint64_t data_in, const uint64_t data_out, | ||||
|                               const uint64_t total_in, const uint64_t total_out, | ||||
|                               void *user_ptr) { | ||||
|     if (net_status_report_) { | ||||
|       XNetTrafficStats net_traffic_stats; | ||||
|       net_traffic_stats.video_in = video_in; | ||||
|       net_traffic_stats.video_out = video_out; | ||||
|       net_traffic_stats.audio_in = audio_in; | ||||
|       net_traffic_stats.audio_out = audio_out; | ||||
|       net_traffic_stats.data_in = data_in; | ||||
|       net_traffic_stats.data_out = data_out; | ||||
|       net_traffic_stats.total_in = total_in; | ||||
|       net_traffic_stats.total_out = total_out; | ||||
|  | ||||
|       net_status_report_(user_id.data(), user_id.size(), TraversalMode(mode), | ||||
|                          &net_traffic_stats, user_data_); | ||||
|     } | ||||
|   }; | ||||
|  | ||||
|   ws_transport_ = std::make_shared<WsClient>(on_receive_ws_msg_, on_ws_status_); | ||||
|   uri_ = "ws://" + cfg_signal_server_ip_ + ":" + cfg_signal_server_port_; | ||||
|   if (ws_transport_) { | ||||
| @@ -225,8 +194,6 @@ int PeerConnection::Init(PeerConnectionParams params, | ||||
|   // do { | ||||
|   // } while (SignalStatus::SignalConnected != GetSignalStatus()); | ||||
|  | ||||
|   nv12_data_ = new char[1280 * 720 * 3 / 2]; | ||||
|  | ||||
|   LOG_INFO("[{}] Init finish", user_id); | ||||
|  | ||||
|   inited_ = true; | ||||
| @@ -349,11 +316,6 @@ int PeerConnection::Destroy() { | ||||
|     ws_transport_->Close(); | ||||
|   } | ||||
|  | ||||
|   if (nv12_data_) { | ||||
|     delete nv12_data_; | ||||
|     nv12_data_ = nullptr; | ||||
|   } | ||||
|  | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| @@ -381,8 +343,7 @@ SignalStatus PeerConnection::GetSignalStatus() { | ||||
|   return signal_status_; | ||||
| } | ||||
|  | ||||
| // media send | ||||
| int PeerConnection::SendVideoData(const XVideoFrame *video_frame) { | ||||
| int PeerConnection::SendVideoFrame(const XVideoFrame *video_frame) { | ||||
|   if (ice_transmission_list_.empty()) { | ||||
|     return -1; | ||||
|   } | ||||
| @@ -392,13 +353,13 @@ int PeerConnection::SendVideoData(const XVideoFrame *video_frame) { | ||||
|       continue; | ||||
|     } | ||||
|  | ||||
|     ice_trans.second->SendVideoData(video_frame); | ||||
|     ice_trans.second->SendVideoFrame(video_frame); | ||||
|   } | ||||
|  | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| int PeerConnection::SendAudioData(const char *data, size_t size) { | ||||
| int PeerConnection::SendAudioFrame(const char *data, size_t size) { | ||||
|   if (ice_transmission_list_.empty()) { | ||||
|     return -1; | ||||
|   } | ||||
| @@ -407,18 +368,18 @@ int PeerConnection::SendAudioData(const char *data, size_t size) { | ||||
|     if (!is_ice_transmission_ready_[ice_trans.first]) { | ||||
|       continue; | ||||
|     } | ||||
|     ice_trans.second->SendAudioData(data, size); | ||||
|     ice_trans.second->SendAudioFrame(data, size); | ||||
|   } | ||||
|  | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| int PeerConnection::SendUserData(const char *data, size_t size) { | ||||
| int PeerConnection::SendDataFrame(const char *data, size_t size) { | ||||
|   for (auto &ice_trans : ice_transmission_list_) { | ||||
|     if (!is_ice_transmission_ready_[ice_trans.first]) { | ||||
|       continue; | ||||
|     } | ||||
|     ice_trans.second->SendUserData(data, size); | ||||
|     ice_trans.second->SendDataFrame(data, size); | ||||
|   } | ||||
|   return 0; | ||||
| } | ||||
| @@ -652,7 +613,7 @@ void PeerConnection::ProcessIceWorkMsg(const IceWorkMsg &msg) { | ||||
|             on_receive_data_buffer_); | ||||
|  | ||||
|         ice_transmission_list_[remote_user_id]->SetOnReceiveNetStatusReportFunc( | ||||
|             on_net_status_report_); | ||||
|             net_status_report_); | ||||
|  | ||||
|         ice_transmission_list_[remote_user_id]->InitIceTransmission( | ||||
|             cfg_stun_server_ip_, stun_server_port_, cfg_turn_server_ip_, | ||||
| @@ -700,7 +661,7 @@ void PeerConnection::ProcessIceWorkMsg(const IceWorkMsg &msg) { | ||||
|             on_receive_data_buffer_); | ||||
|  | ||||
|         ice_transmission_list_[remote_user_id]->SetOnReceiveNetStatusReportFunc( | ||||
|             on_net_status_report_); | ||||
|             net_status_report_); | ||||
|  | ||||
|         ice_transmission_list_[remote_user_id]->InitIceTransmission( | ||||
|             cfg_stun_server_ip_, stun_server_port_, cfg_turn_server_ip_, | ||||
|   | ||||
| @@ -1,3 +1,9 @@ | ||||
| /* | ||||
|  * @Author: DI JUNKUN | ||||
|  * @Date: 2024-11-26 | ||||
|  * Copyright (c) 2024 by DI JUNKUN, All Rights Reserved. | ||||
|  */ | ||||
|  | ||||
| #ifndef _PEER_CONNECTION_H_ | ||||
| #define _PEER_CONNECTION_H_ | ||||
|  | ||||
| @@ -95,11 +101,9 @@ class PeerConnection { | ||||
|  | ||||
|   SignalStatus GetSignalStatus(); | ||||
|  | ||||
|   int SendVideoData(const char *data, size_t size); | ||||
|   int SendAudioData(const char *data, size_t size); | ||||
|   int SendUserData(const char *data, size_t size); | ||||
|  | ||||
|   int SendVideoData(const XVideoFrame *video_frame); | ||||
|   int SendVideoFrame(const XVideoFrame *video_frame); | ||||
|   int SendAudioFrame(const char *data, size_t size); | ||||
|   int SendDataFrame(const char *data, size_t size); | ||||
|  | ||||
|  private: | ||||
|   int Login(); | ||||
| @@ -186,7 +190,6 @@ class PeerConnection { | ||||
|   NetStatusReport net_status_report_; | ||||
|   void *user_data_; | ||||
|  | ||||
|   char *nv12_data_ = nullptr; | ||||
|   bool inited_ = false; | ||||
|   std::string password_; | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,8 @@ | ||||
| #ifndef _RINGBUFFER_H_ | ||||
| #define _RINGBUFFER_H_ | ||||
|  | ||||
| #include <cstddef> | ||||
| #include <cstdint> | ||||
| #include <cstring> | ||||
|  | ||||
| int RingBufferDummy(); | ||||
| @@ -9,7 +11,7 @@ class Data { | ||||
|  public: | ||||
|   Data() = default; | ||||
|  | ||||
|   Data(const char* data, size_t size) { | ||||
|   Data(const char* data, uint32_t size) { | ||||
|     data_ = new char[size]; | ||||
|     memcpy(data_, data, size); | ||||
|     size_ = size; | ||||
| @@ -36,12 +38,12 @@ class Data { | ||||
|     size_ = 0; | ||||
|   } | ||||
|  | ||||
|   size_t size() const { return size_; } | ||||
|   uint32_t size() const { return size_; } | ||||
|   char* data() const { return data_; } | ||||
|  | ||||
|  public: | ||||
|   char* data_ = nullptr; | ||||
|   size_t size_ = 0; | ||||
|   uint32_t size_ = 0; | ||||
| }; | ||||
|  | ||||
| template <typename T> | ||||
| @@ -101,8 +103,8 @@ class RingBuffer { | ||||
|  | ||||
|  private: | ||||
|   unsigned int m_size; | ||||
|   int m_front; | ||||
|   int m_rear; | ||||
|   unsigned int m_front; | ||||
|   unsigned int m_rear; | ||||
|   T* m_data; | ||||
| }; | ||||
|  | ||||
|   | ||||
| @@ -112,7 +112,7 @@ DLLAPI int SendVideoFrame(PeerPtr *peer_ptr, const XVideoFrame *video_frame) { | ||||
|     return -1; | ||||
|   } | ||||
|  | ||||
|   peer_ptr->peer_connection->SendVideoData(video_frame); | ||||
|   peer_ptr->peer_connection->SendVideoFrame(video_frame); | ||||
|  | ||||
|   return 0; | ||||
| } | ||||
| @@ -128,12 +128,12 @@ DLLAPI int SendAudioFrame(PeerPtr *peer_ptr, const char *data, size_t size) { | ||||
|     return -1; | ||||
|   } | ||||
|  | ||||
|   peer_ptr->peer_connection->SendAudioData(data, size); | ||||
|   peer_ptr->peer_connection->SendAudioFrame(data, size); | ||||
|  | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| int SendData(PeerPtr *peer_ptr, const char *data, size_t size) { | ||||
| int SendDataFrame(PeerPtr *peer_ptr, const char *data, size_t size) { | ||||
|   if (!peer_ptr) { | ||||
|     LOG_ERROR("peer_ptr not created"); | ||||
|     return -1; | ||||
| @@ -144,7 +144,7 @@ int SendData(PeerPtr *peer_ptr, const char *data, size_t size) { | ||||
|     return -1; | ||||
|   } | ||||
|  | ||||
|   peer_ptr->peer_connection->SendUserData(data, size); | ||||
|   peer_ptr->peer_connection->SendDataFrame(data, size); | ||||
|  | ||||
|   return 0; | ||||
| } | ||||
| @@ -30,7 +30,7 @@ struct Obu { | ||||
|   uint8_t header; | ||||
|   uint8_t extension_header;  // undefined if (header & kXbit) == 0 | ||||
|   std::vector<uint8_t> payload; | ||||
|   int size;  // size of the header and payload combined. | ||||
|   size_t size;  // size of the header and payload combined. | ||||
| }; | ||||
|  | ||||
| struct Packet { | ||||
|   | ||||
| @@ -101,11 +101,11 @@ std::vector<Obu> ParseObus(uint8_t* payload, int payload_size) { | ||||
|       payload_reader.Consume(size); | ||||
|     } | ||||
|     obu.size += obu.payload.size(); | ||||
|     // Skip obus that shouldn't be transfered over rtp. | ||||
|     int obu_type = ObuType(obu.header); | ||||
|     if (has_ext_header) { | ||||
|       obu.payload.insert(obu.payload.begin(), obu.extension_header); | ||||
|     } | ||||
|     // Skip obus that shouldn't be transfered over rtp. | ||||
|     // int obu_type = ObuType(obu.header); | ||||
|     obu.payload.insert(obu.payload.begin(), obu.header); | ||||
|     // if (obu_type != kObuTypeTemporalDelimiter &&  // | ||||
|     //     obu_type != kObuTypeTileList &&           // | ||||
|   | ||||
| @@ -17,7 +17,7 @@ void RtpAudioReceiver::InsertRtpPacket(RtpPacket& rtp_packet) { | ||||
|   } | ||||
|  | ||||
|   if (rtp_statistics_) { | ||||
|     rtp_statistics_->UpdateReceiveBytes(rtp_packet.Size()); | ||||
|     rtp_statistics_->UpdateReceiveBytes((uint32_t)rtp_packet.Size()); | ||||
|   } | ||||
|  | ||||
|   if (CheckIsTimeSendRR()) { | ||||
|   | ||||
| @@ -42,9 +42,9 @@ int RtpAudioSender::SendRtpPacket(RtpPacket& rtp_packet) { | ||||
|     return -1; | ||||
|   } | ||||
|  | ||||
|   last_send_bytes_ += rtp_packet.Size(); | ||||
|   last_send_bytes_ += (uint32_t)rtp_packet.Size(); | ||||
|   total_rtp_packets_sent_++; | ||||
|   total_rtp_payload_sent_ += rtp_packet.PayloadSize(); | ||||
|   total_rtp_payload_sent_ += (uint32_t)rtp_packet.PayloadSize(); | ||||
|  | ||||
|   if (CheckIsTimeSendSR()) { | ||||
|     RtcpSenderReport rtcp_sr; | ||||
|   | ||||
| @@ -35,7 +35,7 @@ RtpCodec ::~RtpCodec() { | ||||
|   // } | ||||
| } | ||||
|  | ||||
| void RtpCodec::Encode(uint8_t* buffer, size_t size, | ||||
| void RtpCodec::Encode(uint8_t* buffer, uint32_t size, | ||||
|                       std::vector<RtpPacket>& packets) { | ||||
|   if (RtpPacket::PAYLOAD_TYPE::H264 == payload_type_) { | ||||
|     if (fec_enable_ && IsKeyFrame((const uint8_t*)buffer, size)) { | ||||
| @@ -44,8 +44,8 @@ void RtpCodec::Encode(uint8_t* buffer, size_t size, | ||||
|         LOG_ERROR("Invalid fec_packets"); | ||||
|         return; | ||||
|       } | ||||
|       unsigned int num_of_total_packets = 0; | ||||
|       unsigned int num_of_source_packets = 0; | ||||
|       uint8_t num_of_total_packets = 0; | ||||
|       uint8_t num_of_source_packets = 0; | ||||
|       unsigned int last_packet_size = 0; | ||||
|       fec_encoder_.GetFecPacketsParams(size, num_of_total_packets, | ||||
|                                        num_of_source_packets, last_packet_size); | ||||
| @@ -54,13 +54,13 @@ void RtpCodec::Encode(uint8_t* buffer, size_t size, | ||||
|                        std::chrono::system_clock::now().time_since_epoch()) | ||||
|                        .count(); | ||||
|  | ||||
|       for (unsigned int index = 0; index < num_of_total_packets; index++) { | ||||
|       for (uint8_t index = 0; index < num_of_total_packets; index++) { | ||||
|         RtpPacket rtp_packet; | ||||
|         if (index < num_of_source_packets) { | ||||
|           rtp_packet.SetVerion(version_); | ||||
|           rtp_packet.SetHasPadding(has_padding_); | ||||
|           rtp_packet.SetHasExtension(has_extension_); | ||||
|           rtp_packet.SetMarker(index == num_of_source_packets - 1 ? 1 : 0); | ||||
|           rtp_packet.SetMarker((index == (num_of_source_packets - 1)) ? 1 : 0); | ||||
|           rtp_packet.SetPayloadType(RtpPacket::PAYLOAD_TYPE::H264_FEC_SOURCE); | ||||
|           rtp_packet.SetSequenceNumber(sequence_number_++); | ||||
|           rtp_packet.SetTimestamp(timestamp_); | ||||
| @@ -170,13 +170,13 @@ void RtpCodec::Encode(uint8_t* buffer, size_t size, | ||||
|       packets.emplace_back(rtp_packet); | ||||
|  | ||||
|     } else { | ||||
|       size_t last_packet_size = size % MAX_NALU_LEN; | ||||
|       size_t packet_num = size / MAX_NALU_LEN + (last_packet_size ? 1 : 0); | ||||
|       uint32_t last_packet_size = size % MAX_NALU_LEN; | ||||
|       uint32_t packet_num = size / MAX_NALU_LEN + (last_packet_size ? 1 : 0); | ||||
|       timestamp_ = std::chrono::duration_cast<std::chrono::microseconds>( | ||||
|                        std::chrono::system_clock::now().time_since_epoch()) | ||||
|                        .count(); | ||||
|  | ||||
|       for (size_t index = 0; index < packet_num; index++) { | ||||
|       for (uint32_t index = 0; index < packet_num; index++) { | ||||
|         RtpPacket rtp_packet; | ||||
|         rtp_packet.SetVerion(version_); | ||||
|         rtp_packet.SetHasPadding(has_padding_); | ||||
| @@ -254,13 +254,13 @@ void RtpCodec::Encode(uint8_t* buffer, size_t size, | ||||
|         rtp_packet.EncodeAv1(obus[i].payload.data(), obus[i].payload.size()); | ||||
|         packets.emplace_back(rtp_packet); | ||||
|       } else { | ||||
|         size_t last_packet_size = obus[i].payload.size() % MAX_NALU_LEN; | ||||
|         uint32_t last_packet_size = obus[i].payload.size() % MAX_NALU_LEN; | ||||
|         size_t packet_num = | ||||
|             obus[i].payload.size() / MAX_NALU_LEN + (last_packet_size ? 1 : 0); | ||||
|         timestamp_ = std::chrono::duration_cast<std::chrono::microseconds>( | ||||
|                          std::chrono::system_clock::now().time_since_epoch()) | ||||
|                          .count(); | ||||
|         for (size_t index = 0; index < packet_num; index++) { | ||||
|         for (uint32_t index = 0; index < packet_num; index++) { | ||||
|           RtpPacket rtp_packet; | ||||
|           rtp_packet.SetVerion(version_); | ||||
|           rtp_packet.SetHasPadding(has_padding_); | ||||
| @@ -332,7 +332,7 @@ void RtpCodec::Encode(uint8_t* buffer, size_t size, | ||||
|   } | ||||
| } | ||||
|  | ||||
| void RtpCodec::Encode(VideoFrameType frame_type, uint8_t* buffer, size_t size, | ||||
| void RtpCodec::Encode(VideoFrameType frame_type, uint8_t* buffer, uint32_t size, | ||||
|                       std::vector<RtpPacket>& packets) { | ||||
|   if (RtpPacket::PAYLOAD_TYPE::H264 == payload_type_) { | ||||
|     if (fec_enable_ && IsKeyFrame((const uint8_t*)buffer, size)) { | ||||
| @@ -341,8 +341,8 @@ void RtpCodec::Encode(VideoFrameType frame_type, uint8_t* buffer, size_t size, | ||||
|         LOG_ERROR("Invalid fec_packets"); | ||||
|         return; | ||||
|       } | ||||
|       unsigned int num_of_total_packets = 0; | ||||
|       unsigned int num_of_source_packets = 0; | ||||
|       uint8_t num_of_total_packets = 0; | ||||
|       uint8_t num_of_source_packets = 0; | ||||
|       unsigned int last_packet_size = 0; | ||||
|       fec_encoder_.GetFecPacketsParams(size, num_of_total_packets, | ||||
|                                        num_of_source_packets, last_packet_size); | ||||
| @@ -351,7 +351,7 @@ void RtpCodec::Encode(VideoFrameType frame_type, uint8_t* buffer, size_t size, | ||||
|                        std::chrono::system_clock::now().time_since_epoch()) | ||||
|                        .count(); | ||||
|  | ||||
|       for (unsigned int index = 0; index < num_of_total_packets; index++) { | ||||
|       for (uint8_t index = 0; index < num_of_total_packets; index++) { | ||||
|         RtpPacket rtp_packet; | ||||
|         if (index < num_of_source_packets) { | ||||
|           rtp_packet.SetVerion(version_); | ||||
| @@ -469,13 +469,13 @@ void RtpCodec::Encode(VideoFrameType frame_type, uint8_t* buffer, size_t size, | ||||
|       packets.emplace_back(rtp_packet); | ||||
|  | ||||
|     } else { | ||||
|       size_t last_packet_size = size % MAX_NALU_LEN; | ||||
|       size_t packet_num = size / MAX_NALU_LEN + (last_packet_size ? 1 : 0); | ||||
|       uint32_t last_packet_size = size % MAX_NALU_LEN; | ||||
|       uint32_t packet_num = size / MAX_NALU_LEN + (last_packet_size ? 1 : 0); | ||||
|       timestamp_ = std::chrono::duration_cast<std::chrono::microseconds>( | ||||
|                        std::chrono::system_clock::now().time_since_epoch()) | ||||
|                        .count(); | ||||
|  | ||||
|       for (size_t index = 0; index < packet_num; index++) { | ||||
|       for (uint32_t index = 0; index < packet_num; index++) { | ||||
|         RtpPacket rtp_packet; | ||||
|         rtp_packet.SetVerion(version_); | ||||
|         rtp_packet.SetHasPadding(has_padding_); | ||||
| @@ -520,7 +520,7 @@ void RtpCodec::Encode(VideoFrameType frame_type, uint8_t* buffer, size_t size, | ||||
|     } | ||||
|   } else if (RtpPacket::PAYLOAD_TYPE::AV1 == payload_type_) { | ||||
|     std::vector<Obu> obus = ParseObus(buffer, size); | ||||
|     uint32_t timestamp = | ||||
|     uint64_t timestamp = | ||||
|         std::chrono::duration_cast<std::chrono::microseconds>( | ||||
|             std::chrono::system_clock::now().time_since_epoch()) | ||||
|             .count(); | ||||
| @@ -550,11 +550,11 @@ void RtpCodec::Encode(VideoFrameType frame_type, uint8_t* buffer, size_t size, | ||||
|         rtp_packet.EncodeAv1(obus[i].payload.data(), obus[i].size); | ||||
|         packets.emplace_back(rtp_packet); | ||||
|       } else { | ||||
|         size_t last_packet_size = obus[i].size % MAX_NALU_LEN; | ||||
|         uint32_t last_packet_size = obus[i].size % MAX_NALU_LEN; | ||||
|         size_t packet_num = | ||||
|             obus[i].size / MAX_NALU_LEN + (last_packet_size ? 1 : 0); | ||||
|  | ||||
|         for (size_t index = 0; index < packet_num; index++) { | ||||
|         for (uint32_t index = 0; index < packet_num; index++) { | ||||
|           RtpPacket rtp_packet; | ||||
|           rtp_packet.SetVerion(version_); | ||||
|           rtp_packet.SetHasPadding(has_padding_); | ||||
| @@ -618,7 +618,7 @@ size_t RtpCodec::Decode(RtpPacket& packet, uint8_t* payload) { | ||||
|   } | ||||
| } | ||||
|  | ||||
| bool RtpCodec::IsKeyFrame(const uint8_t* buffer, size_t size) { | ||||
| bool RtpCodec::IsKeyFrame(const uint8_t* buffer, uint32_t size) { | ||||
|   if (buffer != nullptr && size != 0 && (*(buffer + 4) & 0x1f) == 0x07) { | ||||
|     return true; | ||||
|   } | ||||
|   | ||||
| @@ -21,27 +21,28 @@ class RtpCodec { | ||||
|   ~RtpCodec(); | ||||
|  | ||||
|  public: | ||||
|   void Encode(uint8_t* buffer, size_t size, std::vector<RtpPacket>& packets); | ||||
|   void Encode(VideoFrameType frame_type, uint8_t* buffer, size_t size, | ||||
|   void Encode(uint8_t* buffer, uint32_t size, std::vector<RtpPacket>& packets); | ||||
|   void Encode(VideoFrameType frame_type, uint8_t* buffer, uint32_t size, | ||||
|               std::vector<RtpPacket>& packets); | ||||
|   size_t Decode(RtpPacket& packet, uint8_t* payload); | ||||
|  | ||||
|   //  protected: | ||||
|   //   void OnReceiveFrame(uint8_t* payload) = 0; | ||||
|  private: | ||||
|   bool IsKeyFrame(const uint8_t* buffer, size_t size); | ||||
|   bool IsKeyFrame(const uint8_t* buffer, uint32_t size); | ||||
|  | ||||
|   void EncodeAv1(uint8_t* buffer, size_t size, std::vector<RtpPacket>& packets); | ||||
|   void EncodeAv1(uint8_t* buffer, uint32_t size, | ||||
|                  std::vector<RtpPacket>& packets); | ||||
|  | ||||
|  private: | ||||
|   uint32_t version_ = 0; | ||||
|   uint8_t version_ = 0; | ||||
|   bool has_padding_ = false; | ||||
|   bool has_extension_ = false; | ||||
|   uint32_t total_csrc_number_ = 0; | ||||
|   bool marker_ = false; | ||||
|   uint32_t payload_type_ = 0; | ||||
|   uint16_t sequence_number_ = 0; | ||||
|   uint32_t timestamp_ = 0; | ||||
|   uint64_t timestamp_ = 0; | ||||
|   uint32_t ssrc_ = 0; | ||||
|   std::vector<uint32_t> csrcs_; | ||||
|   uint16_t profile_ = 0; | ||||
|   | ||||
| @@ -17,7 +17,7 @@ void RtpDataReceiver::InsertRtpPacket(RtpPacket& rtp_packet) { | ||||
|   } | ||||
|  | ||||
|   if (rtp_statistics_) { | ||||
|     rtp_statistics_->UpdateReceiveBytes(rtp_packet.Size()); | ||||
|     rtp_statistics_->UpdateReceiveBytes((uint32_t)rtp_packet.Size()); | ||||
|   } | ||||
|  | ||||
|   if (CheckIsTimeSendRR()) { | ||||
|   | ||||
| @@ -42,9 +42,9 @@ int RtpDataSender::SendRtpPacket(RtpPacket& rtp_packet) { | ||||
|     return -1; | ||||
|   } | ||||
|  | ||||
|   last_send_bytes_ += rtp_packet.Size(); | ||||
|   last_send_bytes_ += (uint32_t)rtp_packet.Size(); | ||||
|   total_rtp_packets_sent_++; | ||||
|   total_rtp_payload_sent_ += rtp_packet.PayloadSize(); | ||||
|   total_rtp_payload_sent_ += (uint32_t)rtp_packet.PayloadSize(); | ||||
|  | ||||
|   if (CheckIsTimeSendSR()) { | ||||
|     RtcpSenderReport rtcp_sr; | ||||
|   | ||||
| @@ -37,7 +37,7 @@ RtpPacket::RtpPacket() : buffer_(new uint8_t[DEFAULT_MTU]), size_(DEFAULT_MTU) { | ||||
|   memset(buffer_, 0, DEFAULT_MTU); | ||||
| } | ||||
|  | ||||
| RtpPacket::RtpPacket(const uint8_t *buffer, size_t size) { | ||||
| RtpPacket::RtpPacket(const uint8_t *buffer, uint32_t size) { | ||||
|   if (size > 0) { | ||||
|     buffer_ = (uint8_t *)malloc(size); | ||||
|     if (NULL == buffer_) { | ||||
| @@ -269,9 +269,10 @@ const uint8_t *RtpPacket::EncodeH264Fua(uint8_t *payload, size_t payload_size) { | ||||
|   return buffer_; | ||||
| } | ||||
|  | ||||
| const uint8_t *RtpPacket::EncodeH264FecSource( | ||||
|     uint8_t *payload, size_t payload_size, unsigned int fec_symbol_id, | ||||
|     unsigned int fec_source_symbol_num) { | ||||
| const uint8_t *RtpPacket::EncodeH264FecSource(uint8_t *payload, | ||||
|                                               size_t payload_size, | ||||
|                                               uint8_t fec_symbol_id, | ||||
|                                               uint8_t fec_source_symbol_num) { | ||||
|   buffer_[0] = (version_ << 6) | (has_padding_ << 5) | (has_extension_ << 4) | | ||||
|                total_csrc_number_; | ||||
|   buffer_[1] = (marker_ << 7) | payload_type_; | ||||
| @@ -329,9 +330,10 @@ const uint8_t *RtpPacket::EncodeH264FecSource( | ||||
|   return buffer_; | ||||
| } | ||||
|  | ||||
| const uint8_t *RtpPacket::EncodeH264FecRepair( | ||||
|     uint8_t *payload, size_t payload_size, unsigned int fec_symbol_id, | ||||
|     unsigned int fec_source_symbol_num) { | ||||
| const uint8_t *RtpPacket::EncodeH264FecRepair(uint8_t *payload, | ||||
|                                               size_t payload_size, | ||||
|                                               uint8_t fec_symbol_id, | ||||
|                                               uint8_t fec_source_symbol_num) { | ||||
|   buffer_[0] = (version_ << 6) | (has_padding_ << 5) | (has_extension_ << 4) | | ||||
|                total_csrc_number_; | ||||
|   buffer_[1] = (marker_ << 7) | payload_type_; | ||||
|   | ||||
| @@ -184,7 +184,7 @@ class RtpPacket { | ||||
|  | ||||
|  public: | ||||
|   RtpPacket(); | ||||
|   RtpPacket(const uint8_t *buffer, size_t size); | ||||
|   RtpPacket(const uint8_t *buffer, uint32_t size); | ||||
|   RtpPacket(const RtpPacket &rtp_packet); | ||||
|   RtpPacket(RtpPacket &&rtp_packet); | ||||
|   RtpPacket &operator=(const RtpPacket &rtp_packet); | ||||
| @@ -194,24 +194,24 @@ class RtpPacket { | ||||
|  | ||||
|  public: | ||||
|   // Set Header | ||||
|   void SetVerion(uint32_t version) { version_ = version; } | ||||
|   void SetVerion(uint8_t version) { version_ = version; } | ||||
|   void SetHasPadding(bool has_padding) { has_padding_ = has_padding; } | ||||
|   void SetHasExtension(bool has_extension) { has_extension_ = has_extension; } | ||||
|   void SetMarker(bool marker) { marker_ = marker; } | ||||
|   void SetPayloadType(PAYLOAD_TYPE payload_type) { | ||||
|     payload_type_ = payload_type; | ||||
|     payload_type_ = (uint8_t)payload_type; | ||||
|   } | ||||
|   void SetSequenceNumber(uint16_t sequence_number) { | ||||
|     sequence_number_ = sequence_number; | ||||
|   } | ||||
|   void SetTimestamp(uint32_t timestamp) { timestamp_ = timestamp; } | ||||
|   void SetTimestamp(uint64_t timestamp) { timestamp_ = timestamp; } | ||||
|   void SetSsrc(uint32_t ssrc) { ssrc_ = ssrc; } | ||||
|   void SetCsrcs(std::vector<uint32_t> &csrcs) { csrcs_ = csrcs; } | ||||
|  | ||||
|   void SetExtensionProfile(uint16_t extension_profile) { | ||||
|     extension_profile_ = extension_profile; | ||||
|   } | ||||
|   void SetExtensionData(uint8_t *extension_data, size_t extension_len) { | ||||
|   void SetExtensionData(uint8_t *extension_data, uint16_t extension_len) { | ||||
|     extension_len_ = extension_len; | ||||
|     extension_data_ = new uint8_t[extension_len_]; | ||||
|     memcpy(extension_data_, extension_data, extension_len_); | ||||
| @@ -258,11 +258,11 @@ class RtpPacket { | ||||
|   const uint8_t *EncodeH264Nalu(uint8_t *payload, size_t payload_size); | ||||
|   const uint8_t *EncodeH264Fua(uint8_t *payload, size_t payload_size); | ||||
|   const uint8_t *EncodeH264FecSource(uint8_t *payload, size_t payload_size, | ||||
|                                      unsigned int fec_symbol_id, | ||||
|                                      unsigned int fec_source_symbol_num); | ||||
|                                      uint8_t fec_symbol_id, | ||||
|                                      uint8_t fec_source_symbol_num); | ||||
|   const uint8_t *EncodeH264FecRepair(uint8_t *payload, size_t payload_size, | ||||
|                                      unsigned int fec_symbol_id, | ||||
|                                      unsigned int fec_source_symbol_num); | ||||
|                                      uint8_t fec_symbol_id, | ||||
|                                      uint8_t fec_source_symbol_num); | ||||
|   const uint8_t *EncodeAv1(uint8_t *payload, size_t payload_size); | ||||
|  | ||||
|   size_t DecodeData(uint8_t *payload = nullptr); | ||||
| @@ -299,7 +299,7 @@ class RtpPacket { | ||||
|     ParseRtpData(); | ||||
|     return sequence_number_; | ||||
|   } | ||||
|   uint32_t Timestamp() { | ||||
|   uint64_t Timestamp() { | ||||
|     ParseRtpData(); | ||||
|     return timestamp_; | ||||
|   } | ||||
| @@ -367,7 +367,7 @@ class RtpPacket { | ||||
|  | ||||
|     if (z == 0 && y == 0 && w == 1) { | ||||
|       return true; | ||||
|     } else if (z == 0 && y == 1 & w == 1) { | ||||
|     } else if (z == 0 && y == 1 && w == 1) { | ||||
|       return true; | ||||
|     } else { | ||||
|       return false; | ||||
| @@ -382,7 +382,7 @@ class RtpPacket { | ||||
|  | ||||
|     if (z == 0 && y == 0 && w == 1) { | ||||
|       return true; | ||||
|     } else if (z == 1 && y == 0 & w == 1) { | ||||
|     } else if (z == 1 && y == 0 && w == 1) { | ||||
|       return true; | ||||
|     } else { | ||||
|       return false; | ||||
| @@ -395,14 +395,14 @@ class RtpPacket { | ||||
|  | ||||
|  private: | ||||
|   // Header | ||||
|   uint32_t version_ = 0; | ||||
|   uint8_t version_ = 0; | ||||
|   bool has_padding_ = false; | ||||
|   bool has_extension_ = false; | ||||
|   uint32_t total_csrc_number_ = 0; | ||||
|   uint8_t total_csrc_number_ = 0; | ||||
|   bool marker_ = false; | ||||
|   uint32_t payload_type_ = 0; | ||||
|   uint8_t payload_type_ = 0; | ||||
|   uint16_t sequence_number_ = 1; | ||||
|   uint32_t timestamp_ = 0; | ||||
|   uint64_t timestamp_ = 0; | ||||
|   uint32_t ssrc_ = 0; | ||||
|   std::vector<uint32_t> csrcs_; | ||||
|   uint16_t profile_ = 0; | ||||
|   | ||||
| @@ -20,7 +20,7 @@ void RtpVideoReceiver::InsertRtpPacket(RtpPacket& rtp_packet) { | ||||
|   } | ||||
|  | ||||
|   if (rtp_statistics_) { | ||||
|     rtp_statistics_->UpdateReceiveBytes(rtp_packet.Size()); | ||||
|     rtp_statistics_->UpdateReceiveBytes((uint32_t)rtp_packet.Size()); | ||||
|   } | ||||
|  | ||||
|   if (CheckIsTimeSendRR()) { | ||||
| @@ -68,6 +68,8 @@ void RtpVideoReceiver::ProcessH264RtpPacket(RtpPacket& rtp_packet) { | ||||
|       } else if (RtpPacket::NAL_UNIT_TYPE::FU_A == rtp_packet.NalUnitType()) { | ||||
|         incomplete_frame_list_[rtp_packet.SequenceNumber()] = rtp_packet; | ||||
|         bool complete = CheckIsH264FrameCompleted(rtp_packet); | ||||
|         if (!complete) { | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   } else { | ||||
| @@ -78,6 +80,8 @@ void RtpVideoReceiver::ProcessH264RtpPacket(RtpPacket& rtp_packet) { | ||||
|       } else if (RtpPacket::NAL_UNIT_TYPE::FU_A == rtp_packet.NalUnitType()) { | ||||
|         incomplete_frame_list_[rtp_packet.SequenceNumber()] = rtp_packet; | ||||
|         bool complete = CheckIsH264FrameCompleted(rtp_packet); | ||||
|         if (!complete) { | ||||
|         } | ||||
|       } | ||||
|     } else if (RtpPacket::PAYLOAD_TYPE::H264_FEC_SOURCE == | ||||
|                rtp_packet.PayloadType()) { | ||||
| @@ -179,6 +183,8 @@ void RtpVideoReceiver::ProcessAv1RtpPacket(RtpPacket& rtp_packet) { | ||||
|   if (RtpPacket::PAYLOAD_TYPE::AV1 == rtp_packet.PayloadType()) { | ||||
|     incomplete_frame_list_[rtp_packet.SequenceNumber()] = rtp_packet; | ||||
|     bool complete = CheckIsAv1FrameCompleted(rtp_packet); | ||||
|     if (!complete) { | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   // std::vector<Obu> obus = | ||||
| @@ -209,7 +215,7 @@ bool RtpVideoReceiver::CheckIsH264FrameCompleted(RtpPacket& rtp_packet) { | ||||
|         } | ||||
|  | ||||
|         size_t complete_frame_size = 0; | ||||
|         for (size_t start = it->first; start <= rtp_packet.SequenceNumber(); | ||||
|         for (uint16_t start = it->first; start <= rtp_packet.SequenceNumber(); | ||||
|              start++) { | ||||
|           memcpy(nv12_data_ + complete_frame_size, | ||||
|                  incomplete_frame_list_[start].Payload(), | ||||
| @@ -237,8 +243,7 @@ bool RtpVideoReceiver::CheckIsH264FrameCompleted(RtpPacket& rtp_packet) { | ||||
| bool RtpVideoReceiver::CheckIsAv1FrameCompleted(RtpPacket& rtp_packet) { | ||||
|   if (rtp_packet.Av1FrameEnd()) { | ||||
|     uint16_t end_seq = rtp_packet.SequenceNumber(); | ||||
|     size_t start = end_seq; | ||||
|     bool start_count = 0; | ||||
|     uint16_t start = end_seq; | ||||
|     while (end_seq--) { | ||||
|       auto it = incomplete_frame_list_.find(end_seq); | ||||
|       if (it == incomplete_frame_list_.end()) { | ||||
|   | ||||
| @@ -59,12 +59,12 @@ class RtpVideoReceiver : public ThreadBase { | ||||
|  private: | ||||
|   bool fec_enable_ = false; | ||||
|   FecDecoder fec_decoder_; | ||||
|   uint32_t last_packet_ts_ = 0; | ||||
|   uint64_t last_packet_ts_ = 0; | ||||
|   // std::map<uint16_t, RtpPacket> incomplete_fec_frame_list_; | ||||
|   // std::map<uint32_t, std::map<uint16_t, RtpPacket>> fec_source_symbol_list_; | ||||
|   // std::map<uint32_t, std::map<uint16_t, RtpPacket>> fec_repair_symbol_list_; | ||||
|   std::set<uint32_t> incomplete_fec_frame_list_; | ||||
|   std::map<uint32_t, std::map<uint16_t, RtpPacket>> incomplete_fec_packet_list_; | ||||
|   std::set<uint64_t> incomplete_fec_frame_list_; | ||||
|   std::map<uint64_t, std::map<uint16_t, RtpPacket>> incomplete_fec_packet_list_; | ||||
| }; | ||||
|  | ||||
| #endif | ||||
|   | ||||
| @@ -42,9 +42,9 @@ int RtpVideoSender::SendRtpPacket(RtpPacket& rtp_packet) { | ||||
|     return -1; | ||||
|   } | ||||
|  | ||||
|   last_send_bytes_ += rtp_packet.Size(); | ||||
|   last_send_bytes_ += (uint32_t)rtp_packet.Size(); | ||||
|   total_rtp_packets_sent_++; | ||||
|   total_rtp_payload_sent_ += rtp_packet.PayloadSize(); | ||||
|   total_rtp_payload_sent_ += (uint32_t)rtp_packet.PayloadSize(); | ||||
|  | ||||
|   if (CheckIsTimeSendSR()) { | ||||
|     RtcpSenderReport rtcp_sr; | ||||
|   | ||||
| @@ -29,6 +29,7 @@ IceTransmission::IceTransmission( | ||||
|       user_data_(user_data) {} | ||||
|  | ||||
| IceTransmission::~IceTransmission() { | ||||
|   user_data_ = nullptr; | ||||
|   video_codec_inited_ = false; | ||||
|   audio_codec_inited_ = false; | ||||
|   load_nvcodec_dll_success_ = false; | ||||
| @@ -66,12 +67,19 @@ int IceTransmission::InitIceTransmission( | ||||
|              uint32_t data_inbound_bitrate, uint32_t data_outbound_bitrate, | ||||
|              uint32_t total_inbound_bitrate, uint32_t total_outbound_bitrate) { | ||||
|         if (on_receive_net_status_report_) { | ||||
|           on_receive_net_status_report_( | ||||
|               user_id_, traversal_type_, video_inbound_bitrate, | ||||
|               video_outbound_bitrate, audio_inbound_bitrate, | ||||
|               audio_outbound_bitrate, data_inbound_bitrate, | ||||
|               data_outbound_bitrate, total_inbound_bitrate, | ||||
|               total_outbound_bitrate, nullptr); | ||||
|           XNetTrafficStats net_traffic_stats; | ||||
|           net_traffic_stats.video_in = video_inbound_bitrate; | ||||
|           net_traffic_stats.video_out = video_outbound_bitrate; | ||||
|           net_traffic_stats.audio_in = audio_inbound_bitrate; | ||||
|           net_traffic_stats.audio_out = audio_outbound_bitrate; | ||||
|           net_traffic_stats.data_in = data_inbound_bitrate; | ||||
|           net_traffic_stats.data_out = data_outbound_bitrate; | ||||
|           net_traffic_stats.total_in = total_inbound_bitrate; | ||||
|           net_traffic_stats.total_out = total_outbound_bitrate; | ||||
|  | ||||
|           on_receive_net_status_report_(user_id_.data(), user_id_.size(), | ||||
|                                         TraversalMode(traversal_type_), | ||||
|                                         &net_traffic_stats, user_data_); | ||||
|         } | ||||
|       }); | ||||
|  | ||||
| @@ -340,10 +348,21 @@ int IceTransmission::InitIceTransmission( | ||||
|             LOG_INFO("Traversal using p2p"); | ||||
|             ice_transmission_obj->traversal_type_ = TraversalType::TP2P; | ||||
|           } | ||||
|           XNetTrafficStats net_traffic_stats; | ||||
|           net_traffic_stats.video_in = 0; | ||||
|           net_traffic_stats.video_out = 0; | ||||
|           net_traffic_stats.audio_in = 0; | ||||
|           net_traffic_stats.audio_out = 0; | ||||
|           net_traffic_stats.data_in = 0; | ||||
|           net_traffic_stats.data_out = 0; | ||||
|           net_traffic_stats.total_in = 0; | ||||
|           net_traffic_stats.total_out = 0; | ||||
|  | ||||
|           ice_transmission_obj->on_receive_net_status_report_( | ||||
|               ice_transmission_obj->user_id_, | ||||
|               ice_transmission_obj->traversal_type_, 0, 0, 0, 0, 0, 0, 0, 0, | ||||
|               nullptr); | ||||
|               ice_transmission_obj->user_id_.data(), | ||||
|               ice_transmission_obj->user_id_.size(), | ||||
|               TraversalMode(ice_transmission_obj->traversal_type_), | ||||
|               &net_traffic_stats, ice_transmission_obj->user_data_); | ||||
|         } | ||||
|       }, | ||||
|       [](NiceAgent *agent, guint stream_id, guint component_id, guint size, | ||||
| @@ -935,7 +954,7 @@ IceTransmission::GetNegotiatedCapabilities() { | ||||
|   return {negotiated_video_pt_, negotiated_audio_pt_, negotiated_data_pt_}; | ||||
| } | ||||
|  | ||||
| int IceTransmission::SendVideoData(const XVideoFrame *video_frame) { | ||||
| int IceTransmission::SendVideoFrame(const XVideoFrame *video_frame) { | ||||
|   if (state_ != NICE_COMPONENT_STATE_CONNECTED && | ||||
|       state_ != NICE_COMPONENT_STATE_READY) { | ||||
|     LOG_ERROR("Ice is not connected, state = [{}]", | ||||
| @@ -974,7 +993,7 @@ int IceTransmission::SendVideoData(const XVideoFrame *video_frame) { | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| int IceTransmission::SendAudioData(const char *data, size_t size) { | ||||
| int IceTransmission::SendAudioFrame(const char *data, size_t size) { | ||||
|   if (state_ != NICE_COMPONENT_STATE_CONNECTED && | ||||
|       state_ != NICE_COMPONENT_STATE_READY) { | ||||
|     LOG_ERROR("Ice is not connected, state = [{}]", | ||||
| @@ -999,7 +1018,7 @@ int IceTransmission::SendAudioData(const char *data, size_t size) { | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| int IceTransmission::SendUserData(const char *data, size_t size) { | ||||
| int IceTransmission::SendDataFrame(const char *data, size_t size) { | ||||
|   if (state_ != NICE_COMPONENT_STATE_CONNECTED && | ||||
|       state_ != NICE_COMPONENT_STATE_READY) { | ||||
|     LOG_ERROR("Ice is not connected, state = [{}]", | ||||
|   | ||||
| @@ -85,10 +85,8 @@ class IceTransmission { | ||||
|   } | ||||
|  | ||||
|   void SetOnReceiveNetStatusReportFunc( | ||||
|       std::function<void(const std::string &, TraversalType, const uint64_t, | ||||
|                          const uint64_t, const uint64_t, const uint64_t, | ||||
|                          const uint64_t, const uint64_t, const uint64_t, | ||||
|                          const uint64_t, void *)> | ||||
|       std::function<void(const char *, const size_t, TraversalMode, | ||||
|                          const XNetTrafficStats *, void *)> | ||||
|           on_receive_net_status_report) { | ||||
|     on_receive_net_status_report_ = on_receive_net_status_report; | ||||
|   } | ||||
| @@ -97,11 +95,11 @@ class IceTransmission { | ||||
|  | ||||
|   int SetTransmissionId(const std::string &transmission_id); | ||||
|  | ||||
|   int SendVideoData(const XVideoFrame *video_frame); | ||||
|   int SendVideoFrame(const XVideoFrame *video_frame); | ||||
|  | ||||
|   int SendAudioData(const char *data, size_t size); | ||||
|   int SendAudioFrame(const char *data, size_t size); | ||||
|  | ||||
|   int SendUserData(const char *data, size_t size); | ||||
|   int SendDataFrame(const char *data, size_t size); | ||||
|  | ||||
|  public: | ||||
|   int GatherCandidates(); | ||||
| @@ -176,10 +174,8 @@ class IceTransmission { | ||||
|   std::function<void(std::string, const std::string &)> on_ice_status_change_ = | ||||
|       nullptr; | ||||
|  | ||||
|   std::function<void(const std::string &, TraversalType, const uint64_t, | ||||
|                      const uint64_t, const uint64_t, const uint64_t, | ||||
|                      const uint64_t, const uint64_t, const uint64_t, | ||||
|                      const uint64_t, void *)> | ||||
|   std::function<void(const char *, const size_t, TraversalMode, | ||||
|                      const XNetTrafficStats *, void *)> | ||||
|       on_receive_net_status_report_ = nullptr; | ||||
|  | ||||
|  private: | ||||
|   | ||||
| @@ -22,13 +22,16 @@ includes("thirdparty") | ||||
|  | ||||
| if is_os("windows") then | ||||
|     add_defines("_WEBSOCKETPP_CPP11_INTERNAL_") | ||||
|     -- add_cxflags("/W4", "/WX") | ||||
|     add_cxflags("/W4") | ||||
| elseif is_os("linux") then | ||||
|     add_requires("glib", {system = true}) | ||||
|     add_packages("glib") | ||||
|     add_cxflags("-fPIC")  | ||||
|     add_cxflags("-fPIC", "-Wno-unused-variable")  | ||||
|     add_syslinks("pthread") | ||||
| elseif is_os("macosx") then | ||||
|     add_ldflags("-Wl,-ld_classic") | ||||
|     add_cxflags("-Wno-unused-variable") | ||||
| end | ||||
|  | ||||
| target("log") | ||||
|   | ||||
		Reference in New Issue
	
	Block a user