blob: 641e2ae6b0eb5f554392ed357030df6d3cdd03c2 [file] [log] [blame]
Bjorn Terelius2eb31882017-11-30 15:15:25 +01001/*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef RTC_TOOLS_EVENT_LOG_VISUALIZER_TRIAGE_NOTIFICATIONS_H_
12#define RTC_TOOLS_EVENT_LOG_VISUALIZER_TRIAGE_NOTIFICATIONS_H_
13
14#include <string>
15
16namespace webrtc {
17namespace plotting {
18
19class TriageNotification {
20 public:
21 TriageNotification() : time_seconds_() {}
22 explicit TriageNotification(float time_seconds)
23 : time_seconds_(time_seconds) {}
24 virtual ~TriageNotification() = default;
25 virtual std::string ToString() = 0;
26 rtc::Optional<float> Time() { return time_seconds_; }
27
28 private:
29 rtc::Optional<float> time_seconds_;
30};
31
32class IncomingRtpReceiveTimeGap : public TriageNotification {
33 public:
34 IncomingRtpReceiveTimeGap(float time_seconds, int64_t duration)
35 : TriageNotification(time_seconds), duration_(duration) {}
36 std::string ToString() {
37 return std::string("No RTP packets received for ") +
38 std::to_string(duration_) + std::string(" ms");
39 }
40
41 private:
42 int64_t duration_;
43};
44
45class IncomingRtcpReceiveTimeGap : public TriageNotification {
46 public:
47 IncomingRtcpReceiveTimeGap(float time_seconds, int64_t duration)
48 : TriageNotification(time_seconds), duration_(duration) {}
49 std::string ToString() {
50 return std::string("No RTCP packets received for ") +
51 std::to_string(duration_) + std::string(" ms");
52 }
53
54 private:
55 int64_t duration_;
56};
57
58class OutgoingRtpSendTimeGap : public TriageNotification {
59 public:
60 OutgoingRtpSendTimeGap(float time_seconds, int64_t duration)
61 : TriageNotification(time_seconds), duration_(duration) {}
62 std::string ToString() {
63 return std::string("No RTP packets sent for ") + std::to_string(duration_) +
64 std::string(" ms");
65 }
66
67 private:
68 int64_t duration_;
69};
70
71class OutgoingRtcpSendTimeGap : public TriageNotification {
72 public:
73 OutgoingRtcpSendTimeGap(float time_seconds, int64_t duration)
74 : TriageNotification(time_seconds), duration_(duration) {}
75 std::string ToString() {
76 return std::string("No RTCP packets sent for ") +
77 std::to_string(duration_) + std::string(" ms");
78 }
79
80 private:
81 int64_t duration_;
82};
83
84class IncomingSeqNoJump : public TriageNotification {
85 public:
86 IncomingSeqNoJump(float time_seconds, uint32_t ssrc)
87 : TriageNotification(time_seconds), ssrc_(ssrc) {}
88 std::string ToString() {
89 return std::string("Sequence number jumps on incoming SSRC ") +
90 std::to_string(ssrc_);
91 }
92
93 private:
94 uint32_t ssrc_;
95};
96
97class IncomingCaptureTimeJump : public TriageNotification {
98 public:
99 IncomingCaptureTimeJump(float time_seconds, uint32_t ssrc)
100 : TriageNotification(time_seconds), ssrc_(ssrc) {}
101 std::string ToString() {
102 return std::string("Capture timestamp jumps on incoming SSRC ") +
103 std::to_string(ssrc_);
104 }
105
106 private:
107 uint32_t ssrc_;
108};
109
110class OutgoingSeqNoJump : public TriageNotification {
111 public:
112 OutgoingSeqNoJump(float time_seconds, uint32_t ssrc)
113 : TriageNotification(time_seconds), ssrc_(ssrc) {}
114 std::string ToString() {
115 return std::string("Sequence number jumps on outgoing SSRC ") +
116 std::to_string(ssrc_);
117 }
118
119 private:
120 uint32_t ssrc_;
121};
122
123class OutgoingCaptureTimeJump : public TriageNotification {
124 public:
125 OutgoingCaptureTimeJump(float time_seconds, uint32_t ssrc)
126 : TriageNotification(time_seconds), ssrc_(ssrc) {}
127 std::string ToString() {
128 return std::string("Capture timestamp jumps on outgoing SSRC ") +
129 std::to_string(ssrc_);
130 }
131
132 private:
133 uint32_t ssrc_;
134};
135
136class OutgoingHighLoss : public TriageNotification {
137 public:
138 explicit OutgoingHighLoss(double avg_loss_fraction)
139 : avg_loss_fraction_(avg_loss_fraction) {}
140 std::string ToString() {
141 return std::string("High average loss (") +
142 std::to_string(avg_loss_fraction_ * 100) +
143 std::string("%) across the call.");
144 }
145
146 private:
147 double avg_loss_fraction_;
148};
149
150} // namespace plotting
151} // namespace webrtc
152
153#endif // RTC_TOOLS_EVENT_LOG_VISUALIZER_TRIAGE_NOTIFICATIONS_H_