Extract internal DVQA shared objects for future split
Bug: b/196229820 Change-Id: I6bb4be2656d1686a5f30721378605b39d5c391ca Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/228522 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34737}
This commit is contained in:
parent
a17ec76351
commit
8b18304e66
@ -444,6 +444,7 @@ if (!build_with_chromium) {
|
||||
deps = [
|
||||
":default_audio_quality_analyzer",
|
||||
":default_video_quality_analyzer",
|
||||
":default_video_quality_analyzer_shared",
|
||||
":network_quality_metrics_reporter",
|
||||
":stats_based_network_quality_metrics_reporter",
|
||||
"../../../api:callfactory_api",
|
||||
@ -502,6 +503,7 @@ if (!build_with_chromium) {
|
||||
sources = [ "analyzer/video/default_video_quality_analyzer_test.cc" ]
|
||||
deps = [
|
||||
":default_video_quality_analyzer",
|
||||
":default_video_quality_analyzer_shared",
|
||||
"../..:test_support",
|
||||
"../../../api:create_frame_generator",
|
||||
"../../../api:rtp_packet_info",
|
||||
@ -617,11 +619,11 @@ if (!build_with_chromium) {
|
||||
sources = [
|
||||
"analyzer/video/default_video_quality_analyzer.cc",
|
||||
"analyzer/video/default_video_quality_analyzer.h",
|
||||
"analyzer/video/default_video_quality_analyzer_shared_objects.cc",
|
||||
"analyzer/video/default_video_quality_analyzer_shared_objects.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":default_video_quality_analyzer_internal",
|
||||
":default_video_quality_analyzer_shared",
|
||||
":multi_head_queue",
|
||||
"../..:perf_test",
|
||||
"../../../api:array_view",
|
||||
@ -645,6 +647,46 @@ if (!build_with_chromium) {
|
||||
"../../../rtc_tools:video_quality_analysis",
|
||||
"../../../system_wrappers",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
||||
}
|
||||
|
||||
# This target contains implementation details of DefaultVideoQualityAnalyzer,
|
||||
# so headers exported by it shouldn't be used in other places.
|
||||
rtc_library("default_video_quality_analyzer_internal") {
|
||||
visibility = [ ":default_video_quality_analyzer" ]
|
||||
|
||||
testonly = true
|
||||
sources = [
|
||||
"analyzer/video/default_video_quality_analyzer_internal_shared_objects.cc",
|
||||
"analyzer/video/default_video_quality_analyzer_internal_shared_objects.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":default_video_quality_analyzer_shared",
|
||||
"../../../api/numerics:numerics",
|
||||
"../../../api/units:timestamp",
|
||||
"../../../api/video:video_frame",
|
||||
"../../../rtc_base:stringutils",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
||||
}
|
||||
|
||||
rtc_library("default_video_quality_analyzer_shared") {
|
||||
visibility = [ "*" ]
|
||||
|
||||
testonly = true
|
||||
sources = [
|
||||
"analyzer/video/default_video_quality_analyzer_shared_objects.cc",
|
||||
"analyzer/video/default_video_quality_analyzer_shared_objects.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
"../../../api/numerics:numerics",
|
||||
"../../../api/units:timestamp",
|
||||
"../../../rtc_base:checks",
|
||||
"../../../rtc_base:stringutils",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
||||
}
|
||||
|
||||
rtc_library("network_quality_metrics_reporter") {
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
#include "rtc_base/time_utils.h"
|
||||
#include "rtc_tools/frame_analyzer/video_geometry_aligner.h"
|
||||
#include "test/pc/e2e/analyzer/video/default_video_quality_analyzer_internal_shared_objects.h"
|
||||
#include "test/pc/e2e/analyzer/video/default_video_quality_analyzer_shared_objects.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -1027,20 +1028,6 @@ double DefaultVideoQualityAnalyzer::GetCpuUsagePercent() {
|
||||
return static_cast<double>(cpu_time_) / wallclock_time_ * 100.0;
|
||||
}
|
||||
|
||||
DefaultVideoQualityAnalyzer::FrameComparison::FrameComparison(
|
||||
InternalStatsKey stats_key,
|
||||
absl::optional<VideoFrame> captured,
|
||||
absl::optional<VideoFrame> rendered,
|
||||
bool dropped,
|
||||
FrameStats frame_stats,
|
||||
OverloadReason overload_reason)
|
||||
: stats_key(std::move(stats_key)),
|
||||
captured(std::move(captured)),
|
||||
rendered(std::move(rendered)),
|
||||
dropped(dropped),
|
||||
frame_stats(std::move(frame_stats)),
|
||||
overload_reason(overload_reason) {}
|
||||
|
||||
uint16_t DefaultVideoQualityAnalyzer::StreamState::PopFront(size_t peer) {
|
||||
absl::optional<uint16_t> frame_id = frame_ids_.PopFront(peer);
|
||||
RTC_DCHECK(frame_id.has_value());
|
||||
@ -1217,8 +1204,8 @@ bool DefaultVideoQualityAnalyzer::FrameInFlight::HasRenderedTime(
|
||||
return it->second.rendered_time.IsFinite();
|
||||
}
|
||||
|
||||
DefaultVideoQualityAnalyzer::FrameStats
|
||||
DefaultVideoQualityAnalyzer::FrameInFlight::GetStatsForPeer(size_t peer) const {
|
||||
FrameStats DefaultVideoQualityAnalyzer::FrameInFlight::GetStatsForPeer(
|
||||
size_t peer) const {
|
||||
FrameStats stats(captured_time_);
|
||||
stats.pre_encode_time = pre_encode_time_;
|
||||
stats.encoded_time = encoded_time_;
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
#include "rtc_base/platform_thread.h"
|
||||
#include "rtc_base/synchronization/mutex.h"
|
||||
#include "system_wrappers/include/clock.h"
|
||||
#include "test/pc/e2e/analyzer/video/default_video_quality_analyzer_internal_shared_objects.h"
|
||||
#include "test/pc/e2e/analyzer/video/default_video_quality_analyzer_shared_objects.h"
|
||||
#include "test/pc/e2e/analyzer/video/multi_head_queue.h"
|
||||
#include "test/testsupport/perf_test.h"
|
||||
@ -113,73 +114,6 @@ class DefaultVideoQualityAnalyzer : public VideoQualityAnalyzerInterface {
|
||||
double GetCpuUsagePercent();
|
||||
|
||||
private:
|
||||
// Final stats computed for frame after it went through the whole video
|
||||
// pipeline from capturing to rendering or dropping.
|
||||
struct FrameStats {
|
||||
FrameStats(Timestamp captured_time) : captured_time(captured_time) {}
|
||||
|
||||
// Frame events timestamp.
|
||||
Timestamp captured_time;
|
||||
Timestamp pre_encode_time = Timestamp::MinusInfinity();
|
||||
Timestamp encoded_time = Timestamp::MinusInfinity();
|
||||
// Time when last packet of a frame was received.
|
||||
Timestamp received_time = Timestamp::MinusInfinity();
|
||||
Timestamp decode_start_time = Timestamp::MinusInfinity();
|
||||
Timestamp decode_end_time = Timestamp::MinusInfinity();
|
||||
Timestamp rendered_time = Timestamp::MinusInfinity();
|
||||
Timestamp prev_frame_rendered_time = Timestamp::MinusInfinity();
|
||||
|
||||
int64_t encoded_image_size = 0;
|
||||
uint32_t target_encode_bitrate = 0;
|
||||
|
||||
absl::optional<int> rendered_frame_width = absl::nullopt;
|
||||
absl::optional<int> rendered_frame_height = absl::nullopt;
|
||||
|
||||
// Can be not set if frame was dropped by encoder.
|
||||
absl::optional<StreamCodecInfo> used_encoder = absl::nullopt;
|
||||
// Can be not set if frame was dropped in the network.
|
||||
absl::optional<StreamCodecInfo> used_decoder = absl::nullopt;
|
||||
};
|
||||
|
||||
// Describes why comparison was done in overloaded mode (without calculating
|
||||
// PSNR and SSIM).
|
||||
enum class OverloadReason {
|
||||
kNone,
|
||||
// Not enough CPU to process all incoming comparisons.
|
||||
kCpu,
|
||||
// Not enough memory to store captured frames for all comparisons.
|
||||
kMemory
|
||||
};
|
||||
|
||||
// Represents comparison between two VideoFrames. Contains video frames itself
|
||||
// and stats. Can be one of two types:
|
||||
// 1. Normal - in this case `captured` is presented and either `rendered` is
|
||||
// presented and `dropped` is false, either `rendered` is omitted and
|
||||
// `dropped` is true.
|
||||
// 2. Overloaded - in this case both `captured` and `rendered` are omitted
|
||||
// because there were too many comparisons in the queue. `dropped` can be
|
||||
// true or false showing was frame dropped or not.
|
||||
struct FrameComparison {
|
||||
FrameComparison(InternalStatsKey stats_key,
|
||||
absl::optional<VideoFrame> captured,
|
||||
absl::optional<VideoFrame> rendered,
|
||||
bool dropped,
|
||||
FrameStats frame_stats,
|
||||
OverloadReason overload_reason);
|
||||
|
||||
InternalStatsKey stats_key;
|
||||
// Frames can be omitted if there too many computations waiting in the
|
||||
// queue.
|
||||
absl::optional<VideoFrame> captured;
|
||||
absl::optional<VideoFrame> rendered;
|
||||
// If true frame was dropped somewhere from capturing to rendering and
|
||||
// wasn't rendered on remote peer side. If `dropped` is true, `rendered`
|
||||
// will be `absl::nullopt`.
|
||||
bool dropped;
|
||||
FrameStats frame_stats;
|
||||
OverloadReason overload_reason;
|
||||
};
|
||||
|
||||
// Represents a current state of video stream.
|
||||
class StreamState {
|
||||
public:
|
||||
|
||||
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 2021 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
#include "test/pc/e2e/analyzer/video/default_video_quality_analyzer_internal_shared_objects.h"
|
||||
|
||||
#include "api/video/video_frame.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
std::string InternalStatsKey::ToString() const {
|
||||
rtc::StringBuilder out;
|
||||
out << "stream=" << stream << "_sender=" << sender
|
||||
<< "_receiver=" << receiver;
|
||||
return out.str();
|
||||
}
|
||||
|
||||
bool operator<(const InternalStatsKey& a, const InternalStatsKey& b) {
|
||||
if (a.stream != b.stream) {
|
||||
return a.stream < b.stream;
|
||||
}
|
||||
if (a.sender != b.sender) {
|
||||
return a.sender < b.sender;
|
||||
}
|
||||
return a.receiver < b.receiver;
|
||||
}
|
||||
|
||||
bool operator==(const InternalStatsKey& a, const InternalStatsKey& b) {
|
||||
return a.stream == b.stream && a.sender == b.sender &&
|
||||
a.receiver == b.receiver;
|
||||
}
|
||||
|
||||
FrameComparison::FrameComparison(InternalStatsKey stats_key,
|
||||
absl::optional<VideoFrame> captured,
|
||||
absl::optional<VideoFrame> rendered,
|
||||
bool dropped,
|
||||
FrameStats frame_stats,
|
||||
OverloadReason overload_reason)
|
||||
: stats_key(std::move(stats_key)),
|
||||
captured(std::move(captured)),
|
||||
rendered(std::move(rendered)),
|
||||
dropped(dropped),
|
||||
frame_stats(std::move(frame_stats)),
|
||||
overload_reason(overload_reason) {}
|
||||
|
||||
} // namespace webrtc
|
||||
@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Copyright (c) 2021 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef TEST_PC_E2E_ANALYZER_VIDEO_DEFAULT_VIDEO_QUALITY_ANALYZER_INTERNAL_SHARED_OBJECTS_H_
|
||||
#define TEST_PC_E2E_ANALYZER_VIDEO_DEFAULT_VIDEO_QUALITY_ANALYZER_INTERNAL_SHARED_OBJECTS_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/units/timestamp.h"
|
||||
#include "api/video/video_frame.h"
|
||||
#include "test/pc/e2e/analyzer/video/default_video_quality_analyzer_shared_objects.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
struct InternalStatsKey {
|
||||
InternalStatsKey(size_t stream, size_t sender, size_t receiver)
|
||||
: stream(stream), sender(sender), receiver(receiver) {}
|
||||
|
||||
std::string ToString() const;
|
||||
|
||||
size_t stream;
|
||||
size_t sender;
|
||||
size_t receiver;
|
||||
};
|
||||
|
||||
// Required to use InternalStatsKey as std::map key.
|
||||
bool operator<(const InternalStatsKey& a, const InternalStatsKey& b);
|
||||
bool operator==(const InternalStatsKey& a, const InternalStatsKey& b);
|
||||
|
||||
// Final stats computed for frame after it went through the whole video
|
||||
// pipeline from capturing to rendering or dropping.
|
||||
struct FrameStats {
|
||||
explicit FrameStats(Timestamp captured_time) : captured_time(captured_time) {}
|
||||
|
||||
// Frame events timestamp.
|
||||
Timestamp captured_time;
|
||||
Timestamp pre_encode_time = Timestamp::MinusInfinity();
|
||||
Timestamp encoded_time = Timestamp::MinusInfinity();
|
||||
// Time when last packet of a frame was received.
|
||||
Timestamp received_time = Timestamp::MinusInfinity();
|
||||
Timestamp decode_start_time = Timestamp::MinusInfinity();
|
||||
Timestamp decode_end_time = Timestamp::MinusInfinity();
|
||||
Timestamp rendered_time = Timestamp::MinusInfinity();
|
||||
Timestamp prev_frame_rendered_time = Timestamp::MinusInfinity();
|
||||
|
||||
int64_t encoded_image_size = 0;
|
||||
uint32_t target_encode_bitrate = 0;
|
||||
|
||||
absl::optional<int> rendered_frame_width = absl::nullopt;
|
||||
absl::optional<int> rendered_frame_height = absl::nullopt;
|
||||
|
||||
// Can be not set if frame was dropped by encoder.
|
||||
absl::optional<webrtc_pc_e2e::StreamCodecInfo> used_encoder = absl::nullopt;
|
||||
// Can be not set if frame was dropped in the network.
|
||||
absl::optional<webrtc_pc_e2e::StreamCodecInfo> used_decoder = absl::nullopt;
|
||||
};
|
||||
|
||||
// Describes why comparison was done in overloaded mode (without calculating
|
||||
// PSNR and SSIM).
|
||||
enum class OverloadReason {
|
||||
kNone,
|
||||
// Not enough CPU to process all incoming comparisons.
|
||||
kCpu,
|
||||
// Not enough memory to store captured frames for all comparisons.
|
||||
kMemory
|
||||
};
|
||||
|
||||
// Represents comparison between two VideoFrames. Contains video frames itself
|
||||
// and stats. Can be one of two types:
|
||||
// 1. Normal - in this case `captured` is presented and either `rendered` is
|
||||
// presented and `dropped` is false, either `rendered` is omitted and
|
||||
// `dropped` is true.
|
||||
// 2. Overloaded - in this case both `captured` and `rendered` are omitted
|
||||
// because there were too many comparisons in the queue. `dropped` can be
|
||||
// true or false showing was frame dropped or not.
|
||||
struct FrameComparison {
|
||||
FrameComparison(InternalStatsKey stats_key,
|
||||
absl::optional<VideoFrame> captured,
|
||||
absl::optional<VideoFrame> rendered,
|
||||
bool dropped,
|
||||
FrameStats frame_stats,
|
||||
OverloadReason overload_reason);
|
||||
|
||||
InternalStatsKey stats_key;
|
||||
// Frames can be omitted if there too many computations waiting in the
|
||||
// queue.
|
||||
absl::optional<VideoFrame> captured;
|
||||
absl::optional<VideoFrame> rendered;
|
||||
// If true frame was dropped somewhere from capturing to rendering and
|
||||
// wasn't rendered on remote peer side. If `dropped` is true, `rendered`
|
||||
// will be `absl::nullopt`.
|
||||
bool dropped;
|
||||
FrameStats frame_stats;
|
||||
OverloadReason overload_reason;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // TEST_PC_E2E_ANALYZER_VIDEO_DEFAULT_VIDEO_QUALITY_ANALYZER_INTERNAL_SHARED_OBJECTS_H_
|
||||
@ -59,27 +59,5 @@ bool operator==(const StatsKey& a, const StatsKey& b) {
|
||||
a.receiver == b.receiver;
|
||||
}
|
||||
|
||||
std::string InternalStatsKey::ToString() const {
|
||||
rtc::StringBuilder out;
|
||||
out << "stream=" << stream << "_sender=" << sender
|
||||
<< "_receiver=" << receiver;
|
||||
return out.str();
|
||||
}
|
||||
|
||||
bool operator<(const InternalStatsKey& a, const InternalStatsKey& b) {
|
||||
if (a.stream != b.stream) {
|
||||
return a.stream < b.stream;
|
||||
}
|
||||
if (a.sender != b.sender) {
|
||||
return a.sender < b.sender;
|
||||
}
|
||||
return a.receiver < b.receiver;
|
||||
}
|
||||
|
||||
bool operator==(const InternalStatsKey& a, const InternalStatsKey& b) {
|
||||
return a.stream == b.stream && a.sender == b.sender &&
|
||||
a.receiver == b.receiver;
|
||||
}
|
||||
|
||||
} // namespace webrtc_pc_e2e
|
||||
} // namespace webrtc
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/numerics/samples_stats_counter.h"
|
||||
#include "api/units/timestamp.h"
|
||||
|
||||
@ -164,21 +165,6 @@ struct StatsKey {
|
||||
bool operator<(const StatsKey& a, const StatsKey& b);
|
||||
bool operator==(const StatsKey& a, const StatsKey& b);
|
||||
|
||||
struct InternalStatsKey {
|
||||
InternalStatsKey(size_t stream, size_t sender, size_t receiver)
|
||||
: stream(stream), sender(sender), receiver(receiver) {}
|
||||
|
||||
std::string ToString() const;
|
||||
|
||||
size_t stream;
|
||||
size_t sender;
|
||||
size_t receiver;
|
||||
};
|
||||
|
||||
// Required to use InternalStatsKey as std::map key.
|
||||
bool operator<(const InternalStatsKey& a, const InternalStatsKey& b);
|
||||
bool operator==(const InternalStatsKey& a, const InternalStatsKey& b);
|
||||
|
||||
} // namespace webrtc_pc_e2e
|
||||
} // namespace webrtc
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user