Add field-trial parameter to enable tests simulating a slow decoder

This CL adds a field trial parameter WebRTC-SlowDownDecoder that is
used to simulate a slow decoder. The parameter specifies how many
extra ms it takes to decode each video frame. This must only be used
in manual testing.

Bug: None
Change-Id: Iad4079100d67b95c224277aaeaf572e38068717f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/151911
Commit-Queue: Johannes Kron <kron@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29153}
This commit is contained in:
Johannes Kron
2019-09-11 12:00:22 +02:00
committed by Commit Bot
parent 2d7b2f5f72
commit 7ddea57e94
3 changed files with 20 additions and 1 deletions

View File

@ -141,6 +141,7 @@ rtc_static_library("video_coding") {
"../../api:fec_controller_api",
"../../api:rtp_headers",
"../../api/units:data_rate",
"../../api/units:time_delta",
"../../api/video:builtin_video_bitrate_allocator_factory",
"../../api/video:encoded_frame",
"../../api/video:video_bitrate_allocator",
@ -155,6 +156,7 @@ rtc_static_library("video_coding") {
"../../rtc_base:rtc_numerics",
"../../rtc_base:rtc_task_queue",
"../../rtc_base/experiments:alr_experiment",
"../../rtc_base/experiments:field_trial_parser",
"../../rtc_base/experiments:jitter_upper_bound_experiment",
"../../rtc_base/experiments:rtt_mult_experiment",
"../../rtc_base/synchronization:sequence_checker",

View File

@ -18,17 +18,25 @@
#include "modules/video_coding/include/video_error_codes.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/thread.h"
#include "rtc_base/time_utils.h"
#include "rtc_base/trace_event.h"
#include "system_wrappers/include/clock.h"
#include "system_wrappers/include/field_trial.h"
namespace webrtc {
VCMDecodedFrameCallback::VCMDecodedFrameCallback(VCMTiming* timing,
Clock* clock)
: _clock(clock), _timing(timing), _timestampMap(kDecoderFrameMemoryLength) {
: _clock(clock),
_timing(timing),
_timestampMap(kDecoderFrameMemoryLength),
_extra_decode_time("t", absl::nullopt) {
ntp_offset_ =
_clock->CurrentNtpInMilliseconds() - _clock->TimeInMilliseconds();
ParseFieldTrial({&_extra_decode_time},
field_trial::FindFullName("WebRTC-SlowDownDecoder"));
}
VCMDecodedFrameCallback::~VCMDecodedFrameCallback() {}
@ -64,6 +72,11 @@ int32_t VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage,
void VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage,
absl::optional<int32_t> decode_time_ms,
absl::optional<uint8_t> qp) {
// Wait some extra time to simulate a slow decoder.
if (_extra_decode_time) {
rtc::Thread::SleepMs(_extra_decode_time->ms());
}
RTC_DCHECK(_receiveCallback) << "Callback must not be null at this point";
TRACE_EVENT_INSTANT1("webrtc", "VCMDecodedFrameCallback::Decoded",
"timestamp", decodedImage.timestamp());

View File

@ -13,12 +13,14 @@
#include <memory>
#include "api/units/time_delta.h"
#include "modules/include/module_common_types.h"
#include "modules/video_coding/encoded_frame.h"
#include "modules/video_coding/include/video_codec_interface.h"
#include "modules/video_coding/timestamp_map.h"
#include "modules/video_coding/timing.h"
#include "rtc_base/critical_section.h"
#include "rtc_base/experiments/field_trial_parser.h"
#include "rtc_base/thread_checker.h"
namespace webrtc {
@ -71,6 +73,8 @@ class VCMDecodedFrameCallback : public DecodedImageCallback {
rtc::CriticalSection lock_;
VCMTimestampMap _timestampMap RTC_GUARDED_BY(lock_);
int64_t ntp_offset_;
// Set by the field trial WebRTC-SlowDownDecoder to simulate a slow decoder.
FieldTrialOptional<TimeDelta> _extra_decode_time;
};
class VCMGenericDecoder {