-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> Commit-Queue: Artem Titov <[email protected]> Cr-Commit-Position: refs/heads/master@{#34737}
- Loading branch information
1 parent
a17ec76
commit 8b18304
Showing
7 changed files
with
210 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
test/pc/e2e/analyzer/video/default_video_quality_analyzer_internal_shared_objects.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
109 changes: 109 additions & 0 deletions
109
test/pc/e2e/analyzer/video/default_video_quality_analyzer_internal_shared_objects.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.