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}
diff --git a/webrtc/modules/video_coding/frame_buffer2.cc b/webrtc/modules/video_coding/frame_buffer2.cc
index 0831c0c..2a7e85e 100644
--- a/webrtc/modules/video_coding/frame_buffer2.cc
+++ b/webrtc/modules/video_coding/frame_buffer2.cc
@@ -16,6 +16,7 @@
#include "webrtc/base/checks.h"
#include "webrtc/base/logging.h"
+#include "webrtc/modules/video_coding/include/video_coding_defines.h"
#include "webrtc/modules/video_coding/jitter_estimator.h"
#include "webrtc/modules/video_coding/timing.h"
#include "webrtc/system_wrappers/include/clock.h"
@@ -34,7 +35,8 @@
FrameBuffer::FrameBuffer(Clock* clock,
VCMJitterEstimator* jitter_estimator,
- VCMTiming* timing)
+ VCMTiming* timing,
+ VCMReceiveStatisticsCallback* stats_callback)
: clock_(clock),
new_countinuous_frame_event_(false, false),
jitter_estimator_(jitter_estimator),
@@ -45,11 +47,10 @@
num_frames_history_(0),
num_frames_buffered_(0),
stopped_(false),
- protection_mode_(kProtectionNack) {}
+ protection_mode_(kProtectionNack),
+ stats_callback_(stats_callback) {}
-FrameBuffer::~FrameBuffer() {
- UpdateHistograms();
-}
+FrameBuffer::~FrameBuffer() {}
FrameBuffer::ReturnReason FrameBuffer::NextFrame(
int64_t max_wait_time_ms,
@@ -165,9 +166,8 @@
rtc::CritScope lock(&crit_);
RTC_DCHECK(frame);
- ++num_total_frames_;
- if (frame->num_references == 0)
- ++num_key_frames_;
+ if (stats_callback_)
+ stats_callback_->OnCompleteFrame(frame->num_references == 0, frame->size());
FrameKey key(frame->picture_id, frame->spatial_layer);
int last_continuous_picture_id =
@@ -381,28 +381,22 @@
}
void FrameBuffer::UpdateJitterDelay() {
- int unused;
- int delay;
- timing_->GetTimings(&unused, &unused, &unused, &unused, &delay, &unused,
- &unused);
+ if (!stats_callback_)
+ return;
- accumulated_delay_ += delay;
- ++accumulated_delay_samples_;
-}
-
-void FrameBuffer::UpdateHistograms() const {
- rtc::CritScope lock(&crit_);
- if (num_total_frames_ > 0) {
- int key_frames_permille = (static_cast<float>(num_key_frames_) * 1000.0f /
- static_cast<float>(num_total_frames_) +
- 0.5f);
- RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.KeyFramesReceivedInPermille",
- key_frames_permille);
- }
-
- if (accumulated_delay_samples_ > 0) {
- RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.JitterBufferDelayInMs",
- accumulated_delay_ / accumulated_delay_samples_);
+ int decode_ms;
+ int max_decode_ms;
+ int current_delay_ms;
+ int target_delay_ms;
+ int jitter_buffer_ms;
+ int min_playout_delay_ms;
+ int render_delay_ms;
+ if (timing_->GetTimings(&decode_ms, &max_decode_ms, ¤t_delay_ms,
+ &target_delay_ms, &jitter_buffer_ms,
+ &min_playout_delay_ms, &render_delay_ms)) {
+ stats_callback_->OnFrameBufferTimingsUpdated(
+ decode_ms, max_decode_ms, current_delay_ms, target_delay_ms,
+ jitter_buffer_ms, min_playout_delay_ms, render_delay_ms);
}
}