From 399c965b6064c440ddcf4015f5f8e9d131c7a0a6 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 14 Jul 2016 17:41:05 +0200 Subject: BASELINE: Update Chromium to 52.0.2743.76 and Ninja to 1.7.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I382f51b959689505a60f8b707255ecb344f7d8b4 Reviewed-by: Michael BrĂ¼ning --- .../remote_bitrate_estimator/bwe_simulations.cc | 1 + .../include/mock/mock_remote_bitrate_estimator.h | 2 +- .../include/remote_bitrate_estimator.h | 3 +- .../include/send_time_history.h | 2 +- .../remote_bitrate_estimator/inter_arrival.cc | 2 +- .../remote_bitrate_estimator.gypi | 1 + .../remote_bitrate_estimator_abs_send_time.cc | 55 ++++++------- .../remote_bitrate_estimator_abs_send_time.h | 14 ++-- ...ote_bitrate_estimator_abs_send_time_unittest.cc | 40 ++++------ .../remote_bitrate_estimator_single_stream.cc | 8 +- .../remote_bitrate_estimator_single_stream.h | 4 +- ...ote_bitrate_estimator_single_stream_unittest.cc | 2 +- .../remote_bitrate_estimator_unittest_helper.cc | 37 +++++---- .../remote_bitrate_estimator_unittest_helper.h | 3 +- .../remote_bitrate_estimators_test.cc | 1 + .../remote_estimator_proxy.cc | 3 +- .../remote_estimator_proxy.h | 3 +- .../remote_estimator_proxy_unittest.cc | 2 +- .../remote_bitrate_estimator/send_time_history.cc | 6 +- .../send_time_history_unittest.cc | 76 ++++++++---------- .../modules/remote_bitrate_estimator/test/bwe.cc | 1 + .../modules/remote_bitrate_estimator/test/bwe.h | 1 + .../test/bwe_test_framework.cc | 10 +-- .../test/bwe_test_framework.h | 1 + .../test/estimators/nada.h | 1 + .../test/estimators/remb.cc | 4 +- .../test/estimators/remb.h | 1 + .../test/estimators/send_side.cc | 7 +- .../modules/remote_bitrate_estimator/test/packet.h | 3 - .../remote_bitrate_estimator/test/packet_sender.cc | 17 ++-- .../remote_bitrate_estimator/test/packet_sender.h | 5 +- .../remote_bitrate_estimator/tools/bwe_rtp.cc | 2 +- .../remote_bitrate_estimator/tools/bwe_rtp_play.cc | 2 +- .../transport_feedback_adapter.cc | 19 ++++- .../transport_feedback_adapter.h | 4 +- .../transport_feedback_adapter_unittest.cc | 91 +++++++++++++++------- 36 files changed, 225 insertions(+), 209 deletions(-) (limited to 'chromium/third_party/webrtc/modules/remote_bitrate_estimator') diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/bwe_simulations.cc b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/bwe_simulations.cc index 4967913558c..d44788be274 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/bwe_simulations.cc +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/bwe_simulations.cc @@ -11,6 +11,7 @@ #include #include "testing/gtest/include/gtest/gtest.h" +#include "webrtc/base/constructormagic.h" #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h" #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test.h" #include "webrtc/modules/remote_bitrate_estimator/test/packet_receiver.h" diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitrate_estimator.h b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitrate_estimator.h index 2c35df872bc..61773037d74 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitrate_estimator.h +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitrate_estimator.h @@ -28,7 +28,7 @@ class MockRemoteBitrateEstimator : public RemoteBitrateEstimator { public: MOCK_METHOD1(IncomingPacketFeedbackVector, void(const std::vector&)); - MOCK_METHOD4(IncomingPacket, void(int64_t, size_t, const RTPHeader&, bool)); + MOCK_METHOD3(IncomingPacket, void(int64_t, size_t, const RTPHeader&)); MOCK_METHOD1(RemoveStream, void(uint32_t)); MOCK_CONST_METHOD2(LatestEstimate, bool(std::vector*, uint32_t*)); diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h index e56c273fc4b..d7d8d2c8d2e 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h @@ -58,8 +58,7 @@ class RemoteBitrateEstimator : public CallStatsObserver, public Module { // Note that |arrival_time_ms| can be of an arbitrary time base. virtual void IncomingPacket(int64_t arrival_time_ms, size_t payload_size, - const RTPHeader& header, - bool was_paced) = 0; + const RTPHeader& header) = 0; // Removes all data for |ssrc|. virtual void RemoveStream(uint32_t ssrc) = 0; diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/include/send_time_history.h b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/include/send_time_history.h index a643c1f1030..83e87f95712 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/include/send_time_history.h +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/include/send_time_history.h @@ -24,7 +24,7 @@ class SendTimeHistory { SendTimeHistory(Clock* clock, int64_t packet_age_limit); virtual ~SendTimeHistory(); - void AddAndRemoveOld(uint16_t sequence_number, size_t length, bool was_paced); + void AddAndRemoveOld(uint16_t sequence_number, size_t length); bool OnSentPacket(uint16_t sequence_number, int64_t timestamp); // Look up PacketInfo for a sent packet, based on the sequence number, and // populate all fields except for receive_time. The packet parameter must diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/inter_arrival.cc b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/inter_arrival.cc index f75bc2b03ea..1b7ce07583d 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/inter_arrival.cc +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/inter_arrival.cc @@ -18,7 +18,7 @@ namespace webrtc { -static const int kBurstDeltaThresholdMs = 5; +static const int kBurstDeltaThresholdMs = 5; InterArrival::InterArrival(uint32_t timestamp_group_length_ticks, double timestamp_to_ms_coeff, diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator.gypi b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator.gypi index 32663d729b8..7b20cf7f9db 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator.gypi +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator.gypi @@ -62,6 +62,7 @@ 'type': 'static_library', 'dependencies': [ '<(DEPTH)/testing/gtest.gyp:gtest', + '<(DEPTH)/testing/gmock.gyp:gmock', ], 'sources': [ 'test/bwe.cc', diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc index 7c2abb2f08f..82335055b43 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc @@ -14,12 +14,12 @@ #include +#include "webrtc/base/checks.h" #include "webrtc/base/constructormagic.h" #include "webrtc/base/logging.h" #include "webrtc/base/thread_annotations.h" #include "webrtc/modules/pacing/paced_sender.h" #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h" -#include "webrtc/system_wrappers/include/clock.h" #include "webrtc/system_wrappers/include/critical_section_wrapper.h" #include "webrtc/typedefs.h" @@ -79,23 +79,19 @@ bool RemoteBitrateEstimatorAbsSendTime::IsWithinClusterBounds( } RemoteBitrateEstimatorAbsSendTime::RemoteBitrateEstimatorAbsSendTime( - RemoteBitrateObserver* observer, - Clock* clock) + RemoteBitrateObserver* observer) : observer_(observer), inter_arrival_(), - estimator_(OverUseDetectorOptions()), + estimator_(), detector_(OverUseDetectorOptions()), incoming_bitrate_(kBitrateWindowMs, 8000), total_probes_received_(0), first_packet_time_ms_(-1), last_update_ms_(-1), - ssrcs_(), - clock_(clock) { + ssrcs_() { RTC_DCHECK(observer_); - RTC_DCHECK(clock_); LOG(LS_INFO) << "RemoteBitrateEstimatorAbsSendTime: Instantiating."; network_thread_.DetachFromThread(); - process_thread_.DetachFromThread(); } void RemoteBitrateEstimatorAbsSendTime::ComputeClusters( @@ -180,8 +176,7 @@ RemoteBitrateEstimatorAbsSendTime::ProcessClusters(int64_t now_ms) { std::min(best_it->GetSendBitrateBps(), best_it->GetRecvBitrateBps()); // Make sure that a probe sent on a lower bitrate than our estimate can't // reduce the estimate. - if (IsBitrateImproving(probe_bitrate_bps) && - probe_bitrate_bps > static_cast(incoming_bitrate_.Rate(now_ms))) { + if (IsBitrateImproving(probe_bitrate_bps)) { LOG(LS_INFO) << "Probe successful, sent at " << best_it->GetSendBitrateBps() << " bps, received at " << best_it->GetRecvBitrateBps() @@ -215,14 +210,14 @@ void RemoteBitrateEstimatorAbsSendTime::IncomingPacketFeedbackVector( for (const auto& packet_info : packet_feedback_vector) { IncomingPacketInfo(packet_info.arrival_time_ms, ConvertMsTo24Bits(packet_info.send_time_ms), - packet_info.payload_size, 0, packet_info.was_paced); + packet_info.payload_size, 0); } } -void RemoteBitrateEstimatorAbsSendTime::IncomingPacket(int64_t arrival_time_ms, - size_t payload_size, - const RTPHeader& header, - bool was_paced) { +void RemoteBitrateEstimatorAbsSendTime::IncomingPacket( + int64_t arrival_time_ms, + size_t payload_size, + const RTPHeader& header) { RTC_DCHECK(network_thread_.CalledOnValidThread()); if (!header.extension.hasAbsoluteSendTime) { LOG(LS_WARNING) << "RemoteBitrateEstimatorAbsSendTimeImpl: Incoming packet " @@ -230,36 +225,31 @@ void RemoteBitrateEstimatorAbsSendTime::IncomingPacket(int64_t arrival_time_ms, return; } IncomingPacketInfo(arrival_time_ms, header.extension.absoluteSendTime, - payload_size, header.ssrc, was_paced); + payload_size, header.ssrc); } void RemoteBitrateEstimatorAbsSendTime::IncomingPacketInfo( int64_t arrival_time_ms, uint32_t send_time_24bits, size_t payload_size, - uint32_t ssrc, - bool was_paced) { + uint32_t ssrc) { assert(send_time_24bits < (1ul << 24)); // Shift up send time to use the full 32 bits that inter_arrival works with, // so wrapping works properly. uint32_t timestamp = send_time_24bits << kAbsSendTimeInterArrivalUpshift; int64_t send_time_ms = static_cast(timestamp) * kTimestampToMs; - int64_t now_ms = clock_->TimeInMilliseconds(); + int64_t now_ms = arrival_time_ms; // TODO(holmer): SSRCs are only needed for REMB, should be broken out from // here. incoming_bitrate_.Update(payload_size, now_ms); if (first_packet_time_ms_ == -1) - first_packet_time_ms_ = clock_->TimeInMilliseconds(); + first_packet_time_ms_ = arrival_time_ms; uint32_t ts_delta = 0; int64_t t_delta = 0; int size_delta = 0; - // For now only try to detect probes while we don't have a valid estimate, and - // make sure the packet was paced. We currently assume that only packets - // larger than 200 bytes are paced by the sender. - was_paced = was_paced && payload_size > PacedSender::kMinProbePacketSize; bool update_estimate = false; uint32_t target_bitrate_bps = 0; std::vector ssrcs; @@ -267,9 +257,14 @@ void RemoteBitrateEstimatorAbsSendTime::IncomingPacketInfo( rtc::CritScope lock(&crit_); TimeoutStreams(now_ms); + RTC_DCHECK(inter_arrival_.get()); + RTC_DCHECK(estimator_.get()); ssrcs_[ssrc] = now_ms; - if (was_paced && + // For now only try to detect probes while we don't have a valid estimate. + // We currently assume that only packets larger than 200 bytes are paced by + // the sender. + if (payload_size > PacedSender::kMinProbePacketSize && (!remote_rate_.ValidEstimate() || now_ms - first_packet_time_ms_ < kInitialProbingIntervalMs)) { // TODO(holmer): Use a map instead to get correct order? @@ -295,9 +290,9 @@ void RemoteBitrateEstimatorAbsSendTime::IncomingPacketInfo( if (inter_arrival_->ComputeDeltas(timestamp, arrival_time_ms, payload_size, &ts_delta, &t_delta, &size_delta)) { double ts_delta_ms = (1000.0 * ts_delta) / (1 << kInterArrivalShift); - estimator_.Update(t_delta, ts_delta_ms, size_delta, detector_.State()); - detector_.Detect(estimator_.offset(), ts_delta_ms, - estimator_.num_of_deltas(), arrival_time_ms); + estimator_->Update(t_delta, ts_delta_ms, size_delta, detector_.State()); + detector_.Detect(estimator_->offset(), ts_delta_ms, + estimator_->num_of_deltas(), arrival_time_ms); } if (!update_estimate) { @@ -319,7 +314,7 @@ void RemoteBitrateEstimatorAbsSendTime::IncomingPacketInfo( // and the target bitrate is too high compared to what we are receiving. const RateControlInput input(detector_.State(), incoming_bitrate_.Rate(now_ms), - estimator_.var_noise()); + estimator_->var_noise()); remote_rate_.Update(&input, now_ms); target_bitrate_bps = remote_rate_.UpdateBandwidthEstimate(now_ms); update_estimate = remote_rate_.ValidEstimate(); @@ -352,6 +347,7 @@ void RemoteBitrateEstimatorAbsSendTime::TimeoutStreams(int64_t now_ms) { inter_arrival_.reset( new InterArrival((kTimestampGroupLengthMs << kInterArrivalShift) / 1000, kTimestampToMs, true)); + estimator_.reset(new OveruseEstimator(OverUseDetectorOptions())); // We deliberately don't reset the first_packet_time_ms_ here for now since // we only probe for bandwidth in the beginning of a call right now. } @@ -359,7 +355,6 @@ void RemoteBitrateEstimatorAbsSendTime::TimeoutStreams(int64_t now_ms) { void RemoteBitrateEstimatorAbsSendTime::OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) { - RTC_DCHECK(process_thread_.CalledOnValidThread()); rtc::CritScope lock(&crit_); remote_rate_.SetRtt(avg_rtt_ms); } diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h index 1f47dc3b244..9403a6cc8b9 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h @@ -17,6 +17,7 @@ #include #include "webrtc/base/checks.h" +#include "webrtc/base/constructormagic.h" #include "webrtc/base/criticalsection.h" #include "webrtc/base/rate_statistics.h" #include "webrtc/base/thread_checker.h" @@ -67,8 +68,7 @@ struct Cluster { class RemoteBitrateEstimatorAbsSendTime : public RemoteBitrateEstimator { public: - RemoteBitrateEstimatorAbsSendTime(RemoteBitrateObserver* observer, - Clock* clock); + explicit RemoteBitrateEstimatorAbsSendTime(RemoteBitrateObserver* observer); virtual ~RemoteBitrateEstimatorAbsSendTime() {} void IncomingPacketFeedbackVector( @@ -76,8 +76,7 @@ class RemoteBitrateEstimatorAbsSendTime : public RemoteBitrateEstimator { void IncomingPacket(int64_t arrival_time_ms, size_t payload_size, - const RTPHeader& header, - bool was_paced) override; + const RTPHeader& header) override; // This class relies on Process() being called periodically (at least once // every other second) for streams to be timed out properly. Therefore it // shouldn't be detached from the ProcessThread except if it's about to be @@ -102,8 +101,7 @@ class RemoteBitrateEstimatorAbsSendTime : public RemoteBitrateEstimator { void IncomingPacketInfo(int64_t arrival_time_ms, uint32_t send_time_24bits, size_t payload_size, - uint32_t ssrc, - bool was_paced); + uint32_t ssrc); void ComputeClusters(std::list* clusters) const; @@ -121,7 +119,7 @@ class RemoteBitrateEstimatorAbsSendTime : public RemoteBitrateEstimator { rtc::ThreadChecker network_thread_; RemoteBitrateObserver* const observer_; std::unique_ptr inter_arrival_; - OveruseEstimator estimator_; + std::unique_ptr estimator_; OveruseDetector detector_; RateStatistics incoming_bitrate_; std::vector recent_propagation_delta_ms_; @@ -131,11 +129,9 @@ class RemoteBitrateEstimatorAbsSendTime : public RemoteBitrateEstimator { int64_t first_packet_time_ms_; int64_t last_update_ms_; - rtc::ThreadChecker process_thread_; rtc::CriticalSection crit_; Ssrcs ssrcs_ GUARDED_BY(&crit_); AimdRateControl remote_rate_ GUARDED_BY(&crit_); - Clock* const clock_; RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RemoteBitrateEstimatorAbsSendTime); }; diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time_unittest.cc b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time_unittest.cc index e8026a5764d..a4e4150e769 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time_unittest.cc +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time_unittest.cc @@ -20,7 +20,7 @@ class RemoteBitrateEstimatorAbsSendTimeTest : RemoteBitrateEstimatorAbsSendTimeTest() {} virtual void SetUp() { bitrate_estimator_.reset(new RemoteBitrateEstimatorAbsSendTime( - bitrate_observer_.get(), &clock_)); + bitrate_observer_.get())); } protected: RTC_DISALLOW_COPY_AND_ASSIGN(RemoteBitrateEstimatorAbsSendTimeTest); @@ -35,15 +35,15 @@ TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, RateIncreaseReordering) { } TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, RateIncreaseRtpTimestamps) { - RateIncreaseRtpTimestampsTestHelper(1232); + RateIncreaseRtpTimestampsTestHelper(1229); } TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, CapacityDropOneStream) { - CapacityDropTestHelper(1, false, 633); + CapacityDropTestHelper(1, false, 667); } TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, CapacityDropOneStreamWrap) { - CapacityDropTestHelper(1, true, 633); + CapacityDropTestHelper(1, true, 667); } TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, CapacityDropTwoStreamsWrap) { @@ -90,7 +90,7 @@ TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, TestProcessAfterTimeout) { // RemoteBitrateEstimator. const int64_t kStreamTimeOutMs = 2000; const int64_t kProcessIntervalMs = 1000; - IncomingPacket(0, 1000, clock_.TimeInMilliseconds(), 0, 0, true); + IncomingPacket(0, 1000, clock_.TimeInMilliseconds(), 0, 0); clock_.AdvanceTimeMilliseconds(kStreamTimeOutMs + 1); // Trigger timeout. bitrate_estimator_->Process(); @@ -106,16 +106,14 @@ TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, TestProbeDetection) { for (int i = 0; i < kProbeLength; ++i) { clock_.AdvanceTimeMilliseconds(10); now_ms = clock_.TimeInMilliseconds(); - IncomingPacket(0, 1000, now_ms, 90 * now_ms, AbsSendTime(now_ms, 1000), - true); + IncomingPacket(0, 1000, now_ms, 90 * now_ms, AbsSendTime(now_ms, 1000)); } // Second burst sent at 8 * 1000 / 5 = 1600 kbps. for (int i = 0; i < kProbeLength; ++i) { clock_.AdvanceTimeMilliseconds(5); now_ms = clock_.TimeInMilliseconds(); - IncomingPacket(0, 1000, now_ms, 90 * now_ms, AbsSendTime(now_ms, 1000), - true); + IncomingPacket(0, 1000, now_ms, 90 * now_ms, AbsSendTime(now_ms, 1000)); } bitrate_estimator_->Process(); @@ -132,12 +130,10 @@ TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, for (int i = 0; i < kProbeLength; ++i) { clock_.AdvanceTimeMilliseconds(5); now_ms = clock_.TimeInMilliseconds(); - IncomingPacket(0, 1000, now_ms, 90 * now_ms, AbsSendTime(now_ms, 1000), - true); + IncomingPacket(0, 1000, now_ms, 90 * now_ms, AbsSendTime(now_ms, 1000)); // Non-paced packet, arriving 5 ms after. clock_.AdvanceTimeMilliseconds(5); - IncomingPacket(0, 100, now_ms, 90 * now_ms, AbsSendTime(now_ms, 1000), - false); + IncomingPacket(0, 100, now_ms, 90 * now_ms, AbsSendTime(now_ms, 1000)); } bitrate_estimator_->Process(); @@ -158,7 +154,7 @@ TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, now_ms = clock_.TimeInMilliseconds(); send_time_ms += 10; IncomingPacket(0, 1000, now_ms, 90 * send_time_ms, - AbsSendTime(send_time_ms, 1000), true); + AbsSendTime(send_time_ms, 1000)); } // Second burst sent at 8 * 1000 / 5 = 1600 kbps, arriving at 8 * 1000 / 8 = @@ -168,7 +164,7 @@ TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, now_ms = clock_.TimeInMilliseconds(); send_time_ms += 5; IncomingPacket(0, 1000, now_ms, send_time_ms, - AbsSendTime(send_time_ms, 1000), true); + AbsSendTime(send_time_ms, 1000)); } bitrate_estimator_->Process(); @@ -188,7 +184,7 @@ TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, send_time_ms += 10; now_ms = clock_.TimeInMilliseconds(); IncomingPacket(0, 1000, now_ms, 90 * send_time_ms, - AbsSendTime(send_time_ms, 1000), true); + AbsSendTime(send_time_ms, 1000)); } bitrate_estimator_->Process(); @@ -207,7 +203,7 @@ TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, TestProbeDetectionFasterArrival) { send_time_ms += 10; now_ms = clock_.TimeInMilliseconds(); IncomingPacket(0, 1000, now_ms, 90 * send_time_ms, - AbsSendTime(send_time_ms, 1000), true); + AbsSendTime(send_time_ms, 1000)); } bitrate_estimator_->Process(); @@ -225,7 +221,7 @@ TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, TestProbeDetectionSlowerArrival) { send_time_ms += 5; now_ms = clock_.TimeInMilliseconds(); IncomingPacket(0, 1000, now_ms, 90 * send_time_ms, - AbsSendTime(send_time_ms, 1000), true); + AbsSendTime(send_time_ms, 1000)); } bitrate_estimator_->Process(); @@ -245,7 +241,7 @@ TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, send_time_ms += 1; now_ms = clock_.TimeInMilliseconds(); IncomingPacket(0, 1000, now_ms, 90 * send_time_ms, - AbsSendTime(send_time_ms, 1000), true); + AbsSendTime(send_time_ms, 1000)); } bitrate_estimator_->Process(); @@ -261,8 +257,7 @@ TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, ProbingIgnoresSmallPackets) { for (int i = 0; i < kProbeLength; ++i) { clock_.AdvanceTimeMilliseconds(10); now_ms = clock_.TimeInMilliseconds(); - IncomingPacket(0, 200, now_ms, 90 * now_ms, AbsSendTime(now_ms, 1000), - true); + IncomingPacket(0, 200, now_ms, 90 * now_ms, AbsSendTime(now_ms, 1000)); } bitrate_estimator_->Process(); @@ -273,8 +268,7 @@ TEST_F(RemoteBitrateEstimatorAbsSendTimeTest, ProbingIgnoresSmallPackets) { for (int i = 0; i < kProbeLength; ++i) { clock_.AdvanceTimeMilliseconds(10); now_ms = clock_.TimeInMilliseconds(); - IncomingPacket(0, 1000, now_ms, 90 * now_ms, AbsSendTime(now_ms, 1000), - true); + IncomingPacket(0, 1000, now_ms, 90 * now_ms, AbsSendTime(now_ms, 1000)); } // Wait long enough so that we can call Process again. diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc index f38ef783067..b5adb9fa70a 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.cc @@ -66,10 +66,10 @@ RemoteBitrateEstimatorSingleStream::~RemoteBitrateEstimatorSingleStream() { } } -void RemoteBitrateEstimatorSingleStream::IncomingPacket(int64_t arrival_time_ms, - size_t payload_size, - const RTPHeader& header, - bool was_paced) { +void RemoteBitrateEstimatorSingleStream::IncomingPacket( + int64_t arrival_time_ms, + size_t payload_size, + const RTPHeader& header) { uint32_t ssrc = header.ssrc; uint32_t rtp_timestamp = header.timestamp + header.extension.transmissionTimeOffset; diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h index 5516ea781da..2f74e1c4af0 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h @@ -15,6 +15,7 @@ #include #include +#include "webrtc/base/constructormagic.h" #include "webrtc/base/rate_statistics.h" #include "webrtc/modules/remote_bitrate_estimator/aimd_rate_control.h" #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h" @@ -30,8 +31,7 @@ class RemoteBitrateEstimatorSingleStream : public RemoteBitrateEstimator { void IncomingPacket(int64_t arrival_time_ms, size_t payload_size, - const RTPHeader& header, - bool was_paced) override; + const RTPHeader& header) override; void Process() override; int64_t TimeUntilNextProcess() override; void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override; diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream_unittest.cc b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream_unittest.cc index 6fd0ad11b57..97e3abaa32b 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream_unittest.cc +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream_unittest.cc @@ -47,7 +47,7 @@ TEST_F(RemoteBitrateEstimatorSingleTest, CapacityDropOneStreamWrap) { } TEST_F(RemoteBitrateEstimatorSingleTest, CapacityDropTwoStreamsWrap) { - CapacityDropTestHelper(2, true, 767); + CapacityDropTestHelper(2, true, 600); } TEST_F(RemoteBitrateEstimatorSingleTest, CapacityDropThreeStreamsWrap) { diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unittest_helper.cc b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unittest_helper.cc index 8bfb8ed0fd3..4530053a869 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unittest_helper.cc +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unittest_helper.cc @@ -221,8 +221,7 @@ void RemoteBitrateEstimatorTest::IncomingPacket(uint32_t ssrc, size_t payload_size, int64_t arrival_time, uint32_t rtp_timestamp, - uint32_t absolute_send_time, - bool was_paced) { + uint32_t absolute_send_time) { RTPHeader header; memset(&header, 0, sizeof(header)); header.ssrc = ssrc; @@ -230,7 +229,7 @@ void RemoteBitrateEstimatorTest::IncomingPacket(uint32_t ssrc, header.extension.hasAbsoluteSendTime = true; header.extension.absoluteSendTime = absolute_send_time; bitrate_estimator_->IncomingPacket(arrival_time + kArrivalTimeClockOffsetMs, - payload_size, header, was_paced); + payload_size, header); } // Generates a frame of packets belonging to a stream at a given bitrate and @@ -255,7 +254,7 @@ bool RemoteBitrateEstimatorTest::GenerateAndProcessFrame(uint32_t ssrc, clock_.TimeInMicroseconds()); IncomingPacket(packet->ssrc, packet->size, (packet->arrival_time + 500) / 1000, packet->rtp_timestamp, - AbsSendTime(packet->send_time, 1000000), true); + AbsSendTime(packet->send_time, 1000000)); if (bitrate_observer_->updated()) { if (bitrate_observer_->latest_bitrate() < bitrate_bps) overuse = true; @@ -319,7 +318,7 @@ void RemoteBitrateEstimatorTest::InitialBehaviorTestHelper( clock_.AdvanceTimeMilliseconds(1000); // Inserting a packet. Still no valid estimate. We need to wait 5 seconds. IncomingPacket(kDefaultSsrc, kMtu, clock_.TimeInMilliseconds(), timestamp, - absolute_send_time, true); + absolute_send_time); bitrate_estimator_->Process(); EXPECT_FALSE(bitrate_estimator_->LatestEstimate(&ssrcs, &bitrate_bps)); EXPECT_EQ(0u, ssrcs.size()); @@ -328,7 +327,7 @@ void RemoteBitrateEstimatorTest::InitialBehaviorTestHelper( // Inserting packets for 5 seconds to get a valid estimate. for (int i = 0; i < 5 * kFramerate + 1; ++i) { IncomingPacket(kDefaultSsrc, kMtu, clock_.TimeInMilliseconds(), timestamp, - absolute_send_time, true); + absolute_send_time); clock_.AdvanceTimeMilliseconds(1000 / kFramerate); timestamp += 90 * kFrameIntervalMs; absolute_send_time = AddAbsSendTime(absolute_send_time, @@ -356,13 +355,13 @@ void RemoteBitrateEstimatorTest::RateIncreaseReorderingTestHelper( uint32_t timestamp = 0; uint32_t absolute_send_time = 0; IncomingPacket(kDefaultSsrc, 1000, clock_.TimeInMilliseconds(), timestamp, - absolute_send_time, true); + absolute_send_time); bitrate_estimator_->Process(); EXPECT_FALSE(bitrate_observer_->updated()); // No valid estimate. // Inserting packets for one second to get a valid estimate. for (int i = 0; i < 5 * kFramerate + 1; ++i) { IncomingPacket(kDefaultSsrc, kMtu, clock_.TimeInMilliseconds(), timestamp, - absolute_send_time, true); + absolute_send_time); clock_.AdvanceTimeMilliseconds(kFrameIntervalMs); timestamp += 90 * kFrameIntervalMs; absolute_send_time = AddAbsSendTime(absolute_send_time, @@ -379,12 +378,12 @@ void RemoteBitrateEstimatorTest::RateIncreaseReorderingTestHelper( absolute_send_time = AddAbsSendTime(absolute_send_time, 2 * kFrameIntervalAbsSendTime); IncomingPacket(kDefaultSsrc, 1000, clock_.TimeInMilliseconds(), timestamp, - absolute_send_time, true); - IncomingPacket(kDefaultSsrc, 1000, clock_.TimeInMilliseconds(), - timestamp - 90 * kFrameIntervalMs, - AddAbsSendTime(absolute_send_time, - -static_cast(kFrameIntervalAbsSendTime)), - true); + absolute_send_time); + IncomingPacket( + kDefaultSsrc, 1000, clock_.TimeInMilliseconds(), + timestamp - 90 * kFrameIntervalMs, + AddAbsSendTime(absolute_send_time, + -static_cast(kFrameIntervalAbsSendTime))); } bitrate_estimator_->Process(); EXPECT_TRUE(bitrate_observer_->updated()); @@ -517,7 +516,7 @@ void RemoteBitrateEstimatorTest::TestTimestampGroupingTestHelper() { // time for the first estimate to be generated and for Process() to be called. for (int i = 0; i <= 6 * kFramerate; ++i) { IncomingPacket(kDefaultSsrc, 1000, clock_.TimeInMilliseconds(), timestamp, - absolute_send_time, true); + absolute_send_time); bitrate_estimator_->Process(); clock_.AdvanceTimeMilliseconds(kFrameIntervalMs); timestamp += 90 * kFrameIntervalMs; @@ -538,7 +537,7 @@ void RemoteBitrateEstimatorTest::TestTimestampGroupingTestHelper() { // Insert |kTimestampGroupLength| frames with just 1 timestamp ticks in // between. Should be treated as part of the same group by the estimator. IncomingPacket(kDefaultSsrc, 100, clock_.TimeInMilliseconds(), timestamp, - absolute_send_time, true); + absolute_send_time); clock_.AdvanceTimeMilliseconds(kFrameIntervalMs / kTimestampGroupLength); timestamp += 1; absolute_send_time = AddAbsSendTime(absolute_send_time, @@ -568,7 +567,7 @@ void RemoteBitrateEstimatorTest::TestWrappingHelper( for (size_t i = 0; i < 3000; ++i) { IncomingPacket(kDefaultSsrc, 1000, clock_.TimeInMilliseconds(), timestamp, - absolute_send_time, true); + absolute_send_time); timestamp += kFrameIntervalMs; clock_.AdvanceTimeMilliseconds(kFrameIntervalMs); absolute_send_time = AddAbsSendTime(absolute_send_time, @@ -583,9 +582,9 @@ void RemoteBitrateEstimatorTest::TestWrappingHelper( absolute_send_time = AddAbsSendTime(absolute_send_time, AbsSendTime(silence_time_s, 1)); bitrate_estimator_->Process(); - for (size_t i = 0; i < 10; ++i) { + for (size_t i = 0; i < 21; ++i) { IncomingPacket(kDefaultSsrc, 1000, clock_.TimeInMilliseconds(), timestamp, - absolute_send_time, true); + absolute_send_time); timestamp += kFrameIntervalMs; clock_.AdvanceTimeMilliseconds(2 * kFrameIntervalMs); absolute_send_time = AddAbsSendTime(absolute_send_time, diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unittest_helper.h b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unittest_helper.h index 12ac9e8502d..b4bff670e75 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unittest_helper.h +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unittest_helper.h @@ -173,8 +173,7 @@ class RemoteBitrateEstimatorTest : public ::testing::Test { size_t payload_size, int64_t arrival_time, uint32_t rtp_timestamp, - uint32_t absolute_send_time, - bool was_paced); + uint32_t absolute_send_time); // Generates a frame of packets belonging to a stream at a given bitrate and // with a given ssrc. The stream is pushed through a very simple simulated diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimators_test.cc b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimators_test.cc index 31cd9f98028..e307242f8d3 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimators_test.cc +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimators_test.cc @@ -16,6 +16,7 @@ #include #include +#include "webrtc/base/constructormagic.h" #include "webrtc/base/random.h" #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h" #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test.h" diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.cc b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.cc index eace9fc8b0a..2172bce9380 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.cc +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.cc @@ -43,8 +43,7 @@ void RemoteEstimatorProxy::IncomingPacketFeedbackVector( void RemoteEstimatorProxy::IncomingPacket(int64_t arrival_time_ms, size_t payload_size, - const RTPHeader& header, - bool was_paced) { + const RTPHeader& header) { if (!header.extension.hasTransportSequenceNumber) { LOG(LS_WARNING) << "RemoteEstimatorProxy: Incoming packet " "is missing the transport sequence number extension!"; diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.h b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.h index 93d5244b67b..66373e29778 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.h +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.h @@ -39,8 +39,7 @@ class RemoteEstimatorProxy : public RemoteBitrateEstimator { const std::vector& packet_feedback_vector) override; void IncomingPacket(int64_t arrival_time_ms, size_t payload_size, - const RTPHeader& header, - bool was_paced) override; + const RTPHeader& header) override; void RemoveStream(uint32_t ssrc) override {} bool LatestEstimate(std::vector* ssrcs, unsigned int* bitrate_bps) const override; diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy_unittest.cc b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy_unittest.cc index 3c3c7297e18..a1264b2ff95 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy_unittest.cc +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy_unittest.cc @@ -37,7 +37,7 @@ class RemoteEstimatorProxyTest : public ::testing::Test { header.extension.hasTransportSequenceNumber = true; header.extension.transportSequenceNumber = seq; header.ssrc = kMediaSsrc; - proxy_.IncomingPacket(time_ms, kDefaultPacketSize, header, true); + proxy_.IncomingPacket(time_ms, kDefaultPacketSize, header); } void Process() { diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/send_time_history.cc b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/send_time_history.cc index a58d12a1600..f4fe2208a81 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/send_time_history.cc +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/send_time_history.cc @@ -26,9 +26,7 @@ void SendTimeHistory::Clear() { history_.clear(); } -void SendTimeHistory::AddAndRemoveOld(uint16_t sequence_number, - size_t length, - bool was_paced) { +void SendTimeHistory::AddAndRemoveOld(uint16_t sequence_number, size_t length) { EraseOld(); if (history_.empty()) @@ -36,7 +34,7 @@ void SendTimeHistory::AddAndRemoveOld(uint16_t sequence_number, history_.insert(std::pair( sequence_number, PacketInfo(clock_->TimeInMilliseconds(), 0, -1, - sequence_number, length, was_paced))); + sequence_number, length))); } bool SendTimeHistory::OnSentPacket(uint16_t sequence_number, diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/send_time_history_unittest.cc b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/send_time_history_unittest.cc index b525813cdca..7500f575fb7 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/send_time_history_unittest.cc +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/send_time_history_unittest.cc @@ -33,9 +33,8 @@ class SendTimeHistoryTest : public ::testing::Test { void AddPacketWithSendTime(uint16_t sequence_number, size_t length, - bool was_paced, int64_t send_time_ms) { - history_.AddAndRemoveOld(sequence_number, length, was_paced); + history_.AddAndRemoveOld(sequence_number, length); history_.OnSentPacket(sequence_number, send_time_ms); } @@ -46,42 +45,40 @@ class SendTimeHistoryTest : public ::testing::Test { // Help class extended so we can do EXPECT_EQ and collections. class PacketInfo : public webrtc::PacketInfo { public: - PacketInfo() : webrtc::PacketInfo(-1, 0, 0, 0, 0, false) {} + PacketInfo() : webrtc::PacketInfo(-1, 0, 0, 0, 0) {} PacketInfo(int64_t arrival_time_ms, uint16_t sequence_number) - : PacketInfo(arrival_time_ms, 0, sequence_number, 0, false) {} + : PacketInfo(arrival_time_ms, 0, sequence_number, 0) {} PacketInfo(int64_t arrival_time_ms, int64_t send_time_ms, uint16_t sequence_number, - size_t payload_size, - bool was_paced) + size_t payload_size) : webrtc::PacketInfo(-1, arrival_time_ms, send_time_ms, sequence_number, - payload_size, - was_paced) {} + payload_size) {} bool operator==(const PacketInfo& other) const { return arrival_time_ms == other.arrival_time_ms && send_time_ms == other.send_time_ms && sequence_number == other.sequence_number && - payload_size == other.payload_size && was_paced == other.was_paced; + payload_size == other.payload_size; } }; TEST_F(SendTimeHistoryTest, AddRemoveOne) { const uint16_t kSeqNo = 10; - const PacketInfo kSentPacket(0, 1, kSeqNo, 1, true); - AddPacketWithSendTime(kSeqNo, 1, true, 1); + const PacketInfo kSentPacket(0, 1, kSeqNo, 1); + AddPacketWithSendTime(kSeqNo, 1, 1); - PacketInfo received_packet(0, 0, kSeqNo, 0, false); + PacketInfo received_packet(0, 0, kSeqNo, 0); EXPECT_TRUE(history_.GetInfo(&received_packet, false)); EXPECT_EQ(kSentPacket, received_packet); - PacketInfo received_packet2(0, 0, kSeqNo, 0, false); + PacketInfo received_packet2(0, 0, kSeqNo, 0); EXPECT_TRUE(history_.GetInfo(&received_packet2, true)); EXPECT_EQ(kSentPacket, received_packet2); - PacketInfo received_packet3(0, 0, kSeqNo, 0, false); + PacketInfo received_packet3(0, 0, kSeqNo, 0); EXPECT_FALSE(history_.GetInfo(&received_packet3, true)); } @@ -90,9 +87,8 @@ TEST_F(SendTimeHistoryTest, PopulatesExpectedFields) { const int64_t kSendTime = 1000; const int64_t kReceiveTime = 2000; const size_t kPayloadSize = 42; - const bool kPaced = true; - AddPacketWithSendTime(kSeqNo, kPayloadSize, kPaced, kSendTime); + AddPacketWithSendTime(kSeqNo, kPayloadSize, kSendTime); PacketInfo info(kReceiveTime, kSeqNo); EXPECT_TRUE(history_.GetInfo(&info, true)); @@ -100,7 +96,6 @@ TEST_F(SendTimeHistoryTest, PopulatesExpectedFields) { EXPECT_EQ(kSendTime, info.send_time_ms); EXPECT_EQ(kSeqNo, info.sequence_number); EXPECT_EQ(kPayloadSize, info.payload_size); - EXPECT_EQ(kPaced, info.was_paced); } TEST_F(SendTimeHistoryTest, AddThenRemoveOutOfOrder) { @@ -109,19 +104,16 @@ TEST_F(SendTimeHistoryTest, AddThenRemoveOutOfOrder) { const size_t num_items = 100; const size_t kPacketSize = 400; const size_t kTransmissionTime = 1234; - const bool kPaced = true; for (size_t i = 0; i < num_items; ++i) { sent_packets.push_back(PacketInfo(0, static_cast(i), - static_cast(i), kPacketSize, - kPaced)); + static_cast(i), kPacketSize)); received_packets.push_back( PacketInfo(static_cast(i) + kTransmissionTime, 0, - static_cast(i), kPacketSize, false)); + static_cast(i), kPacketSize)); } for (size_t i = 0; i < num_items; ++i) { history_.AddAndRemoveOld(sent_packets[i].sequence_number, - sent_packets[i].payload_size, - sent_packets[i].was_paced); + sent_packets[i].payload_size); } for (size_t i = 0; i < num_items; ++i) history_.OnSentPacket(sent_packets[i].sequence_number, @@ -143,19 +135,19 @@ TEST_F(SendTimeHistoryTest, HistorySize) { const int kItems = kDefaultHistoryLengthMs / 100; for (int i = 0; i < kItems; ++i) { clock_.AdvanceTimeMilliseconds(100); - AddPacketWithSendTime(i, 0, false, i * 100); + AddPacketWithSendTime(i, 0, i * 100); } for (int i = 0; i < kItems; ++i) { - PacketInfo info(0, 0, static_cast(i), 0, false); + PacketInfo info(0, 0, static_cast(i), 0); EXPECT_TRUE(history_.GetInfo(&info, false)); EXPECT_EQ(i * 100, info.send_time_ms); } clock_.AdvanceTimeMilliseconds(101); - AddPacketWithSendTime(kItems, 0, false, kItems * 101); - PacketInfo info(0, 0, 0, 0, false); + AddPacketWithSendTime(kItems, 0, kItems * 101); + PacketInfo info(0, 0, 0, 0); EXPECT_FALSE(history_.GetInfo(&info, false)); for (int i = 1; i < (kItems + 1); ++i) { - PacketInfo info2(0, 0, static_cast(i), 0, false); + PacketInfo info2(0, 0, static_cast(i), 0); EXPECT_TRUE(history_.GetInfo(&info2, false)); int64_t expected_time_ms = (i == kItems) ? i * 101 : i * 100; EXPECT_EQ(expected_time_ms, info2.send_time_ms); @@ -164,16 +156,16 @@ TEST_F(SendTimeHistoryTest, HistorySize) { TEST_F(SendTimeHistoryTest, HistorySizeWithWraparound) { const uint16_t kMaxSeqNo = std::numeric_limits::max(); - AddPacketWithSendTime(kMaxSeqNo - 2, 0, false, 0); + AddPacketWithSendTime(kMaxSeqNo - 2, 0, 0); clock_.AdvanceTimeMilliseconds(100); - AddPacketWithSendTime(kMaxSeqNo - 1, 1, false, 100); + AddPacketWithSendTime(kMaxSeqNo - 1, 1, 100); clock_.AdvanceTimeMilliseconds(100); - AddPacketWithSendTime(kMaxSeqNo, 0, false, 200); + AddPacketWithSendTime(kMaxSeqNo, 0, 200); clock_.AdvanceTimeMilliseconds(kDefaultHistoryLengthMs - 200 + 1); - AddPacketWithSendTime(0, 0, false, kDefaultHistoryLengthMs); + AddPacketWithSendTime(0, 0, kDefaultHistoryLengthMs); PacketInfo info(0, static_cast(kMaxSeqNo - 2)); EXPECT_FALSE(history_.GetInfo(&info, false)); @@ -189,7 +181,7 @@ TEST_F(SendTimeHistoryTest, HistorySizeWithWraparound) { EXPECT_TRUE(history_.GetInfo(&info5, true)); clock_.AdvanceTimeMilliseconds(100); - AddPacketWithSendTime(1, 0, false, 1100); + AddPacketWithSendTime(1, 0, 1100); PacketInfo info6(0, static_cast(kMaxSeqNo - 2)); EXPECT_FALSE(history_.GetInfo(&info6, false)); @@ -206,26 +198,26 @@ TEST_F(SendTimeHistoryTest, HistorySizeWithWraparound) { TEST_F(SendTimeHistoryTest, InterlievedGetAndRemove) { const uint16_t kSeqNo = 1; const int64_t kTimestamp = 2; - PacketInfo packets[3] = {{0, kTimestamp, kSeqNo, 0, false}, - {0, kTimestamp + 1, kSeqNo + 1, 0, false}, - {0, kTimestamp + 2, kSeqNo + 2, 0, false}}; + PacketInfo packets[3] = {{0, kTimestamp, kSeqNo, 0}, + {0, kTimestamp + 1, kSeqNo + 1, 0}, + {0, kTimestamp + 2, kSeqNo + 2, 0}}; AddPacketWithSendTime(packets[0].sequence_number, packets[0].payload_size, - packets[0].was_paced, packets[0].send_time_ms); + packets[0].send_time_ms); AddPacketWithSendTime(packets[1].sequence_number, packets[1].payload_size, - packets[1].was_paced, packets[1].send_time_ms); - PacketInfo info(0, 0, packets[0].sequence_number, 0, false); + packets[1].send_time_ms); + PacketInfo info(0, 0, packets[0].sequence_number, 0); EXPECT_TRUE(history_.GetInfo(&info, true)); EXPECT_EQ(packets[0], info); AddPacketWithSendTime(packets[2].sequence_number, packets[2].payload_size, - packets[2].was_paced, packets[2].send_time_ms); + packets[2].send_time_ms); - PacketInfo info2(0, 0, packets[1].sequence_number, 0, false); + PacketInfo info2(0, 0, packets[1].sequence_number, 0); EXPECT_TRUE(history_.GetInfo(&info2, true)); EXPECT_EQ(packets[1], info2); - PacketInfo info3(0, 0, packets[2].sequence_number, 0, false); + PacketInfo info3(0, 0, packets[2].sequence_number, 0); EXPECT_TRUE(history_.GetInfo(&info3, true)); EXPECT_EQ(packets[2], info3); } diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/bwe.cc b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/bwe.cc index 5e282c6f087..b21a269ec6b 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/bwe.cc +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/bwe.cc @@ -13,6 +13,7 @@ #include #include "webrtc/base/common.h" +#include "webrtc/base/constructormagic.h" #include "webrtc/modules/remote_bitrate_estimator/test/estimators/nada.h" #include "webrtc/modules/remote_bitrate_estimator/test/estimators/remb.h" #include "webrtc/modules/remote_bitrate_estimator/test/estimators/send_side.h" diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/bwe.h b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/bwe.h index bd016cf318b..fc3018f9967 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/bwe.h +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/bwe.h @@ -16,6 +16,7 @@ #include #include +#include "webrtc/base/constructormagic.h" #include "webrtc/base/gtest_prod_util.h" #include "webrtc/modules/remote_bitrate_estimator/test/packet.h" #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc index 41bf836c9e9..a9fd617118a 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc @@ -14,6 +14,8 @@ #include +#include "webrtc/base/constructormagic.h" + namespace webrtc { namespace testing { namespace bwe { @@ -97,18 +99,14 @@ Packet::Packet() creation_time_us_(-1), send_time_us_(-1), sender_timestamp_us_(-1), - payload_size_(0), - paced_(false) { -} + payload_size_(0) {} Packet::Packet(int flow_id, int64_t send_time_us, size_t payload_size) : flow_id_(flow_id), creation_time_us_(send_time_us), send_time_us_(send_time_us), sender_timestamp_us_(send_time_us), - payload_size_(payload_size), - paced_(false) { -} + payload_size_(payload_size) {} Packet::~Packet() { } diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h index 223b20f21c5..1fe3a228e4b 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h @@ -25,6 +25,7 @@ #include #include "webrtc/base/common.h" +#include "webrtc/base/constructormagic.h" #include "webrtc/base/random.h" #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" #include "webrtc/modules/include/module_common_types.h" diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/estimators/nada.h b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/estimators/nada.h index 37009c77018..2a33440bc3b 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/estimators/nada.h +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/estimators/nada.h @@ -21,6 +21,7 @@ #include #include +#include "webrtc/base/constructormagic.h" #include "webrtc/modules/include/module_common_types.h" #include "webrtc/modules/remote_bitrate_estimator/test/bwe.h" #include "webrtc/voice_engine/channel.h" diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/estimators/remb.cc b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/estimators/remb.cc index d469e675e41..e2d3da9632a 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/estimators/remb.cc +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/estimators/remb.cc @@ -69,7 +69,7 @@ RembReceiver::RembReceiver(int flow_id, bool plot) recv_stats_(ReceiveStatistics::Create(&clock_)), latest_estimate_bps_(-1), last_feedback_ms_(-1), - estimator_(new RemoteBitrateEstimatorAbsSendTime(this, &clock_)) { + estimator_(new RemoteBitrateEstimatorAbsSendTime(this)) { std::stringstream ss; ss << "Estimate_" << flow_id_ << "#1"; estimate_log_prefix_ = ss.str(); @@ -95,7 +95,7 @@ void RembReceiver::ReceivePacket(int64_t arrival_time_ms, step_ms = std::max(estimator_->TimeUntilNextProcess(), 0); } estimator_->IncomingPacket(arrival_time_ms, media_packet.payload_size(), - media_packet.header(), true); + media_packet.header()); clock_.AdvanceTimeMilliseconds(arrival_time_ms - clock_.TimeInMilliseconds()); ASSERT_TRUE(arrival_time_ms == clock_.TimeInMilliseconds()); diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/estimators/remb.h b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/estimators/remb.h index 5e6b6edb256..3dc4f388c8f 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/estimators/remb.h +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/estimators/remb.h @@ -15,6 +15,7 @@ #include #include +#include "webrtc/base/constructormagic.h" #include "webrtc/modules/remote_bitrate_estimator/test/bwe.h" namespace webrtc { diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/estimators/send_side.cc b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/estimators/send_side.cc index 36dff1fb2ac..c54a7b05949 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/estimators/send_side.cc +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/estimators/send_side.cc @@ -23,7 +23,7 @@ const int kFeedbackIntervalMs = 50; FullBweSender::FullBweSender(int kbps, BitrateObserver* observer, Clock* clock) : bitrate_controller_( BitrateController::CreateBitrateController(clock, observer)), - rbe_(new RemoteBitrateEstimatorAbsSendTime(this, clock)), + rbe_(new RemoteBitrateEstimatorAbsSendTime(this)), feedback_observer_(bitrate_controller_->CreateRtcpBandwidthObserver()), clock_(clock), send_time_history_(clock_, 10000), @@ -93,8 +93,7 @@ void FullBweSender::OnPacketsSent(const Packets& packets) { if (packet->GetPacketType() == Packet::kMedia) { MediaPacket* media_packet = static_cast(packet); send_time_history_.AddAndRemoveOld(media_packet->header().sequenceNumber, - media_packet->payload_size(), - packet->paced()); + media_packet->payload_size()); send_time_history_.OnSentPacket(media_packet->header().sequenceNumber, media_packet->sender_timestamp_ms()); } @@ -126,7 +125,7 @@ void SendSideBweReceiver::ReceivePacket(int64_t arrival_time_ms, const MediaPacket& media_packet) { packet_feedback_vector_.push_back(PacketInfo( -1, arrival_time_ms, media_packet.sender_timestamp_ms(), - media_packet.header().sequenceNumber, media_packet.payload_size(), true)); + media_packet.header().sequenceNumber, media_packet.payload_size())); // Log received packet information. BweReceiver::ReceivePacket(arrival_time_ms, media_packet); diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/packet.h b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/packet.h index 4a361c4dc20..9aa596c1bd7 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/packet.h +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/packet.h @@ -42,8 +42,6 @@ class Packet { virtual void set_sender_timestamp_us(int64_t sender_timestamp_us) { sender_timestamp_us_ = sender_timestamp_us; } - virtual void set_paced(bool paced) { paced_ = paced; } - virtual bool paced() const { return paced_; } virtual int64_t creation_time_ms() const { return (creation_time_us_ + 500) / 1000; } @@ -58,7 +56,6 @@ class Packet { int64_t send_time_us_; // Time the packet left last processor touching it. int64_t sender_timestamp_us_; // Time the packet left the Sender. size_t payload_size_; // Size of the (non-existent, simulated) payload. - bool paced_; // True if sent through paced sender. }; class MediaPacket : public Packet { diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/packet_sender.cc b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/packet_sender.cc index 3bcbc0a071b..7ffeb5584b0 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/packet_sender.cc +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/packet_sender.cc @@ -157,13 +157,9 @@ PacedVideoSender::PacedVideoSender(PacketProcessorListener* listener, VideoSource* source, BandwidthEstimatorType estimator) : VideoSender(listener, source, estimator), - pacer_(&clock_, - this, - source->bits_per_second() / 1000, - PacedSender::kDefaultPaceMultiplier * source->bits_per_second() / - 1000, - 0) { + pacer_(&clock_, this) { modules_.push_back(&pacer_); + pacer_.SetEstimatedBitrate(source->bits_per_second()); } PacedVideoSender::~PacedVideoSender() { @@ -271,8 +267,6 @@ void PacedVideoSender::QueuePackets(Packets* batch, } Packets to_transfer; to_transfer.splice(to_transfer.begin(), queue_, queue_.begin(), it); - for (Packet* packet : to_transfer) - packet->set_paced(true); bwe_->OnPacketsSent(to_transfer); batch->merge(to_transfer, DereferencingComparator); } @@ -280,7 +274,8 @@ void PacedVideoSender::QueuePackets(Packets* batch, bool PacedVideoSender::TimeToSendPacket(uint32_t ssrc, uint16_t sequence_number, int64_t capture_time_ms, - bool retransmission) { + bool retransmission, + int probe_cluster_id) { for (Packets::iterator it = pacer_queue_.begin(); it != pacer_queue_.end(); ++it) { MediaPacket* media_packet = static_cast(*it); @@ -310,9 +305,7 @@ void PacedVideoSender::OnNetworkChanged(uint32_t target_bitrate_bps, uint8_t fraction_lost, int64_t rtt) { VideoSender::OnNetworkChanged(target_bitrate_bps, fraction_lost, rtt); - pacer_.UpdateBitrate( - target_bitrate_bps / 1000, - PacedSender::kDefaultPaceMultiplier * target_bitrate_bps / 1000, 0); + pacer_.SetEstimatedBitrate(target_bitrate_bps); } const int kNoLimit = std::numeric_limits::max(); diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/packet_sender.h b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/packet_sender.h index 5ed4a3bc380..4990574bdec 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/packet_sender.h +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/test/packet_sender.h @@ -100,7 +100,7 @@ class VideoSender : public PacketSender, public BitrateObserver { RTC_DISALLOW_COPY_AND_ASSIGN(VideoSender); }; -class PacedVideoSender : public VideoSender, public PacedSender::Callback { +class PacedVideoSender : public VideoSender, public PacedSender::PacketSender { public: PacedVideoSender(PacketProcessorListener* listener, VideoSource* source, @@ -113,7 +113,8 @@ class PacedVideoSender : public VideoSender, public PacedSender::Callback { bool TimeToSendPacket(uint32_t ssrc, uint16_t sequence_number, int64_t capture_time_ms, - bool retransmission) override; + bool retransmission, + int probe_cluster_id) override; size_t TimeToSendPadding(size_t bytes) override; // Implements BitrateObserver. diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/tools/bwe_rtp.cc b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/tools/bwe_rtp.cc index f138035de53..7ae6ede363e 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/tools/bwe_rtp.cc +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/tools/bwe_rtp.cc @@ -117,7 +117,7 @@ bool ParseArgsAndSetupEstimator(int argc, switch (extension) { case webrtc::kRtpExtensionAbsoluteSendTime: { *estimator = - new webrtc::RemoteBitrateEstimatorAbsSendTime(observer, clock); + new webrtc::RemoteBitrateEstimatorAbsSendTime(observer); *estimator_used = "AbsoluteSendTimeRemoteBitrateEstimator"; break; } diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/tools/bwe_rtp_play.cc b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/tools/bwe_rtp_play.cc index 08dc0e63a02..f5dbaef3717 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/tools/bwe_rtp_play.cc +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/tools/bwe_rtp_play.cc @@ -83,7 +83,7 @@ int main(int argc, char** argv) { packet_length = packet.original_length; } rbe->IncomingPacket(clock.TimeInMilliseconds(), - packet_length - header.headerLength, header, true); + packet_length - header.headerLength, header); ++packet_counter; } if (!rtp_reader->NextPacket(&packet)) { diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter.cc b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter.cc index f7e07a5dc51..a02f407d072 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter.cc +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter.cc @@ -10,6 +10,7 @@ #include "webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter.h" +#include #include #include "webrtc/base/checks.h" @@ -26,6 +27,17 @@ const int64_t kBaseTimestampScaleFactor = rtcp::TransportFeedback::kDeltaScaleFactor * (1 << 8); const int64_t kBaseTimestampRangeSizeUs = kBaseTimestampScaleFactor * (1 << 24); +class PacketInfoComparator { + public: + inline bool operator()(const PacketInfo& lhs, const PacketInfo& rhs) { + if (lhs.arrival_time_ms != rhs.arrival_time_ms) + return lhs.arrival_time_ms < rhs.arrival_time_ms; + if (lhs.send_time_ms != rhs.send_time_ms) + return lhs.send_time_ms < rhs.send_time_ms; + return lhs.sequence_number < rhs.sequence_number; + } +}; + TransportFeedbackAdapter::TransportFeedbackAdapter( BitrateController* bitrate_controller, Clock* clock) @@ -46,10 +58,9 @@ void TransportFeedbackAdapter::SetBitrateEstimator( } void TransportFeedbackAdapter::AddPacket(uint16_t sequence_number, - size_t length, - bool was_paced) { + size_t length) { rtc::CritScope cs(&lock_); - send_time_history_.AddAndRemoveOld(sequence_number, length, was_paced); + send_time_history_.AddAndRemoveOld(sequence_number, length); } void TransportFeedbackAdapter::OnSentPacket(uint16_t sequence_number, @@ -104,6 +115,8 @@ void TransportFeedbackAdapter::OnTransportFeedback( } ++sequence_number; } + std::sort(packet_feedback_vector.begin(), packet_feedback_vector.end(), + PacketInfoComparator()); RTC_DCHECK(delta_it == delta_vec.end()); if (failed_lookups > 0) { LOG(LS_WARNING) << "Failed to lookup send time for " << failed_lookups diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter.h b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter.h index c97ef57cf05..867570f26b9 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter.h +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter.h @@ -38,9 +38,7 @@ class TransportFeedbackAdapter : public TransportFeedbackObserver, } // Implements TransportFeedbackObserver. - void AddPacket(uint16_t sequence_number, - size_t length, - bool was_paced) override; + void AddPacket(uint16_t sequence_number, size_t length) override; void OnSentPacket(uint16_t sequence_number, int64_t send_time_ms); void OnTransportFeedback(const rtcp::TransportFeedback& feedback) override; diff --git a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter_unittest.cc b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter_unittest.cc index f3be09206ec..239f2ec561d 100644 --- a/chromium/third_party/webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter_unittest.cc +++ b/chromium/third_party/webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter_unittest.cc @@ -92,15 +92,13 @@ class TransportFeedbackAdapterTest : public ::testing::Test { EXPECT_EQ(truth[i].send_time_ms, input[i].send_time_ms); EXPECT_EQ(truth[i].sequence_number, input[i].sequence_number); EXPECT_EQ(truth[i].payload_size, input[i].payload_size); - EXPECT_EQ(truth[i].was_paced, input[i].was_paced); } } // Utility method, to reset arrival_time_ms before adding send time. void OnSentPacket(PacketInfo info) { info.arrival_time_ms = 0; - adapter_->AddPacket(info.sequence_number, info.payload_size, - info.was_paced); + adapter_->AddPacket(info.sequence_number, info.payload_size); adapter_->OnSentPacket(info.sequence_number, info.send_time_ms); } @@ -114,11 +112,11 @@ class TransportFeedbackAdapterTest : public ::testing::Test { TEST_F(TransportFeedbackAdapterTest, AdaptsFeedbackAndPopulatesSendTimes) { std::vector packets; - packets.push_back(PacketInfo(100, 200, 0, 1500, true)); - packets.push_back(PacketInfo(110, 210, 1, 1500, true)); - packets.push_back(PacketInfo(120, 220, 2, 1500, true)); - packets.push_back(PacketInfo(130, 230, 3, 1500, true)); - packets.push_back(PacketInfo(140, 240, 4, 1500, true)); + packets.push_back(PacketInfo(100, 200, 0, 1500)); + packets.push_back(PacketInfo(110, 210, 1, 1500)); + packets.push_back(PacketInfo(120, 220, 2, 1500)); + packets.push_back(PacketInfo(130, 230, 3, 1500)); + packets.push_back(PacketInfo(140, 240, 4, 1500)); for (const PacketInfo& packet : packets) OnSentPacket(packet); @@ -145,11 +143,11 @@ TEST_F(TransportFeedbackAdapterTest, AdaptsFeedbackAndPopulatesSendTimes) { TEST_F(TransportFeedbackAdapterTest, HandlesDroppedPackets) { std::vector packets; - packets.push_back(PacketInfo(100, 200, 0, 1500, true)); - packets.push_back(PacketInfo(110, 210, 1, 1500, true)); - packets.push_back(PacketInfo(120, 220, 2, 1500, true)); - packets.push_back(PacketInfo(130, 230, 3, 1500, true)); - packets.push_back(PacketInfo(140, 240, 4, 1500, true)); + packets.push_back(PacketInfo(100, 200, 0, 1500)); + packets.push_back(PacketInfo(110, 210, 1, 1500)); + packets.push_back(PacketInfo(120, 220, 2, 1500)); + packets.push_back(PacketInfo(130, 230, 3, 1500)); + packets.push_back(PacketInfo(140, 240, 4, 1500)); const uint16_t kSendSideDropBefore = 1; const uint16_t kReceiveSideDropAfter = 3; @@ -190,9 +188,9 @@ TEST_F(TransportFeedbackAdapterTest, SendTimeWrapsBothWays) { static_cast(1 << 8) * static_cast((1 << 23) - 1) / 1000; std::vector packets; - packets.push_back(PacketInfo(kHighArrivalTimeMs - 64, 200, 0, 1500, true)); - packets.push_back(PacketInfo(kHighArrivalTimeMs + 64, 210, 1, 1500, true)); - packets.push_back(PacketInfo(kHighArrivalTimeMs, 220, 2, 1500, true)); + packets.push_back(PacketInfo(kHighArrivalTimeMs - 64, 200, 0, 1500)); + packets.push_back(PacketInfo(kHighArrivalTimeMs + 64, 210, 1, 1500)); + packets.push_back(PacketInfo(kHighArrivalTimeMs, 220, 2, 1500)); for (const PacketInfo& packet : packets) OnSentPacket(packet); @@ -207,8 +205,8 @@ TEST_F(TransportFeedbackAdapterTest, SendTimeWrapsBothWays) { packets[i].sequence_number, packets[i].arrival_time_ms * 1000)); rtc::Buffer raw_packet = feedback->Build(); - feedback = rtc::ScopedToUnique(rtcp::TransportFeedback::ParseFrom( - raw_packet.data(), raw_packet.size())); + feedback = rtcp::TransportFeedback::ParseFrom(raw_packet.data(), + raw_packet.size()); std::vector expected_packets; expected_packets.push_back(packets[i]); @@ -223,6 +221,39 @@ TEST_F(TransportFeedbackAdapterTest, SendTimeWrapsBothWays) { } } +TEST_F(TransportFeedbackAdapterTest, HandlesReordering) { + std::vector packets; + packets.push_back(PacketInfo(120, 200, 0, 1500)); + packets.push_back(PacketInfo(110, 210, 1, 1500)); + packets.push_back(PacketInfo(100, 220, 2, 1500)); + std::vector expected_packets; + expected_packets.push_back(packets[2]); + expected_packets.push_back(packets[1]); + expected_packets.push_back(packets[0]); + + for (const PacketInfo& packet : packets) + OnSentPacket(packet); + + rtcp::TransportFeedback feedback; + feedback.WithBase(packets[0].sequence_number, + packets[0].arrival_time_ms * 1000); + + for (const PacketInfo& packet : packets) { + EXPECT_TRUE(feedback.WithReceivedPacket(packet.sequence_number, + packet.arrival_time_ms * 1000)); + } + + feedback.Build(); + + EXPECT_CALL(*bitrate_estimator_, IncomingPacketFeedbackVector(_)) + .Times(1) + .WillOnce(Invoke([expected_packets, + this](const std::vector& feedback_vector) { + ComparePacketVectors(expected_packets, feedback_vector); + })); + adapter_->OnTransportFeedback(feedback); +} + TEST_F(TransportFeedbackAdapterTest, TimestampDeltas) { std::vector sent_packets; const int64_t kSmallDeltaUs = @@ -257,6 +288,14 @@ TEST_F(TransportFeedbackAdapterTest, TimestampDeltas) { info.arrival_time_ms += (kLargePositiveDeltaUs + 1000) / 1000; ++info.sequence_number; + // Expected to be ordered on arrival time when the feedback message has been + // parsed. + std::vector expected_packets; + expected_packets.push_back(sent_packets[0]); + expected_packets.push_back(sent_packets[3]); + expected_packets.push_back(sent_packets[1]); + expected_packets.push_back(sent_packets[2]); + // Packets will be added to send history. for (const PacketInfo& packet : sent_packets) OnSentPacket(packet); @@ -276,17 +315,17 @@ TEST_F(TransportFeedbackAdapterTest, TimestampDeltas) { info.arrival_time_ms * 1000)); rtc::Buffer raw_packet = feedback->Build(); - feedback = rtc::ScopedToUnique( - rtcp::TransportFeedback::ParseFrom(raw_packet.data(), raw_packet.size())); + feedback = + rtcp::TransportFeedback::ParseFrom(raw_packet.data(), raw_packet.size()); std::vector received_feedback; EXPECT_TRUE(feedback.get() != nullptr); EXPECT_CALL(*bitrate_estimator_, IncomingPacketFeedbackVector(_)) .Times(1) - .WillOnce(Invoke([sent_packets, &received_feedback]( + .WillOnce(Invoke([expected_packets, &received_feedback]( const std::vector& feedback_vector) { - EXPECT_EQ(sent_packets.size(), feedback_vector.size()); + EXPECT_EQ(expected_packets.size(), feedback_vector.size()); received_feedback = feedback_vector; })); adapter_->OnTransportFeedback(*feedback.get()); @@ -297,8 +336,8 @@ TEST_F(TransportFeedbackAdapterTest, TimestampDeltas) { EXPECT_TRUE(feedback->WithReceivedPacket(info.sequence_number, info.arrival_time_ms * 1000)); raw_packet = feedback->Build(); - feedback = rtc::ScopedToUnique( - rtcp::TransportFeedback::ParseFrom(raw_packet.data(), raw_packet.size())); + feedback = + rtcp::TransportFeedback::ParseFrom(raw_packet.data(), raw_packet.size()); EXPECT_TRUE(feedback.get() != nullptr); EXPECT_CALL(*bitrate_estimator_, IncomingPacketFeedbackVector(_)) @@ -310,9 +349,9 @@ TEST_F(TransportFeedbackAdapterTest, TimestampDeltas) { })); adapter_->OnTransportFeedback(*feedback.get()); - sent_packets.push_back(info); + expected_packets.push_back(info); - ComparePacketVectors(sent_packets, received_feedback); + ComparePacketVectors(expected_packets, received_feedback); } } // namespace test -- cgit v1.2.1