Fixes a bug in the simulation framework where the time offset is accumulating as the packet trace is repeated, causing increasingly large gaps with no packets being transmitted.
R=solenberg@webrtc.org Review URL: https://webrtc-codereview.appspot.com/9469004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5650 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
ed865b5d46
commit
45846977f9
@ -335,6 +335,7 @@ void ChokeFilter::RunFor(int64_t /*time_ms*/, Packets* in_out) {
|
||||
TraceBasedDeliveryFilter::TraceBasedDeliveryFilter(
|
||||
PacketProcessorListener* listener)
|
||||
: PacketProcessor(listener),
|
||||
current_offset_us_(0),
|
||||
delivery_times_us_(),
|
||||
next_delivery_it_(),
|
||||
local_time_us_(-1),
|
||||
@ -345,6 +346,7 @@ TraceBasedDeliveryFilter::TraceBasedDeliveryFilter(
|
||||
PacketProcessorListener* listener,
|
||||
const std::string& name)
|
||||
: PacketProcessor(listener),
|
||||
current_offset_us_(0),
|
||||
delivery_times_us_(),
|
||||
next_delivery_it_(),
|
||||
local_time_us_(-1),
|
||||
@ -409,8 +411,9 @@ void TraceBasedDeliveryFilter::ProceedToNextSlot() {
|
||||
// When the trace wraps we allow two packets to be sent back-to-back.
|
||||
for (TimeList::iterator it = delivery_times_us_.begin();
|
||||
it != delivery_times_us_.end(); ++it) {
|
||||
*it += local_time_us_;
|
||||
*it += local_time_us_ - current_offset_us_;
|
||||
}
|
||||
current_offset_us_ += local_time_us_ - current_offset_us_;
|
||||
next_delivery_it_ = delivery_times_us_.begin();
|
||||
}
|
||||
}
|
||||
|
@ -312,6 +312,7 @@ class TraceBasedDeliveryFilter : public PacketProcessor {
|
||||
void ProceedToNextSlot();
|
||||
|
||||
typedef std::vector<int64_t> TimeList;
|
||||
int64_t current_offset_us_;
|
||||
TimeList delivery_times_us_;
|
||||
TimeList::const_iterator next_delivery_it_;
|
||||
int64_t local_time_us_;
|
||||
|
@ -709,12 +709,12 @@ TEST_F(BweTestFramework_ChokeFilterTest, ShortTrace) {
|
||||
TestChoke(&filter, 100, 100, 6);
|
||||
}
|
||||
|
||||
TEST_F(BweTestFramework_ChokeFilterTest, ShortTraceWrap) {
|
||||
// According to the input file 10 packets should be transmitted within
|
||||
// 140 milliseconds (at the wrapping point two packets are sent back to back).
|
||||
TEST_F(BweTestFramework_ChokeFilterTest, ShortTraceTwoWraps) {
|
||||
// According to the input file 19 packets should be transmitted within
|
||||
// 280 milliseconds (at the wrapping point two packets are sent back to back).
|
||||
TraceBasedDeliveryFilter filter(NULL);
|
||||
ASSERT_TRUE(filter.Init(test::ResourcePath("synthetic-trace", "rx")));
|
||||
TestChoke(&filter, 140, 100, 10);
|
||||
TestChoke(&filter, 280, 100, 19);
|
||||
}
|
||||
|
||||
void TestVideoSender(VideoSender* sender, int64_t run_for_ms,
|
||||
|
Loading…
Reference in New Issue
Block a user