Fix frames dropped statistics

The |frames_dropped| statistics contain not only frames that are dropped
but also frames that are in internal queues. This CL changes that so
that |frames_dropped| only contains frames that are dropped.

Bug: chromium:990317
Change-Id: If222568501b277a75bc514661c4f8f861b56aaed
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150111
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Johannes Kron <kron@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28968}
This commit is contained in:
Johannes Kron
2019-08-26 15:04:43 +02:00
committed by Commit Bot
parent 7e896d0162
commit 0c141c591a
16 changed files with 96 additions and 5 deletions

View File

@ -111,6 +111,7 @@ class VCMReceiveStatisticsCallbackMock : public VCMReceiveStatisticsCallback {
void(bool is_keyframe,
size_t size_bytes,
VideoContentType content_type));
MOCK_METHOD1(OnDroppedFrames, void(uint32_t frames_dropped));
MOCK_METHOD1(OnDiscardedPacketsUpdated, void(int discarded_packets));
MOCK_METHOD1(OnFrameCountsUpdated, void(const FrameCounts& frame_counts));
MOCK_METHOD6(OnFrameBufferTimingsUpdated,
@ -406,6 +407,8 @@ TEST_F(TestFrameBuffer2, DropTemporalLayerSlowDecoder) {
pid + i, pid + i - 1);
}
EXPECT_CALL(stats_callback_, OnDroppedFrames(1)).Times(3);
for (int i = 0; i < 10; ++i) {
ExtractFrame();
clock_.AdvanceTimeMilliseconds(70);
@ -423,6 +426,41 @@ TEST_F(TestFrameBuffer2, DropTemporalLayerSlowDecoder) {
CheckNoFrame(9);
}
TEST_F(TestFrameBuffer2, DropFramesIfSystemIsStalled) {
uint16_t pid = Rand();
uint32_t ts = Rand();
InsertFrame(pid, 0, ts, false, true, kFrameSize);
InsertFrame(pid + 1, 0, ts + 1 * kFps10, false, true, kFrameSize, pid);
InsertFrame(pid + 2, 0, ts + 2 * kFps10, false, true, kFrameSize, pid + 1);
InsertFrame(pid + 3, 0, ts + 3 * kFps10, false, true, kFrameSize);
ExtractFrame();
// Jump forward in time, simulating the system being stalled for some reason.
clock_.AdvanceTimeMilliseconds(3 * kFps10);
// Extract one more frame, expect second and third frame to be dropped.
EXPECT_CALL(stats_callback_, OnDroppedFrames(2)).Times(1);
ExtractFrame();
CheckFrame(0, pid + 0, 0);
CheckFrame(1, pid + 3, 0);
}
TEST_F(TestFrameBuffer2, DroppedFramesCountedOnClear) {
uint16_t pid = Rand();
uint32_t ts = Rand();
InsertFrame(pid, 0, ts, false, true, kFrameSize);
for (int i = 1; i < 5; ++i) {
InsertFrame(pid + i, 0, ts + i * kFps10, false, true, kFrameSize,
pid + i - 1);
}
// All frames should be dropped when Clear is called.
EXPECT_CALL(stats_callback_, OnDroppedFrames(5)).Times(1);
buffer_->Clear();
}
TEST_F(TestFrameBuffer2, InsertLateFrame) {
uint16_t pid = Rand();
uint32_t ts = Rand();