Revert "Always use real VideoStreamsFactory in full stack tests"

This reverts commit 18cf2383aa2eb9de5778991c9d13b6b847143d37.

Reason for revert: Unexpected changes in webrtc_perf stats.

Original change's description:
> Always use real VideoStreamsFactory in full stack tests
> 
> Because quality scaling is enabled now in full stack test, correct
> factory should be used to compute actual resolution.
> 
> Also, since analyzed stream may be disabled completely now, change how
> analyzer considers the test finished --- count captured frames and
> stop if required amount of frames is captured and no new comparison were
> made.
> 
> Bug: webrtc:10204
> Change-Id: I205ebc892969ec1cf2d83e054e5c95e089d32104
> Reviewed-on: https://webrtc-review.googlesource.com/c/118687
> Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
> Reviewed-by: Erik Språng <sprang@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#26358}

TBR=ilnik@webrtc.org,sprang@webrtc.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: webrtc:10204
Change-Id: Ia52fd55c9f68627166e0538d377003eae4ea518a
Reviewed-on: https://webrtc-review.googlesource.com/c/119946
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26405}
This commit is contained in:
Ilya Nikolaevskiy 2019-01-25 13:50:22 +00:00 committed by Commit Bot
parent da37473a54
commit b2d714110e
3 changed files with 36 additions and 84 deletions

View File

