Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2601)

Unified Diff: webrtc/modules/video_coding/video_packet_buffer_unittest.cc

Issue 2853503002: Dont request keyframes if the stream is inactive or if we are currently receiving a keyframe. (Closed)
Patch Set: Rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/video_coding/packet_buffer.cc ('k') | webrtc/video/end_to_end_tests.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/video_coding/video_packet_buffer_unittest.cc
diff --git a/webrtc/modules/video_coding/video_packet_buffer_unittest.cc b/webrtc/modules/video_coding/video_packet_buffer_unittest.cc
index 86d54ebafe84c2251a0fc9a18513e4a040327f22..e418d124666d147c1e8ba3c0c666ae5a25709ce0 100644
--- a/webrtc/modules/video_coding/video_packet_buffer_unittest.cc
+++ b/webrtc/modules/video_coding/video_packet_buffer_unittest.cc
@@ -58,7 +58,8 @@ class TestPacketBuffer : public ::testing::Test,
VCMPacket packet;
packet.codec = kVideoCodecGeneric;
packet.seqNum = seq_num;
- packet.frameType = keyframe ? kVideoFrameKey : kVideoFrameDelta;
+ packet.frameType =
+ keyframe == kKeyFrame ? kVideoFrameKey : kVideoFrameDelta;
packet.is_first_packet_in_frame = first == kFirst;
packet.markerBit = last == kLast;
packet.sizeBytes = data_size;
@@ -78,7 +79,7 @@ class TestPacketBuffer : public ::testing::Test,
const int kMaxSize = 64;
Random rand_;
- std::unique_ptr<Clock> clock_;
+ std::unique_ptr<SimulatedClock> clock_;
rtc::scoped_refptr<PacketBuffer> packet_buffer_;
std::map<uint16_t, std::unique_ptr<RtpFrameObject>> frames_from_callback_;
};
@@ -501,5 +502,40 @@ TEST_F(TestPacketBuffer, OneH264FrameFillBuffer) {
CheckFrame(0);
}
+TEST_F(TestPacketBuffer, PacketTimestamps) {
+ rtc::Optional<int64_t> packet_ms;
+ rtc::Optional<int64_t> packet_keyframe_ms;
+
+ packet_ms = packet_buffer_->LastReceivedPacketMs();
+ packet_keyframe_ms = packet_buffer_->LastReceivedKeyframePacketMs();
+ EXPECT_FALSE(packet_ms);
+ EXPECT_FALSE(packet_keyframe_ms);
+
+ int64_t keyframe_ms = clock_->TimeInMilliseconds();
+ EXPECT_TRUE(Insert(100, kKeyFrame, kFirst, kLast));
+ packet_ms = packet_buffer_->LastReceivedPacketMs();
+ packet_keyframe_ms = packet_buffer_->LastReceivedKeyframePacketMs();
+ EXPECT_TRUE(packet_ms);
+ EXPECT_TRUE(packet_keyframe_ms);
+ EXPECT_EQ(keyframe_ms, *packet_ms);
+ EXPECT_EQ(keyframe_ms, *packet_keyframe_ms);
+
+ clock_->AdvanceTimeMilliseconds(100);
+ int64_t delta_ms = clock_->TimeInMilliseconds();
+ EXPECT_TRUE(Insert(101, kDeltaFrame, kFirst, kLast));
+ packet_ms = packet_buffer_->LastReceivedPacketMs();
+ packet_keyframe_ms = packet_buffer_->LastReceivedKeyframePacketMs();
+ EXPECT_TRUE(packet_ms);
+ EXPECT_TRUE(packet_keyframe_ms);
+ EXPECT_EQ(delta_ms, *packet_ms);
+ EXPECT_EQ(keyframe_ms, *packet_keyframe_ms);
+
+ packet_buffer_->Clear();
+ packet_ms = packet_buffer_->LastReceivedPacketMs();
+ packet_keyframe_ms = packet_buffer_->LastReceivedKeyframePacketMs();
+ EXPECT_FALSE(packet_ms);
+ EXPECT_FALSE(packet_keyframe_ms);
+}
+
} // namespace video_coding
} // namespace webrtc
« no previous file with comments | « webrtc/modules/video_coding/packet_buffer.cc ('k') | webrtc/video/end_to_end_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698