This is a follow-up to https://webrtc-review.googlesource.com/c/src/+/106280. This time the whole code base is covered. Some files may have not been fixed though, whenever the IWYU tool was breaking the build. Bug: webrtc:8311 Change-Id: I2c31f552a87e887d33931d46e87b6208b1e483ef Reviewed-on: https://webrtc-review.googlesource.com/c/111965 Commit-Queue: Yves Gerey <yvesg@google.com> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25830}
83 lines
2.4 KiB
C++
83 lines
2.4 KiB
C++
/*
|
|
* Copyright (c) 2017 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 "api/video/video_timing.h"
|
|
|
|
#include "api/array_view.h"
|
|
#include "rtc_base/strings/string_builder.h"
|
|
|
|
namespace webrtc {
|
|
|
|
TimingFrameInfo::TimingFrameInfo()
|
|
: rtp_timestamp(0),
|
|
capture_time_ms(-1),
|
|
encode_start_ms(-1),
|
|
encode_finish_ms(-1),
|
|
packetization_finish_ms(-1),
|
|
pacer_exit_ms(-1),
|
|
network_timestamp_ms(-1),
|
|
network2_timestamp_ms(-1),
|
|
receive_start_ms(-1),
|
|
receive_finish_ms(-1),
|
|
decode_start_ms(-1),
|
|
decode_finish_ms(-1),
|
|
render_time_ms(-1),
|
|
flags(VideoSendTiming::kNotTriggered) {}
|
|
|
|
int64_t TimingFrameInfo::EndToEndDelay() const {
|
|
return capture_time_ms >= 0 ? decode_finish_ms - capture_time_ms : -1;
|
|
}
|
|
|
|
bool TimingFrameInfo::IsLongerThan(const TimingFrameInfo& other) const {
|
|
int64_t other_delay = other.EndToEndDelay();
|
|
return other_delay == -1 || EndToEndDelay() > other_delay;
|
|
}
|
|
|
|
bool TimingFrameInfo::operator<(const TimingFrameInfo& other) const {
|
|
return other.IsLongerThan(*this);
|
|
}
|
|
|
|
bool TimingFrameInfo::operator<=(const TimingFrameInfo& other) const {
|
|
return !IsLongerThan(other);
|
|
}
|
|
|
|
bool TimingFrameInfo::IsOutlier() const {
|
|
return !IsInvalid() && (flags & VideoSendTiming::kTriggeredBySize);
|
|
}
|
|
|
|
bool TimingFrameInfo::IsTimerTriggered() const {
|
|
return !IsInvalid() && (flags & VideoSendTiming::kTriggeredByTimer);
|
|
}
|
|
|
|
bool TimingFrameInfo::IsInvalid() const {
|
|
return flags == VideoSendTiming::kInvalid;
|
|
}
|
|
|
|
std::string TimingFrameInfo::ToString() const {
|
|
if (IsInvalid()) {
|
|
return "";
|
|
}
|
|
|
|
char buf[1024];
|
|
rtc::SimpleStringBuilder sb(buf);
|
|
|
|
sb << rtp_timestamp << ',' << capture_time_ms << ',' << encode_start_ms << ','
|
|
<< encode_finish_ms << ',' << packetization_finish_ms << ','
|
|
<< pacer_exit_ms << ',' << network_timestamp_ms << ','
|
|
<< network2_timestamp_ms << ',' << receive_start_ms << ','
|
|
<< receive_finish_ms << ',' << decode_start_ms << ',' << decode_finish_ms
|
|
<< ',' << render_time_ms << ',' << IsOutlier() << ','
|
|
<< IsTimerTriggered();
|
|
|
|
return sb.str();
|
|
}
|
|
|
|
} // namespace webrtc
|