Skip to content

Commit 27378f3

Browse files
Philipel-WebRTCCommit bot
authored andcommitted
Revert of Make the new jitter buffer the default jitter buffer. (patchset #2 id:290001 of https://codereview.chromium.org/2652043005/ )
Reason for revert: Breaks downstream bots Original issue's description: > Reland of Make the new jitter buffer the default jitter buffer. (patchset #1 id:1 of https://codereview.webrtc.org/2638423003/ ) > > Reason for revert: > Bugfixes related to the new jitter buffer has landed. > > Original issue's description: > > Revert of Make the new jitter buffer the default jitter buffer. (patchset #2 id:230001 of https://codereview.webrtc.org/2642753002/ ) > > > > Reason for revert: > > Breaks tests downstream. > > > > Original issue's description: > > > Reland of Make the new jitter buffer the default jitter buffer. (patchset #1 id:1 of https://codereview.chromium.org/2632123005/ ) > > > > > > Reason for revert: > > > Fix in this CL: https://codereview.chromium.org/2640793003/ > > > > > > Original issue's description: > > > > Revert of Make the new jitter buffer the default jitter buffer. (patchset #7 id:120001 of https://codereview.chromium.org/2627463004/ ) > > > > > > > > Reason for revert: > > > > Breaks android bots. > > > > > > > > Original issue's description: > > > > > Make the new jitter buffer the default jitter buffer. > > > > > > > > > > This CL contains only the changes necessary to make the switch to the new jitter > > > > > buffer, clean up will be done in follow up CLs. > > > > > > > > > > In this CL: > > > > > - Removed the WebRTC-NewVideoJitterBuffer experiment and made the > > > > > new video jitter buffer the default one. > > > > > - Moved WebRTC.Video.KeyFramesReceivedInPermille and > > > > > WebRTC.Video.JitterBufferDelayInMs to the ReceiveStatisticsProxy. > > > > > > > > > > BUG=webrtc:5514 > > > > > > > > > > Review-Url: https://codereview.webrtc.org/2627463004 > > > > > Cr-Commit-Position: refs/heads/master@{#16114} > > > > > Committed: https://chromium.googlesource.com/external/webrtc/+/0f0763d86d5d4e7f27e8dece02560e39c6da97d6 > > > > > > > > TBR=stefan@webrtc.org,terelius@webrtc.org > > > > # Skipping CQ checks because original CL landed less than 1 days ago. > > > > NOPRESUBMIT=true > > > > NOTREECHECKS=true > > > > NOTRY=true > > > > BUG=webrtc:5514 > > > > > > > > Review-Url: https://codereview.webrtc.org/2632123005 > > > > Cr-Commit-Position: refs/heads/master@{#16117} > > > > Committed: https://chromium.googlesource.com/external/webrtc/+/c08c191f7d206dc0de945185370d18f29d556931 > > > > > > TBR=stefan@webrtc.org,terelius@webrtc.org > > > # Not skipping CQ checks because original CL landed more than 1 days ago. > > > BUG=webrtc:5514 > > > > > > Review-Url: https://codereview.webrtc.org/2642753002 > > > Cr-Commit-Position: refs/heads/master@{#16149} > > > Committed: https://chromium.googlesource.com/external/webrtc/+/f20dd0014d1cfc8a2e859a9e177e7fe2b21274ca > > > > TBR=stefan@webrtc.org,terelius@webrtc.org,philipel@webrtc.org > > # Skipping CQ checks because original CL landed less than 1 days ago. > > NOPRESUBMIT=true > > NOTREECHECKS=true > > NOTRY=true > > BUG=webrtc:5514 > > > > Review-Url: https://codereview.webrtc.org/2638423003 > > Cr-Commit-Position: refs/heads/master@{#16159} > > Committed: https://chromium.googlesource.com/external/webrtc/+/04926b82641c426d764aa6e013e133db519129db > > TBR=stefan@webrtc.org,terelius@webrtc.org,kjellander@webrtc.org,kjellander@google.com > # Not skipping CQ checks because original CL landed more than 1 days ago. > BUG=webrtc:5514 > > Review-Url: https://codereview.webrtc.org/2652043005 > Cr-Commit-Position: refs/heads/master@{#16293} > Committed: https://chromium.googlesource.com/external/webrtc/+/09d6ef00fc21b9f2c2c27e50e5e2952329ac4b4b TBR=stefan@webrtc.org,terelius@webrtc.org,kjellander@webrtc.org,kjellander@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:5514 Review-Url: https://codereview.webrtc.org/2656983002 Cr-Commit-Position: refs/heads/master@{#16316}
1 parent 54a05b2 commit 27378f3

17 files changed

Lines changed: 246 additions & 313 deletions

webrtc/modules/video_coding/frame_buffer2.cc

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
#include "webrtc/base/checks.h"
1818
#include "webrtc/base/logging.h"
19-
#include "webrtc/modules/video_coding/include/video_coding_defines.h"
2019
#include "webrtc/modules/video_coding/jitter_estimator.h"
2120
#include "webrtc/modules/video_coding/timing.h"
2221
#include "webrtc/system_wrappers/include/clock.h"
@@ -35,8 +34,7 @@ constexpr int kMaxFramesHistory = 50;
3534

3635
FrameBuffer::FrameBuffer(Clock* clock,
3736
VCMJitterEstimator* jitter_estimator,
38-
VCMTiming* timing,
39-
VCMReceiveStatisticsCallback* stats_callback)
37+
VCMTiming* timing)
4038
: clock_(clock),
4139
new_countinuous_frame_event_(false, false),
4240
jitter_estimator_(jitter_estimator),
@@ -47,10 +45,11 @@ FrameBuffer::FrameBuffer(Clock* clock,
4745
num_frames_history_(0),
4846
num_frames_buffered_(0),
4947
stopped_(false),
50-
protection_mode_(kProtectionNack),
51-
stats_callback_(stats_callback) {}
48+
protection_mode_(kProtectionNack) {}
5249

53-
FrameBuffer::~FrameBuffer() {}
50+
FrameBuffer::~FrameBuffer() {
51+
UpdateHistograms();
52+
}
5453

5554
FrameBuffer::ReturnReason FrameBuffer::NextFrame(
5655
int64_t max_wait_time_ms,
@@ -166,8 +165,9 @@ int FrameBuffer::InsertFrame(std::unique_ptr<FrameObject> frame) {
166165
rtc::CritScope lock(&crit_);
167166
RTC_DCHECK(frame);
168167

169-
if (stats_callback_)
170-
stats_callback_->OnCompleteFrame(frame->num_references == 0, frame->size());
168+
++num_total_frames_;
169+
if (frame->num_references == 0)
170+
++num_key_frames_;
171171

172172
FrameKey key(frame->picture_id, frame->spatial_layer);
173173
int last_continuous_picture_id =
@@ -381,22 +381,28 @@ bool FrameBuffer::UpdateFrameInfoWithIncomingFrame(const FrameObject& frame,
381381
}
382382

383383
void FrameBuffer::UpdateJitterDelay() {
384-
if (!stats_callback_)
385-
return;
386-
387-
int decode_ms;
388-
int max_decode_ms;
389-
int current_delay_ms;
390-
int target_delay_ms;
391-
int jitter_buffer_ms;
392-
int min_playout_delay_ms;
393-
int render_delay_ms;
394-
if (timing_->GetTimings(&decode_ms, &max_decode_ms, &current_delay_ms,
395-
&target_delay_ms, &jitter_buffer_ms,
396-
&min_playout_delay_ms, &render_delay_ms)) {
397-
stats_callback_->OnFrameBufferTimingsUpdated(
398-
decode_ms, max_decode_ms, current_delay_ms, target_delay_ms,
399-
jitter_buffer_ms, min_playout_delay_ms, render_delay_ms);
384+
int unused;
385+
int delay;
386+
timing_->GetTimings(&unused, &unused, &unused, &unused, &delay, &unused,
387+
&unused);
388+
389+
accumulated_delay_ += delay;
390+
++accumulated_delay_samples_;
391+
}
392+
393+
void FrameBuffer::UpdateHistograms() const {
394+
rtc::CritScope lock(&crit_);
395+
if (num_total_frames_ > 0) {
396+
int key_frames_permille = (static_cast<float>(num_key_frames_) * 1000.0f /
397+
static_cast<float>(num_total_frames_) +
398+
0.5f);
399+
RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.KeyFramesReceivedInPermille",
400+
key_frames_permille);
401+
}
402+
403+
if (accumulated_delay_samples_ > 0) {
404+
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.JitterBufferDelayInMs",
405+
accumulated_delay_ / accumulated_delay_samples_);
400406
}
401407
}
402408

webrtc/modules/video_coding/frame_buffer2.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
namespace webrtc {
2929

3030
class Clock;
31-
class VCMReceiveStatisticsCallback;
3231
class VCMJitterEstimator;
3332
class VCMTiming;
3433

@@ -40,8 +39,7 @@ class FrameBuffer {
4039

4140
FrameBuffer(Clock* clock,
4241
VCMJitterEstimator* jitter_estimator,
43-
VCMTiming* timing,
44-
VCMReceiveStatisticsCallback* stats_proxy);
42+
VCMTiming* timing);
4543

4644
virtual ~FrameBuffer();
4745

@@ -143,6 +141,8 @@ class FrameBuffer {
143141

144142
void UpdateJitterDelay() EXCLUSIVE_LOCKS_REQUIRED(crit_);
145143

144+
void UpdateHistograms() const;
145+
146146
void ClearFramesAndHistory() EXCLUSIVE_LOCKS_REQUIRED(crit_);
147147

148148
FrameMap frames_ GUARDED_BY(crit_);
@@ -160,9 +160,16 @@ class FrameBuffer {
160160
int num_frames_buffered_ GUARDED_BY(crit_);
161161
bool stopped_ GUARDED_BY(crit_);
162162
VCMVideoProtection protection_mode_ GUARDED_BY(crit_);
163-
VCMReceiveStatisticsCallback* const stats_callback_;
164163

165164
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FrameBuffer);
165+
166+
// For WebRTC.Video.JitterBufferDelayInMs metric.
167+
int64_t accumulated_delay_ = 0;
168+
int64_t accumulated_delay_samples_ = 0;
169+
170+
// For WebRTC.Video.KeyFramesReceivedInPermille metric.
171+
int64_t num_total_frames_ = 0;
172+
int64_t num_key_frames_ = 0;
166173
};
167174

168175
} // namespace video_coding

webrtc/modules/video_coding/frame_buffer2_unittest.cc

Lines changed: 1 addition & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@
2525
#include "webrtc/test/gmock.h"
2626
#include "webrtc/test/gtest.h"
2727

28-
using testing::_;
29-
using testing::Return;
30-
3128
namespace webrtc {
3229
namespace video_coding {
3330

@@ -57,16 +54,6 @@ class VCMTimingFake : public VCMTiming {
5754
return std::max<int>(0, render_time_ms - now_ms - kDecodeTime);
5855
}
5956

60-
bool GetTimings(int* decode_ms,
61-
int* max_decode_ms,
62-
int* current_delay_ms,
63-
int* target_delay_ms,
64-
int* jitter_buffer_ms,
65-
int* min_playout_delay_ms,
66-
int* render_delay_ms) const override {
67-
return true;
68-
}
69-
7057
private:
7158
static constexpr int kDelayMs = 50;
7259
static constexpr int kDecodeTime = kDelayMs / 2;
@@ -95,27 +82,6 @@ class FrameObjectFake : public FrameObject {
9582
int64_t ReceivedTime() const override { return 0; }
9683

9784
int64_t RenderTime() const override { return _renderTimeMs; }
98-
99-
// In EncodedImage |_length| is used to descibe its size and |_size| to
100-
// describe its capacity.
101-
void SetSize(int size) { _length = size; }
102-
};
103-
104-
class VCMReceiveStatisticsCallbackMock : public VCMReceiveStatisticsCallback {
105-
public:
106-
MOCK_METHOD2(OnReceiveRatesUpdated,
107-
void(uint32_t bitRate, uint32_t frameRate));
108-
MOCK_METHOD2(OnCompleteFrame, void(bool is_keyframe, size_t size_bytes));
109-
MOCK_METHOD1(OnDiscardedPacketsUpdated, void(int discarded_packets));
110-
MOCK_METHOD1(OnFrameCountsUpdated, void(const FrameCounts& frame_counts));
111-
MOCK_METHOD7(OnFrameBufferTimingsUpdated,
112-
void(int decode_ms,
113-
int max_decode_ms,
114-
int current_delay_ms,
115-
int target_delay_ms,
116-
int jitter_buffer_ms,
117-
int min_playout_delay_ms,
118-
int render_delay_ms));
11985
};
12086

12187
class TestFrameBuffer2 : public ::testing::Test {
@@ -129,7 +95,7 @@ class TestFrameBuffer2 : public ::testing::Test {
12995
: clock_(0),
13096
timing_(&clock_),
13197
jitter_estimator_(&clock_),
132-
buffer_(&clock_, &jitter_estimator_, &timing_, &stats_callback_),
98+
buffer_(&clock_, &jitter_estimator_, &timing_),
13399
rand_(0x34678213),
134100
tear_down_(false),
135101
extract_thread_(&ExtractLoop, this, "Extract Thread"),
@@ -224,7 +190,6 @@ class TestFrameBuffer2 : public ::testing::Test {
224190
FrameBuffer buffer_;
225191
std::vector<std::unique_ptr<FrameObject>> frames_;
226192
Random rand_;
227-
::testing::NiceMock<VCMReceiveStatisticsCallbackMock> stats_callback_;
228193

229194
int64_t max_wait_time_;
230195
bool tear_down_;
@@ -472,30 +437,5 @@ TEST_F(TestFrameBuffer2, PictureIdJumpBack) {
472437
CheckNoFrame(2);
473438
}
474439

475-
TEST_F(TestFrameBuffer2, StatsCallback) {
476-
uint16_t pid = Rand();
477-
uint32_t ts = Rand();
478-
const int kFrameSize = 5000;
479-
480-
EXPECT_CALL(stats_callback_, OnCompleteFrame(true, kFrameSize));
481-
EXPECT_CALL(stats_callback_,
482-
OnFrameBufferTimingsUpdated(_, _, _, _, _, _, _));
483-
484-
{
485-
std::unique_ptr<FrameObjectFake> frame(new FrameObjectFake());
486-
frame->SetSize(kFrameSize);
487-
frame->picture_id = pid;
488-
frame->spatial_layer = 0;
489-
frame->timestamp = ts;
490-
frame->num_references = 0;
491-
frame->inter_layer_predicted = false;
492-
493-
EXPECT_EQ(buffer_.InsertFrame(std::move(frame)), pid);
494-
}
495-
496-
ExtractFrame();
497-
CheckFrame(0, pid, 0);
498-
}
499-
500440
} // namespace video_coding
501441
} // namespace webrtc

webrtc/modules/video_coding/include/video_coding_defines.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,8 @@ class VCMSendStatisticsCallback {
9090
class VCMReceiveStatisticsCallback {
9191
public:
9292
virtual void OnReceiveRatesUpdated(uint32_t bitRate, uint32_t frameRate) = 0;
93-
virtual void OnCompleteFrame(bool is_keyframe, size_t size_bytes) = 0;
9493
virtual void OnDiscardedPacketsUpdated(int discarded_packets) = 0;
9594
virtual void OnFrameCountsUpdated(const FrameCounts& frame_counts) = 0;
96-
virtual void OnFrameBufferTimingsUpdated(int decode_ms,
97-
int max_decode_ms,
98-
int current_delay_ms,
99-
int target_delay_ms,
100-
int jitter_buffer_ms,
101-
int min_playout_delay_ms,
102-
int render_delay_ms) = 0;
10395

10496
protected:
10597
virtual ~VCMReceiveStatisticsCallback() {}

webrtc/modules/video_coding/timing.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,13 @@ class VCMTiming {
9494

9595
// Return current timing information. Returns true if the first frame has been
9696
// decoded, false otherwise.
97-
virtual bool GetTimings(int* decode_ms,
98-
int* max_decode_ms,
99-
int* current_delay_ms,
100-
int* target_delay_ms,
101-
int* jitter_buffer_ms,
102-
int* min_playout_delay_ms,
103-
int* render_delay_ms) const;
97+
bool GetTimings(int* decode_ms,
98+
int* max_decode_ms,
99+
int* current_delay_ms,
100+
int* target_delay_ms,
101+
int* jitter_buffer_ms,
102+
int* min_playout_delay_ms,
103+
int* render_delay_ms) const;
104104

105105
enum { kDefaultRenderDelayMs = 10 };
106106
enum { kDelayMaxChangeMsPerS = 100 };

webrtc/modules/video_coding/video_receiver.cc

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,31 @@ VideoReceiver::~VideoReceiver() {}
5656

5757
void VideoReceiver::Process() {
5858
// Receive-side statistics
59-
60-
// TODO(philipel): Remove this if block when we know what to do with
61-
// ReceiveStatisticsProxy::QualitySample.
6259
if (_receiveStatsTimer.TimeUntilProcess() == 0) {
6360
_receiveStatsTimer.Processed();
6461
rtc::CritScope cs(&process_crit_);
6562
if (_receiveStatsCallback != nullptr) {
66-
_receiveStatsCallback->OnReceiveRatesUpdated(0, 0);
63+
uint32_t bitRate;
64+
uint32_t frameRate;
65+
_receiver.ReceiveStatistics(&bitRate, &frameRate);
66+
_receiveStatsCallback->OnReceiveRatesUpdated(bitRate, frameRate);
67+
}
68+
69+
if (_decoderTimingCallback != nullptr) {
70+
int decode_ms;
71+
int max_decode_ms;
72+
int current_delay_ms;
73+
int target_delay_ms;
74+
int jitter_buffer_ms;
75+
int min_playout_delay_ms;
76+
int render_delay_ms;
77+
if (_timing->GetTimings(&decode_ms, &max_decode_ms, &current_delay_ms,
78+
&target_delay_ms, &jitter_buffer_ms,
79+
&min_playout_delay_ms, &render_delay_ms)) {
80+
_decoderTimingCallback->OnDecoderTiming(
81+
decode_ms, max_decode_ms, current_delay_ms, target_delay_ms,
82+
jitter_buffer_ms, min_playout_delay_ms, render_delay_ms);
83+
}
6784
}
6885
}
6986

@@ -275,7 +292,7 @@ int32_t VideoReceiver::Decode(uint16_t maxWaitTimeMs) {
275292
return ret;
276293
}
277294

278-
// Used for the new jitter buffer.
295+
// Used for the WebRTC-NewVideoJitterBuffer experiment.
279296
// TODO(philipel): Clean up among the Decode functions as we replace
280297
// VCMEncodedFrame with FrameObject.
281298
int32_t VideoReceiver::Decode(const webrtc::VCMEncodedFrame* frame) {

webrtc/video/end_to_end_tests.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,6 +1234,9 @@ TEST_P(EndToEndTest, ReceivesPliAndRecoversWithNack) {
12341234
}
12351235

12361236
TEST_P(EndToEndTest, ReceivesPliAndRecoversWithoutNack) {
1237+
// This test makes no sense for the new video jitter buffer.
1238+
if (GetParam() == new_jb_enabled)
1239+
return;
12371240
ReceivesPliAndRecovers(0);
12381241
}
12391242

@@ -3033,6 +3036,10 @@ TEST_P(EndToEndTest, GetStats) {
30333036
ReceiveStreamRenderer receive_stream_renderer_;
30343037
} test;
30353038

3039+
// TODO(philipel): Implement statistics for the new video jitter buffer.
3040+
if (GetParam() == new_jb_enabled)
3041+
return;
3042+
30363043
RunBaseTest(&test);
30373044
}
30383045

0 commit comments

Comments
 (0)