summaryrefslogtreecommitdiffstats
path: root/libtransport/src/protocols/rtc
diff options
context:
space:
mode:
Diffstat (limited to 'libtransport/src/protocols/rtc')
-rw-r--r--libtransport/src/protocols/rtc/rtc.cc6
-rw-r--r--libtransport/src/protocols/rtc/rtc_consts.h2
-rw-r--r--libtransport/src/protocols/rtc/rtc_data_path.cc6
-rw-r--r--libtransport/src/protocols/rtc/rtc_ldr.cc22
-rw-r--r--libtransport/src/protocols/rtc/rtc_packet.h22
-rw-r--r--libtransport/src/protocols/rtc/rtc_rc_queue.cc6
-rw-r--r--libtransport/src/protocols/rtc/rtc_state.cc2
-rw-r--r--libtransport/src/protocols/rtc/rtc_state.h2
8 files changed, 36 insertions, 32 deletions
diff --git a/libtransport/src/protocols/rtc/rtc.cc b/libtransport/src/protocols/rtc/rtc.cc
index bb95ab686..46659ac74 100644
--- a/libtransport/src/protocols/rtc/rtc.cc
+++ b/libtransport/src/protocols/rtc/rtc.cc
@@ -220,11 +220,11 @@ void RTCTransportProtocol::updateSyncWindow() {
// if some of the info are not available do not update the current win
if (prod_rate != 0.0 && rtt != 0.0 && packet_size != 0.0) {
current_sync_win_ = (uint32_t)ceil(prod_rate * rtt / packet_size);
- current_sync_win_ +=
+ current_sync_win_ += (uint32_t)
ceil(prod_rate * (PRODUCER_BUFFER_MS / MILLI_IN_A_SEC) / packet_size);
if(current_state_ == SyncState::catch_up) {
- current_sync_win_ = current_sync_win_ * CATCH_UP_WIN_INCREMENT;
+ current_sync_win_ = (uint32_t) (current_sync_win_ * CATCH_UP_WIN_INCREMENT);
}
current_sync_win_ = std::min(current_sync_win_, max_sync_win_);
@@ -515,7 +515,7 @@ void RTCTransportProtocol::onContentObject(Interest &interest,
ContentObject &content_object) {
TRANSPORT_LOGD("Received content object of size: %zu",
content_object.payloadSize());
- uint32_t payload_size = content_object.payloadSize();
+ uint32_t payload_size = (uint32_t) content_object.payloadSize();
uint32_t segment_number = content_object.getName().getSuffix();
if (segment_number >= MIN_PROBE_SEQ) {
diff --git a/libtransport/src/protocols/rtc/rtc_consts.h b/libtransport/src/protocols/rtc/rtc_consts.h
index 0cf9516ab..e172fc7a1 100644
--- a/libtransport/src/protocols/rtc/rtc_consts.h
+++ b/libtransport/src/protocols/rtc/rtc_consts.h
@@ -97,7 +97,7 @@ const double MAX_CACHED_PACKETS = 262144; // 2^18
// about 50 sec of traffic at 50Mbps
// with 1200 bytes packets
-const uint32_t MAX_ROUND_WHIOUT_PACKETS =
+const uint32_t MAX_ROUND_WHIOUT_PACKETS = (const uint32_t)
(20 * MILLI_IN_A_SEC) / ROUND_LEN; // 20 sec in rounds;
// used in ldr
diff --git a/libtransport/src/protocols/rtc/rtc_data_path.cc b/libtransport/src/protocols/rtc/rtc_data_path.cc
index c098088a3..a545225cb 100644
--- a/libtransport/src/protocols/rtc/rtc_data_path.cc
+++ b/libtransport/src/protocols/rtc/rtc_data_path.cc
@@ -69,7 +69,7 @@ void RTCDataPath::insertOwdSample(int64_t owd) {
if (avg_owd != DBL_MAX)
avg_owd = (avg_owd * (1 - ALPHA_RTC)) + (owd * ALPHA_RTC);
else {
- avg_owd = owd;
+ avg_owd = (double)owd;
}
int64_t queueVal = owd - std::min(getMinOwd(), min_owd);
@@ -77,7 +77,7 @@ void RTCDataPath::insertOwdSample(int64_t owd) {
if (queuing_delay != DBL_MAX)
queuing_delay = (queuing_delay * (1 - ALPHA_RTC)) + (queueVal * ALPHA_RTC);
else {
- queuing_delay = queueVal;
+ queuing_delay = (double)queueVal;
}
// keep track of the jitter computed as for RTP (RFC 3550)
@@ -100,7 +100,7 @@ void RTCDataPath::computeInterArrivalGap(uint32_t segment_number) {
largest_recv_seq_ = segment_number;
largest_recv_seq_time_ = now;
if (avg_inter_arrival_ == DBL_MAX)
- avg_inter_arrival_ = delta;
+ avg_inter_arrival_ = (double)delta;
else
avg_inter_arrival_ =
(avg_inter_arrival_ * (1 - ALPHA_RTC)) + (delta * ALPHA_RTC);
diff --git a/libtransport/src/protocols/rtc/rtc_ldr.cc b/libtransport/src/protocols/rtc/rtc_ldr.cc
index e91b29c04..0ef381fe1 100644
--- a/libtransport/src/protocols/rtc/rtc_ldr.cc
+++ b/libtransport/src/protocols/rtc/rtc_ldr.cc
@@ -40,7 +40,7 @@ RTCLossDetectionAndRecovery::~RTCLossDetectionAndRecovery() {}
void RTCLossDetectionAndRecovery::turnOnRTX() {
rtx_on_ = true;
- scheduleSentinelTimer(state_->getRTT() * CATCH_UP_RTT_INCREMENT);
+ scheduleSentinelTimer((uint32_t)(state_->getRTT() * CATCH_UP_RTT_INCREMENT));
}
void RTCLossDetectionAndRecovery::turnOffRTX() {
@@ -182,8 +182,8 @@ uint64_t RTCLossDetectionAndRecovery::computeNextSend(uint32_t seq,
if (prod_rate != 0) {
double packet_size = state_->getAveragePacketSize();
- estimated_iat = ceil(1000.0 / (prod_rate / packet_size));
- jitter = ceil(state_->getJitter());
+ estimated_iat = (uint32_t)ceil(1000.0 / (prod_rate / packet_size));
+ jitter = (uint32_t)ceil(state_->getJitter());
}
uint32_t wait = estimated_iat + jitter;
@@ -202,20 +202,20 @@ uint64_t RTCLossDetectionAndRecovery::computeNextSend(uint32_t seq,
}
double packet_size = state_->getAveragePacketSize();
- uint32_t estimated_iat = ceil(1000.0 / (prod_rate / packet_size));
+ uint32_t estimated_iat = (uint32_t)ceil(1000.0 / (prod_rate / packet_size));
uint64_t rtt = state_->getRTT();
if (rtt == 0) rtt = SENTINEL_TIMER_INTERVAL;
- wait = rtt;
+ wait = (uint32_t)rtt;
if (estimated_iat > rtt) wait = estimated_iat;
- uint32_t jitter = ceil(state_->getJitter());
+ uint32_t jitter = (uint32_t)ceil(state_->getJitter());
wait += jitter;
// it may happen that the channel is congested and we have some additional
// queuing delay to take into account
- uint32_t queue = ceil(state_->getQueuing());
+ uint32_t queue = (uint32_t)ceil(state_->getQueuing());
wait += queue;
TRANSPORT_LOGD(
@@ -389,8 +389,8 @@ void RTCLossDetectionAndRecovery::sentinelTimer() {
} else {
double prod_rate = state_->getProducerRate();
double packet_size = state_->getAveragePacketSize();
- uint32_t estimated_iat = ceil(1000.0 / (prod_rate / packet_size));
- uint32_t jitter = ceil(state_->getJitter());
+ uint32_t estimated_iat = (uint32_t)ceil(1000.0 / (prod_rate / packet_size));
+ uint32_t jitter = (uint32_t)ceil(state_->getJitter());
// try to reduce the number of timers if the estimated IAT is too small
next_timer = std::max((estimated_iat + jitter) * 20, (uint32_t)1);
@@ -400,7 +400,7 @@ void RTCLossDetectionAndRecovery::sentinelTimer() {
if (!expired) {
// discount the amout of time that is already passed
- uint32_t discount = now - last_event_;
+ uint32_t discount = (uint32_t)(now - last_event_);
if (next_timer > discount) {
next_timer = next_timer - discount;
} else {
@@ -411,7 +411,7 @@ void RTCLossDetectionAndRecovery::sentinelTimer() {
} else if (sent) {
// wait at least one producer stats interval + owd to check if the
// production rate is reducing.
- uint32_t min_wait = PRODUCER_STATS_INTERVAL + ceil(state_->getQueuing());
+ uint32_t min_wait = PRODUCER_STATS_INTERVAL + (uint32_t)ceil(state_->getQueuing());
next_timer = std::max(next_timer, min_wait);
TRANSPORT_LOGD("wait for updates from prod, next timer: %u", next_timer);
}
diff --git a/libtransport/src/protocols/rtc/rtc_packet.h b/libtransport/src/protocols/rtc/rtc_packet.h
index abb1323a3..2f2b19fb9 100644
--- a/libtransport/src/protocols/rtc/rtc_packet.h
+++ b/libtransport/src/protocols/rtc/rtc_packet.h
@@ -25,7 +25,11 @@
*/
#pragma once
+#ifndef _WIN32
#include <arpa/inet.h>
+#else
+#include <hicn/transport/portability/win_portability.h>
+#endif
namespace transport {
@@ -37,14 +41,14 @@ inline uint64_t _ntohll(const uint64_t *input) {
uint64_t return_val;
uint8_t *tmp = (uint8_t *)&return_val;
- tmp[0] = *input >> 56;
- tmp[1] = *input >> 48;
- tmp[2] = *input >> 40;
- tmp[3] = *input >> 32;
- tmp[4] = *input >> 24;
- tmp[5] = *input >> 16;
- tmp[6] = *input >> 8;
- tmp[7] = *input >> 0;
+ tmp[0] = (uint8_t)(*input >> 56);
+ tmp[1] = (uint8_t)(*input >> 48);
+ tmp[2] = (uint8_t)(*input >> 40);
+ tmp[3] = (uint8_t)(*input >> 32);
+ tmp[4] = (uint8_t)(*input >> 24);
+ tmp[5] = (uint8_t)(*input >> 16);
+ tmp[6] = (uint8_t)(*input >> 8);
+ tmp[7] = (uint8_t)(*input >> 0);
return return_val;
}
@@ -86,4 +90,4 @@ struct nack_packet_t {
} // end namespace protocol
-} // end namespace transport
+} // end namespace transport \ No newline at end of file
diff --git a/libtransport/src/protocols/rtc/rtc_rc_queue.cc b/libtransport/src/protocols/rtc/rtc_rc_queue.cc
index a1c89e329..3c7318dae 100644
--- a/libtransport/src/protocols/rtc/rtc_rc_queue.cc
+++ b/libtransport/src/protocols/rtc/rtc_rc_queue.cc
@@ -67,11 +67,11 @@ void RTCRateControlQueue::onNewRound(double round_len) {
if (prev_congestion_state == CongestionState::Normal) {
// init the congetion window using the received rate
congestion_win_ = (uint32_t)ceil(received_rate * rtt / packet_size);
- rounds_since_last_drop_ = ROUNDS_BEFORE_TAKE_ACTION + 1;
+ rounds_since_last_drop_ = (uint32_t)ROUNDS_BEFORE_TAKE_ACTION + 1;
}
if (rounds_since_last_drop_ >= ROUNDS_BEFORE_TAKE_ACTION) {
- uint32_t win = congestion_win_ * WIN_DECREASE_FACTOR;
+ uint32_t win = congestion_win_ * (uint32_t)WIN_DECREASE_FACTOR;
congestion_win_ = std::max(win, WIN_MIN);
rounds_since_last_drop_ = 0;
return;
@@ -88,7 +88,7 @@ void RTCRateControlQueue::onNewRound(double round_len) {
rounds_without_congestion_++;
if (rounds_without_congestion_ < ROUNDS_BEFORE_TAKE_ACTION) return;
- congestion_win_ = congestion_win_ * WIN_INCREASE_FACTOR;
+ congestion_win_ = congestion_win_ * (uint32_t)WIN_INCREASE_FACTOR;
congestion_win_ = std::min(congestion_win_, INITIAL_WIN_MAX);
}
}
diff --git a/libtransport/src/protocols/rtc/rtc_state.cc b/libtransport/src/protocols/rtc/rtc_state.cc
index eabf8942c..9c965bfed 100644
--- a/libtransport/src/protocols/rtc/rtc_state.cc
+++ b/libtransport/src/protocols/rtc/rtc_state.cc
@@ -547,7 +547,7 @@ void RTCState::checkInitRttTimer() {
double prod_rate = getProducerRate();
double rtt = (double)getRTT() / MILLI_IN_A_SEC;
double packet_size = getAveragePacketSize();
- uint32_t pkt_in_rtt_ = std::floor(((prod_rate / packet_size) * rtt) * 0.8);
+ uint32_t pkt_in_rtt_ = (uint32_t)std::floor(((prod_rate / packet_size) * rtt) * 0.8);
last_seq_nacked_ = last_production_seq_ + pkt_in_rtt_;
discovered_rtt_callback_();
diff --git a/libtransport/src/protocols/rtc/rtc_state.h b/libtransport/src/protocols/rtc/rtc_state.h
index 943a0a113..e4fefaffe 100644
--- a/libtransport/src/protocols/rtc/rtc_state.h
+++ b/libtransport/src/protocols/rtc/rtc_state.h
@@ -102,7 +102,7 @@ class RTCState : std::enable_shared_from_this<RTCState> {
return false;
}
uint32_t getPendingInterestNumber() const {
- return pending_interests_.size();
+ return (uint32_t)pending_interests_.size();
}
PacketState isReceivedOrLost(uint32_t seq) {
auto it = received_or_lost_packets_.find(seq);