Commit graph

10 commits

Author SHA1 Message Date
Yun Zhang
4774a9fcb8 Fix rate statistic when time window running out of samples
Current rate statistic tracker has assumption, the tracking window will
always be full after first filled up. This assumption looks not always
true. One example is the input_framerate_ tracker inside
video_stream_sender.cc which is used for setup frame droper and encoder.
Whenever there is a gap in video stream, like mute/unmute,
pacer pause/unpause etc. The fps detected from the rate_statistics
becomes samples_filled_partial_window / full_window_size, which could
be extremely low for a while. This creates a misalignment between the
fps we told encoder/frame dropper, and the real fps we fed into them,
which causes short-term serious overshot and very bad experience on
delay, avsync, congestion etc. This may also depends on how fast
encoder could react to the gap between set fps and real fps, but
libvpx and openh264 at least cannot handle this well.

So propose a fix to update first timestamp after tracker window
drained. This will give more accurate fps estimate similar based on
active window after sample gets drained

Bug: webrtc:13403
Change-Id: I96792c11091fe8bfa63e669f4360a3b3e95593e1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/237720
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35447}
2021-11-30 23:57:40 +00:00
Erik Språng
03d9e52998 Replaces ring buffer in RateStatistics with deque.
Since RateStatistics is in practice always used with increasing
timestamps, and is often sparesely populated, replace the pre-allocated
ring buffer with a simple deque where each element tracks which time it
represents.

Bug: webrtc:11600
Change-Id: I866d7cfa607228c35452f0f19575825d2e694f75
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/175906
Commit-Queue: Erik Språng <sprang@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31344}
2020-05-25 12:14:44 +00:00
Harald Alvestrand
a846cef197 Change rate stats classes to use int64_t not size_t
This avoids integer overflows when size_t is 32 bits, and conforms
to style guide recommendations to avoid unsigned integers.

Also add tests for overflow on RateStatistics accumulator.

Bug: webrtc:11247
Change-Id: Ifa0db567f41bbcf3ec46d89ab888f2ed9d03f3f0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/163991
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Yves Gerey <yvesg@google.com>
Cr-Commit-Position: refs/heads/master@{#30268}
2020-01-15 13:46:38 +00:00
Yves Gerey
a688d11d96 Return unavailable rate rather than garbage value.
This CL quiets UBSan when value doesn't fit uint32_t.

Bug: webrtc:11182
Change-Id: I8a45867be9aaceeb490db1a3747eb0efc6eb6a8f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/163983
Reviewed-by: Florent Castelli <orphis@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Yves Gerey <yvesg@google.com>
Cr-Commit-Position: refs/heads/master@{#30132}
2020-01-02 15:55:24 +00:00
Mirko Bonadei
317a1f09ed Use std::make_unique instead of absl::make_unique.
WebRTC is now using C++14 so there is no need to use the Abseil version
of std::make_unique.

This CL has been created with the following steps:

git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt
git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt
git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt

diff --new-line-format="" --unchanged-line-format="" \
  /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \
  uniq > /tmp/only_make_unique.txt
diff --new-line-format="" --unchanged-line-format="" \
  /tmp/only_make_unique.txt /tmp/memory.txt | \
  xargs grep -l "absl/memory" > /tmp/add-memory.txt

git grep -l "\babsl::make_unique\b" | \
  xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g"

git checkout PRESUBMIT.py abseil-in-webrtc.md

cat /tmp/add-memory.txt | \
  xargs sed -i \
  's/#include "absl\/memory\/memory.h"/#include <memory>/g'
git cl format
# Manual fix order of the new inserted #include <memory>

cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \
  xargs sed -i '/#include "absl\/memory\/memory.h"/d'

git ls-files | grep BUILD.gn | \
  xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d'

python tools_webrtc/gn_check_autofix.py \
  -m tryserver.webrtc -b linux_rel

# Repead the gn_check_autofix step for other platforms

git ls-files | grep BUILD.gn | \
  xargs sed -i 's/absl\/memory:memory/absl\/memory/g'
git cl format

Bug: webrtc:10945
Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29209}
2019-09-17 15:47:29 +00:00
Sergey Silkin
40b7050ac6 Add copy and move constructors to RateStatistics.
Bug: none
Change-Id: I589a7f202ee1c4b8c06e8f44aa570c47d066ab72
Reviewed-on: https://webrtc-review.googlesource.com/95647
Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24445}
2018-08-27 11:28:37 +00:00
Danil Chapovalov
0a1d189e50 Replace rtc::Optional with absl::optional in rtc_base
This is a no-op change because rtc::Optional is an alias to absl::optional

This CL generated by running script with parameter 'rtc_base'
Then manually fix where Optional was used without rtc prefix (patchset#3)

find $@ -type f \( -name \*.h -o -name \*.cc \) \
-exec sed -i 's|rtc::Optional|absl::optional|g' {} \+ \
-exec sed -i 's|rtc::nullopt|absl::nullopt|g' {} \+ \
-exec sed -i 's|#include "api/optional.h"|#include "absl/types/optional.h"|' {} \+

find $@ -type f -name BUILD.gn \
-exec sed -r -i 's|"[\./api]*:optional"|"//third_party/abseil-cpp/absl/types:optional"|' {} \+;

git cl format

Bug: webrtc:9078
Change-Id: I825f80cc8089747876ba6316d9e7c30e05716974
Reviewed-on: https://webrtc-review.googlesource.com/84585
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23700}
2018-06-21 11:23:40 +00:00
Oskar Sundbom
f82000328d Optional: Use nullopt and implicit construction in /rtc_base/rate_statistics.cc
Changes places where we explicitly construct an Optional to instead use
nullopt or the requisite value type only.

This CL was uploaded by git cl split.

R=sprang@webrtc.org

Bug: None
Change-Id: I50d25d6174486928963c2e98455587a8a9f0bee6
Reviewed-on: https://webrtc-review.googlesource.com/23616
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Oskar Sundbom <ossu@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20930}
2017-11-29 11:37:29 +00:00
Mirko Bonadei
92ea95e34a Fixing WebRTC after moving from src/webrtc to src/
In https://webrtc-review.googlesource.com/c/src/+/1560 we moved WebRTC
from src/webrtc to src/ (in order to preserve an healthy git history).
This CL takes care of fixing header guards, #include paths, etc...

NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
TBR=tommi@webrtc.org


Bug: chromium:611808
Change-Id: Iea91618212bee0af16aa3f05071eab8f93706578
Reviewed-on: https://webrtc-review.googlesource.com/1561
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Henrik Kjellander <kjellander@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19846}
2017-09-15 05:02:56 +00:00
Mirko Bonadei
bb547203bf Moving src/webrtc into src/.
In order to eliminate the WebRTC Subtree mirror in Chromium, 
WebRTC is moving the content of the src/webrtc directory up
to the src/ directory.

NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
TBR=tommi@webrtc.org

Bug: chromium:611808
Change-Id: Iac59c5b51b950f174119565bac87955a7994bc38
Reviewed-on: https://webrtc-review.googlesource.com/1560
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Henrik Kjellander <kjellander@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19845}
2017-09-15 04:25:06 +00:00
Renamed from webrtc/rtc_base/rate_statistics.cc (Browse further)