mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-27 04:35:34 +08:00
[fix] update qos module
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* @Author: DI JUNKUN
|
* @Author: DI JUNKUN
|
||||||
* @Date: 2024-12-18
|
* @Date: 2024-12-18
|
||||||
* Copyright (c) 2024 by DI JUNKUN, All Rights Reserved.
|
* Copyright 2018 The WebRTC project authors. All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _ARRAY_VIEW_H_
|
#ifndef _ARRAY_VIEW_H_
|
||||||
|
|||||||
@@ -1,15 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
|
* @Author: DI JUNKUN
|
||||||
*
|
* @Date: 2024-12-18
|
||||||
* Use of this source code is governed by a BSD-style license
|
* Copyright 2018 The WebRTC project authors. All Rights Reserved.
|
||||||
* that can be found in the LICENSE file in the root of the source
|
|
||||||
* tree. An additional intellectual property rights grant can be found
|
|
||||||
* in the file PATENTS. All contributing project authors may
|
|
||||||
* be found in the AUTHORS file in the root of the source tree.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MODULES_RTP_RTCP_SOURCE_BYTE_IO_H_
|
#ifndef _BYTE_IO_H_
|
||||||
#define MODULES_RTP_RTCP_SOURCE_BYTE_IO_H_
|
#define _BYTE_IO_H_
|
||||||
|
|
||||||
// This file contains classes for reading and writing integer types from/to
|
// This file contains classes for reading and writing integer types from/to
|
||||||
// byte array representations. Signed/unsigned, partial (whole byte) sizes,
|
// byte array representations. Signed/unsigned, partial (whole byte) sizes,
|
||||||
@@ -391,4 +387,4 @@ class ByteWriter<T, 8, false> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MODULES_RTP_RTCP_SOURCE_BYTE_IO_H_
|
#endif
|
||||||
@@ -1,22 +1,16 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 The WebRTC Project Authors. All rights reserved.
|
* @Author: DI JUNKUN
|
||||||
*
|
* @Date: 2024-12-18
|
||||||
* Use of this source code is governed by a BSD-style license
|
* Copyright 2018 The WebRTC project authors. All Rights Reserved.
|
||||||
* that can be found in the LICENSE file in the root of the source
|
|
||||||
* tree. An additional intellectual property rights grant can be found
|
|
||||||
* in the file PATENTS. All contributing project authors may
|
|
||||||
* be found in the AUTHORS file in the root of the source tree.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef RTC_BASE_TYPE_TRAITS_H_
|
#ifndef _TYPE_TRAITS_H_
|
||||||
#define RTC_BASE_TYPE_TRAITS_H_
|
#define _TYPE_TRAITS_H_
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
namespace rtc {
|
|
||||||
|
|
||||||
// Determines if the given class has zero-argument .data() and .size() methods
|
// Determines if the given class has zero-argument .data() and .size() methods
|
||||||
// whose return values are convertible to T* and size_t, respectively.
|
// whose return values are convertible to T* and size_t, respectively.
|
||||||
template <typename DS, typename T>
|
template <typename DS, typename T>
|
||||||
@@ -136,6 +130,4 @@ static_assert(!IsIntlike<S>::value, "");
|
|||||||
|
|
||||||
} // namespace test_enum_intlike
|
} // namespace test_enum_intlike
|
||||||
|
|
||||||
} // namespace rtc
|
#endif
|
||||||
|
|
||||||
#endif // RTC_BASE_TYPE_TRAITS_H_
|
|
||||||
@@ -4,17 +4,19 @@
|
|||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
void CongestionControlFeedbackTracker::ReceivedPacket(
|
void CongestionControlFeedbackTracker::ReceivedPacket(
|
||||||
const RtpPacketReceived& packet) {
|
const RtpPacketReceived& packet) {
|
||||||
int64_t unwrapped_sequence_number =
|
int64_t unwrapped_sequence_number =
|
||||||
unwrapper_.Unwrap(packet.SequenceNumber());
|
unwrapper_.Unwrap(packet.SequenceNumber());
|
||||||
if (last_sequence_number_in_feedback_ &&
|
if (last_sequence_number_in_feedback_ &&
|
||||||
unwrapped_sequence_number < *last_sequence_number_in_feedback_ + 1) {
|
unwrapped_sequence_number < *last_sequence_number_in_feedback_ + 1) {
|
||||||
RTC_LOG(LS_WARNING)
|
LOG_WARN(
|
||||||
<< "Received packet unorderered between feeedback. SSRC: "
|
"Received packet unorderered between feeedback. SSRC: {} Seq: {} last "
|
||||||
<< packet.Ssrc() << " Seq: " << packet.SequenceNumber()
|
"feedback: {}",
|
||||||
<< " last feedback: "
|
packet.Ssrc(), packet.SequenceNumber(),
|
||||||
<< static_cast<uint16_t>(*last_sequence_number_in_feedback_);
|
static_cast<uint16_t>(*last_sequence_number_in_feedback_));
|
||||||
// TODO: bugs.webrtc.org/374550342 - According to spec, the old packets
|
// TODO: bugs.webrtc.org/374550342 - According to spec, the old packets
|
||||||
// should be reported again. But at the moment, we dont store history of
|
// should be reported again. But at the moment, we dont store history of
|
||||||
// packet we already reported and thus, they will be reported as lost. Note
|
// packet we already reported and thus, they will be reported as lost. Note
|
||||||
@@ -49,8 +51,14 @@ void CongestionControlFeedbackTracker::AddPacketsToFeedback(
|
|||||||
for (int64_t sequence_number = *last_sequence_number_in_feedback_ + 1;
|
for (int64_t sequence_number = *last_sequence_number_in_feedback_ + 1;
|
||||||
sequence_number <= packets_.back().unwrapped_sequence_number;
|
sequence_number <= packets_.back().unwrapped_sequence_number;
|
||||||
++sequence_number) {
|
++sequence_number) {
|
||||||
RTC_DCHECK(packet_it != packets_.end());
|
if (packet_it == packets_.end()) {
|
||||||
RTC_DCHECK_EQ(ssrc, packet_it->ssrc);
|
LOG_FATAL("Invalid packet_it");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (ssrc != packet_it->ssrc) {
|
||||||
|
LOG_FATAL("Invalid ssrc");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
rtc::EcnMarking ecn = rtc::EcnMarking::kNotEct;
|
rtc::EcnMarking ecn = rtc::EcnMarking::kNotEct;
|
||||||
TimeDelta arrival_time_offset = TimeDelta::MinusInfinity();
|
TimeDelta arrival_time_offset = TimeDelta::MinusInfinity();
|
||||||
@@ -70,9 +78,8 @@ void CongestionControlFeedbackTracker::AddPacketsToFeedback(
|
|||||||
if (packet_it->ecn == rtc::EcnMarking::kCe) {
|
if (packet_it->ecn == rtc::EcnMarking::kCe) {
|
||||||
ecn = rtc::EcnMarking::kCe;
|
ecn = rtc::EcnMarking::kCe;
|
||||||
}
|
}
|
||||||
RTC_LOG(LS_WARNING) << "Received duplicate packet ssrc:" << ssrc
|
LOG_WARN("Received duplicate packet ssrc: {} seq: {} ecn: {}", ssrc,
|
||||||
<< " seq:" << static_cast<uint16_t>(sequence_number)
|
static_cast<uint16_t>(sequence_number), static_cast<int>(ecn));
|
||||||
<< " ecn: " << static_cast<int>(ecn);
|
|
||||||
++packet_it;
|
++packet_it;
|
||||||
}
|
}
|
||||||
} // else - the packet has not been received yet.
|
} // else - the packet has not been received yet.
|
||||||
@@ -126,8 +126,8 @@ void ReceiveSideCongestionController::OnBitrateChanged(int bitrate_bps) {
|
|||||||
send_bandwidth_estimate);
|
send_bandwidth_estimate);
|
||||||
}
|
}
|
||||||
|
|
||||||
TimeDelta ReceiveSideCongestionController::MaybeProcess() {
|
int64_t ReceiveSideCongestionController::MaybeProcess() {
|
||||||
Timestamp now = env_.clock().CurrentTime();
|
int64_t now = env_.clock().CurrentTime();
|
||||||
if (send_rfc8888_congestion_feedback_) {
|
if (send_rfc8888_congestion_feedback_) {
|
||||||
RTC_DCHECK_RUN_ON(&sequence_checker_);
|
RTC_DCHECK_RUN_ON(&sequence_checker_);
|
||||||
return congestion_control_feedback_generator_.Process(now);
|
return congestion_control_feedback_generator_.Process(now);
|
||||||
@@ -8,13 +8,14 @@
|
|||||||
#define _RECEIVE_SIDE_CONGESTION_CONTROLLER_H_
|
#define _RECEIVE_SIDE_CONGESTION_CONTROLLER_H_
|
||||||
|
|
||||||
class ReceiveSideCongestionController {
|
class ReceiveSideCongestionController {
|
||||||
|
public:
|
||||||
|
enum MediaType { VIDEO, AUDIO, DATA };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ReceiveSideCongestionController();
|
ReceiveSideCongestionController();
|
||||||
~ReceiveSideCongestionController() override = default;
|
~ReceiveSideCongestionController() override = default;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void EnablSendCongestionControlFeedbackAccordingToRfc8888();
|
|
||||||
|
|
||||||
void OnReceivedPacket(const RtpPacketReceived& packet, MediaType media_type);
|
void OnReceivedPacket(const RtpPacketReceived& packet, MediaType media_type);
|
||||||
|
|
||||||
// Implements CallStatsObserver.
|
// Implements CallStatsObserver.
|
||||||
@@ -39,13 +40,11 @@ class ReceiveSideCongestionController {
|
|||||||
|
|
||||||
// Runs periodic tasks if it is time to run them, returns time until next
|
// Runs periodic tasks if it is time to run them, returns time until next
|
||||||
// call to `MaybeProcess` should be non idle.
|
// call to `MaybeProcess` should be non idle.
|
||||||
TimeDelta MaybeProcess();
|
int64_t MaybeProcess();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void PickEstimator(bool has_absolute_send_time)
|
void PickEstimator(bool has_absolute_send_time);
|
||||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
|
|
||||||
|
|
||||||
const Environment env_;
|
|
||||||
RembThrottler remb_throttler_;
|
RembThrottler remb_throttler_;
|
||||||
|
|
||||||
// TODO: bugs.webrtc.org/42224904 - Use sequence checker for all usage of
|
// TODO: bugs.webrtc.org/42224904 - Use sequence checker for all usage of
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ target("media")
|
|||||||
|
|
||||||
target("qos")
|
target("qos")
|
||||||
set_kind("object")
|
set_kind("object")
|
||||||
add_deps("log")
|
add_deps("log", "rtp")
|
||||||
add_files("src/qos/*.cpp")
|
add_files("src/qos/*.cpp")
|
||||||
add_includedirs("src/qos", {public = true})
|
add_includedirs("src/qos", {public = true})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user