Remove statistics tracking from FrameBuffer2

This was only set to nullptr in non-test environments and was thusly
unused. With this change, the stats callbacks are gaurenteed to only
come from the VideoStreamBufferController and so the thread checks can
be removed.

Bug: webrtc:14003
Change-Id: Iaf0e77aa7c45a317e38ae27739edcefd3123d832
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/272021
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37816}
This commit is contained in:
Evan Shrubsole
2022-08-17 14:35:58 +00:00
committed by WebRTC LUCI CQ
parent c48f9ef354
commit de7ae5755b
6 changed files with 4 additions and 119 deletions

View File

@ -137,7 +137,6 @@ class TestFrameBuffer2 : public ::testing::Test {
timing_(time_controller_.GetClock(), field_trials_),
buffer_(new FrameBuffer(time_controller_.GetClock(),
&timing_,
&stats_callback_,
field_trials_)),
rand_(0x34678213) {}
@ -225,7 +224,6 @@ class TestFrameBuffer2 : public ::testing::Test {
std::unique_ptr<FrameBuffer> buffer_;
std::vector<std::unique_ptr<EncodedFrame>> frames_;
Random rand_;
::testing::NiceMock<VCMReceiveStatisticsCallbackMock> stats_callback_;
};
// From https://en.cppreference.com/w/cpp/language/static: "If ... a constexpr
@ -284,8 +282,8 @@ TEST_F(TestFrameBuffer2, OneSuperFrame) {
TEST_F(TestFrameBuffer2, ZeroPlayoutDelay) {
test::ScopedKeyValueConfig field_trials;
VCMTiming timing(time_controller_.GetClock(), field_trials);
buffer_.reset(new FrameBuffer(time_controller_.GetClock(), &timing,
&stats_callback_, field_trials));
buffer_ = std::make_unique<FrameBuffer>(time_controller_.GetClock(), &timing,
field_trials);
const VideoPlayoutDelay kPlayoutDelayMs = {0, 0};
std::unique_ptr<FrameObjectFake> test_frame(new FrameObjectFake());
test_frame->SetId(0);
@ -379,8 +377,6 @@ TEST_F(TestFrameBuffer2, DropTemporalLayerSlowDecoder) {
pid + i - 1);
}
EXPECT_CALL(stats_callback_, OnDroppedFrames(1)).Times(3);
for (int i = 0; i < 10; ++i) {
ExtractFrame();
time_controller_.AdvanceTime(TimeDelta::Millis(70));
@ -411,7 +407,6 @@ TEST_F(TestFrameBuffer2, DropFramesIfSystemIsStalled) {
// Jump forward in time, simulating the system being stalled for some reason.
time_controller_.AdvanceTime(TimeDelta::Millis(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);
@ -428,7 +423,6 @@ TEST_F(TestFrameBuffer2, DroppedFramesCountedOnClear) {
}
// All frames should be dropped when Clear is called.
EXPECT_CALL(stats_callback_, OnDroppedFrames(5)).Times(1);
buffer_->Clear();
}
@ -520,31 +514,6 @@ TEST_F(TestFrameBuffer2, PictureIdJumpBack) {
CheckNoFrame(2);
}
TEST_F(TestFrameBuffer2, StatsCallback) {
uint16_t pid = Rand();
uint32_t ts = Rand();
const int kFrameSize = 5000;
EXPECT_CALL(stats_callback_,
OnCompleteFrame(true, kFrameSize, VideoContentType::UNSPECIFIED));
EXPECT_CALL(stats_callback_, OnFrameBufferTimingsUpdated(_, _, _, _, _, _));
// Stats callback requires a previously decoded frame.
timing_.StopDecodeTimer(TimeDelta::Millis(1), Timestamp::Zero());
{
std::unique_ptr<FrameObjectFake> frame(new FrameObjectFake());
frame->SetEncodedData(EncodedImageBuffer::Create(kFrameSize));
frame->SetId(pid);
frame->SetTimestamp(ts);
frame->num_references = 0;
EXPECT_EQ(buffer_->InsertFrame(std::move(frame)), pid);
}
ExtractFrame();
CheckFrame(0, pid, 0);
}
TEST_F(TestFrameBuffer2, ForwardJumps) {
EXPECT_EQ(5453, InsertFrame(5453, 0, 1, true, kFrameSize));
ExtractFrame();