@ -36,12 +36,6 @@ namespace webrtc {
namespace {
constexpr int kSendStatsPollingIntervalMs = 1000;
constexpr size_t kMaxComparisons = 10;
// How often is keep alive message printed.
constexpr int kKeepAliveIntervalSeconds = 30;
// Interval between checking that the test is over.
constexpr int kProbingIntervalMs = 500;
constexpr int kKeepAliveIntervalIterations =
kKeepAliveIntervalSeconds * 1000 / kProbingIntervalMs;
bool IsFlexfec(int payload_type) {
return payload_type == test::CallTest::kFlexfecPayloadType;
@ -69,7 +63,7 @@ VideoAnalyzer::VideoAnalyzer(test::LayerFilteringTransport* transport,
send_stream_(nullptr),
receive_stream_(nullptr),
audio_receive_stream_(nullptr),
captured_frame_forwarder_(this, clock, duration_frames),
captured_frame_forwarder_(this, clock),
test_label_(test_label),
graph_data_output_file_(graph_data_output_file),
graph_title_(graph_title),
@ -83,7 +77,6 @@ VideoAnalyzer::VideoAnalyzer(test::LayerFilteringTransport* transport,
frames_recorded_(0),
frames_processed_(0),
dropped_frames_(0),
captured_frames_(0),
dropped_frames_before_first_encode_(0),
dropped_frames_before_rendering_(0),
last_render_time_(0),
@ -340,16 +333,12 @@ void VideoAnalyzer::Wait() {
stats_polling_thread_.Start();
int last_frames_processed = -1;
int last_frames_captured = -1;
int iteration = 0;
while (!done_.Wait(kProbingIntervalMs)) {
while (!done_.Wait(test::CallTest::kDefaultTimeoutMs)) {
int frames_processed;
int frames_captured;
{
rtc::CritScope crit(&comparison_lock_);
frames_processed = frames_processed_;
frames_captured = captured_frames_;
}
// Print some output so test infrastructure won't think we've crashed.
@ -357,35 +346,24 @@ void VideoAnalyzer::Wait() {
"Uh, I'm-I'm not quite dead, sir.",
"Uh, I-I think uh, I could pull through, sir.",
"Actually, I think I'm all right to come with you--"};
if (++iteration % kKeepAliveIntervalIterations == 0) {
printf("- %s\n", kKeepAliveMessages[iteration % 3]);
}
printf("- %s\n", kKeepAliveMessages[iteration++ % 3]);
if (last_frames_processed == -1) {
last_frames_processed = frames_processed;
last_frames_captured = frames_captured;
continue;
}
if (frames_processed == last_frames_processed &&
last_frames_captured == frames_captured) {
if (frames_captured < frames_to_process_) {
if (frames_processed == last_frames_processed) {
EXPECT_GT(frames_processed, last_frames_processed)
<< "Analyzer stalled while waiting for test to finish.";
}
done_.Set();
break;
}
last_frames_processed = frames_processed;
last_frames_captured = frames_captured;
}
if (iteration > 0)
printf("- Farewell, sweet Concorde!\n");
PrintResults();
if (graph_data_output_file_)
PrintSamplesToFile();
stats_polling_thread_.Stop();
}
@ -538,6 +516,9 @@ bool VideoAnalyzer::CompareFrames() {
StopExcludingCpuThreadTime();
if (FrameProcessed()) {
PrintResults();
if (graph_data_output_file_)
PrintSamplesToFile();
done_.Set();
comparison_available_event_.Set();
return false;
@ -583,11 +564,6 @@ bool VideoAnalyzer::FrameProcessed() {
void VideoAnalyzer::PrintResults() {
StopMeasuringCpuProcessTime();
int frames_left;
{
rtc::CritScope crit(&crit_);
frames_left = frames_.size();
}
rtc::CritScope crit(&comparison_lock_);
// Record the time from the last freeze until the last rendered frame to
// ensure we cover the full timespan of the session. Otherwise the metric
@ -616,8 +592,7 @@ void VideoAnalyzer::PrintResults() {
if (receive_stream_ != nullptr) {
PrintResult("decode_time", decode_time_ms_, " ms");
}
dropped_frames_ += dropped_frames_before_first_encode_ +
dropped_frames_before_rendering_ + frames_left;
test::PrintResult("dropped_frames", "", test_label_.c_str(), dropped_frames_,
"frames", false);
test::PrintResult("cpu_usage", "", test_label_.c_str(), GetCpuUsagePercent(),
@ -778,10 +753,7 @@ double VideoAnalyzer::GetAverageMediaBitrateBps() {
void VideoAnalyzer::AddCapturedFrameForComparison(
const VideoFrame& video_frame) {
rtc::CritScope lock(&crit_);
if (captured_frames_ < frames_to_process_) {
++captured_frames_;
frames_.push_back(video_frame);
}
}
void VideoAnalyzer::AddFrameComparison(const VideoFrame& reference,
@ -872,14 +844,11 @@ VideoAnalyzer::Sample::Sample(int dropped,
VideoAnalyzer::CapturedFrameForwarder::CapturedFrameForwarder(
VideoAnalyzer* analyzer,
Clock* clock,
int frames_to_process)
Clock* clock)
: analyzer_(analyzer),
send_stream_input_(nullptr),
video_source_(nullptr),
clock_(clock),
captured_frames_(0),
frames_to_process_(frames_to_process) {}
clock_(clock) {}
void VideoAnalyzer::CapturedFrameForwarder::SetSource(
VideoSourceInterface<VideoFrame>* video_source) {
@ -897,8 +866,7 @@ void VideoAnalyzer::CapturedFrameForwarder::OnFrame(
copy.set_timestamp(copy.ntp_time_ms() * 90);
analyzer_->AddCapturedFrameForComparison(copy);
rtc::CritScope lock(&crit_);
++captured_frames_;
if (send_stream_input_ && captured_frames_ <= frames_to_process_)
if (send_stream_input_)
send_stream_input_->OnFrame(copy);
}

View File

@ -136,9 +136,7 @@ class VideoAnalyzer : public PacketReceiver,
class CapturedFrameForwarder : public rtc::VideoSinkInterface<VideoFrame>,
public rtc::VideoSourceInterface<VideoFrame> {
public:
CapturedFrameForwarder(VideoAnalyzer* analyzer,
Clock* clock,
int frames_to_process);
explicit CapturedFrameForwarder(VideoAnalyzer* analyzer, Clock* clock);
void SetSource(rtc::VideoSourceInterface<VideoFrame>* video_source);
private:
@ -157,8 +155,6 @@ class VideoAnalyzer : public PacketReceiver,
RTC_GUARDED_BY(crit_);
VideoSourceInterface<VideoFrame>* video_source_;
Clock* clock_;
int captured_frames_ RTC_GUARDED_BY(crit_);
int frames_to_process_ RTC_GUARDED_BY(crit_);
};
struct FrameWithPsnr {
@ -244,7 +240,6 @@ class VideoAnalyzer : public PacketReceiver,
int frames_recorded_;
int frames_processed_;
int dropped_frames_;
int captured_frames_;
int dropped_frames_before_first_encode_;
int dropped_frames_before_rendering_;
int64_t last_render_time_;

View File

@ -630,17 +630,19 @@ void VideoQualityTest::SetupVideo(Transport* send_transport,
video_encoder_configs_[video_idx].max_bitrate_bps +=
params_.ss[video_idx].streams[i].max_bitrate_bps;
}
if (params_.ss[video_idx].infer_streams) {
video_encoder_configs_[video_idx].simulcast_layers =
std::vector<VideoStream>(params_.ss[video_idx].streams.size());
if (!params_.ss[video_idx].infer_streams) {
video_encoder_configs_[video_idx].simulcast_layers =
params_.ss[video_idx].streams;
}
video_encoder_configs_[video_idx].video_stream_factory =
new rtc::RefCountedObject<cricket::EncoderStreamFactory>(
params_.video[video_idx].codec,
params_.ss[video_idx].streams[0].max_qp,
params_.screenshare[video_idx].enabled, true);
} else {
video_encoder_configs_[video_idx].video_stream_factory =
new rtc::RefCountedObject<VideoStreamFactory>(
params_.ss[video_idx].streams);
}
video_encoder_configs_[video_idx].spatial_layers =
params_.ss[video_idx].spatial_layers;
@ -717,26 +719,6 @@ void VideoQualityTest::SetupVideo(Transport* send_transport,
<< params_.video[video_idx].codec << ", stream "
<< video_idx;
}
} else {
// Default mode. Single SL, no automatic_scaling,
if (params_.video[video_idx].codec == "VP8") {
VideoCodecVP8 vp8_settings = VideoEncoder::GetDefaultVp8Settings();
vp8_settings.automaticResizeOn = false;
video_encoder_configs_[video_idx].encoder_specific_settings =
new rtc::RefCountedObject<
VideoEncoderConfig::Vp8EncoderSpecificSettings>(vp8_settings);
} else if (params_.video[video_idx].codec == "VP9") {
VideoCodecVP9 vp9_settings = VideoEncoder::GetDefaultVp9Settings();
vp9_settings.automaticResizeOn = false;
video_encoder_configs_[video_idx].encoder_specific_settings =
new rtc::RefCountedObject<
VideoEncoderConfig::Vp9EncoderSpecificSettings>(vp9_settings);
} else if (params_.video[video_idx].codec == "H264") {
VideoCodecH264 h264_settings = VideoEncoder::GetDefaultH264Settings();
video_encoder_configs_[video_idx].encoder_specific_settings =
new rtc::RefCountedObject<
VideoEncoderConfig::H264EncoderSpecificSettings>(h264_settings);
}
}
total_streams_used += num_video_substreams;
}
@ -809,9 +791,16 @@ void VideoQualityTest::SetupThumbnails(Transport* send_transport,
params_.video[0].suspend_below_min_bitrate;
thumbnail_encoder_config.number_of_streams = 1;
thumbnail_encoder_config.max_bitrate_bps = 50000;
std::vector<VideoStream> streams{params_.ss[0].streams[0]};
if (params_.ss[0].infer_streams) {
thumbnail_encoder_config.video_stream_factory =
new rtc::RefCountedObject<VideoStreamFactory>(streams);
new rtc::RefCountedObject<VideoStreamFactory>(params_.ss[0].streams);
} else {
thumbnail_encoder_config.simulcast_layers = std::vector<VideoStream>(1);
thumbnail_encoder_config.video_stream_factory =
new rtc::RefCountedObject<cricket::EncoderStreamFactory>(
params_.video[0].codec, params_.ss[0].streams[0].max_qp,
params_.screenshare[0].enabled, true);
}
thumbnail_encoder_config.spatial_layers = params_.ss[0].spatial_layers;
thumbnail_encoder_configs_.push_back(thumbnail_encoder_config.Copy());