Don't pace out packets or generate padding when the pacer is disabled.
TEST=trybots R=pbos@webrtc.org Review URL: https://webrtc-codereview.appspot.com/2000004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4513 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
2ab209ef14
commit
80865fd611
@ -175,7 +175,6 @@ bool PacedSender::SendPacket(Priority priority, uint32_t ssrc,
|
||||
CriticalSectionScoped cs(critsect_.get());
|
||||
|
||||
if (!enabled_) {
|
||||
UpdateMediaBytesSent(bytes);
|
||||
return true; // We can send now.
|
||||
}
|
||||
if (capture_time_ms < 0) {
|
||||
@ -244,6 +243,9 @@ int32_t PacedSender::Process() {
|
||||
CriticalSectionScoped cs(critsect_.get());
|
||||
int elapsed_time_ms = (now - time_last_update_).Milliseconds();
|
||||
time_last_update_ = now;
|
||||
if (!enabled_) {
|
||||
return 0;
|
||||
}
|
||||
if (!paused_) {
|
||||
if (elapsed_time_ms > 0) {
|
||||
uint32_t delta_time_ms = std::min(kMaxIntervalTimeMs, elapsed_time_ms);
|
||||
@ -261,7 +263,7 @@ int32_t PacedSender::Process() {
|
||||
const bool success = callback_->TimeToSendPacket(ssrc, sequence_number,
|
||||
capture_time_ms);
|
||||
critsect_->Enter();
|
||||
// If packet cannt be sent then keep it in packet list and exit early.
|
||||
// If packet cannot be sent then keep it in packet list and exit early.
|
||||
// There's no need to send more packets.
|
||||
if (!success) {
|
||||
return 0;
|
||||
|
@ -235,6 +235,22 @@ TEST_F(PacedSenderTest, Padding) {
|
||||
EXPECT_EQ(0, send_bucket_->Process());
|
||||
}
|
||||
|
||||
TEST_F(PacedSenderTest, NoPaddingWhenDisabled) {
|
||||
send_bucket_->SetStatus(false);
|
||||
send_bucket_->UpdateBitrate(kTargetBitrate, kTargetBitrate);
|
||||
// No padding is expected since the pacer is disabled.
|
||||
EXPECT_CALL(callback_, TimeToSendPadding(_)).Times(0);
|
||||
EXPECT_EQ(5, send_bucket_->TimeUntilNextProcess());
|
||||
TickTime::AdvanceFakeClock(5);
|
||||
EXPECT_EQ(0, send_bucket_->TimeUntilNextProcess());
|
||||
EXPECT_EQ(0, send_bucket_->Process());
|
||||
EXPECT_CALL(callback_, TimeToSendPadding(_)).Times(0);
|
||||
EXPECT_EQ(5, send_bucket_->TimeUntilNextProcess());
|
||||
TickTime::AdvanceFakeClock(5);
|
||||
EXPECT_EQ(0, send_bucket_->TimeUntilNextProcess());
|
||||
EXPECT_EQ(0, send_bucket_->Process());
|
||||
}
|
||||
|
||||
TEST_F(PacedSenderTest, VerifyPaddingUpToBitrate) {
|
||||
uint32_t ssrc = 12345;
|
||||
uint16_t sequence_number = 1234;
|
||||
|
Loading…
x
Reference in New Issue
Block a user