diff --git a/src/channel/rtp_channel/rtp_video_receiver.h b/src/channel/rtp_channel/rtp_video_receiver.h index b708516..0f6d92b 100644 --- a/src/channel/rtp_channel/rtp_video_receiver.h +++ b/src/channel/rtp_channel/rtp_video_receiver.h @@ -14,7 +14,7 @@ #include "rtcp_receiver_report.h" #include "rtp_packet_av1.h" #include "rtp_packet_h264.h" -#include "rtp_rtcp_defines.h " +#include "rtp_rtcp_defines.h" #include "rtp_statistics.h" #include "thread_base.h" #include "video_frame.h" diff --git a/src/common/copy_on_write_buffer.h b/src/common/copy_on_write_buffer.h index 16aacfb..eaf70c4 100644 --- a/src/common/copy_on_write_buffer.h +++ b/src/common/copy_on_write_buffer.h @@ -38,7 +38,7 @@ class CopyOnWriteBuffer { private: void EnsureUnique() { - if (!buffer_.unique()) { + if (buffer_.use_count() != 1) { buffer_ = std::make_shared>(*buffer_); } } diff --git a/src/common/rtc_base/ref_counter.h b/src/common/rtc_base/ref_counter.h index 7983c89..af25391 100644 --- a/src/common/rtc_base/ref_counter.h +++ b/src/common/rtc_base/ref_counter.h @@ -12,7 +12,7 @@ #include -#include "ref_count.h" +#include "api/ref_count.h" namespace webrtc { namespace webrtc_impl { diff --git a/src/common/rtc_base/system_time.cc b/src/common/rtc_base/system_time.cc index 6ae171b..aae087b 100644 --- a/src/common/rtc_base/system_time.cc +++ b/src/common/rtc_base/system_time.cc @@ -18,10 +18,10 @@ #if defined(__POSIX__) #include +#endif #if defined(__APPLE__) #include #endif -#endif #if defined(_WIN32) // clang-format off diff --git a/src/common/rtc_base/time_utils.cc b/src/common/rtc_base/time_utils.cc index b341da9..daf983c 100644 --- a/src/common/rtc_base/time_utils.cc +++ b/src/common/rtc_base/time_utils.cc @@ -15,13 +15,12 @@ #endif #include "rtc_base/numerics/safe_conversions.h" +#include "rtc_base/system_time.h" #include "rtc_base/time_utils.h" -#include "system_time.h" -#if defined(_WIN32) -#include "rtc_base/win32.h" -#endif #if defined(_WIN32) #include + +#include "rtc_base/win32.h" #endif namespace rtc { @@ -228,6 +227,7 @@ int64_t TimeUTCMicros() { return (li.QuadPart - kFileTimeToUnixTimeEpochOffset) / kFileTimeToMicroSeconds; #endif + return 0; } int64_t TimeUTCMillis() { return TimeUTCMicros() / kNumMicrosecsPerMillisec; } diff --git a/src/common/rtc_base/time_utils.h b/src/common/rtc_base/time_utils.h index 7c80cb2..98bbc59 100644 --- a/src/common/rtc_base/time_utils.h +++ b/src/common/rtc_base/time_utils.h @@ -14,7 +14,7 @@ #include #include -#include "system_time.h" +#include "rtc_base/system_time.h" namespace rtc { diff --git a/src/qos/transport_feedback_adapter.cc b/src/qos/transport_feedback_adapter.cc index 243d509..a313660 100644 --- a/src/qos/transport_feedback_adapter.cc +++ b/src/qos/transport_feedback_adapter.cc @@ -96,6 +96,7 @@ void TransportFeedbackAdapter::AddPacket(const RtpPacketToSend& packet_to_send, feedback.sent.sequence_number = seq_num_unwrapper_.Unwrap( packet_to_send.transport_sequence_number().value_or(0)); feedback.sent.size = DataSize::Bytes(packet_to_send.size() + overhead_bytes); + LOG_WARN("!!! packet_to_send.size: {}", packet_to_send.size()); feedback.sent.audio = packet_to_send.packet_type() == RtpPacketMediaType::kAudio; feedback.network_route = network_route_; diff --git a/src/rtp/rtp_packetizer/rtp_packetizer_generic.cpp b/src/rtp/rtp_packetizer/rtp_packetizer_generic.cpp index 7d5ff2d..a412bd0 100644 --- a/src/rtp/rtp_packetizer/rtp_packetizer_generic.cpp +++ b/src/rtp/rtp_packetizer/rtp_packetizer_generic.cpp @@ -24,9 +24,9 @@ std::vector RtpPacketizerGeneric::Build(uint8_t* payload, payload_size / MAX_NALU_LEN + (last_packet_size ? 1 : 0); // TODO: use frame timestamp - timestamp_ = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()) - .count(); + uint64_t timestamp = std::chrono::duration_cast( + std::chrono::system_clock::now().time_since_epoch()) + .count(); std::vector rtp_packets; for (uint32_t index = 0; index < packet_num; index++) { @@ -37,11 +37,10 @@ std::vector RtpPacketizerGeneric::Build(uint8_t* payload, marker_ = index == packet_num - 1 ? 1 : 0; payload_type_ = rtp::PAYLOAD_TYPE(payload_type_); sequence_number_++; - timestamp_ = timestamp_; + timestamp_ = timestamp; ssrc_ = ssrc_; if (!csrc_count_) { - csrcs_ = csrcs_; } rtp_packet_frame_.clear(); diff --git a/src/rtp/rtp_packetizer/rtp_packetizer_h264.cpp b/src/rtp/rtp_packetizer/rtp_packetizer_h264.cpp index 408123d..54b11e9 100644 --- a/src/rtp/rtp_packetizer/rtp_packetizer_h264.cpp +++ b/src/rtp/rtp_packetizer/rtp_packetizer_h264.cpp @@ -81,10 +81,8 @@ std::vector RtpPacketizerH264::BuildNalu(uint8_t* payload, timestamp_ = std::chrono::duration_cast( std::chrono::system_clock::now().time_since_epoch()) .count(); - ssrc_ = ssrc_; if (!csrc_count_) { - csrcs_ = csrcs_; } rtp::FU_INDICATOR fu_indicator; @@ -141,9 +139,9 @@ std::vector RtpPacketizerH264::BuildFua(uint8_t* payload, payload_size / MAX_NALU_LEN + (last_packet_size ? 1 : 0); // TODO: use frame timestamp - timestamp_ = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()) - .count(); + uint64_t timestamp = std::chrono::duration_cast( + std::chrono::system_clock::now().time_since_epoch()) + .count(); for (uint32_t index = 0; index < packet_num; index++) { version_ = kRtpVersion; @@ -153,7 +151,7 @@ std::vector RtpPacketizerH264::BuildFua(uint8_t* payload, marker_ = (index == (packet_num - 1)) ? 1 : 0; payload_type_ = rtp::PAYLOAD_TYPE(payload_type_); sequence_number_++; - timestamp_ = timestamp_; + timestamp_ = timestamp; ssrc_ = ssrc_; if (!csrc_count_) { diff --git a/src/rtp/rtp_packetizer/rtp_packetizer_h264.h b/src/rtp/rtp_packetizer/rtp_packetizer_h264.h index 05441a1..5c97153 100644 --- a/src/rtp/rtp_packetizer/rtp_packetizer_h264.h +++ b/src/rtp/rtp_packetizer/rtp_packetizer_h264.h @@ -18,11 +18,9 @@ class RtpPacketizerH264 : public RtpPacketizer { std::vector Build(uint8_t* payload, uint32_t payload_size) override; - std::vector RtpPacketizerH264::BuildNalu(uint8_t* payload, - uint32_t payload_size); + std::vector BuildNalu(uint8_t* payload, uint32_t payload_size); - std::vector RtpPacketizerH264::BuildFua(uint8_t* payload, - uint32_t payload_size); + std::vector BuildFua(uint8_t* payload, uint32_t payload_size); private: bool EncodeH264Fua(RtpPacket& rtp_packet, uint8_t* payload, diff --git a/xmake.lua b/xmake.lua index 3b2dbbd..4211b1a 100644 --- a/xmake.lua +++ b/xmake.lua @@ -48,6 +48,9 @@ target("common") "src/common/rtc_base/numerics/*.cc", "src/common/api/units/*.cc", "src/common/api/transport/*.cc") + if not is_os("windows") then + remove_files("src/common/rtc_base/win32.cc") + end add_includedirs("src/common", {public = true}) target("inih")