Use int64_t more consistently for times, in particular for RTT values.
Existing code was inconsistent about whether to use uint16_t, int, unsigned int, or uint32_t, and sometimes silently truncated one to another, or truncated int64_t. Because most core time-handling functions use int64_t, being consistent about using int64_t unless otherwise necessary minimizes the number of explicit or implicit casts. BUG=chromium:81439 TEST=none R=henrik.lundin@webrtc.org, holmer@google.com, tommi@webrtc.org Review URL: https://webrtc-codereview.appspot.com/31349004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@8045 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
a7add19cf4
commit
16825b1a82
@ -1271,7 +1271,7 @@ class MediaCodecVideoEncoder : public webrtc::VideoEncoder,
|
||||
webrtc::EncodedImageCallback* callback) OVERRIDE;
|
||||
virtual int32_t Release() OVERRIDE;
|
||||
virtual int32_t SetChannelParameters(uint32_t /* packet_loss */,
|
||||
int /* rtt */) OVERRIDE;
|
||||
int64_t /* rtt */) OVERRIDE;
|
||||
virtual int32_t SetRates(uint32_t new_bit_rate, uint32_t frame_rate) OVERRIDE;
|
||||
|
||||
// rtc::MessageHandler implementation.
|
||||
@ -1472,7 +1472,7 @@ int32_t MediaCodecVideoEncoder::Release() {
|
||||
}
|
||||
|
||||
int32_t MediaCodecVideoEncoder::SetChannelParameters(uint32_t /* packet_loss */,
|
||||
int /* rtt */) {
|
||||
int64_t /* rtt */) {
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
|
||||
|
@ -681,7 +681,7 @@ struct MediaSenderInfo {
|
||||
int packets_sent;
|
||||
int packets_lost;
|
||||
float fraction_lost;
|
||||
int rtt_ms;
|
||||
int64_t rtt_ms;
|
||||
std::string codec_name;
|
||||
std::vector<SsrcSenderInfo> local_stats;
|
||||
std::vector<SsrcReceiverInfo> remote_stats;
|
||||
@ -948,7 +948,7 @@ struct BandwidthEstimationInfo {
|
||||
int actual_enc_bitrate;
|
||||
int retransmit_bitrate;
|
||||
int transmit_bitrate;
|
||||
int bucket_delay;
|
||||
int64_t bucket_delay;
|
||||
// The following stats are only valid when
|
||||
// StatsOptions::include_received_propagation_stats is true.
|
||||
int total_received_propagation_delta_ms;
|
||||
|
@ -175,7 +175,7 @@ class FakeWebRtcVideoEncoder : public webrtc::VideoEncoder {
|
||||
}
|
||||
|
||||
virtual int32 SetChannelParameters(uint32 packetLoss,
|
||||
int rtt) {
|
||||
int64_t rtt) {
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
|
||||
@ -1134,15 +1134,15 @@ class FakeWebRtcVideoEngine
|
||||
WEBRTC_STUB_CONST(GetRtcpPacketTypeCounters, (int,
|
||||
webrtc::RtcpPacketTypeCounter*, webrtc::RtcpPacketTypeCounter*));
|
||||
WEBRTC_STUB_CONST(GetReceivedRTCPStatistics, (const int, unsigned short&,
|
||||
unsigned int&, unsigned int&, unsigned int&, int&));
|
||||
unsigned int&, unsigned int&, unsigned int&, int64_t&));
|
||||
WEBRTC_STUB_CONST(GetSentRTCPStatistics, (const int, unsigned short&,
|
||||
unsigned int&, unsigned int&, unsigned int&, int&));
|
||||
unsigned int&, unsigned int&, unsigned int&, int64_t&));
|
||||
WEBRTC_STUB_CONST(GetRTPStatistics, (const int, size_t&, unsigned int&,
|
||||
size_t&, unsigned int&));
|
||||
WEBRTC_STUB_CONST(GetReceiveChannelRtcpStatistics, (const int,
|
||||
webrtc::RtcpStatistics&, int&));
|
||||
webrtc::RtcpStatistics&, int64_t&));
|
||||
WEBRTC_STUB_CONST(GetSendChannelRtcpStatistics, (const int,
|
||||
webrtc::RtcpStatistics&, int&));
|
||||
webrtc::RtcpStatistics&, int64_t&));
|
||||
WEBRTC_STUB_CONST(GetRtpStatistics, (const int, webrtc::StreamDataCounters&,
|
||||
webrtc::StreamDataCounters&));
|
||||
WEBRTC_FUNC_CONST(GetBandwidthUsage, (const int channel,
|
||||
|
@ -2678,7 +2678,7 @@ bool WebRtcVideoMediaChannel::GetStats(const StatsOptions& options,
|
||||
// It's not a fatal error if we can't, since RTCP may not have arrived
|
||||
// yet.
|
||||
webrtc::RtcpStatistics outgoing_stream_rtcp_stats;
|
||||
int outgoing_stream_rtt_ms;
|
||||
int64_t outgoing_stream_rtt_ms;
|
||||
|
||||
if (engine_->vie()->rtp()->GetSendChannelRtcpStatistics(
|
||||
channel_id,
|
||||
@ -2782,7 +2782,7 @@ bool WebRtcVideoMediaChannel::GetStats(const StatsOptions& options,
|
||||
|
||||
// Get our locally created statistics of the received RTP stream.
|
||||
webrtc::RtcpStatistics incoming_stream_rtcp_stats;
|
||||
int incoming_stream_rtt_ms;
|
||||
int64_t incoming_stream_rtt_ms;
|
||||
if (engine_->vie()->rtp()->GetReceiveChannelRtcpStatistics(
|
||||
channel->channel_id(),
|
||||
incoming_stream_rtcp_stats,
|
||||
|
@ -105,8 +105,8 @@ class Call {
|
||||
|
||||
int send_bandwidth_bps;
|
||||
int recv_bandwidth_bps;
|
||||
int pacer_delay_ms;
|
||||
int rtt_ms;
|
||||
int64_t pacer_delay_ms;
|
||||
int64_t rtt_ms;
|
||||
};
|
||||
|
||||
static Call* Create(const Call::Config& config);
|
||||
|
@ -594,7 +594,7 @@ JOWW(jobject, VideoEngine_getReceivedRtcpStatistics)(JNIEnv* jni, jobject j_vie,
|
||||
unsigned int cumulative_lost; // NOLINT
|
||||
unsigned int extended_max; // NOLINT
|
||||
unsigned int jitter; // NOLINT
|
||||
int rtt_ms;
|
||||
int64_t rtt_ms;
|
||||
VideoEngineData* vie_data = GetVideoEngineData(jni, j_vie);
|
||||
if (vie_data->rtp->GetReceivedRTCPStatistics(channel, fraction_lost,
|
||||
cumulative_lost, extended_max,
|
||||
@ -608,7 +608,7 @@ JOWW(jobject, VideoEngine_getReceivedRtcpStatistics)(JNIEnv* jni, jobject j_vie,
|
||||
jobject j_rtcp_statistics =
|
||||
jni->NewObject(j_rtcp_statistics_class, j_rtcp_statistics_ctor,
|
||||
fraction_lost, cumulative_lost, extended_max, jitter,
|
||||
rtt_ms);
|
||||
static_cast<int>(rtt_ms));
|
||||
CHECK_EXCEPTION(jni, "error during NewObject");
|
||||
return j_rtcp_statistics;
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <algorithm> // sort
|
||||
#include <vector>
|
||||
|
||||
#include "webrtc/base/format_macros.h"
|
||||
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
|
||||
#include "webrtc/common_types.h"
|
||||
#include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
|
||||
@ -727,12 +728,12 @@ void AcmReceiver::DisableNack() {
|
||||
}
|
||||
|
||||
std::vector<uint16_t> AcmReceiver::GetNackList(
|
||||
int round_trip_time_ms) const {
|
||||
int64_t round_trip_time_ms) const {
|
||||
CriticalSectionScoped lock(crit_sect_.get());
|
||||
if (round_trip_time_ms < 0) {
|
||||
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, id_,
|
||||
"GetNackList: round trip time cannot be negative."
|
||||
" round_trip_time_ms=%d", round_trip_time_ms);
|
||||
" round_trip_time_ms=%" PRId64, round_trip_time_ms);
|
||||
}
|
||||
if (nack_enabled_ && round_trip_time_ms >= 0) {
|
||||
assert(nack_.get());
|
||||
|
@ -305,7 +305,7 @@ class AcmReceiver {
|
||||
// -round_trip_time_ms : estimate of the round-trip-time (in milliseconds).
|
||||
// Return value : list of packets to be retransmitted.
|
||||
//
|
||||
std::vector<uint16_t> GetNackList(int round_trip_time_ms) const;
|
||||
std::vector<uint16_t> GetNackList(int64_t round_trip_time_ms) const;
|
||||
|
||||
//
|
||||
// Get statistics of calls to GetAudio().
|
||||
|
@ -2017,7 +2017,7 @@ void AudioCodingModuleImpl::DisableNack() {
|
||||
}
|
||||
|
||||
std::vector<uint16_t> AudioCodingModuleImpl::GetNackList(
|
||||
int round_trip_time_ms) const {
|
||||
int64_t round_trip_time_ms) const {
|
||||
return receiver_.GetNackList(round_trip_time_ms);
|
||||
}
|
||||
|
||||
|
@ -246,7 +246,7 @@ class AudioCodingModuleImpl : public AudioCodingModule {
|
||||
virtual void DisableNack() OVERRIDE;
|
||||
|
||||
virtual std::vector<uint16_t> GetNackList(
|
||||
int round_trip_time_ms) const OVERRIDE;
|
||||
int64_t round_trip_time_ms) const OVERRIDE;
|
||||
|
||||
virtual void GetDecodingCallStatistics(
|
||||
AudioDecodingCallStats* stats) const OVERRIDE;
|
||||
|
@ -207,13 +207,13 @@ void Nack::LimitNackListSize() {
|
||||
nack_list_.erase(nack_list_.begin(), nack_list_.upper_bound(limit));
|
||||
}
|
||||
|
||||
int Nack::TimeToPlay(uint32_t timestamp) const {
|
||||
int64_t Nack::TimeToPlay(uint32_t timestamp) const {
|
||||
uint32_t timestamp_increase = timestamp - timestamp_last_decoded_rtp_;
|
||||
return timestamp_increase / sample_rate_khz_;
|
||||
}
|
||||
|
||||
// We don't erase elements with time-to-play shorter than round-trip-time.
|
||||
std::vector<uint16_t> Nack::GetNackList(int round_trip_time_ms) const {
|
||||
std::vector<uint16_t> Nack::GetNackList(int64_t round_trip_time_ms) const {
|
||||
std::vector<uint16_t> sequence_numbers;
|
||||
for (NackList::const_iterator it = nack_list_.begin(); it != nack_list_.end();
|
||||
++it) {
|
||||
|
@ -87,7 +87,7 @@ class Nack {
|
||||
// Get a list of "missing" packets which have expected time-to-play larger
|
||||
// than the given round-trip-time (in milliseconds).
|
||||
// Note: Late packets are not included.
|
||||
std::vector<uint16_t> GetNackList(int round_trip_time_ms) const;
|
||||
std::vector<uint16_t> GetNackList(int64_t round_trip_time_ms) const;
|
||||
|
||||
// Reset to default values. The NACK list is cleared.
|
||||
// |nack_threshold_packets_| & |max_nack_list_size_| preserve their values.
|
||||
@ -98,7 +98,7 @@ class Nack {
|
||||
FRIEND_TEST_ALL_PREFIXES(NackTest, EstimateTimestampAndTimeToPlay);
|
||||
|
||||
struct NackElement {
|
||||
NackElement(int initial_time_to_play_ms,
|
||||
NackElement(int64_t initial_time_to_play_ms,
|
||||
uint32_t initial_timestamp,
|
||||
bool missing)
|
||||
: time_to_play_ms(initial_time_to_play_ms),
|
||||
@ -107,7 +107,7 @@ class Nack {
|
||||
|
||||
// Estimated time (ms) left for this packet to be decoded. This estimate is
|
||||
// updated every time jitter buffer decodes a packet.
|
||||
int time_to_play_ms;
|
||||
int64_t time_to_play_ms;
|
||||
|
||||
// A guess about the timestamp of the missing packet, it is used for
|
||||
// estimation of |time_to_play_ms|. The estimate might be slightly wrong if
|
||||
@ -171,7 +171,7 @@ class Nack {
|
||||
uint32_t EstimateTimestamp(uint16_t sequence_number);
|
||||
|
||||
// Compute time-to-play given a timestamp.
|
||||
int TimeToPlay(uint32_t timestamp) const;
|
||||
int64_t TimeToPlay(uint32_t timestamp) const;
|
||||
|
||||
// If packet N is arrived, any packet prior to N - |nack_threshold_packets_|
|
||||
// which is not arrived is considered missing, and should be in NACK list.
|
||||
|
@ -29,7 +29,7 @@ const int kNackThreshold = 3;
|
||||
const int kSampleRateHz = 16000;
|
||||
const int kPacketSizeMs = 30;
|
||||
const uint32_t kTimestampIncrement = 480; // 30 ms.
|
||||
const int kShortRoundTripTimeMs = 1;
|
||||
const int64_t kShortRoundTripTimeMs = 1;
|
||||
|
||||
bool IsNackListCorrect(const std::vector<uint16_t>& nack_list,
|
||||
const uint16_t* lost_sequence_numbers,
|
||||
|
@ -991,7 +991,8 @@ class AudioCodingModule: public Module {
|
||||
// Negative |round_trip_time_ms| results is an error message and empty list
|
||||
// is returned.
|
||||
//
|
||||
virtual std::vector<uint16_t> GetNackList(int round_trip_time_ms) const = 0;
|
||||
virtual std::vector<uint16_t> GetNackList(
|
||||
int64_t round_trip_time_ms) const = 0;
|
||||
|
||||
virtual void GetDecodingCallStatistics(
|
||||
AudioDecodingCallStats* call_stats) const = 0;
|
||||
|
@ -33,7 +33,7 @@ class BitrateControllerImpl::RtcpBandwidthObserverImpl
|
||||
// Received RTCP receiver block.
|
||||
virtual void OnReceivedRtcpReceiverReport(
|
||||
const ReportBlockList& report_blocks,
|
||||
uint16_t rtt,
|
||||
int64_t rtt,
|
||||
int64_t now_ms) OVERRIDE {
|
||||
if (report_blocks.empty())
|
||||
return;
|
||||
@ -153,7 +153,7 @@ void BitrateControllerImpl::SetBitrateObserver(
|
||||
}
|
||||
uint32_t current_estimate;
|
||||
uint8_t loss;
|
||||
uint32_t rtt;
|
||||
int64_t rtt;
|
||||
bandwidth_estimation_.CurrentEstimate(¤t_estimate, &loss, &rtt);
|
||||
bandwidth_estimation_.SetSendBitrate(std::max(sum_start_bitrate,
|
||||
current_estimate));
|
||||
@ -252,7 +252,7 @@ int32_t BitrateControllerImpl::Process() {
|
||||
|
||||
void BitrateControllerImpl::OnReceivedRtcpReceiverReport(
|
||||
uint8_t fraction_loss,
|
||||
uint32_t rtt,
|
||||
int64_t rtt,
|
||||
int number_of_packets,
|
||||
int64_t now_ms) {
|
||||
CriticalSectionScoped cs(critsect_);
|
||||
@ -264,7 +264,7 @@ void BitrateControllerImpl::OnReceivedRtcpReceiverReport(
|
||||
void BitrateControllerImpl::MaybeTriggerOnNetworkChanged() {
|
||||
uint32_t bitrate;
|
||||
uint8_t fraction_loss;
|
||||
uint32_t rtt;
|
||||
int64_t rtt;
|
||||
bandwidth_estimation_.CurrentEstimate(&bitrate, &fraction_loss, &rtt);
|
||||
bitrate -= std::min(bitrate, reserved_bitrate_bps_);
|
||||
|
||||
@ -286,7 +286,7 @@ void BitrateControllerImpl::MaybeTriggerOnNetworkChanged() {
|
||||
|
||||
void BitrateControllerImpl::OnNetworkChanged(uint32_t bitrate,
|
||||
uint8_t fraction_loss,
|
||||
uint32_t rtt) {
|
||||
int64_t rtt) {
|
||||
// Sanity check.
|
||||
if (bitrate_observers_.empty())
|
||||
return;
|
||||
@ -304,7 +304,7 @@ void BitrateControllerImpl::OnNetworkChanged(uint32_t bitrate,
|
||||
|
||||
void BitrateControllerImpl::NormalRateAllocation(uint32_t bitrate,
|
||||
uint8_t fraction_loss,
|
||||
uint32_t rtt,
|
||||
int64_t rtt,
|
||||
uint32_t sum_min_bitrates) {
|
||||
uint32_t number_of_observers = bitrate_observers_.size();
|
||||
uint32_t bitrate_per_observer = (bitrate - sum_min_bitrates) /
|
||||
@ -344,7 +344,7 @@ void BitrateControllerImpl::NormalRateAllocation(uint32_t bitrate,
|
||||
|
||||
void BitrateControllerImpl::LowRateAllocation(uint32_t bitrate,
|
||||
uint8_t fraction_loss,
|
||||
uint32_t rtt,
|
||||
int64_t rtt,
|
||||
uint32_t sum_min_bitrates) {
|
||||
if (enforce_min_bitrate_) {
|
||||
// Min bitrate to all observers.
|
||||
@ -375,7 +375,7 @@ bool BitrateControllerImpl::AvailableBandwidth(uint32_t* bandwidth) const {
|
||||
CriticalSectionScoped cs(critsect_);
|
||||
uint32_t bitrate;
|
||||
uint8_t fraction_loss;
|
||||
uint32_t rtt;
|
||||
int64_t rtt;
|
||||
bandwidth_estimation_.CurrentEstimate(&bitrate, &fraction_loss, &rtt);
|
||||
if (bitrate) {
|
||||
*bandwidth = bitrate - std::min(bitrate, reserved_bitrate_bps_);
|
||||
|
@ -89,7 +89,7 @@ class BitrateControllerImpl : public BitrateController {
|
||||
void OnReceivedEstimatedBitrate(uint32_t bitrate);
|
||||
|
||||
void OnReceivedRtcpReceiverReport(uint8_t fraction_loss,
|
||||
uint32_t rtt,
|
||||
int64_t rtt,
|
||||
int number_of_packets,
|
||||
int64_t now_ms);
|
||||
|
||||
@ -97,18 +97,18 @@ class BitrateControllerImpl : public BitrateController {
|
||||
|
||||
void OnNetworkChanged(uint32_t bitrate,
|
||||
uint8_t fraction_loss, // 0 - 255.
|
||||
uint32_t rtt)
|
||||
int64_t rtt)
|
||||
EXCLUSIVE_LOCKS_REQUIRED(*critsect_);
|
||||
|
||||
void NormalRateAllocation(uint32_t bitrate,
|
||||
uint8_t fraction_loss,
|
||||
uint32_t rtt,
|
||||
int64_t rtt,
|
||||
uint32_t sum_min_bitrates)
|
||||
EXCLUSIVE_LOCKS_REQUIRED(*critsect_);
|
||||
|
||||
void LowRateAllocation(uint32_t bitrate,
|
||||
uint8_t fraction_loss,
|
||||
uint32_t rtt,
|
||||
int64_t rtt,
|
||||
uint32_t sum_min_bitrates)
|
||||
EXCLUSIVE_LOCKS_REQUIRED(*critsect_);
|
||||
|
||||
@ -129,7 +129,7 @@ class BitrateControllerImpl : public BitrateController {
|
||||
|
||||
uint32_t last_bitrate_bps_ GUARDED_BY(*critsect_);
|
||||
uint8_t last_fraction_loss_ GUARDED_BY(*critsect_);
|
||||
uint32_t last_rtt_ms_ GUARDED_BY(*critsect_);
|
||||
int64_t last_rtt_ms_ GUARDED_BY(*critsect_);
|
||||
bool last_enforce_min_bitrate_ GUARDED_BY(*critsect_);
|
||||
bool bitrate_observers_modified_ GUARDED_BY(*critsect_);
|
||||
uint32_t last_reserved_bitrate_bps_ GUARDED_BY(*critsect_);
|
||||
|
@ -45,14 +45,14 @@ class TestBitrateObserver: public BitrateObserver {
|
||||
|
||||
virtual void OnNetworkChanged(uint32_t bitrate,
|
||||
uint8_t fraction_loss,
|
||||
uint32_t rtt) {
|
||||
int64_t rtt) {
|
||||
last_bitrate_ = bitrate;
|
||||
last_fraction_loss_ = fraction_loss;
|
||||
last_rtt_ = rtt;
|
||||
}
|
||||
uint32_t last_bitrate_;
|
||||
uint8_t last_fraction_loss_;
|
||||
uint32_t last_rtt_;
|
||||
int64_t last_rtt_;
|
||||
};
|
||||
|
||||
class BitrateControllerTest : public ::testing::Test {
|
||||
@ -112,7 +112,7 @@ TEST_F(BitrateControllerTest, OneBitrateObserverOneRtcpObserver) {
|
||||
bandwidth_observer_->OnReceivedEstimatedBitrate(200000);
|
||||
EXPECT_EQ(200000u, bitrate_observer.last_bitrate_);
|
||||
EXPECT_EQ(0, bitrate_observer.last_fraction_loss_);
|
||||
EXPECT_EQ(0u, bitrate_observer.last_rtt_);
|
||||
EXPECT_EQ(0, bitrate_observer.last_rtt_);
|
||||
bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms);
|
||||
report_blocks.clear();
|
||||
time_ms += 2000;
|
||||
@ -125,7 +125,7 @@ TEST_F(BitrateControllerTest, OneBitrateObserverOneRtcpObserver) {
|
||||
bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms);
|
||||
EXPECT_EQ(217000u, bitrate_observer.last_bitrate_);
|
||||
EXPECT_EQ(0, bitrate_observer.last_fraction_loss_);
|
||||
EXPECT_EQ(50u, bitrate_observer.last_rtt_);
|
||||
EXPECT_EQ(50, bitrate_observer.last_rtt_);
|
||||
time_ms += 1000;
|
||||
|
||||
report_blocks.clear();
|
||||
@ -133,7 +133,7 @@ TEST_F(BitrateControllerTest, OneBitrateObserverOneRtcpObserver) {
|
||||
bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms);
|
||||
EXPECT_EQ(235360u, bitrate_observer.last_bitrate_);
|
||||
EXPECT_EQ(0, bitrate_observer.last_fraction_loss_);
|
||||
EXPECT_EQ(50u, bitrate_observer.last_rtt_);
|
||||
EXPECT_EQ(50, bitrate_observer.last_rtt_);
|
||||
time_ms += 1000;
|
||||
|
||||
report_blocks.clear();
|
||||
@ -170,7 +170,7 @@ TEST_F(BitrateControllerTest, OneBitrateObserverOneRtcpObserver) {
|
||||
bandwidth_observer_->OnReceivedEstimatedBitrate(250000);
|
||||
EXPECT_EQ(250000u, bitrate_observer.last_bitrate_);
|
||||
EXPECT_EQ(0, bitrate_observer.last_fraction_loss_);
|
||||
EXPECT_EQ(50u, bitrate_observer.last_rtt_);
|
||||
EXPECT_EQ(50, bitrate_observer.last_rtt_);
|
||||
|
||||
bandwidth_observer_->OnReceivedEstimatedBitrate(1000);
|
||||
EXPECT_EQ(100000u, bitrate_observer.last_bitrate_); // Min cap.
|
||||
@ -198,7 +198,7 @@ TEST_F(BitrateControllerTest, OneBitrateObserverTwoRtcpObservers) {
|
||||
report_blocks, 100, 1);
|
||||
EXPECT_EQ(217000u, bitrate_observer.last_bitrate_);
|
||||
EXPECT_EQ(0, bitrate_observer.last_fraction_loss_);
|
||||
EXPECT_EQ(100u, bitrate_observer.last_rtt_);
|
||||
EXPECT_EQ(100, bitrate_observer.last_rtt_);
|
||||
time_ms += 500;
|
||||
|
||||
// Test bitrate increase 8% per second.
|
||||
@ -210,7 +210,7 @@ TEST_F(BitrateControllerTest, OneBitrateObserverTwoRtcpObservers) {
|
||||
report_blocks, 100, time_ms);
|
||||
EXPECT_EQ(235360u, bitrate_observer.last_bitrate_);
|
||||
EXPECT_EQ(0, bitrate_observer.last_fraction_loss_);
|
||||
EXPECT_EQ(100u, bitrate_observer.last_rtt_);
|
||||
EXPECT_EQ(100, bitrate_observer.last_rtt_);
|
||||
time_ms += 500;
|
||||
|
||||
// Extra report should not change estimate.
|
||||
@ -268,7 +268,7 @@ TEST_F(BitrateControllerTest, OneBitrateObserverTwoRtcpObservers) {
|
||||
second_bandwidth_observer->OnReceivedEstimatedBitrate(250000);
|
||||
EXPECT_EQ(250000u, bitrate_observer.last_bitrate_);
|
||||
EXPECT_EQ(0, bitrate_observer.last_fraction_loss_);
|
||||
EXPECT_EQ(50u, bitrate_observer.last_rtt_);
|
||||
EXPECT_EQ(50, bitrate_observer.last_rtt_);
|
||||
|
||||
// Min cap.
|
||||
bandwidth_observer_->OnReceivedEstimatedBitrate(1000);
|
||||
@ -307,7 +307,7 @@ TEST_F(BitrateControllerTest, OneBitrateObserverMultipleReportBlocks) {
|
||||
time_ms);
|
||||
EXPECT_GT(bitrate_observer.last_bitrate_, last_bitrate);
|
||||
EXPECT_EQ(0, bitrate_observer.last_fraction_loss_);
|
||||
EXPECT_EQ(50u, bitrate_observer.last_rtt_);
|
||||
EXPECT_EQ(50, bitrate_observer.last_rtt_);
|
||||
last_bitrate = bitrate_observer.last_bitrate_;
|
||||
time_ms += 1000;
|
||||
sequence_number[0] += 20;
|
||||
@ -323,7 +323,7 @@ TEST_F(BitrateControllerTest, OneBitrateObserverMultipleReportBlocks) {
|
||||
bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms);
|
||||
EXPECT_LT(bitrate_observer.last_bitrate_, last_bitrate);
|
||||
EXPECT_EQ(WeightedLoss(20, 50, 1, 0), bitrate_observer.last_fraction_loss_);
|
||||
EXPECT_EQ(50u, bitrate_observer.last_rtt_);
|
||||
EXPECT_EQ(50, bitrate_observer.last_rtt_);
|
||||
last_bitrate = bitrate_observer.last_bitrate_;
|
||||
sequence_number[0] += 20;
|
||||
sequence_number[1] += 20;
|
||||
@ -336,7 +336,7 @@ TEST_F(BitrateControllerTest, OneBitrateObserverMultipleReportBlocks) {
|
||||
bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms);
|
||||
EXPECT_LT(bitrate_observer.last_bitrate_, last_bitrate);
|
||||
EXPECT_EQ(WeightedLoss(20, 0, 20, 75), bitrate_observer.last_fraction_loss_);
|
||||
EXPECT_EQ(50u, bitrate_observer.last_rtt_);
|
||||
EXPECT_EQ(50, bitrate_observer.last_rtt_);
|
||||
last_bitrate = bitrate_observer.last_bitrate_;
|
||||
sequence_number[0] += 20;
|
||||
sequence_number[1] += 1;
|
||||
@ -349,7 +349,7 @@ TEST_F(BitrateControllerTest, OneBitrateObserverMultipleReportBlocks) {
|
||||
bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms);
|
||||
EXPECT_EQ(bitrate_observer.last_bitrate_, last_bitrate);
|
||||
EXPECT_EQ(WeightedLoss(20, 1, 1, 255), bitrate_observer.last_fraction_loss_);
|
||||
EXPECT_EQ(50u, bitrate_observer.last_rtt_);
|
||||
EXPECT_EQ(50, bitrate_observer.last_rtt_);
|
||||
last_bitrate = bitrate_observer.last_bitrate_;
|
||||
sequence_number[0] += 20;
|
||||
sequence_number[1] += 1;
|
||||
@ -369,7 +369,7 @@ TEST_F(BitrateControllerTest, TwoBitrateObserversOneRtcpObserver) {
|
||||
bandwidth_observer_->OnReceivedEstimatedBitrate(200000);
|
||||
EXPECT_EQ(100000u, bitrate_observer_1.last_bitrate_);
|
||||
EXPECT_EQ(0, bitrate_observer_1.last_fraction_loss_);
|
||||
EXPECT_EQ(0u, bitrate_observer_1.last_rtt_);
|
||||
EXPECT_EQ(0, bitrate_observer_1.last_rtt_);
|
||||
bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms);
|
||||
report_blocks.clear();
|
||||
time_ms += 2000;
|
||||
@ -383,12 +383,12 @@ TEST_F(BitrateControllerTest, TwoBitrateObserversOneRtcpObserver) {
|
||||
bandwidth_observer_->OnReceivedRtcpReceiverReport(report_blocks, 50, time_ms);
|
||||
EXPECT_EQ(112500u, bitrate_observer_1.last_bitrate_);
|
||||
EXPECT_EQ(0, bitrate_observer_1.last_fraction_loss_);
|
||||
EXPECT_EQ(50u, bitrate_observer_1.last_rtt_);
|
||||
EXPECT_EQ(50, bitrate_observer_1.last_rtt_);
|
||||
time_ms += 1000;
|
||||
|
||||
EXPECT_EQ(212500u, bitrate_observer_2.last_bitrate_);
|
||||
EXPECT_EQ(0, bitrate_observer_2.last_fraction_loss_);
|
||||
EXPECT_EQ(50u, bitrate_observer_2.last_rtt_);
|
||||
EXPECT_EQ(50, bitrate_observer_2.last_rtt_);
|
||||
|
||||
report_blocks.clear();
|
||||
report_blocks.push_back(CreateReportBlock(1, 2, 0, 41));
|
||||
@ -460,10 +460,10 @@ TEST_F(BitrateControllerTest, TwoBitrateObserversOneRtcpObserver) {
|
||||
bandwidth_observer_->OnReceivedEstimatedBitrate(350000);
|
||||
EXPECT_EQ(125000u, bitrate_observer_1.last_bitrate_);
|
||||
EXPECT_EQ(0, bitrate_observer_1.last_fraction_loss_);
|
||||
EXPECT_EQ(50u, bitrate_observer_1.last_rtt_);
|
||||
EXPECT_EQ(50, bitrate_observer_1.last_rtt_);
|
||||
EXPECT_EQ(225000u, bitrate_observer_2.last_bitrate_);
|
||||
EXPECT_EQ(0, bitrate_observer_2.last_fraction_loss_);
|
||||
EXPECT_EQ(50u, bitrate_observer_2.last_rtt_);
|
||||
EXPECT_EQ(50, bitrate_observer_2.last_rtt_);
|
||||
|
||||
bandwidth_observer_->OnReceivedEstimatedBitrate(1000);
|
||||
EXPECT_EQ(100000u, bitrate_observer_1.last_bitrate_); // Min cap.
|
||||
|
@ -31,7 +31,7 @@ class BitrateObserver {
|
||||
public:
|
||||
virtual void OnNetworkChanged(uint32_t target_bitrate,
|
||||
uint8_t fraction_loss, // 0 - 255.
|
||||
uint32_t rtt) = 0;
|
||||
int64_t rtt) = 0;
|
||||
|
||||
virtual ~BitrateObserver() {}
|
||||
};
|
||||
|
@ -27,7 +27,7 @@ enum { kBweConverganceTimeMs = 20000 };
|
||||
|
||||
// Calculate the rate that TCP-Friendly Rate Control (TFRC) would apply.
|
||||
// The formula in RFC 3448, Section 3.1, is used.
|
||||
uint32_t CalcTfrcBps(uint16_t rtt, uint8_t loss) {
|
||||
uint32_t CalcTfrcBps(int64_t rtt, uint8_t loss) {
|
||||
if (rtt == 0 || loss == 0) {
|
||||
// Input variables out of range.
|
||||
return 0;
|
||||
@ -89,7 +89,7 @@ void SendSideBandwidthEstimation::SetMinBitrate(uint32_t min_bitrate) {
|
||||
|
||||
void SendSideBandwidthEstimation::CurrentEstimate(uint32_t* bitrate,
|
||||
uint8_t* loss,
|
||||
uint32_t* rtt) const {
|
||||
int64_t* rtt) const {
|
||||
*bitrate = bitrate_;
|
||||
*loss = last_fraction_loss_;
|
||||
*rtt = last_round_trip_time_ms_;
|
||||
@ -101,7 +101,7 @@ void SendSideBandwidthEstimation::UpdateReceiverEstimate(uint32_t bandwidth) {
|
||||
}
|
||||
|
||||
void SendSideBandwidthEstimation::UpdateReceiverBlock(uint8_t fraction_loss,
|
||||
uint32_t rtt,
|
||||
int64_t rtt,
|
||||
int number_of_packets,
|
||||
int64_t now_ms) {
|
||||
if (first_report_time_ms_ == -1)
|
||||
@ -137,7 +137,7 @@ void SendSideBandwidthEstimation::UpdateReceiverBlock(uint8_t fraction_loss,
|
||||
}
|
||||
|
||||
void SendSideBandwidthEstimation::UpdateUmaStats(int64_t now_ms,
|
||||
int rtt,
|
||||
int64_t rtt,
|
||||
int lost_packets) {
|
||||
if (IsInStartPhase(now_ms)) {
|
||||
initially_lost_packets_ += lost_packets;
|
||||
@ -146,7 +146,8 @@ void SendSideBandwidthEstimation::UpdateUmaStats(int64_t now_ms,
|
||||
bitrate_at_2_seconds_kbps_ = (bitrate_ + 500) / 1000;
|
||||
RTC_HISTOGRAM_COUNTS(
|
||||
"WebRTC.BWE.InitiallyLostPackets", initially_lost_packets_, 0, 100, 50);
|
||||
RTC_HISTOGRAM_COUNTS("WebRTC.BWE.InitialRtt", rtt, 0, 2000, 50);
|
||||
RTC_HISTOGRAM_COUNTS(
|
||||
"WebRTC.BWE.InitialRtt", static_cast<int>(rtt), 0, 2000, 50);
|
||||
RTC_HISTOGRAM_COUNTS("WebRTC.BWE.InitialBandwidthEstimate",
|
||||
bitrate_at_2_seconds_kbps_,
|
||||
0,
|
||||
@ -203,8 +204,7 @@ void SendSideBandwidthEstimation::UpdateEstimate(int64_t now_ms) {
|
||||
// Loss > 10%: Limit the rate decreases to once a kBweDecreaseIntervalMs +
|
||||
// rtt.
|
||||
if ((now_ms - time_last_decrease_ms_) >=
|
||||
static_cast<uint32_t>(kBweDecreaseIntervalMs +
|
||||
last_round_trip_time_ms_)) {
|
||||
(kBweDecreaseIntervalMs + last_round_trip_time_ms_)) {
|
||||
time_last_decrease_ms_ = now_ms;
|
||||
|
||||
// Reduce rate:
|
||||
|
@ -24,7 +24,7 @@ class SendSideBandwidthEstimation {
|
||||
SendSideBandwidthEstimation();
|
||||
virtual ~SendSideBandwidthEstimation();
|
||||
|
||||
void CurrentEstimate(uint32_t* bitrate, uint8_t* loss, uint32_t* rtt) const;
|
||||
void CurrentEstimate(uint32_t* bitrate, uint8_t* loss, int64_t* rtt) const;
|
||||
|
||||
// Call periodically to update estimate.
|
||||
void UpdateEstimate(int64_t now_ms);
|
||||
@ -34,7 +34,7 @@ class SendSideBandwidthEstimation {
|
||||
|
||||
// Call when we receive a RTCP message with a ReceiveBlock.
|
||||
void UpdateReceiverBlock(uint8_t fraction_loss,
|
||||
uint32_t rtt,
|
||||
int64_t rtt,
|
||||
int number_of_packets,
|
||||
int64_t now_ms);
|
||||
|
||||
@ -50,7 +50,7 @@ class SendSideBandwidthEstimation {
|
||||
|
||||
bool IsInStartPhase(int64_t now_ms) const;
|
||||
|
||||
void UpdateUmaStats(int64_t now_ms, int rtt, int lost_packets);
|
||||
void UpdateUmaStats(int64_t now_ms, int64_t rtt, int lost_packets);
|
||||
|
||||
// Returns the input bitrate capped to the thresholds defined by the max,
|
||||
// min and incoming bandwidth.
|
||||
@ -73,7 +73,7 @@ class SendSideBandwidthEstimation {
|
||||
|
||||
int64_t time_last_receiver_block_ms_;
|
||||
uint8_t last_fraction_loss_;
|
||||
uint16_t last_round_trip_time_ms_;
|
||||
int64_t last_round_trip_time_ms_;
|
||||
|
||||
uint32_t bwe_incoming_;
|
||||
int64_t time_last_decrease_ms_;
|
||||
|
@ -45,7 +45,7 @@ TEST(SendSideBweTest, InitialRembWithProbing) {
|
||||
bwe.UpdateEstimate(now_ms);
|
||||
uint32_t bitrate;
|
||||
uint8_t fraction_loss;
|
||||
uint32_t rtt;
|
||||
int64_t rtt;
|
||||
bwe.CurrentEstimate(&bitrate, &fraction_loss, &rtt);
|
||||
EXPECT_EQ(kRemb, bitrate);
|
||||
|
||||
@ -73,7 +73,7 @@ TEST(SendSideBweTest, InitialRembWithoutProbing) {
|
||||
bwe.UpdateEstimate(now_ms);
|
||||
uint32_t bitrate;
|
||||
uint8_t fraction_loss;
|
||||
uint32_t rtt;
|
||||
int64_t rtt;
|
||||
bwe.CurrentEstimate(&bitrate, &fraction_loss, &rtt);
|
||||
EXPECT_EQ(kStartBitrate, bitrate);
|
||||
}
|
||||
|
@ -51,8 +51,8 @@ class DesktopFrame {
|
||||
void set_dpi(const DesktopVector& dpi) { dpi_ = dpi; }
|
||||
|
||||
// Time taken to capture the frame in milliseconds.
|
||||
int32_t capture_time_ms() const { return capture_time_ms_; }
|
||||
void set_capture_time_ms(int32_t time_ms) { capture_time_ms_ = time_ms; }
|
||||
int64_t capture_time_ms() const { return capture_time_ms_; }
|
||||
void set_capture_time_ms(int64_t time_ms) { capture_time_ms_ = time_ms; }
|
||||
|
||||
// Optional shape for the frame. Frames may be shaped e.g. if
|
||||
// capturing the contents of a shaped window.
|
||||
@ -87,7 +87,7 @@ class DesktopFrame {
|
||||
|
||||
DesktopRegion updated_region_;
|
||||
DesktopVector dpi_;
|
||||
int32_t capture_time_ms_;
|
||||
int64_t capture_time_ms_;
|
||||
scoped_ptr<DesktopRegion> shape_;
|
||||
|
||||
private:
|
||||
|
@ -279,7 +279,7 @@ struct FecProtectionParams {
|
||||
// CallStats object using RegisterStatsObserver.
|
||||
class CallStatsObserver {
|
||||
public:
|
||||
virtual void OnRttUpdate(uint32_t rtt_ms) = 0;
|
||||
virtual void OnRttUpdate(int64_t rtt_ms) = 0;
|
||||
|
||||
virtual ~CallStatsObserver() {}
|
||||
};
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
static const uint32_t kDefaultRttMs = 200;
|
||||
static const int64_t kDefaultRttMs = 200;
|
||||
static const int64_t kLogIntervalMs = 1000;
|
||||
static const double kWithinIncomingBitrateHysteresis = 1.05;
|
||||
|
||||
@ -66,7 +66,8 @@ int64_t AimdRateControl::GetFeedbackInterval() const {
|
||||
|
||||
bool AimdRateControl::TimeToReduceFurther(int64_t time_now,
|
||||
uint32_t incoming_bitrate_bps) const {
|
||||
const int bitrate_reduction_interval = std::max(std::min(rtt_, 200u), 10u);
|
||||
const int64_t bitrate_reduction_interval =
|
||||
std::max<int64_t>(std::min<int64_t>(rtt_, 200), 10);
|
||||
if (time_now - time_last_bitrate_change_ >= bitrate_reduction_interval) {
|
||||
return true;
|
||||
}
|
||||
@ -93,7 +94,7 @@ uint32_t AimdRateControl::UpdateBandwidthEstimate(int64_t now_ms) {
|
||||
return current_bitrate_bps_;
|
||||
}
|
||||
|
||||
void AimdRateControl::SetRtt(uint32_t rtt) {
|
||||
void AimdRateControl::SetRtt(int64_t rtt) {
|
||||
rtt_ = rtt;
|
||||
}
|
||||
|
||||
@ -168,7 +169,7 @@ uint32_t AimdRateControl::ChangeBitrate(uint32_t current_bitrate_bps,
|
||||
}
|
||||
if (rate_control_region_ == kRcNearMax) {
|
||||
// Approximate the over-use estimator delay to 100 ms.
|
||||
const uint32_t response_time = rtt_ + 100;
|
||||
const int64_t response_time = rtt_ + 100;
|
||||
uint32_t additive_increase_bps = AdditiveRateIncrease(
|
||||
now_ms, time_last_bitrate_change_, response_time);
|
||||
BWE_TEST_LOGGING_PLOT("add_increase#1", -1,
|
||||
@ -253,7 +254,7 @@ uint32_t AimdRateControl::MultiplicativeRateIncrease(
|
||||
}
|
||||
|
||||
uint32_t AimdRateControl::AdditiveRateIncrease(
|
||||
int64_t now_ms, int64_t last_ms, uint32_t response_time_ms) const {
|
||||
int64_t now_ms, int64_t last_ms, int64_t response_time_ms) const {
|
||||
assert(response_time_ms > 0);
|
||||
double beta = 0.0;
|
||||
if (last_ms > 0) {
|
||||
|
@ -39,7 +39,7 @@ class AimdRateControl : public RemoteRateControl {
|
||||
int64_t time_now, uint32_t incoming_bitrate_bps) const OVERRIDE;
|
||||
virtual uint32_t LatestEstimate() const OVERRIDE;
|
||||
virtual uint32_t UpdateBandwidthEstimate(int64_t now_ms) OVERRIDE;
|
||||
virtual void SetRtt(uint32_t rtt) OVERRIDE;
|
||||
virtual void SetRtt(int64_t rtt) OVERRIDE;
|
||||
virtual RateControlRegion Update(const RateControlInput* input,
|
||||
int64_t now_ms) OVERRIDE;
|
||||
virtual void SetEstimate(int bitrate_bps, int64_t now_ms) OVERRIDE;
|
||||
@ -58,7 +58,7 @@ class AimdRateControl : public RemoteRateControl {
|
||||
uint32_t MultiplicativeRateIncrease(int64_t now_ms, int64_t last_ms,
|
||||
uint32_t current_bitrate_bps) const;
|
||||
uint32_t AdditiveRateIncrease(int64_t now_ms, int64_t last_ms,
|
||||
uint32_t response_time_ms) const;
|
||||
int64_t response_time_ms) const;
|
||||
void UpdateChangePeriod(int64_t now_ms);
|
||||
void UpdateMaxBitRateEstimate(float incoming_bit_rate_kbps);
|
||||
void ChangeState(const RateControlInput& input, int64_t now_ms);
|
||||
@ -80,7 +80,7 @@ class AimdRateControl : public RemoteRateControl {
|
||||
int64_t time_first_incoming_estimate_;
|
||||
bool bitrate_is_initialized_;
|
||||
float beta_;
|
||||
uint32_t rtt_;
|
||||
int64_t rtt_;
|
||||
int64_t time_of_last_log_;
|
||||
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(AimdRateControl);
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
const uint32_t kDefaultRttMs = 200;
|
||||
const int64_t kDefaultRttMs = 200;
|
||||
const int64_t kLogIntervalMs = 1000;
|
||||
|
||||
MimdRateControl::MimdRateControl(uint32_t min_bitrate_bps)
|
||||
@ -61,7 +61,8 @@ int64_t MimdRateControl::GetFeedbackInterval() const {
|
||||
|
||||
bool MimdRateControl::TimeToReduceFurther(int64_t time_now,
|
||||
uint32_t incoming_bitrate_bps) const {
|
||||
const int bitrate_reduction_interval = std::max(std::min(rtt_, 200u), 10u);
|
||||
const int64_t bitrate_reduction_interval =
|
||||
std::max<int64_t>(std::min<int64_t>(rtt_, 200), 10);
|
||||
if (time_now - last_bit_rate_change_ >= bitrate_reduction_interval) {
|
||||
return true;
|
||||
}
|
||||
@ -88,7 +89,7 @@ uint32_t MimdRateControl::UpdateBandwidthEstimate(int64_t now_ms) {
|
||||
return current_bit_rate_;
|
||||
}
|
||||
|
||||
void MimdRateControl::SetRtt(uint32_t rtt) {
|
||||
void MimdRateControl::SetRtt(int64_t rtt) {
|
||||
rtt_ = rtt;
|
||||
}
|
||||
|
||||
@ -156,8 +157,8 @@ uint32_t MimdRateControl::ChangeBitRate(uint32_t current_bit_rate,
|
||||
ChangeRegion(kRcAboveMax);
|
||||
}
|
||||
}
|
||||
const uint32_t response_time = static_cast<uint32_t>(avg_change_period_ +
|
||||
0.5f) + rtt_ + 300;
|
||||
const int64_t response_time =
|
||||
static_cast<int64_t>(avg_change_period_ + 0.5f) + rtt_ + 300;
|
||||
double alpha = RateIncreaseFactor(now_ms, last_bit_rate_change_,
|
||||
response_time, noise_var);
|
||||
|
||||
@ -215,9 +216,9 @@ uint32_t MimdRateControl::ChangeBitRate(uint32_t current_bit_rate,
|
||||
}
|
||||
|
||||
double MimdRateControl::RateIncreaseFactor(int64_t now_ms,
|
||||
int64_t last_ms,
|
||||
uint32_t reaction_time_ms,
|
||||
double noise_var) const {
|
||||
int64_t last_ms,
|
||||
int64_t reaction_time_ms,
|
||||
double noise_var) const {
|
||||
// alpha = 1.02 + B ./ (1 + exp(b*(tr - (c1*s2 + c2))))
|
||||
// Parameters
|
||||
const double B = 0.0407;
|
||||
|
@ -33,7 +33,7 @@ class MimdRateControl : public RemoteRateControl {
|
||||
int64_t time_now, uint32_t incoming_bitrate_bps) const OVERRIDE;
|
||||
virtual uint32_t LatestEstimate() const OVERRIDE;
|
||||
virtual uint32_t UpdateBandwidthEstimate(int64_t now_ms) OVERRIDE;
|
||||
virtual void SetRtt(uint32_t rtt) OVERRIDE;
|
||||
virtual void SetRtt(int64_t rtt) OVERRIDE;
|
||||
virtual RateControlRegion Update(const RateControlInput* input,
|
||||
int64_t now_ms) OVERRIDE;
|
||||
virtual void SetEstimate(int bitrate_bps, int64_t now_ms) OVERRIDE;
|
||||
@ -45,7 +45,7 @@ class MimdRateControl : public RemoteRateControl {
|
||||
int64_t now_ms);
|
||||
double RateIncreaseFactor(int64_t now_ms,
|
||||
int64_t last_ms,
|
||||
uint32_t reaction_time_ms,
|
||||
int64_t reaction_time_ms,
|
||||
double noise_var) const;
|
||||
void UpdateChangePeriod(int64_t now_ms);
|
||||
void UpdateMaxBitRateEstimate(float incoming_bit_rate_kbps);
|
||||
@ -70,7 +70,7 @@ class MimdRateControl : public RemoteRateControl {
|
||||
float avg_change_period_;
|
||||
int64_t last_change_ms_;
|
||||
float beta_;
|
||||
uint32_t rtt_;
|
||||
int64_t rtt_;
|
||||
int64_t time_of_last_log_;
|
||||
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(MimdRateControl);
|
||||
|
@ -84,7 +84,7 @@ class RemoteBitrateEstimatorAbsSendTimeImpl : public RemoteBitrateEstimator {
|
||||
// deleted.
|
||||
virtual int32_t Process() OVERRIDE;
|
||||
virtual int64_t TimeUntilNextProcess() OVERRIDE;
|
||||
virtual void OnRttUpdate(uint32_t rtt) OVERRIDE;
|
||||
virtual void OnRttUpdate(int64_t rtt) OVERRIDE;
|
||||
virtual void RemoveStream(unsigned int ssrc) OVERRIDE;
|
||||
virtual bool LatestEstimate(std::vector<unsigned int>* ssrcs,
|
||||
unsigned int* bitrate_bps) const OVERRIDE;
|
||||
@ -419,7 +419,7 @@ void RemoteBitrateEstimatorAbsSendTimeImpl::UpdateEstimate(int64_t now_ms) {
|
||||
detector_.SetRateControlRegion(region);
|
||||
}
|
||||
|
||||
void RemoteBitrateEstimatorAbsSendTimeImpl::OnRttUpdate(uint32_t rtt) {
|
||||
void RemoteBitrateEstimatorAbsSendTimeImpl::OnRttUpdate(int64_t rtt) {
|
||||
CriticalSectionScoped cs(crit_sect_.get());
|
||||
remote_rate_->SetRtt(rtt);
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ class RemoteBitrateEstimatorImpl : public RemoteBitrateEstimator {
|
||||
const RTPHeader& header) OVERRIDE;
|
||||
virtual int32_t Process() OVERRIDE;
|
||||
virtual int64_t TimeUntilNextProcess() OVERRIDE;
|
||||
virtual void OnRttUpdate(uint32_t rtt) OVERRIDE;
|
||||
virtual void OnRttUpdate(int64_t rtt) OVERRIDE;
|
||||
virtual void RemoveStream(unsigned int ssrc) OVERRIDE;
|
||||
virtual bool LatestEstimate(std::vector<unsigned int>* ssrcs,
|
||||
unsigned int* bitrate_bps) const OVERRIDE;
|
||||
@ -230,7 +230,7 @@ void RemoteBitrateEstimatorImpl::UpdateEstimate(int64_t now_ms) {
|
||||
}
|
||||
}
|
||||
|
||||
void RemoteBitrateEstimatorImpl::OnRttUpdate(uint32_t rtt) {
|
||||
void RemoteBitrateEstimatorImpl::OnRttUpdate(int64_t rtt) {
|
||||
CriticalSectionScoped cs(crit_sect_.get());
|
||||
remote_rate_->SetRtt(rtt);
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ class RemoteRateControl {
|
||||
uint32_t incoming_bitrate_bps) const = 0;
|
||||
virtual uint32_t LatestEstimate() const = 0;
|
||||
virtual uint32_t UpdateBandwidthEstimate(int64_t now_ms) = 0;
|
||||
virtual void SetRtt(unsigned int rtt) = 0;
|
||||
virtual void SetRtt(int64_t rtt) = 0;
|
||||
virtual RateControlRegion Update(const RateControlInput* input,
|
||||
int64_t now_ms) = 0;
|
||||
virtual void SetEstimate(int bitrate_bps, int64_t time_now_ms) = 0;
|
||||
|
@ -41,7 +41,7 @@ class StreamStatistician {
|
||||
// Returns true if the packet with RTP header |header| is likely to be a
|
||||
// retransmitted packet, false otherwise.
|
||||
virtual bool IsRetransmitOfOldPacket(const RTPHeader& header,
|
||||
int min_rtt) const = 0;
|
||||
int64_t min_rtt) const = 0;
|
||||
|
||||
// Returns true if |sequence_number| is received in order, false otherwise.
|
||||
virtual bool IsPacketInOrder(uint16_t sequence_number) const = 0;
|
||||
|
@ -31,7 +31,7 @@ class RemoteNtpTimeEstimator {
|
||||
|
||||
// Updates the estimator with round trip time |rtt|, NTP seconds |ntp_secs|,
|
||||
// NTP fraction |ntp_frac| and RTP timestamp |rtcp_timestamp|.
|
||||
bool UpdateRtcpTimestamp(uint16_t rtt, uint32_t ntp_secs, uint32_t ntp_frac,
|
||||
bool UpdateRtcpTimestamp(int64_t rtt, uint32_t ntp_secs, uint32_t ntp_frac,
|
||||
uint32_t rtp_timestamp);
|
||||
|
||||
// Estimates the NTP timestamp in local timebase from |rtp_timestamp|.
|
||||
|
@ -376,10 +376,10 @@ class RtpRtcp : public Module {
|
||||
* return -1 on failure else 0
|
||||
*/
|
||||
virtual int32_t RTT(uint32_t remoteSSRC,
|
||||
uint16_t* RTT,
|
||||
uint16_t* avgRTT,
|
||||
uint16_t* minRTT,
|
||||
uint16_t* maxRTT) const = 0;
|
||||
int64_t* RTT,
|
||||
int64_t* avgRTT,
|
||||
int64_t* minRTT,
|
||||
int64_t* maxRTT) const = 0;
|
||||
|
||||
/*
|
||||
* Force a send of a RTCP packet
|
||||
|
@ -287,7 +287,7 @@ class RtcpBandwidthObserver {
|
||||
|
||||
virtual void OnReceivedRtcpReceiverReport(
|
||||
const ReportBlockList& report_blocks,
|
||||
uint16_t rtt,
|
||||
int64_t rtt,
|
||||
int64_t now_ms) = 0;
|
||||
|
||||
virtual ~RtcpBandwidthObserver() {}
|
||||
@ -295,9 +295,9 @@ class RtcpBandwidthObserver {
|
||||
|
||||
class RtcpRttStats {
|
||||
public:
|
||||
virtual void OnRttUpdate(uint32_t rtt) = 0;
|
||||
virtual void OnRttUpdate(int64_t rtt) = 0;
|
||||
|
||||
virtual uint32_t LastProcessedRtt() const = 0;
|
||||
virtual int64_t LastProcessedRtt() const = 0;
|
||||
|
||||
virtual ~RtcpRttStats() {};
|
||||
};
|
||||
|
@ -155,7 +155,11 @@ class MockRtpRtcp : public RtpRtcp {
|
||||
MOCK_METHOD1(RemoveMixedCNAME,
|
||||
int32_t(const uint32_t SSRC));
|
||||
MOCK_CONST_METHOD5(RTT,
|
||||
int32_t(const uint32_t remoteSSRC, uint16_t* RTT, uint16_t* avgRTT, uint16_t* minRTT, uint16_t* maxRTT));
|
||||
int32_t(const uint32_t remoteSSRC,
|
||||
int64_t* RTT,
|
||||
int64_t* avgRTT,
|
||||
int64_t* minRTT,
|
||||
int64_t* maxRTT));
|
||||
MOCK_METHOD1(SendRTCP,
|
||||
int32_t(uint32_t rtcpPacketType));
|
||||
MOCK_METHOD1(SendRTCPReferencePictureSelection,
|
||||
|
@ -345,7 +345,7 @@ void StreamStatisticianImpl::LastReceiveTimeNtp(uint32_t* secs,
|
||||
}
|
||||
|
||||
bool StreamStatisticianImpl::IsRetransmitOfOldPacket(
|
||||
const RTPHeader& header, int min_rtt) const {
|
||||
const RTPHeader& header, int64_t min_rtt) const {
|
||||
CriticalSectionScoped cs(stream_lock_.get());
|
||||
if (InOrderPacketInternal(header.sequenceNumber)) {
|
||||
return false;
|
||||
@ -358,17 +358,16 @@ bool StreamStatisticianImpl::IsRetransmitOfOldPacket(
|
||||
|
||||
// Diff in time stamp since last received in order.
|
||||
uint32_t timestamp_diff = header.timestamp - last_received_timestamp_;
|
||||
int32_t rtp_time_stamp_diff_ms = static_cast<int32_t>(timestamp_diff) /
|
||||
frequency_khz;
|
||||
uint32_t rtp_time_stamp_diff_ms = timestamp_diff / frequency_khz;
|
||||
|
||||
int32_t max_delay_ms = 0;
|
||||
int64_t max_delay_ms = 0;
|
||||
if (min_rtt == 0) {
|
||||
// Jitter standard deviation in samples.
|
||||
float jitter_std = sqrt(static_cast<float>(jitter_q4_ >> 4));
|
||||
|
||||
// 2 times the standard deviation => 95% confidence.
|
||||
// And transform to milliseconds by dividing by the frequency in kHz.
|
||||
max_delay_ms = static_cast<int32_t>((2 * jitter_std) / frequency_khz);
|
||||
max_delay_ms = static_cast<int64_t>((2 * jitter_std) / frequency_khz);
|
||||
|
||||
// Min max_delay_ms is 1.
|
||||
if (max_delay_ms == 0) {
|
||||
|
@ -38,7 +38,7 @@ class StreamStatisticianImpl : public StreamStatistician {
|
||||
virtual uint32_t BitrateReceived() const OVERRIDE;
|
||||
virtual void ResetStatistics() OVERRIDE;
|
||||
virtual bool IsRetransmitOfOldPacket(const RTPHeader& header,
|
||||
int min_rtt) const OVERRIDE;
|
||||
int64_t min_rtt) const OVERRIDE;
|
||||
virtual bool IsPacketInOrder(uint16_t sequence_number) const OVERRIDE;
|
||||
|
||||
void IncomingPacket(const RTPHeader& rtp_header,
|
||||
|
@ -28,7 +28,7 @@ RemoteNtpTimeEstimator::RemoteNtpTimeEstimator(Clock* clock)
|
||||
|
||||
RemoteNtpTimeEstimator::~RemoteNtpTimeEstimator() {}
|
||||
|
||||
bool RemoteNtpTimeEstimator::UpdateRtcpTimestamp(uint16_t rtt,
|
||||
bool RemoteNtpTimeEstimator::UpdateRtcpTimestamp(int64_t rtt,
|
||||
uint32_t ntp_secs,
|
||||
uint32_t ntp_frac,
|
||||
uint32_t rtcp_timestamp) {
|
||||
|
@ -21,7 +21,7 @@ using ::testing::SetArgPointee;
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
static const int kTestRtt = 10;
|
||||
static const int64_t kTestRtt = 10;
|
||||
static const int64_t kLocalClockInitialTimeMs = 123;
|
||||
static const int64_t kRemoteClockInitialTimeMs = 345;
|
||||
static const uint32_t kTimestampOffset = 567;
|
||||
@ -54,14 +54,14 @@ class RemoteNtpTimeEstimatorTest : public ::testing::Test {
|
||||
ReceiveRtcpSr(kTestRtt, rtcp_timestamp, ntp_seconds, ntp_fractions);
|
||||
}
|
||||
|
||||
void UpdateRtcpTimestamp(uint16_t rtt, uint32_t ntp_secs, uint32_t ntp_frac,
|
||||
void UpdateRtcpTimestamp(int64_t rtt, uint32_t ntp_secs, uint32_t ntp_frac,
|
||||
uint32_t rtp_timestamp, bool expected_result) {
|
||||
EXPECT_EQ(expected_result,
|
||||
estimator_.UpdateRtcpTimestamp(rtt, ntp_secs, ntp_frac,
|
||||
rtp_timestamp));
|
||||
}
|
||||
|
||||
void ReceiveRtcpSr(uint16_t rtt,
|
||||
void ReceiveRtcpSr(int64_t rtt,
|
||||
uint32_t rtcp_timestamp,
|
||||
uint32_t ntp_seconds,
|
||||
uint32_t ntp_fractions) {
|
||||
|
@ -163,10 +163,10 @@ void RTCPReceiver::SetSsrcs(uint32_t main_ssrc,
|
||||
}
|
||||
|
||||
int32_t RTCPReceiver::RTT(uint32_t remoteSSRC,
|
||||
uint16_t* RTT,
|
||||
uint16_t* avgRTT,
|
||||
uint16_t* minRTT,
|
||||
uint16_t* maxRTT) const {
|
||||
int64_t* RTT,
|
||||
int64_t* avgRTT,
|
||||
int64_t* minRTT,
|
||||
int64_t* maxRTT) const {
|
||||
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
|
||||
|
||||
RTCPReportBlockInformation* reportBlock =
|
||||
@ -190,7 +190,7 @@ int32_t RTCPReceiver::RTT(uint32_t remoteSSRC,
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool RTCPReceiver::GetAndResetXrRrRtt(uint16_t* rtt_ms) {
|
||||
bool RTCPReceiver::GetAndResetXrRrRtt(int64_t* rtt_ms) {
|
||||
assert(rtt_ms);
|
||||
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
|
||||
if (xr_rr_rtt_ms_ == 0) {
|
||||
@ -480,7 +480,7 @@ void RTCPReceiver::HandleReportBlock(
|
||||
// To avoid problem with acquiring _criticalSectionRTCPSender while holding
|
||||
// _criticalSectionRTCPReceiver.
|
||||
_criticalSectionRTCPReceiver->Leave();
|
||||
uint32_t sendTimeMS =
|
||||
int64_t sendTimeMS =
|
||||
_rtpRtcp.SendTimeOfSendReport(rtcpPacket.ReportBlockItem.LastSR);
|
||||
_criticalSectionRTCPReceiver->Enter();
|
||||
|
||||
@ -526,15 +526,15 @@ void RTCPReceiver::HandleReportBlock(
|
||||
_clock->CurrentNtp(lastReceivedRRNTPsecs, lastReceivedRRNTPfrac);
|
||||
|
||||
// time when we received this in MS
|
||||
uint32_t receiveTimeMS = Clock::NtpToMs(lastReceivedRRNTPsecs,
|
||||
lastReceivedRRNTPfrac);
|
||||
int64_t receiveTimeMS = Clock::NtpToMs(lastReceivedRRNTPsecs,
|
||||
lastReceivedRRNTPfrac);
|
||||
|
||||
// Estimate RTT
|
||||
uint32_t d = (delaySinceLastSendReport & 0x0000ffff) * 1000;
|
||||
d /= 65536;
|
||||
d += ((delaySinceLastSendReport & 0xffff0000) >> 16) * 1000;
|
||||
|
||||
int32_t RTT = 0;
|
||||
int64_t RTT = 0;
|
||||
|
||||
if (sendTimeMS > 0) {
|
||||
RTT = receiveTimeMS - d - sendTimeMS;
|
||||
@ -543,27 +543,27 @@ void RTCPReceiver::HandleReportBlock(
|
||||
}
|
||||
if (RTT > reportBlock->maxRTT) {
|
||||
// store max RTT
|
||||
reportBlock->maxRTT = (uint16_t) RTT;
|
||||
reportBlock->maxRTT = RTT;
|
||||
}
|
||||
if (reportBlock->minRTT == 0) {
|
||||
// first RTT
|
||||
reportBlock->minRTT = (uint16_t) RTT;
|
||||
reportBlock->minRTT = RTT;
|
||||
} else if (RTT < reportBlock->minRTT) {
|
||||
// Store min RTT
|
||||
reportBlock->minRTT = (uint16_t) RTT;
|
||||
reportBlock->minRTT = RTT;
|
||||
}
|
||||
// store last RTT
|
||||
reportBlock->RTT = (uint16_t) RTT;
|
||||
reportBlock->RTT = RTT;
|
||||
|
||||
// store average RTT
|
||||
if (reportBlock->numAverageCalcs != 0) {
|
||||
float ac = static_cast<float> (reportBlock->numAverageCalcs);
|
||||
float newAverage = ((ac / (ac + 1)) * reportBlock->avgRTT)
|
||||
+ ((1 / (ac + 1)) * RTT);
|
||||
reportBlock->avgRTT = static_cast<int> (newAverage + 0.5f);
|
||||
float ac = static_cast<float>(reportBlock->numAverageCalcs);
|
||||
float newAverage =
|
||||
((ac / (ac + 1)) * reportBlock->avgRTT) + ((1 / (ac + 1)) * RTT);
|
||||
reportBlock->avgRTT = static_cast<int64_t>(newAverage + 0.5f);
|
||||
} else {
|
||||
// first RTT
|
||||
reportBlock->avgRTT = (uint16_t) RTT;
|
||||
reportBlock->avgRTT = RTT;
|
||||
}
|
||||
reportBlock->numAverageCalcs++;
|
||||
}
|
||||
@ -962,9 +962,9 @@ void RTCPReceiver::HandleXrDlrrReportBlockItem(
|
||||
(((packet.XRDLRRReportBlockItem.DelayLastRR & 0x0000ffff) * 1000) >> 16) +
|
||||
(((packet.XRDLRRReportBlockItem.DelayLastRR & 0xffff0000) >> 16) * 1000);
|
||||
|
||||
int32_t rtt = _clock->CurrentNtpInMilliseconds() - delay_rr_ms - send_time_ms;
|
||||
int64_t rtt = _clock->CurrentNtpInMilliseconds() - delay_rr_ms - send_time_ms;
|
||||
|
||||
xr_rr_rtt_ms_ = static_cast<uint16_t>(std::max(rtt, 1));
|
||||
xr_rr_rtt_ms_ = std::max<int64_t>(rtt, 1);
|
||||
|
||||
rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpXrDlrrReportBlock;
|
||||
}
|
||||
|
@ -71,14 +71,14 @@ public:
|
||||
|
||||
// get rtt
|
||||
int32_t RTT(uint32_t remoteSSRC,
|
||||
uint16_t* RTT,
|
||||
uint16_t* avgRTT,
|
||||
uint16_t* minRTT,
|
||||
uint16_t* maxRTT) const;
|
||||
int64_t* RTT,
|
||||
int64_t* avgRTT,
|
||||
int64_t* minRTT,
|
||||
int64_t* maxRTT) const;
|
||||
|
||||
int32_t SenderInfoReceived(RTCPSenderInfo* senderInfo) const;
|
||||
|
||||
bool GetAndResetXrRrRtt(uint16_t* rtt_ms);
|
||||
bool GetAndResetXrRrRtt(int64_t* rtt_ms);
|
||||
|
||||
// get statistics
|
||||
int32_t StatisticsReceived(
|
||||
@ -257,7 +257,7 @@ protected:
|
||||
uint32_t _lastReceivedXRNTPsecs;
|
||||
uint32_t _lastReceivedXRNTPfrac;
|
||||
// Estimated rtt, zero when there is no valid estimate.
|
||||
uint16_t xr_rr_rtt_ms_;
|
||||
int64_t xr_rr_rtt_ms_;
|
||||
|
||||
// Received report blocks.
|
||||
ReportBlockMap _receivedReportBlockMap
|
||||
|
@ -34,11 +34,11 @@ public:
|
||||
uint32_t remoteMaxJitter;
|
||||
|
||||
// RTT
|
||||
uint16_t RTT;
|
||||
uint16_t minRTT;
|
||||
uint16_t maxRTT;
|
||||
uint16_t avgRTT;
|
||||
uint32_t numAverageCalcs;
|
||||
int64_t RTT;
|
||||
int64_t minRTT;
|
||||
int64_t maxRTT;
|
||||
int64_t avgRTT;
|
||||
uint32_t numAverageCalcs;
|
||||
};
|
||||
|
||||
class RTCPPacketInformation
|
||||
@ -68,7 +68,7 @@ public:
|
||||
uint16_t applicationLength;
|
||||
|
||||
ReportBlockList report_blocks;
|
||||
uint16_t rtt;
|
||||
int64_t rtt;
|
||||
|
||||
uint32_t interArrivalJitter;
|
||||
|
||||
|
@ -744,7 +744,7 @@ TEST_F(RtcpReceiverTest, InjectXrPacketWithUnknownReportBlock) {
|
||||
}
|
||||
|
||||
TEST_F(RtcpReceiverTest, TestXrRrRttInitiallyFalse) {
|
||||
uint16_t rtt_ms;
|
||||
int64_t rtt_ms;
|
||||
EXPECT_FALSE(rtcp_receiver_->GetAndResetXrRrRtt(&rtt_ms));
|
||||
}
|
||||
|
||||
|
@ -438,8 +438,7 @@ From RFC 3550
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
RTCPSender::LastSendReport( uint32_t& lastRTCPTime)
|
||||
uint32_t RTCPSender::LastSendReport(int64_t& lastRTCPTime)
|
||||
{
|
||||
CriticalSectionScoped lock(_criticalSectionRTCPSender);
|
||||
|
||||
@ -447,7 +446,7 @@ RTCPSender::LastSendReport( uint32_t& lastRTCPTime)
|
||||
return _lastSendReport[0];
|
||||
}
|
||||
|
||||
uint32_t RTCPSender::SendTimeOfSendReport(uint32_t sendReport) {
|
||||
int64_t RTCPSender::SendTimeOfSendReport(uint32_t sendReport) {
|
||||
CriticalSectionScoped lock(_criticalSectionRTCPSender);
|
||||
|
||||
// This is only saved when we are the sender
|
||||
|
@ -103,13 +103,13 @@ public:
|
||||
|
||||
int32_t RemoveMixedCNAME(uint32_t SSRC);
|
||||
|
||||
uint32_t SendTimeOfSendReport(uint32_t sendReport);
|
||||
int64_t SendTimeOfSendReport(uint32_t sendReport);
|
||||
|
||||
bool SendTimeOfXrRrReport(uint32_t mid_ntp, int64_t* time_ms) const;
|
||||
|
||||
bool TimeToSendRTCPReport(bool sendKeyframeBeforeRTP = false) const;
|
||||
|
||||
uint32_t LastSendReport(uint32_t& lastRTCPTime);
|
||||
uint32_t LastSendReport(int64_t& lastRTCPTime);
|
||||
|
||||
int32_t SendRTCP(
|
||||
const FeedbackState& feedback_state,
|
||||
@ -310,7 +310,7 @@ private:
|
||||
// Sent
|
||||
uint32_t _lastSendReport[RTCP_NUMBER_OF_SR] GUARDED_BY(
|
||||
_criticalSectionRTCPSender); // allow packet loss and RTT above 1 sec
|
||||
uint32_t _lastRTCPTime[RTCP_NUMBER_OF_SR] GUARDED_BY(
|
||||
int64_t _lastRTCPTime[RTCP_NUMBER_OF_SR] GUARDED_BY(
|
||||
_criticalSectionRTCPSender);
|
||||
|
||||
// Sent XR receiver reference time report.
|
||||
|
@ -178,7 +178,7 @@ bool RTPPacketHistory::HasRTPPacket(uint16_t sequence_number) const {
|
||||
}
|
||||
|
||||
bool RTPPacketHistory::GetPacketAndSetSendTime(uint16_t sequence_number,
|
||||
uint32_t min_elapsed_time_ms,
|
||||
int64_t min_elapsed_time_ms,
|
||||
bool retransmit,
|
||||
uint8_t* packet,
|
||||
size_t* packet_length,
|
||||
|
@ -53,7 +53,7 @@ class RTPPacketHistory {
|
||||
// stored_time_ms: returns the time when the packet was stored.
|
||||
// type: returns the storage type set in PutRTPPacket.
|
||||
bool GetPacketAndSetSendTime(uint16_t sequence_number,
|
||||
uint32_t min_elapsed_time_ms,
|
||||
int64_t min_elapsed_time_ms,
|
||||
bool retransmit,
|
||||
uint8_t* packet,
|
||||
size_t* packet_length,
|
||||
|
@ -181,10 +181,10 @@ int32_t ModuleRtpRtcpImpl::Process() {
|
||||
last_rtt_process_time_ && process_rtt) {
|
||||
std::vector<RTCPReportBlock> receive_blocks;
|
||||
rtcp_receiver_.StatisticsReceived(&receive_blocks);
|
||||
uint16_t max_rtt = 0;
|
||||
int64_t max_rtt = 0;
|
||||
for (std::vector<RTCPReportBlock>::iterator it = receive_blocks.begin();
|
||||
it != receive_blocks.end(); ++it) {
|
||||
uint16_t rtt = 0;
|
||||
int64_t rtt = 0;
|
||||
rtcp_receiver_.RTT(it->remoteSSRC, &rtt, NULL, NULL, NULL);
|
||||
max_rtt = (rtt > max_rtt) ? rtt : max_rtt;
|
||||
}
|
||||
@ -216,7 +216,7 @@ int32_t ModuleRtpRtcpImpl::Process() {
|
||||
} else {
|
||||
// Report rtt from receiver.
|
||||
if (process_rtt) {
|
||||
uint16_t rtt_ms;
|
||||
int64_t rtt_ms;
|
||||
if (rtt_stats_ && rtcp_receiver_.GetAndResetXrRrRtt(&rtt_ms)) {
|
||||
rtt_stats_->OnRttUpdate(rtt_ms);
|
||||
}
|
||||
@ -707,7 +707,7 @@ void ModuleRtpRtcpImpl::SetRTCPStatus(const RTCPMethod method) {
|
||||
|
||||
// Only for internal test.
|
||||
uint32_t ModuleRtpRtcpImpl::LastSendReport(
|
||||
uint32_t& last_rtcptime) {
|
||||
int64_t& last_rtcptime) {
|
||||
return rtcp_sender_.LastSendReport(last_rtcptime);
|
||||
}
|
||||
|
||||
@ -747,14 +747,14 @@ int32_t ModuleRtpRtcpImpl::RemoteNTP(
|
||||
|
||||
// Get RoundTripTime.
|
||||
int32_t ModuleRtpRtcpImpl::RTT(const uint32_t remote_ssrc,
|
||||
uint16_t* rtt,
|
||||
uint16_t* avg_rtt,
|
||||
uint16_t* min_rtt,
|
||||
uint16_t* max_rtt) const {
|
||||
int64_t* rtt,
|
||||
int64_t* avg_rtt,
|
||||
int64_t* min_rtt,
|
||||
int64_t* max_rtt) const {
|
||||
int32_t ret = rtcp_receiver_.RTT(remote_ssrc, rtt, avg_rtt, min_rtt, max_rtt);
|
||||
if (rtt && *rtt == 0) {
|
||||
// Try to get RTT from RtcpRttStats class.
|
||||
*rtt = static_cast<uint16_t>(rtt_ms());
|
||||
*rtt = rtt_ms();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -944,7 +944,7 @@ int32_t ModuleRtpRtcpImpl::SendNACK(const uint16_t* nack_list,
|
||||
|
||||
bool ModuleRtpRtcpImpl::TimeToSendFullNackList(int64_t now) const {
|
||||
// Use RTT from RtcpRttStats class if provided.
|
||||
uint16_t rtt = rtt_ms();
|
||||
int64_t rtt = rtt_ms();
|
||||
if (rtt == 0) {
|
||||
rtcp_receiver_.RTT(rtcp_receiver_.RemoteSSRC(), NULL, &rtt, NULL, NULL);
|
||||
}
|
||||
@ -1244,7 +1244,7 @@ int32_t ModuleRtpRtcpImpl::SendRTCPReferencePictureSelection(
|
||||
GetFeedbackState(), kRtcpRpsi, 0, 0, false, picture_id);
|
||||
}
|
||||
|
||||
uint32_t ModuleRtpRtcpImpl::SendTimeOfSendReport(
|
||||
int64_t ModuleRtpRtcpImpl::SendTimeOfSendReport(
|
||||
const uint32_t send_report) {
|
||||
return rtcp_sender_.SendTimeOfSendReport(send_report);
|
||||
}
|
||||
@ -1261,7 +1261,7 @@ void ModuleRtpRtcpImpl::OnReceivedNACK(
|
||||
return;
|
||||
}
|
||||
// Use RTT from RtcpRttStats class if provided.
|
||||
uint16_t rtt = rtt_ms();
|
||||
int64_t rtt = rtt_ms();
|
||||
if (rtt == 0) {
|
||||
rtcp_receiver_.RTT(rtcp_receiver_.RemoteSSRC(), NULL, &rtt, NULL, NULL);
|
||||
}
|
||||
@ -1324,12 +1324,12 @@ void ModuleRtpRtcpImpl::SetRtcpReceiverSsrcs(uint32_t main_ssrc) {
|
||||
rtcp_receiver_.SetSsrcs(main_ssrc, ssrcs);
|
||||
}
|
||||
|
||||
void ModuleRtpRtcpImpl::set_rtt_ms(uint32_t rtt_ms) {
|
||||
void ModuleRtpRtcpImpl::set_rtt_ms(int64_t rtt_ms) {
|
||||
CriticalSectionScoped cs(critical_section_rtt_.get());
|
||||
rtt_ms_ = rtt_ms;
|
||||
}
|
||||
|
||||
uint32_t ModuleRtpRtcpImpl::rtt_ms() const {
|
||||
int64_t ModuleRtpRtcpImpl::rtt_ms() const {
|
||||
CriticalSectionScoped cs(critical_section_rtt_.get());
|
||||
return rtt_ms_;
|
||||
}
|
||||
|
@ -158,10 +158,10 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
|
||||
|
||||
// Get RoundTripTime.
|
||||
virtual int32_t RTT(uint32_t remote_ssrc,
|
||||
uint16_t* rtt,
|
||||
uint16_t* avg_rtt,
|
||||
uint16_t* min_rtt,
|
||||
uint16_t* max_rtt) const OVERRIDE;
|
||||
int64_t* rtt,
|
||||
int64_t* avg_rtt,
|
||||
int64_t* min_rtt,
|
||||
int64_t* max_rtt) const OVERRIDE;
|
||||
|
||||
// Force a send of an RTCP packet.
|
||||
// Normal SR and RR are triggered via the process function.
|
||||
@ -326,7 +326,7 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
|
||||
uint32_t* fec_rate,
|
||||
uint32_t* nackRate) const OVERRIDE;
|
||||
|
||||
uint32_t SendTimeOfSendReport(uint32_t send_report);
|
||||
int64_t SendTimeOfSendReport(uint32_t send_report);
|
||||
|
||||
bool SendTimeOfXrRrReport(uint32_t mid_ntp, int64_t* time_ms) const;
|
||||
|
||||
@ -367,7 +367,7 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
|
||||
uint16_t RemoteSequenceNumber() const;
|
||||
|
||||
// Only for internal testing.
|
||||
uint32_t LastSendReport(uint32_t& last_rtcptime);
|
||||
uint32_t LastSendReport(int64_t& last_rtcptime);
|
||||
|
||||
RTPSender rtp_sender_;
|
||||
|
||||
@ -382,8 +382,8 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
|
||||
int64_t RtcpReportInterval();
|
||||
void SetRtcpReceiverSsrcs(uint32_t main_ssrc);
|
||||
|
||||
void set_rtt_ms(uint32_t rtt_ms);
|
||||
uint32_t rtt_ms() const;
|
||||
void set_rtt_ms(int64_t rtt_ms);
|
||||
int64_t rtt_ms() const;
|
||||
|
||||
bool TimeToSendFullNackList(int64_t now) const;
|
||||
|
||||
@ -419,7 +419,7 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
|
||||
|
||||
// The processed RTT from RtcpRttStats.
|
||||
scoped_ptr<CriticalSectionWrapper> critical_section_rtt_;
|
||||
uint32_t rtt_ms_;
|
||||
int64_t rtt_ms_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -31,7 +31,7 @@ namespace {
|
||||
const uint32_t kSenderSsrc = 0x12345;
|
||||
const uint32_t kReceiverSsrc = 0x23456;
|
||||
const uint32_t kSenderRtxSsrc = 0x32345;
|
||||
const uint32_t kOneWayNetworkDelayMs = 100;
|
||||
const int64_t kOneWayNetworkDelayMs = 100;
|
||||
const uint8_t kBaseLayerTid = 0;
|
||||
const uint8_t kHigherLayerTid = 1;
|
||||
const uint16_t kSequenceNumber = 100;
|
||||
@ -41,13 +41,13 @@ class RtcpRttStatsTestImpl : public RtcpRttStats {
|
||||
RtcpRttStatsTestImpl() : rtt_ms_(0) {}
|
||||
virtual ~RtcpRttStatsTestImpl() {}
|
||||
|
||||
virtual void OnRttUpdate(uint32_t rtt_ms) OVERRIDE {
|
||||
virtual void OnRttUpdate(int64_t rtt_ms) OVERRIDE {
|
||||
rtt_ms_ = rtt_ms;
|
||||
}
|
||||
virtual uint32_t LastProcessedRtt() const OVERRIDE {
|
||||
virtual int64_t LastProcessedRtt() const OVERRIDE {
|
||||
return rtt_ms_;
|
||||
}
|
||||
uint32_t rtt_ms_;
|
||||
int64_t rtt_ms_;
|
||||
};
|
||||
|
||||
class SendTransport : public Transport,
|
||||
@ -63,7 +63,7 @@ class SendTransport : public Transport,
|
||||
void SetRtpRtcpModule(ModuleRtpRtcpImpl* receiver) {
|
||||
receiver_ = receiver;
|
||||
}
|
||||
void SimulateNetworkDelay(uint32_t delay_ms, SimulatedClock* clock) {
|
||||
void SimulateNetworkDelay(int64_t delay_ms, SimulatedClock* clock) {
|
||||
clock_ = clock;
|
||||
delay_ms_ = delay_ms;
|
||||
}
|
||||
@ -92,7 +92,7 @@ class SendTransport : public Transport,
|
||||
}
|
||||
ModuleRtpRtcpImpl* receiver_;
|
||||
SimulatedClock* clock_;
|
||||
uint32_t delay_ms_;
|
||||
int64_t delay_ms_;
|
||||
int rtp_packets_sent_;
|
||||
RTPHeader last_rtp_header_;
|
||||
std::vector<uint16_t> last_nack_list_;
|
||||
@ -277,10 +277,10 @@ TEST_F(RtpRtcpImplTest, Rtt) {
|
||||
EXPECT_EQ(0, receiver_.impl_->SendRTCP(kRtcpReport));
|
||||
|
||||
// Verify RTT.
|
||||
uint16_t rtt;
|
||||
uint16_t avg_rtt;
|
||||
uint16_t min_rtt;
|
||||
uint16_t max_rtt;
|
||||
int64_t rtt;
|
||||
int64_t avg_rtt;
|
||||
int64_t min_rtt;
|
||||
int64_t max_rtt;
|
||||
EXPECT_EQ(0,
|
||||
sender_.impl_->RTT(kReceiverSsrc, &rtt, &avg_rtt, &min_rtt, &max_rtt));
|
||||
EXPECT_EQ(2 * kOneWayNetworkDelayMs, rtt);
|
||||
@ -293,8 +293,8 @@ TEST_F(RtpRtcpImplTest, Rtt) {
|
||||
sender_.impl_->RTT(kReceiverSsrc+1, &rtt, &avg_rtt, &min_rtt, &max_rtt));
|
||||
|
||||
// Verify RTT from rtt_stats config.
|
||||
EXPECT_EQ(0U, sender_.rtt_stats_.LastProcessedRtt());
|
||||
EXPECT_EQ(0U, sender_.impl_->rtt_ms());
|
||||
EXPECT_EQ(0, sender_.rtt_stats_.LastProcessedRtt());
|
||||
EXPECT_EQ(0, sender_.impl_->rtt_ms());
|
||||
sender_.impl_->Process();
|
||||
EXPECT_EQ(2 * kOneWayNetworkDelayMs, sender_.rtt_stats_.LastProcessedRtt());
|
||||
EXPECT_EQ(2 * kOneWayNetworkDelayMs, sender_.impl_->rtt_ms());
|
||||
@ -317,8 +317,8 @@ TEST_F(RtpRtcpImplTest, RttForReceiverOnly) {
|
||||
EXPECT_EQ(0, sender_.impl_->SendRTCP(kRtcpReport));
|
||||
|
||||
// Verify RTT.
|
||||
EXPECT_EQ(0U, receiver_.rtt_stats_.LastProcessedRtt());
|
||||
EXPECT_EQ(0U, receiver_.impl_->rtt_ms());
|
||||
EXPECT_EQ(0, receiver_.rtt_stats_.LastProcessedRtt());
|
||||
EXPECT_EQ(0, receiver_.impl_->rtt_ms());
|
||||
receiver_.impl_->Process();
|
||||
EXPECT_EQ(2 * kOneWayNetworkDelayMs, receiver_.rtt_stats_.LastProcessedRtt());
|
||||
EXPECT_EQ(2 * kOneWayNetworkDelayMs, receiver_.impl_->rtt_ms());
|
||||
|
@ -653,7 +653,7 @@ bool RTPSender::StorePackets() const {
|
||||
return packet_history_.StorePackets();
|
||||
}
|
||||
|
||||
int32_t RTPSender::ReSendPacket(uint16_t packet_id, uint32_t min_resend_time) {
|
||||
int32_t RTPSender::ReSendPacket(uint16_t packet_id, int64_t min_resend_time) {
|
||||
size_t length = IP_PACKET_SIZE;
|
||||
uint8_t data_buffer[IP_PACKET_SIZE];
|
||||
int64_t capture_time_ms;
|
||||
@ -720,7 +720,7 @@ int RTPSender::SetSelectiveRetransmissions(uint8_t settings) {
|
||||
}
|
||||
|
||||
void RTPSender::OnReceivedNACK(const std::list<uint16_t>& nack_sequence_numbers,
|
||||
uint16_t avg_rtt) {
|
||||
int64_t avg_rtt) {
|
||||
TRACE_EVENT2("webrtc_rtp", "RTPSender::OnReceivedNACK",
|
||||
"num_seqnum", nack_sequence_numbers.size(), "avg_rtt", avg_rtt);
|
||||
const int64_t now = clock_->TimeInMilliseconds();
|
||||
|
@ -173,13 +173,13 @@ class RTPSender : public RTPSenderInterface {
|
||||
int SelectiveRetransmissions() const;
|
||||
int SetSelectiveRetransmissions(uint8_t settings);
|
||||
void OnReceivedNACK(const std::list<uint16_t>& nack_sequence_numbers,
|
||||
uint16_t avg_rtt);
|
||||
int64_t avg_rtt);
|
||||
|
||||
void SetStorePacketsStatus(bool enable, uint16_t number_to_store);
|
||||
|
||||
bool StorePackets() const;
|
||||
|
||||
int32_t ReSendPacket(uint16_t packet_id, uint32_t min_resend_time = 0);
|
||||
int32_t ReSendPacket(uint16_t packet_id, int64_t min_resend_time = 0);
|
||||
|
||||
bool ProcessNACKBitRate(uint32_t now);
|
||||
|
||||
|
@ -319,10 +319,10 @@ TEST_F(RtpRtcpRtcpTest, RTCP) {
|
||||
EXPECT_EQ(test_sequence_number, stats.extended_max_sequence_number);
|
||||
EXPECT_EQ(reportBlockReceived.jitter, stats.jitter);
|
||||
|
||||
uint16_t RTT;
|
||||
uint16_t avgRTT;
|
||||
uint16_t minRTT;
|
||||
uint16_t maxRTT;
|
||||
int64_t RTT;
|
||||
int64_t avgRTT;
|
||||
int64_t minRTT;
|
||||
int64_t maxRTT;
|
||||
|
||||
// Get RoundTripTime.
|
||||
EXPECT_EQ(0, module1->RTT(test_ssrc + 1, &RTT, &avgRTT, &minRTT, &maxRTT));
|
||||
|
@ -87,7 +87,7 @@ class VideoCaptureModule: public RefCountedModule {
|
||||
// - packetLoss : Fraction lost
|
||||
// (loss rate in percent = 100 * packetLoss / 255).
|
||||
// - rtt : Round-trip time in milliseconds.
|
||||
virtual int32_t SetChannelParameters(uint32_t packetLoss, int rtt) = 0;
|
||||
virtual int32_t SetChannelParameters(uint32_t packetLoss, int64_t rtt) = 0;
|
||||
|
||||
// Encode the next frame as key frame.
|
||||
virtual int32_t EncodeFrameType(const FrameType type) = 0;
|
||||
|
@ -73,7 +73,7 @@ class I420Encoder : public VideoEncoder {
|
||||
}
|
||||
|
||||
virtual int SetChannelParameters(uint32_t /*packetLoss*/,
|
||||
int /*rtt*/) OVERRIDE {
|
||||
int64_t /*rtt*/) OVERRIDE {
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ class MockVideoEncoder : public VideoEncoder {
|
||||
int32_t(EncodedImageCallback* callback));
|
||||
MOCK_METHOD0(Release, int32_t());
|
||||
MOCK_METHOD0(Reset, int32_t());
|
||||
MOCK_METHOD2(SetChannelParameters, int32_t(uint32_t packetLoss, int rtt));
|
||||
MOCK_METHOD2(SetChannelParameters, int32_t(uint32_t packetLoss, int64_t rtt));
|
||||
MOCK_METHOD2(SetRates, int32_t(uint32_t newBitRate, uint32_t frameRate));
|
||||
MOCK_METHOD1(SetPeriodicKeyFrames, int32_t(bool enable));
|
||||
MOCK_METHOD2(CodecConfigParameters,
|
||||
|
@ -78,7 +78,8 @@ int ReferencePictureSelection::EncodeFlags(int picture_id, bool send_refresh,
|
||||
// enough for an RPSI to arrive after the decoder decoded the reference frame.
|
||||
// Ideally that should happen after one round-trip time.
|
||||
// Add a margin defined by |kRttConfidence|.
|
||||
uint32_t update_interval = kRttConfidence * rtt_;
|
||||
int64_t update_interval = static_cast<int64_t>(kRttConfidence * rtt_);
|
||||
const int64_t kMinUpdateInterval = 90 * 10; // Timestamp frequency
|
||||
if (update_interval < kMinUpdateInterval)
|
||||
update_interval = kMinUpdateInterval;
|
||||
// Don't send reference frame updates until we have an established reference.
|
||||
@ -114,13 +115,13 @@ void ReferencePictureSelection::EncodedKeyFrame(int picture_id) {
|
||||
received_ack_ = false;
|
||||
}
|
||||
|
||||
void ReferencePictureSelection::SetRtt(int rtt) {
|
||||
void ReferencePictureSelection::SetRtt(int64_t rtt) {
|
||||
// Convert from milliseconds to timestamp frequency.
|
||||
rtt_ = 90 * rtt;
|
||||
}
|
||||
|
||||
uint32_t ReferencePictureSelection::TimestampDiff(uint32_t new_ts,
|
||||
uint32_t old_ts) {
|
||||
int64_t ReferencePictureSelection::TimestampDiff(uint32_t new_ts,
|
||||
uint32_t old_ts) {
|
||||
if (old_ts > new_ts) {
|
||||
// Assuming this is a wrap, doing a compensated subtraction.
|
||||
return (new_ts + (static_cast<int64_t>(1) << 32)) - old_ts;
|
||||
|
@ -54,13 +54,11 @@ class ReferencePictureSelection {
|
||||
|
||||
// Set the round-trip time between the sender and the receiver to |rtt|
|
||||
// milliseconds.
|
||||
void SetRtt(int rtt);
|
||||
void SetRtt(int64_t rtt);
|
||||
|
||||
private:
|
||||
static uint32_t TimestampDiff(uint32_t new_ts, uint32_t old_ts);
|
||||
static int64_t TimestampDiff(uint32_t new_ts, uint32_t old_ts);
|
||||
|
||||
// The minimum time between reference frame updates.
|
||||
enum { kMinUpdateInterval = 90 * 10 }; // Timestamp frequency
|
||||
const double kRttConfidence;
|
||||
|
||||
bool update_golden_next_;
|
||||
@ -70,7 +68,7 @@ class ReferencePictureSelection {
|
||||
uint32_t last_sent_ref_update_time_;
|
||||
int established_ref_picture_id_;
|
||||
uint32_t last_refresh_time_;
|
||||
uint32_t rtt_;
|
||||
int64_t rtt_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -297,7 +297,7 @@ int SimulcastEncoderAdapter::RegisterEncodeCompleteCallback(
|
||||
}
|
||||
|
||||
int SimulcastEncoderAdapter::SetChannelParameters(uint32_t packet_loss,
|
||||
int rtt) {
|
||||
int64_t rtt) {
|
||||
for (size_t stream_idx = 0; stream_idx < streaminfos_.size(); ++stream_idx) {
|
||||
streaminfos_[stream_idx].encoder->SetChannelParameters(packet_loss, rtt);
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ class SimulcastEncoderAdapter : public VP8Encoder,
|
||||
const std::vector<VideoFrameType>* frame_types) OVERRIDE;
|
||||
virtual int RegisterEncodeCompleteCallback(
|
||||
EncodedImageCallback* callback) OVERRIDE;
|
||||
virtual int SetChannelParameters(uint32_t packet_loss, int rtt) OVERRIDE;
|
||||
virtual int SetChannelParameters(uint32_t packet_loss, int64_t rtt) OVERRIDE;
|
||||
virtual int SetRates(uint32_t new_bitrate_kbit,
|
||||
uint32_t new_framerate) OVERRIDE;
|
||||
|
||||
|
@ -132,7 +132,7 @@ class MockVideoEncoder : public VideoEncoder {
|
||||
}
|
||||
|
||||
MOCK_METHOD2(SetChannelParameters,
|
||||
int32_t(uint32_t packetLoss, int rtt));
|
||||
int32_t(uint32_t packetLoss, int64_t rtt));
|
||||
|
||||
virtual ~MockVideoEncoder() {
|
||||
}
|
||||
@ -175,7 +175,7 @@ class TestSimulcastEncoderAdapterFakeHelper {
|
||||
return new SimulcastEncoderAdapter(scoped_factory.Pass());
|
||||
}
|
||||
|
||||
void ExpectCallSetChannelParameters(uint32_t packetLoss, int rtt) {
|
||||
void ExpectCallSetChannelParameters(uint32_t packetLoss, int64_t rtt) {
|
||||
EXPECT_TRUE(!factory_->encoders().empty());
|
||||
for (size_t i = 0; i < factory_->encoders().size(); ++i) {
|
||||
EXPECT_CALL(*factory_->encoders()[i],
|
||||
@ -295,7 +295,7 @@ TEST_F(TestSimulcastEncoderAdapterFake, InitEncode) {
|
||||
TEST_F(TestSimulcastEncoderAdapterFake, SetChannelParameters) {
|
||||
SetupCodec();
|
||||
const uint32_t packetLoss = 5;
|
||||
const int rtt = 30;
|
||||
const int64_t rtt = 30;
|
||||
helper_->ExpectCallSetChannelParameters(packetLoss, rtt);
|
||||
adapter_->SetChannelParameters(packetLoss, rtt);
|
||||
}
|
||||
|
@ -1024,7 +1024,7 @@ int VP8EncoderImpl::GetEncodedPartitions(
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
|
||||
int VP8EncoderImpl::SetChannelParameters(uint32_t packetLoss, int rtt) {
|
||||
int VP8EncoderImpl::SetChannelParameters(uint32_t packetLoss, int64_t rtt) {
|
||||
rps_.SetRtt(rtt);
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class VP8EncoderImpl : public VP8Encoder {
|
||||
|
||||
virtual int RegisterEncodeCompleteCallback(EncodedImageCallback* callback);
|
||||
|
||||
virtual int SetChannelParameters(uint32_t packet_loss, int rtt);
|
||||
virtual int SetChannelParameters(uint32_t packet_loss, int64_t rtt);
|
||||
|
||||
virtual int SetRates(uint32_t new_bitrate_kbit, uint32_t frame_rate);
|
||||
|
||||
|
@ -334,7 +334,7 @@ int VP9EncoderImpl::GetEncodedPartitions(const I420VideoFrame& input_image) {
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
|
||||
int VP9EncoderImpl::SetChannelParameters(uint32_t packet_loss, int rtt) {
|
||||
int VP9EncoderImpl::SetChannelParameters(uint32_t packet_loss, int64_t rtt) {
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ class VP9EncoderImpl : public VP9Encoder {
|
||||
virtual int RegisterEncodeCompleteCallback(EncodedImageCallback* callback)
|
||||
OVERRIDE;
|
||||
|
||||
virtual int SetChannelParameters(uint32_t packet_loss, int rtt) OVERRIDE;
|
||||
virtual int SetChannelParameters(uint32_t packet_loss, int64_t rtt) OVERRIDE;
|
||||
|
||||
virtual int SetRates(uint32_t new_bitrate_kbit, uint32_t frame_rate) OVERRIDE;
|
||||
|
||||
|
@ -196,8 +196,8 @@ public:
|
||||
// Return value : VCM_OK, on success.
|
||||
// < 0, on error.
|
||||
virtual int32_t SetChannelParameters(uint32_t target_bitrate,
|
||||
uint8_t lossRate,
|
||||
uint32_t rtt) = 0;
|
||||
uint8_t lossRate,
|
||||
int64_t rtt) = 0;
|
||||
|
||||
// Sets the parameters describing the receive channel. These parameters are inputs to the
|
||||
// Media Optimization inside the VCM.
|
||||
@ -209,7 +209,7 @@ public:
|
||||
//
|
||||
// Return value : VCM_OK, on success.
|
||||
// < 0, on error.
|
||||
virtual int32_t SetReceiveChannelParameters(uint32_t rtt) = 0;
|
||||
virtual int32_t SetReceiveChannelParameters(int64_t rtt) = 0;
|
||||
|
||||
// Register a transport callback which will be called to deliver the encoded data and
|
||||
// side information.
|
||||
|
@ -106,7 +106,7 @@ VCMGenericEncoder::Encode(const I420VideoFrame& inputFrame,
|
||||
}
|
||||
|
||||
int32_t
|
||||
VCMGenericEncoder::SetChannelParameters(int32_t packetLoss, int rtt)
|
||||
VCMGenericEncoder::SetChannelParameters(int32_t packetLoss, int64_t rtt)
|
||||
{
|
||||
return _encoder.SetChannelParameters(packetLoss, rtt);
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
/**
|
||||
* Set a new packet loss rate and a new round-trip time in milliseconds.
|
||||
*/
|
||||
int32_t SetChannelParameters(int32_t packetLoss, int rtt);
|
||||
int32_t SetChannelParameters(int32_t packetLoss, int64_t rtt);
|
||||
int32_t CodecConfigParameters(uint8_t* buffer, int32_t size);
|
||||
/**
|
||||
* Register a transport callback which will be called to deliver the encoded
|
||||
|
@ -31,7 +31,7 @@
|
||||
namespace webrtc {
|
||||
|
||||
// Use this rtt if no value has been reported.
|
||||
static const uint32_t kDefaultRtt = 200;
|
||||
static const int64_t kDefaultRtt = 200;
|
||||
|
||||
typedef std::pair<uint32_t, VCMFrameBuffer*> FrameListPair;
|
||||
|
||||
@ -783,7 +783,7 @@ uint32_t VCMJitterBuffer::EstimatedJitterMs() {
|
||||
// low_rtt_nackThresholdMs_ == -1 means no FEC.
|
||||
double rtt_mult = 1.0f;
|
||||
if (low_rtt_nack_threshold_ms_ >= 0 &&
|
||||
static_cast<int>(rtt_ms_) >= low_rtt_nack_threshold_ms_) {
|
||||
rtt_ms_ >= low_rtt_nack_threshold_ms_) {
|
||||
// For RTTs above low_rtt_nack_threshold_ms_ we don't apply extra delay
|
||||
// when waiting for retransmissions.
|
||||
rtt_mult = 0.0f;
|
||||
@ -791,15 +791,15 @@ uint32_t VCMJitterBuffer::EstimatedJitterMs() {
|
||||
return jitter_estimate_.GetJitterEstimate(rtt_mult);
|
||||
}
|
||||
|
||||
void VCMJitterBuffer::UpdateRtt(uint32_t rtt_ms) {
|
||||
void VCMJitterBuffer::UpdateRtt(int64_t rtt_ms) {
|
||||
CriticalSectionScoped cs(crit_sect_);
|
||||
rtt_ms_ = rtt_ms;
|
||||
jitter_estimate_.UpdateRtt(rtt_ms);
|
||||
}
|
||||
|
||||
void VCMJitterBuffer::SetNackMode(VCMNackMode mode,
|
||||
int low_rtt_nack_threshold_ms,
|
||||
int high_rtt_nack_threshold_ms) {
|
||||
int64_t low_rtt_nack_threshold_ms,
|
||||
int64_t high_rtt_nack_threshold_ms) {
|
||||
CriticalSectionScoped cs(crit_sect_);
|
||||
nack_mode_ = mode;
|
||||
if (mode == kNoNack) {
|
||||
@ -1214,7 +1214,7 @@ bool VCMJitterBuffer::WaitForRetransmissions() {
|
||||
// Evaluate if the RTT is higher than |high_rtt_nack_threshold_ms_|, and in
|
||||
// that case we don't wait for retransmissions.
|
||||
if (high_rtt_nack_threshold_ms_ >= 0 &&
|
||||
rtt_ms_ >= static_cast<unsigned int>(high_rtt_nack_threshold_ms_)) {
|
||||
rtt_ms_ >= high_rtt_nack_threshold_ms_) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -153,7 +153,7 @@ class VCMJitterBuffer {
|
||||
uint32_t EstimatedJitterMs();
|
||||
|
||||
// Updates the round-trip time estimate.
|
||||
void UpdateRtt(uint32_t rtt_ms);
|
||||
void UpdateRtt(int64_t rtt_ms);
|
||||
|
||||
// Set the NACK mode. |highRttNackThreshold| is an RTT threshold in ms above
|
||||
// which NACK will be disabled if the NACK mode is |kNackHybrid|, -1 meaning
|
||||
@ -161,8 +161,8 @@ class VCMJitterBuffer {
|
||||
// |lowRttNackThreshold| is an RTT threshold in ms below which we expect to
|
||||
// rely on NACK only, and therefore are using larger buffers to have time to
|
||||
// wait for retransmissions.
|
||||
void SetNackMode(VCMNackMode mode, int low_rtt_nack_threshold_ms,
|
||||
int high_rtt_nack_threshold_ms);
|
||||
void SetNackMode(VCMNackMode mode, int64_t low_rtt_nack_threshold_ms,
|
||||
int64_t high_rtt_nack_threshold_ms);
|
||||
|
||||
void SetNackSettings(size_t max_nack_list_size,
|
||||
int max_packet_age_to_nack,
|
||||
@ -331,12 +331,12 @@ class VCMJitterBuffer {
|
||||
// Calculates network delays used for jitter calculations.
|
||||
VCMInterFrameDelay inter_frame_delay_;
|
||||
VCMJitterSample waiting_for_completion_;
|
||||
uint32_t rtt_ms_;
|
||||
int64_t rtt_ms_;
|
||||
|
||||
// NACK and retransmissions.
|
||||
VCMNackMode nack_mode_;
|
||||
int low_rtt_nack_threshold_ms_;
|
||||
int high_rtt_nack_threshold_ms_;
|
||||
int64_t low_rtt_nack_threshold_ms_;
|
||||
int64_t high_rtt_nack_threshold_ms_;
|
||||
// Holds the internal NACK list (the missing sequence numbers).
|
||||
SequenceNumberSet missing_sequence_numbers_;
|
||||
uint16_t latest_received_sequence_number_;
|
||||
|
@ -406,7 +406,7 @@ VCMJitterEstimator::PostProcessEstimate()
|
||||
}
|
||||
|
||||
void
|
||||
VCMJitterEstimator::UpdateRtt(uint32_t rttMs)
|
||||
VCMJitterEstimator::UpdateRtt(int64_t rttMs)
|
||||
{
|
||||
_rttFilter.Update(rttMs);
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
//
|
||||
// Input:
|
||||
// - rttMs : RTT in ms
|
||||
void UpdateRtt(uint32_t rttMs);
|
||||
void UpdateRtt(int64_t rttMs);
|
||||
|
||||
void UpdateMaxFrameSize(uint32_t frameSizeBytes);
|
||||
|
||||
|
@ -53,8 +53,8 @@ VCMProtectionMethod::UpdateContentMetrics(const
|
||||
_qmRobustness->UpdateContent(contentMetrics);
|
||||
}
|
||||
|
||||
VCMNackFecMethod::VCMNackFecMethod(int lowRttNackThresholdMs,
|
||||
int highRttNackThresholdMs)
|
||||
VCMNackFecMethod::VCMNackFecMethod(int64_t lowRttNackThresholdMs,
|
||||
int64_t highRttNackThresholdMs)
|
||||
: VCMFecMethod(),
|
||||
_lowRttNackMs(lowRttNackThresholdMs),
|
||||
_highRttNackMs(highRttNackThresholdMs),
|
||||
@ -159,6 +159,8 @@ bool VCMNackFecMethod::BitRateTooLowForFec(
|
||||
}
|
||||
// TODO (marpan): add condition based on maximum frames used for FEC,
|
||||
// and expand condition based on frame size.
|
||||
// Max round trip time threshold in ms.
|
||||
const int64_t kMaxRttTurnOffFec = 200;
|
||||
if (estimate_bytes_per_frame < max_bytes_per_frame &&
|
||||
parameters->numLayers < 3 &&
|
||||
parameters->rtt < kMaxRttTurnOffFec) {
|
||||
@ -737,7 +739,7 @@ VCMLossProtectionLogic::RequiredBitRate() const
|
||||
}
|
||||
|
||||
void
|
||||
VCMLossProtectionLogic::UpdateRtt(uint32_t rtt)
|
||||
VCMLossProtectionLogic::UpdateRtt(int64_t rtt)
|
||||
{
|
||||
_rtt = rtt;
|
||||
}
|
||||
|
@ -41,10 +41,7 @@ enum FilterPacketLossMode {
|
||||
|
||||
// Thresholds for hybrid NACK/FEC
|
||||
// common to media optimization and the jitter buffer.
|
||||
enum HybridNackTH {
|
||||
kHighRttNackMs = 100,
|
||||
kLowRttNackMs = 20
|
||||
};
|
||||
const int64_t kLowRttNackMs = 20;
|
||||
|
||||
struct VCMProtectionParameters
|
||||
{
|
||||
@ -55,7 +52,7 @@ struct VCMProtectionParameters
|
||||
numLayers(1)
|
||||
{}
|
||||
|
||||
int rtt;
|
||||
int64_t rtt;
|
||||
float lossPr;
|
||||
float bitRate;
|
||||
float packetsPerFrame;
|
||||
@ -211,16 +208,14 @@ protected:
|
||||
enum { kMaxBytesPerFrameForFecLow = 400 };
|
||||
// Max bytes/frame for frame size larger than VGA, ~200k at 25fps.
|
||||
enum { kMaxBytesPerFrameForFecHigh = 1000 };
|
||||
// Max round trip time threshold in ms.
|
||||
enum { kMaxRttTurnOffFec = 200 };
|
||||
};
|
||||
|
||||
|
||||
class VCMNackFecMethod : public VCMFecMethod
|
||||
{
|
||||
public:
|
||||
VCMNackFecMethod(int lowRttNackThresholdMs,
|
||||
int highRttNackThresholdMs);
|
||||
VCMNackFecMethod(int64_t lowRttNackThresholdMs,
|
||||
int64_t highRttNackThresholdMs);
|
||||
virtual ~VCMNackFecMethod();
|
||||
virtual bool UpdateParameters(const VCMProtectionParameters* parameters);
|
||||
// Get the effective packet loss for ER
|
||||
@ -234,8 +229,8 @@ public:
|
||||
private:
|
||||
int ComputeMaxFramesFec(const VCMProtectionParameters* parameters);
|
||||
|
||||
int _lowRttNackMs;
|
||||
int _highRttNackMs;
|
||||
int64_t _lowRttNackMs;
|
||||
int64_t _highRttNackMs;
|
||||
int _maxFramesFec;
|
||||
};
|
||||
|
||||
@ -267,7 +262,7 @@ public:
|
||||
//
|
||||
// Input:
|
||||
// - rtt : Round-trip time in seconds.
|
||||
void UpdateRtt(uint32_t rtt);
|
||||
void UpdateRtt(int64_t rtt);
|
||||
|
||||
// Update residual packet loss
|
||||
//
|
||||
@ -369,7 +364,7 @@ private:
|
||||
uint8_t MaxFilteredLossPr(int64_t nowMs) const;
|
||||
VCMProtectionMethod* _selectedMethod;
|
||||
VCMProtectionParameters _currentParameters;
|
||||
uint32_t _rtt;
|
||||
int64_t _rtt;
|
||||
float _lossPr;
|
||||
float _bitRate;
|
||||
float _frameRate;
|
||||
|
@ -200,7 +200,7 @@ void MediaOptimization::SetEncodingDataInternal(VideoCodecType send_codec_type,
|
||||
uint32_t MediaOptimization::SetTargetRates(
|
||||
uint32_t target_bitrate,
|
||||
uint8_t fraction_lost,
|
||||
uint32_t round_trip_time_ms,
|
||||
int64_t round_trip_time_ms,
|
||||
VCMProtectionCallback* protection_callback,
|
||||
VCMQMSettingsCallback* qmsettings_callback) {
|
||||
CriticalSectionScoped lock(crit_sect_.get());
|
||||
|
@ -58,7 +58,7 @@ class MediaOptimization {
|
||||
// an internal critical section.
|
||||
uint32_t SetTargetRates(uint32_t target_bitrate,
|
||||
uint8_t fraction_lost,
|
||||
uint32_t round_trip_time_ms,
|
||||
int64_t round_trip_time_ms,
|
||||
VCMProtectionCallback* protection_callback,
|
||||
VCMQMSettingsCallback* qmsettings_callback);
|
||||
|
||||
|
@ -15,9 +15,8 @@ namespace webrtc
|
||||
{
|
||||
|
||||
// Table for adjusting FEC rate for NACK/FEC protection method
|
||||
// Table values are built as a sigmoid function, ranging from 0 to
|
||||
// kHighRttNackMs (100), based on the HybridNackTH values defined in
|
||||
// media_opt_util.h.
|
||||
// Table values are built as a sigmoid function, ranging from 0 to 100, based on
|
||||
// the HybridNackTH values defined in media_opt_util.h.
|
||||
const uint16_t VCMNackFecTable[100] = {
|
||||
0,
|
||||
0,
|
||||
|
@ -925,7 +925,7 @@ void VCMQmRobustness::Reset() {
|
||||
float VCMQmRobustness::AdjustFecFactor(uint8_t code_rate_delta,
|
||||
float total_rate,
|
||||
float framerate,
|
||||
uint32_t rtt_time,
|
||||
int64_t rtt_time,
|
||||
uint8_t packet_loss) {
|
||||
// Default: no adjustment
|
||||
float adjust_fec = 1.0f;
|
||||
|
@ -353,7 +353,7 @@ class VCMQmRobustness : public VCMQmMethod {
|
||||
float AdjustFecFactor(uint8_t code_rate_delta,
|
||||
float total_rate,
|
||||
float framerate,
|
||||
uint32_t rtt_time,
|
||||
int64_t rtt_time,
|
||||
uint8_t packet_loss);
|
||||
|
||||
// Set the UEP protection on/off.
|
||||
@ -365,7 +365,7 @@ class VCMQmRobustness : public VCMQmMethod {
|
||||
private:
|
||||
// Previous state of network parameters.
|
||||
float prev_total_rate_;
|
||||
uint32_t prev_rtt_time_;
|
||||
int64_t prev_rtt_time_;
|
||||
uint8_t prev_packet_loss_;
|
||||
uint8_t prev_code_rate_delta_;
|
||||
};
|
||||
|
@ -59,7 +59,7 @@ int32_t VCMReceiver::Initialize() {
|
||||
return VCM_OK;
|
||||
}
|
||||
|
||||
void VCMReceiver::UpdateRtt(uint32_t rtt) {
|
||||
void VCMReceiver::UpdateRtt(int64_t rtt) {
|
||||
jitter_buffer_.UpdateRtt(rtt);
|
||||
}
|
||||
|
||||
@ -191,8 +191,8 @@ uint32_t VCMReceiver::DiscardedPackets() const {
|
||||
}
|
||||
|
||||
void VCMReceiver::SetNackMode(VCMNackMode nackMode,
|
||||
int low_rtt_nack_threshold_ms,
|
||||
int high_rtt_nack_threshold_ms) {
|
||||
int64_t low_rtt_nack_threshold_ms,
|
||||
int64_t high_rtt_nack_threshold_ms) {
|
||||
CriticalSectionScoped cs(crit_sect_);
|
||||
// Default to always having NACK enabled in hybrid mode.
|
||||
jitter_buffer_.SetNackMode(nackMode, low_rtt_nack_threshold_ms,
|
||||
|
@ -44,7 +44,7 @@ class VCMReceiver {
|
||||
|
||||
void Reset();
|
||||
int32_t Initialize();
|
||||
void UpdateRtt(uint32_t rtt);
|
||||
void UpdateRtt(int64_t rtt);
|
||||
int32_t InsertPacket(const VCMPacket& packet,
|
||||
uint16_t frame_width,
|
||||
uint16_t frame_height);
|
||||
@ -57,8 +57,8 @@ class VCMReceiver {
|
||||
|
||||
// NACK.
|
||||
void SetNackMode(VCMNackMode nackMode,
|
||||
int low_rtt_nack_threshold_ms,
|
||||
int high_rtt_nack_threshold_ms);
|
||||
int64_t low_rtt_nack_threshold_ms,
|
||||
int64_t high_rtt_nack_threshold_ms);
|
||||
void SetNackSettings(size_t max_nack_list_size,
|
||||
int max_packet_age_to_nack,
|
||||
int max_incomplete_time_ms);
|
||||
|
@ -58,7 +58,7 @@ VCMRttFilter::Reset()
|
||||
}
|
||||
|
||||
void
|
||||
VCMRttFilter::Update(uint32_t rttMs)
|
||||
VCMRttFilter::Update(int64_t rttMs)
|
||||
{
|
||||
if (!_gotNonZeroUpdate)
|
||||
{
|
||||
@ -103,7 +103,7 @@ VCMRttFilter::Update(uint32_t rttMs)
|
||||
}
|
||||
|
||||
bool
|
||||
VCMRttFilter::JumpDetection(uint32_t rttMs)
|
||||
VCMRttFilter::JumpDetection(int64_t rttMs)
|
||||
{
|
||||
double diffFromAvg = _avgRtt - rttMs;
|
||||
if (fabs(diffFromAvg) > _jumpStdDevs * sqrt(_varRtt))
|
||||
@ -147,7 +147,7 @@ VCMRttFilter::JumpDetection(uint32_t rttMs)
|
||||
}
|
||||
|
||||
bool
|
||||
VCMRttFilter::DriftDetection(uint32_t rttMs)
|
||||
VCMRttFilter::DriftDetection(int64_t rttMs)
|
||||
{
|
||||
if (_maxRtt - _avgRtt > _driftStdDevs * sqrt(_varRtt))
|
||||
{
|
||||
@ -174,7 +174,7 @@ VCMRttFilter::DriftDetection(uint32_t rttMs)
|
||||
}
|
||||
|
||||
void
|
||||
VCMRttFilter::ShortRttFilter(uint32_t* buf, uint32_t length)
|
||||
VCMRttFilter::ShortRttFilter(int64_t* buf, uint32_t length)
|
||||
{
|
||||
if (length == 0)
|
||||
{
|
||||
@ -193,10 +193,10 @@ VCMRttFilter::ShortRttFilter(uint32_t* buf, uint32_t length)
|
||||
_avgRtt = _avgRtt / static_cast<double>(length);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
int64_t
|
||||
VCMRttFilter::RttMs() const
|
||||
{
|
||||
return static_cast<uint32_t>(_maxRtt + 0.5);
|
||||
return static_cast<int64_t>(_maxRtt + 0.5);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,9 +26,9 @@ public:
|
||||
// Resets the filter.
|
||||
void Reset();
|
||||
// Updates the filter with a new sample.
|
||||
void Update(uint32_t rttMs);
|
||||
void Update(int64_t rttMs);
|
||||
// A getter function for the current RTT level in ms.
|
||||
uint32_t RttMs() const;
|
||||
int64_t RttMs() const;
|
||||
|
||||
private:
|
||||
// The size of the drift and jump memory buffers
|
||||
@ -39,19 +39,19 @@ private:
|
||||
// samples and average to the standard deviation.
|
||||
// Returns true if the long time statistics should be updated
|
||||
// and false otherwise
|
||||
bool JumpDetection(uint32_t rttMs);
|
||||
bool JumpDetection(int64_t rttMs);
|
||||
// Detects RTT drifts by comparing the difference between
|
||||
// max and average to the standard deviation.
|
||||
// Returns true if the long time statistics should be updated
|
||||
// and false otherwise
|
||||
bool DriftDetection(uint32_t rttMs);
|
||||
bool DriftDetection(int64_t rttMs);
|
||||
// Computes the short time average and maximum of the vector buf.
|
||||
void ShortRttFilter(uint32_t* buf, uint32_t length);
|
||||
void ShortRttFilter(int64_t* buf, uint32_t length);
|
||||
|
||||
bool _gotNonZeroUpdate;
|
||||
double _avgRtt;
|
||||
double _varRtt;
|
||||
uint32_t _maxRtt;
|
||||
int64_t _maxRtt;
|
||||
uint32_t _filtFactCount;
|
||||
const uint32_t _filtFactMax;
|
||||
const double _jumpStdDevs;
|
||||
@ -59,8 +59,8 @@ private:
|
||||
int32_t _jumpCount;
|
||||
int32_t _driftCount;
|
||||
const int32_t _detectThreshold;
|
||||
uint32_t _jumpBuf[kMaxDriftJumpCount];
|
||||
uint32_t _driftBuf[kMaxDriftJumpCount];
|
||||
int64_t _jumpBuf[kMaxDriftJumpCount];
|
||||
int64_t _driftBuf[kMaxDriftJumpCount];
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -14,18 +14,13 @@
|
||||
#include "webrtc/system_wrappers/interface/logging.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace {
|
||||
// Used in determining whether a frame is decodable.
|
||||
enum {kRttThreshold = 100}; // Not decodable if Rtt is lower than this.
|
||||
|
||||
// Do not decode frames if the number of packets is between these two
|
||||
// thresholds.
|
||||
static const float kLowPacketPercentageThreshold = 0.2f;
|
||||
static const float kHighPacketPercentageThreshold = 0.8f;
|
||||
namespace {
|
||||
|
||||
uint16_t BufferToUWord16(const uint8_t* dataBuffer) {
|
||||
return (dataBuffer[0] << 8) | dataBuffer[1];
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
VCMSessionInfo::VCMSessionInfo()
|
||||
@ -233,6 +228,12 @@ void VCMSessionInfo::UpdateDecodableSession(const FrameData& frame_data) {
|
||||
return;
|
||||
// TODO(agalusza): Account for bursty loss.
|
||||
// TODO(agalusza): Refine these values to better approximate optimal ones.
|
||||
// Do not decode frames if the RTT is lower than this.
|
||||
const int64_t kRttThreshold = 100;
|
||||
// Do not decode frames if the number of packets is between these two
|
||||
// thresholds.
|
||||
const float kLowPacketPercentageThreshold = 0.2f;
|
||||
const float kHighPacketPercentageThreshold = 0.8f;
|
||||
if (frame_data.rtt_ms < kRttThreshold
|
||||
|| frame_type_ == kVideoFrameKey
|
||||
|| !HaveFirstPacket()
|
||||
|
@ -22,7 +22,7 @@ namespace webrtc {
|
||||
// Used to pass data from jitter buffer to session info.
|
||||
// This data is then used in determining whether a frame is decodable.
|
||||
struct FrameData {
|
||||
int rtt_ms;
|
||||
int64_t rtt_ms;
|
||||
float rolling_average_packets_per_frame;
|
||||
};
|
||||
|
||||
|
@ -142,7 +142,7 @@ class VideoCodingModuleImpl : public VideoCodingModule {
|
||||
|
||||
virtual int32_t SetChannelParameters(uint32_t target_bitrate, // bits/s.
|
||||
uint8_t lossRate,
|
||||
uint32_t rtt) OVERRIDE {
|
||||
int64_t rtt) OVERRIDE {
|
||||
return sender_->SetChannelParameters(target_bitrate, lossRate, rtt);
|
||||
}
|
||||
|
||||
@ -332,7 +332,7 @@ class VideoCodingModuleImpl : public VideoCodingModule {
|
||||
return receiver_->SetMinReceiverDelay(desired_delay_ms);
|
||||
}
|
||||
|
||||
virtual int32_t SetReceiveChannelParameters(uint32_t rtt) OVERRIDE {
|
||||
virtual int32_t SetReceiveChannelParameters(int64_t rtt) OVERRIDE {
|
||||
return receiver_->SetReceiveChannelParameters(rtt);
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ class VideoSender {
|
||||
|
||||
int32_t SetChannelParameters(uint32_t target_bitrate, // bits/s.
|
||||
uint8_t lossRate,
|
||||
uint32_t rtt);
|
||||
int64_t rtt);
|
||||
|
||||
int32_t RegisterTransportCallback(VCMPacketizationCallback* transport);
|
||||
int32_t RegisterSendStatisticsCallback(VCMSendStatisticsCallback* sendStats);
|
||||
@ -175,7 +175,7 @@ class VideoReceiver {
|
||||
void SetDecodeErrorMode(VCMDecodeErrorMode decode_error_mode);
|
||||
int SetMinReceiverDelay(int desired_delay_ms);
|
||||
|
||||
int32_t SetReceiveChannelParameters(uint32_t rtt);
|
||||
int32_t SetReceiveChannelParameters(int64_t rtt);
|
||||
int32_t SetVideoProtection(VCMVideoProtection videoProtection, bool enable);
|
||||
|
||||
int64_t TimeUntilNextProcess();
|
||||
|
@ -168,7 +168,7 @@ int64_t VideoReceiver::TimeUntilNextProcess() {
|
||||
return timeUntilNextProcess;
|
||||
}
|
||||
|
||||
int32_t VideoReceiver::SetReceiveChannelParameters(uint32_t rtt) {
|
||||
int32_t VideoReceiver::SetReceiveChannelParameters(int64_t rtt) {
|
||||
CriticalSectionScoped receiveCs(_receiveCritSect);
|
||||
_receiver.UpdateRtt(rtt);
|
||||
return 0;
|
||||
|
@ -244,7 +244,7 @@ int VideoSender::FrameRate(unsigned int* framerate) const {
|
||||
// Set channel parameters
|
||||
int32_t VideoSender::SetChannelParameters(uint32_t target_bitrate,
|
||||
uint8_t lossRate,
|
||||
uint32_t rtt) {
|
||||
int64_t rtt) {
|
||||
int32_t ret = 0;
|
||||
{
|
||||
CriticalSectionScoped sendCs(_sendCritSect);
|
||||
|
@ -75,7 +75,7 @@ private:
|
||||
bool _nackEnabled;
|
||||
bool _fecEnabled;
|
||||
bool _nackFecEnabled;
|
||||
uint8_t _rttMS;
|
||||
int64_t _rttMS;
|
||||
float _bitRate;
|
||||
double _lossRate;
|
||||
uint32_t _renderDelayMs;
|
||||
|
@ -119,7 +119,7 @@ int MTRxTxTest(CmdArgs& args)
|
||||
// Nack support is currently not implemented in this test.
|
||||
bool nackEnabled = false;
|
||||
bool fecEnabled = false;
|
||||
uint8_t rttMS = 20;
|
||||
int64_t rttMS = 20;
|
||||
float lossRate = 0.0*255; // no packet loss
|
||||
uint32_t renderDelayMs = 0;
|
||||
uint32_t minPlayoutDelayMs = 0;
|
||||
|
@ -71,7 +71,7 @@ class RawRtpPacket {
|
||||
|
||||
class LostPackets {
|
||||
public:
|
||||
LostPackets(Clock* clock, uint32_t rtt_ms)
|
||||
LostPackets(Clock* clock, int64_t rtt_ms)
|
||||
: crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
debug_file_(fopen("PacketLossDebug.txt", "w")),
|
||||
loss_count_(0),
|
||||
@ -180,7 +180,7 @@ class LostPackets {
|
||||
int loss_count_;
|
||||
RtpPacketList packets_;
|
||||
Clock* clock_;
|
||||
uint32_t rtt_ms_;
|
||||
int64_t rtt_ms_;
|
||||
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(LostPackets);
|
||||
};
|
||||
@ -323,7 +323,7 @@ class RtpPlayerImpl : public RtpPlayerInterface {
|
||||
RtpPlayerImpl(PayloadSinkFactoryInterface* payload_sink_factory,
|
||||
const PayloadTypes& payload_types, Clock* clock,
|
||||
scoped_ptr<test::RtpFileReader>* packet_source,
|
||||
float loss_rate, uint32_t rtt_ms, bool reordering)
|
||||
float loss_rate, int64_t rtt_ms, bool reordering)
|
||||
: ssrc_handlers_(payload_sink_factory, payload_types),
|
||||
clock_(clock),
|
||||
next_rtp_time_(0),
|
||||
@ -468,7 +468,7 @@ class RtpPlayerImpl : public RtpPlayerInterface {
|
||||
|
||||
RtpPlayerInterface* Create(const std::string& input_filename,
|
||||
PayloadSinkFactoryInterface* payload_sink_factory, Clock* clock,
|
||||
const PayloadTypes& payload_types, float loss_rate, uint32_t rtt_ms,
|
||||
const PayloadTypes& payload_types, float loss_rate, int64_t rtt_ms,
|
||||
bool reordering) {
|
||||
scoped_ptr<test::RtpFileReader> packet_source(test::RtpFileReader::Create(
|
||||
test::RtpFileReader::kRtpDump, input_filename));
|
||||
|
@ -88,7 +88,7 @@ class RtpPlayerInterface {
|
||||
|
||||
RtpPlayerInterface* Create(const std::string& inputFilename,
|
||||
PayloadSinkFactoryInterface* payloadSinkFactory, Clock* clock,
|
||||
const PayloadTypes& payload_types, float lossRate, uint32_t rttMs,
|
||||
const PayloadTypes& payload_types, float lossRate, int64_t rttMs,
|
||||
bool reordering);
|
||||
|
||||
} // namespace rtpplayer
|
||||
|
@ -108,7 +108,7 @@ VcmPayloadSinkFactory::VcmPayloadSinkFactory(
|
||||
Clock* clock,
|
||||
bool protection_enabled,
|
||||
VCMVideoProtection protection_method,
|
||||
uint32_t rtt_ms,
|
||||
int64_t rtt_ms,
|
||||
uint32_t render_delay_ms,
|
||||
uint32_t min_playout_delay_ms)
|
||||
: base_out_filename_(base_out_filename),
|
||||
|
@ -28,7 +28,7 @@ class VcmPayloadSinkFactory : public PayloadSinkFactoryInterface {
|
||||
VcmPayloadSinkFactory(const std::string& base_out_filename,
|
||||
Clock* clock, bool protection_enabled,
|
||||
VCMVideoProtection protection_method,
|
||||
uint32_t rtt_ms, uint32_t render_delay_ms,
|
||||
int64_t rtt_ms, uint32_t render_delay_ms,
|
||||
uint32_t min_playout_delay_ms);
|
||||
virtual ~VcmPayloadSinkFactory();
|
||||
|
||||
@ -50,7 +50,7 @@ class VcmPayloadSinkFactory : public PayloadSinkFactoryInterface {
|
||||
Clock* clock_;
|
||||
bool protection_enabled_;
|
||||
VCMVideoProtection protection_method_;
|
||||
uint32_t rtt_ms_;
|
||||
int64_t rtt_ms_;
|
||||
uint32_t render_delay_ms_;
|
||||
uint32_t min_playout_delay_ms_;
|
||||
scoped_ptr<NullEventFactory> null_event_factory_;
|
||||
|
@ -20,7 +20,7 @@ const webrtc::VCMVideoProtection kConfigProtectionMethod =
|
||||
webrtc::kProtectionNack;
|
||||
const float kConfigLossRate = 0.0f;
|
||||
const bool kConfigReordering = false;
|
||||
const uint32_t kConfigRttMs = 0;
|
||||
const int64_t kConfigRttMs = 0;
|
||||
const uint32_t kConfigRenderDelayMs = 0;
|
||||
const uint32_t kConfigMinPlayoutDelayMs = 0;
|
||||
const int64_t kConfigMaxRuntimeMs = -1;
|
||||
|
@ -26,7 +26,7 @@ const bool kConfigProtectionEnabled = true;
|
||||
const webrtc::VCMVideoProtection kConfigProtectionMethod =
|
||||
webrtc::kProtectionNack;
|
||||
const float kConfigLossRate = 0.05f;
|
||||
const uint32_t kConfigRttMs = 50;
|
||||
const int64_t kConfigRttMs = 50;
|
||||
const bool kConfigReordering = false;
|
||||
const uint32_t kConfigRenderDelayMs = 0;
|
||||
const uint32_t kConfigMinPlayoutDelayMs = 0;
|
||||
|
@ -69,7 +69,7 @@ int32_t ConfigurableFrameSizeEncoder::Release() {
|
||||
}
|
||||
|
||||
int32_t ConfigurableFrameSizeEncoder::SetChannelParameters(uint32_t packet_loss,
|
||||
int rtt) {
|
||||
int64_t rtt) {
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,8 @@ class ConfigurableFrameSizeEncoder : public VideoEncoder {
|
||||
|
||||
virtual int32_t Release() OVERRIDE;
|
||||
|
||||
virtual int32_t SetChannelParameters(uint32_t packet_loss, int rtt) OVERRIDE;
|
||||
virtual int32_t SetChannelParameters(uint32_t packet_loss,
|
||||
int64_t rtt) OVERRIDE;
|
||||
|
||||
virtual int32_t SetRates(uint32_t new_bit_rate, uint32_t frame_rate) OVERRIDE;
|
||||
|
||||
|
@ -119,7 +119,7 @@ int32_t FakeEncoder::RegisterEncodeCompleteCallback(
|
||||
|
||||
int32_t FakeEncoder::Release() { return 0; }
|
||||
|
||||
int32_t FakeEncoder::SetChannelParameters(uint32_t packet_loss, int rtt) {
|
||||
int32_t FakeEncoder::SetChannelParameters(uint32_t packet_loss, int64_t rtt) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user