Skip to content

Commit

Permalink
Fix intervals in periodic Plis (#1497)
Browse files Browse the repository at this point in the history
  • Loading branch information
lodoyun authored Oct 29, 2019
1 parent d878442 commit feebd7c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions erizo/src/erizo/rtp/PeriodicPliHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void PeriodicPliHandler::updateInterval(bool active, uint32_t interval_ms) {
requested_interval_ = std::chrono::milliseconds(interval_ms);
if (enabled_ && requested_periodic_plis_ && !has_scheduled_pli_) {
ELOG_DEBUG("%s, message: Updating interval, requested_periodic_plis_: %u, interval: %u", stream_->toLog(),
requested_periodic_plis_, requested_interval_);
requested_periodic_plis_, ClockUtils::durationToMs(requested_interval_));
scheduleNextPli(requested_interval_);
has_scheduled_pli_ = true;
}
Expand Down Expand Up @@ -73,7 +73,7 @@ void PeriodicPliHandler::scheduleNextPli(duration next_pli_time) {
if (this_ptr->requested_periodic_plis_) {
ELOG_DEBUG("%s, message: Maybe Sending PLI, keyframes_received_in_interval_: %u",
this_ptr->stream_->toLog(), this_ptr->keyframes_received_in_interval_);
if (this_ptr->keyframes_received_in_interval_ == 0) {
if (this_ptr->keyframes_received_in_interval_ <= 1) {
ELOG_DEBUG("%s, message: Will send PLI, keyframes_received_in_interval_: %u",
this_ptr->stream_->toLog(), this_ptr->keyframes_received_in_interval_);
this_ptr->sendPLI();
Expand Down
4 changes: 3 additions & 1 deletion erizo/src/test/rtp/PeriodicPliHandlerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ TEST_F(PeriodicPliHandlerTest, shouldUpdateIntervalIfRequested) {
executeTasksInNextMs(2*kArbitraryKeyframePeriodMs+1);
}

TEST_F(PeriodicPliHandlerTest, shouldNotSendPliIfKeyframeIsReceivedInPeriod) {
TEST_F(PeriodicPliHandlerTest, shouldNotSendPliIfMoreThanOneKeyframeIsReceivedInPeriod) {
auto keyframe = erizo::PacketTools::createVP8Packet(erizo::kArbitrarySeqNumber, true, true);
auto keyframe2 = erizo::PacketTools::createVP8Packet(erizo::kArbitrarySeqNumber + 1, true, true);

EXPECT_CALL(*writer.get(), write(_, _)).With(Args<1>(erizo::IsPLI())).Times(0);
EXPECT_CALL(*reader.get(), read(_, _)).
Expand All @@ -100,6 +101,7 @@ TEST_F(PeriodicPliHandlerTest, shouldNotSendPliIfKeyframeIsReceivedInPeriod) {
periodic_pli_handler->updateInterval(true, kArbitraryKeyframePeriodMs);
executeTasksInNextMs(kArbitraryKeyframePeriodMs/2);
pipeline->read(keyframe);
pipeline->read(keyframe2);
executeTasksInNextMs(kArbitraryKeyframePeriodMs/2 + 1);
}

Expand Down

0 comments on commit feebd7c

Please sign in to comment.