mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1833237 - Vendor libwebrtc from 86163248f4
Upstream commit: https://webrtc.googlesource.com/src/+/86163248f427e0bda57ffa2f76e53d76bb0b5366 Rename CodecTimer -> DecodeTimePercentileFilter. The CodecTimer is not a codec timer, it's more like a decoder stopwatch with a percentile filter wrapped around it. Since the purpose of the class is to provide an estimate for how much decode delay to add when determining the render timestamp of a frame, let's rename this class to `DecodeTimePercentileFilter`. No functional changes are intended. Bug: webrtc:14905 Change-Id: I48c99e4f500c4f9e1a2a20b0afe72d6e76c5192d Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/293462 Reviewed-by: Philip Eliasson <philipel@webrtc.org> Commit-Queue: Rasmus Brandt <brandtr@webrtc.org> Cr-Commit-Position: refs/heads/main@{#39332}
This commit is contained in:
parent
ba4c849948
commit
f3c3a54f26
3
third_party/libwebrtc/README.moz-ff-commit
vendored
3
third_party/libwebrtc/README.moz-ff-commit
vendored
@ -21627,3 +21627,6 @@ cd7ea3ef46
|
||||
# MOZ_LIBWEBRTC_SRC=/mnt/arena/dev/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
|
||||
# base of lastest vendoring
|
||||
f1e392214d
|
||||
# MOZ_LIBWEBRTC_SRC=/mnt/arena/dev/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
|
||||
# base of lastest vendoring
|
||||
86163248f4
|
||||
|
2
third_party/libwebrtc/README.mozilla
vendored
2
third_party/libwebrtc/README.mozilla
vendored
@ -14440,3 +14440,5 @@ libwebrtc updated from /mnt/arena/dev/elm/.moz-fast-forward/moz-libwebrtc commit
|
||||
libwebrtc updated from /mnt/arena/dev/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-06-07T06:45:55.148262.
|
||||
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /mnt/arena/dev/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
|
||||
libwebrtc updated from /mnt/arena/dev/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-06-07T06:46:44.153119.
|
||||
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /mnt/arena/dev/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
|
||||
libwebrtc updated from /mnt/arena/dev/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-06-07T06:47:35.900842.
|
||||
|
@ -8,10 +8,10 @@
|
||||
|
||||
import("../../../webrtc.gni")
|
||||
|
||||
rtc_library("codec_timer") {
|
||||
rtc_library("decode_time_percentile_filter") {
|
||||
sources = [
|
||||
"codec_timer.cc",
|
||||
"codec_timer.h",
|
||||
"decode_time_percentile_filter.cc",
|
||||
"decode_time_percentile_filter.h",
|
||||
]
|
||||
deps = [ "../../../rtc_base:rtc_numerics" ]
|
||||
}
|
||||
@ -104,7 +104,7 @@ rtc_library("timing_module") {
|
||||
"timing.h",
|
||||
]
|
||||
deps = [
|
||||
":codec_timer",
|
||||
":decode_time_percentile_filter",
|
||||
":timestamp_extrapolator",
|
||||
"../../../api:field_trials_view",
|
||||
"../../../api/units:time_delta",
|
||||
|
@ -8,7 +8,7 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "modules/video_coding/timing/codec_timer.h"
|
||||
#include "modules/video_coding/timing/decode_time_percentile_filter.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
@ -25,10 +25,12 @@ const int64_t kTimeLimitMs = 10000;
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
CodecTimer::CodecTimer() : ignored_sample_count_(0), filter_(kPercentile) {}
|
||||
CodecTimer::~CodecTimer() = default;
|
||||
DecodeTimePercentileFilter::DecodeTimePercentileFilter()
|
||||
: ignored_sample_count_(0), filter_(kPercentile) {}
|
||||
DecodeTimePercentileFilter::~DecodeTimePercentileFilter() = default;
|
||||
|
||||
void CodecTimer::AddTiming(int64_t decode_time_ms, int64_t now_ms) {
|
||||
void DecodeTimePercentileFilter::AddTiming(int64_t decode_time_ms,
|
||||
int64_t now_ms) {
|
||||
// Ignore the first `kIgnoredSampleCount` samples.
|
||||
if (ignored_sample_count_ < kIgnoredSampleCount) {
|
||||
++ignored_sample_count_;
|
||||
@ -48,11 +50,12 @@ void CodecTimer::AddTiming(int64_t decode_time_ms, int64_t now_ms) {
|
||||
}
|
||||
|
||||
// Get the 95th percentile observed decode time within a time window.
|
||||
int64_t CodecTimer::RequiredDecodeTimeMs() const {
|
||||
int64_t DecodeTimePercentileFilter::RequiredDecodeTimeMs() const {
|
||||
return filter_.GetPercentileValue();
|
||||
}
|
||||
|
||||
CodecTimer::Sample::Sample(int64_t decode_time_ms, int64_t sample_time_ms)
|
||||
DecodeTimePercentileFilter::Sample::Sample(int64_t decode_time_ms,
|
||||
int64_t sample_time_ms)
|
||||
: decode_time_ms(decode_time_ms), sample_time_ms(sample_time_ms) {}
|
||||
|
||||
} // namespace webrtc
|
@ -8,8 +8,8 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef MODULES_VIDEO_CODING_TIMING_CODEC_TIMER_H_
|
||||
#define MODULES_VIDEO_CODING_TIMING_CODEC_TIMER_H_
|
||||
#ifndef MODULES_VIDEO_CODING_TIMING_DECODE_TIME_PERCENTILE_FILTER_H_
|
||||
#define MODULES_VIDEO_CODING_TIMING_DECODE_TIME_PERCENTILE_FILTER_H_
|
||||
|
||||
#include <queue>
|
||||
|
||||
@ -17,10 +17,14 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class CodecTimer {
|
||||
// The `DecodeTimePercentileFilter` filters the actual per-frame decode times
|
||||
// and provides an estimate for the 95th percentile of those decode times. This
|
||||
// estimate can be used to determine how large the "decode delay term" should be
|
||||
// when determining the render timestamp for a frame.
|
||||
class DecodeTimePercentileFilter {
|
||||
public:
|
||||
CodecTimer();
|
||||
~CodecTimer();
|
||||
DecodeTimePercentileFilter();
|
||||
~DecodeTimePercentileFilter();
|
||||
|
||||
// Add a new decode time to the filter.
|
||||
void AddTiming(int64_t new_decode_time_ms, int64_t now_ms);
|
||||
@ -47,4 +51,4 @@ class CodecTimer {
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // MODULES_VIDEO_CODING_TIMING_CODEC_TIMER_H_
|
||||
#endif // MODULES_VIDEO_CODING_TIMING_DECODE_TIME_PERCENTILE_FILTER_H_
|
@ -13,6 +13,7 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "api/units/time_delta.h"
|
||||
#include "modules/video_coding/timing/decode_time_percentile_filter.h"
|
||||
#include "modules/video_coding/timing/timestamp_extrapolator.h"
|
||||
#include "rtc_base/experiments/field_trial_parser.h"
|
||||
#include "rtc_base/logging.h"
|
||||
@ -47,7 +48,7 @@ VCMTiming::VCMTiming(Clock* clock, const FieldTrialsView& field_trials)
|
||||
: clock_(clock),
|
||||
ts_extrapolator_(
|
||||
std::make_unique<TimestampExtrapolator>(clock_->CurrentTime())),
|
||||
codec_timer_(std::make_unique<CodecTimer>()),
|
||||
decode_time_filter_(std::make_unique<DecodeTimePercentileFilter>()),
|
||||
render_delay_(kDefaultRenderDelay),
|
||||
min_playout_delay_(TimeDelta::Zero()),
|
||||
max_playout_delay_(TimeDelta::Seconds(10)),
|
||||
@ -65,7 +66,7 @@ VCMTiming::VCMTiming(Clock* clock, const FieldTrialsView& field_trials)
|
||||
void VCMTiming::Reset() {
|
||||
MutexLock lock(&mutex_);
|
||||
ts_extrapolator_->Reset(clock_->CurrentTime());
|
||||
codec_timer_ = std::make_unique<CodecTimer>();
|
||||
decode_time_filter_ = std::make_unique<DecodeTimePercentileFilter>();
|
||||
render_delay_ = kDefaultRenderDelay;
|
||||
min_playout_delay_ = TimeDelta::Zero();
|
||||
jitter_delay_ = TimeDelta::Zero();
|
||||
@ -171,7 +172,7 @@ void VCMTiming::UpdateCurrentDelay(Timestamp render_time,
|
||||
|
||||
void VCMTiming::StopDecodeTimer(TimeDelta decode_time, Timestamp now) {
|
||||
MutexLock lock(&mutex_);
|
||||
codec_timer_->AddTiming(decode_time.ms(), now.ms());
|
||||
decode_time_filter_->AddTiming(decode_time.ms(), now.ms());
|
||||
RTC_DCHECK_GE(decode_time, TimeDelta::Zero());
|
||||
++num_decoded_frames_;
|
||||
}
|
||||
@ -211,7 +212,7 @@ Timestamp VCMTiming::RenderTimeInternal(uint32_t frame_timestamp,
|
||||
}
|
||||
|
||||
TimeDelta VCMTiming::RequiredDecodeTime() const {
|
||||
const int decode_time_ms = codec_timer_->RequiredDecodeTimeMs();
|
||||
const int decode_time_ms = decode_time_filter_->RequiredDecodeTimeMs();
|
||||
RTC_DCHECK_GE(decode_time_ms, 0);
|
||||
return TimeDelta::Millis(decode_time_ms);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "api/units/time_delta.h"
|
||||
#include "api/video/video_frame.h"
|
||||
#include "api/video/video_timing.h"
|
||||
#include "modules/video_coding/timing/codec_timer.h"
|
||||
#include "modules/video_coding/timing/decode_time_percentile_filter.h"
|
||||
#include "modules/video_coding/timing/timestamp_extrapolator.h"
|
||||
#include "rtc_base/experiments/field_trial_parser.h"
|
||||
#include "rtc_base/synchronization/mutex.h"
|
||||
@ -129,8 +129,8 @@ class VCMTiming {
|
||||
Clock* const clock_;
|
||||
const std::unique_ptr<TimestampExtrapolator> ts_extrapolator_
|
||||
RTC_PT_GUARDED_BY(mutex_);
|
||||
std::unique_ptr<CodecTimer> codec_timer_ RTC_GUARDED_BY(mutex_)
|
||||
RTC_PT_GUARDED_BY(mutex_);
|
||||
std::unique_ptr<DecodeTimePercentileFilter> decode_time_filter_
|
||||
RTC_GUARDED_BY(mutex_) RTC_PT_GUARDED_BY(mutex_);
|
||||
TimeDelta render_delay_ RTC_GUARDED_BY(mutex_);
|
||||
// Best-effort playout delay range for frames from capture to render.
|
||||
// The receiver tries to keep the delay between `min_playout_delay_ms_`
|
||||
|
Loading…
Reference in New Issue
Block a user