summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/moz-patch-stack/0056.patch
blob: 27b9c65715f110c7ded1407f4b0ca87e10dacb85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
From: Andreas Pehrson <apehrson@mozilla.com>
Date: Tue, 2 Nov 2021 14:35:00 +0000
Subject: Bug 1729455 - Add to stats the local receive time for receiving video
 Sender Reports. r=ng

Differential Revision: https://phabricator.services.mozilla.com/D125712
Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/99267b6d193fbcb3e4c845c5e80770424d6d06e2
---
 call/video_receive_stream.h                  |  3 ++-
 modules/rtp_rtcp/source/rtcp_receiver.cc     |  6 ++++--
 modules/rtp_rtcp/source/rtcp_receiver.h      |  3 ++-
 modules/rtp_rtcp/source/rtp_rtcp_impl.cc     | 10 +++++-----
 modules/rtp_rtcp/source/rtp_rtcp_impl.h      |  3 ++-
 modules/rtp_rtcp/source/rtp_rtcp_impl2.cc    | 10 +++++-----
 modules/rtp_rtcp/source/rtp_rtcp_impl2.h     |  3 ++-
 modules/rtp_rtcp/source/rtp_rtcp_interface.h |  5 +++--
 video/rtp_video_stream_receiver2.cc          |  5 +++--
 video/rtp_video_stream_receiver2.h           |  3 ++-
 video/video_receive_stream2.cc               |  3 ++-
 11 files changed, 32 insertions(+), 22 deletions(-)

diff --git a/call/video_receive_stream.h b/call/video_receive_stream.h
index 31c9bff7b0..25c294a2a6 100644
--- a/call/video_receive_stream.h
+++ b/call/video_receive_stream.h
@@ -145,10 +145,11 @@ class VideoReceiveStreamInterface : public MediaReceiveStreamInterface {
     RtpReceiveStats rtp_stats;
     RtcpPacketTypeCounter rtcp_packet_type_counts;
 
-    // Mozilla modification: Init these three.
+    // Mozilla modification: Init these.
     uint32_t rtcp_sender_packets_sent = 0;
     uint32_t rtcp_sender_octets_sent = 0;
     int64_t rtcp_sender_ntp_timestamp_ms = 0;
+    int64_t rtcp_sender_remote_ntp_timestamp_ms = 0;
 
     // Timing frame info: all important timestamps for a full lifetime of a
     // single 'timing frame'.
diff --git a/modules/rtp_rtcp/source/rtcp_receiver.cc b/modules/rtp_rtcp/source/rtcp_receiver.cc
index 69d62ead5a..936750c263 100644
--- a/modules/rtp_rtcp/source/rtcp_receiver.cc
+++ b/modules/rtp_rtcp/source/rtcp_receiver.cc
@@ -432,11 +432,13 @@ RTCPReceiver::ConsumeReceivedXrReferenceTimeInfo() {
 
 void RTCPReceiver::RemoteRTCPSenderInfo(uint32_t* packet_count,
                                         uint32_t* octet_count,
-                                        int64_t* ntp_timestamp_ms) const {
+                                        int64_t* ntp_timestamp_ms,
+                                        int64_t* remote_ntp_timestamp_ms) const {
   MutexLock lock(&rtcp_receiver_lock_);
   *packet_count = remote_sender_packet_count_;
   *octet_count = remote_sender_octet_count_;
-  *ntp_timestamp_ms = remote_sender_ntp_time_.ToMs();
+  *ntp_timestamp_ms = last_received_sr_ntp_.ToMs();
+  *remote_ntp_timestamp_ms = remote_sender_ntp_time_.ToMs();
 }
 
 std::vector<ReportBlockData> RTCPReceiver::GetLatestReportBlockData() const {
diff --git a/modules/rtp_rtcp/source/rtcp_receiver.h b/modules/rtp_rtcp/source/rtcp_receiver.h
index a05a69059a..e3f5bc765c 100644
--- a/modules/rtp_rtcp/source/rtcp_receiver.h
+++ b/modules/rtp_rtcp/source/rtcp_receiver.h
@@ -135,7 +135,8 @@ class RTCPReceiver final {
   // Get received sender packet and octet counts
   void RemoteRTCPSenderInfo(uint32_t* packet_count,
                             uint32_t* octet_count,
-                            int64_t* ntp_timestamp_ms) const;
+                            int64_t* ntp_timestamp_ms,
+                            int64_t* remote_ntp_timestamp_ms) const;
 
   // Get rtt.
   int32_t RTT(uint32_t remote_ssrc,
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
index bf9e2b3bf9..1c31611409 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
@@ -527,11 +527,11 @@ void ModuleRtpRtcpImpl::GetSendStreamDataCounters(
 }
 
 // Received RTCP report.
-void ModuleRtpRtcpImpl::RemoteRTCPSenderInfo(uint32_t* packet_count,
-                                             uint32_t* octet_count,
-                                             int64_t* ntp_timestamp_ms) const {
-  return rtcp_receiver_.RemoteRTCPSenderInfo(packet_count, octet_count,
-                                             ntp_timestamp_ms);
+void ModuleRtpRtcpImpl::RemoteRTCPSenderInfo(
+    uint32_t* packet_count, uint32_t* octet_count, int64_t* ntp_timestamp_ms,
+    int64_t* remote_ntp_timestamp_ms) const {
+  return rtcp_receiver_.RemoteRTCPSenderInfo(
+      packet_count, octet_count, ntp_timestamp_ms, remote_ntp_timestamp_ms);
 }
 
 std::vector<ReportBlockData> ModuleRtpRtcpImpl::GetLatestReportBlockData()
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.h b/modules/rtp_rtcp/source/rtp_rtcp_impl.h
index 5cf558717e..6070b67d44 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.h
@@ -194,7 +194,8 @@ class ABSL_DEPRECATED("") ModuleRtpRtcpImpl
 
   void RemoteRTCPSenderInfo(uint32_t* packet_count,
                             uint32_t* octet_count,
-                            int64_t* ntp_timestamp_ms) const override;
+                            int64_t* ntp_timestamp_ms,
+                            int64_t* remote_ntp_timestamp_ms) const override;
 
   // A snapshot of the most recent Report Block with additional data of
   // interest to statistics. Used to implement RTCRemoteInboundRtpStreamStats.
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc
index 8378a76133..66d2e7a44e 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2.cc
@@ -508,11 +508,11 @@ void ModuleRtpRtcpImpl2::GetSendStreamDataCounters(
 }
 
 // Received RTCP report.
-void ModuleRtpRtcpImpl2::RemoteRTCPSenderInfo(uint32_t* packet_count,
-                                             uint32_t* octet_count,
-                                             int64_t* ntp_timestamp_ms) const {
-  return rtcp_receiver_.RemoteRTCPSenderInfo(packet_count, octet_count,
-                                             ntp_timestamp_ms);
+void ModuleRtpRtcpImpl2::RemoteRTCPSenderInfo(
+    uint32_t* packet_count, uint32_t* octet_count, int64_t* ntp_timestamp_ms,
+    int64_t* remote_ntp_timestamp_ms) const {
+  return rtcp_receiver_.RemoteRTCPSenderInfo(
+      packet_count, octet_count, ntp_timestamp_ms, remote_ntp_timestamp_ms);
 }
 
 std::vector<ReportBlockData> ModuleRtpRtcpImpl2::GetLatestReportBlockData()
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl2.h b/modules/rtp_rtcp/source/rtp_rtcp_impl2.h
index 4ef67d4647..c43d0c34ba 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl2.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl2.h
@@ -206,7 +206,8 @@ class ModuleRtpRtcpImpl2 final : public RtpRtcpInterface,
 
   void RemoteRTCPSenderInfo(uint32_t* packet_count,
                             uint32_t* octet_count,
-                            int64_t* ntp_timestamp_ms) const override;
+                            int64_t* ntp_timestamp_ms,
+                            int64_t* remote_ntp_timestamp_ms) const override;
 
   // A snapshot of the most recent Report Block with additional data of
   // interest to statistics. Used to implement RTCRemoteInboundRtpStreamStats.
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_interface.h b/modules/rtp_rtcp/source/rtp_rtcp_interface.h
index b988c7805d..cb4a0a427f 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_interface.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_interface.h
@@ -403,10 +403,11 @@ class RtpRtcpInterface : public RtcpFeedbackSenderInterface {
       StreamDataCounters* rtx_counters) const = 0;
 
 
-  // Returns packet count, octet count, and timestamp from RTCP sender report.
+  // Returns packet count, octet count, and timestamps from RTCP sender report.
   virtual void RemoteRTCPSenderInfo(uint32_t* packet_count,
                                     uint32_t* octet_count,
-                                    int64_t* ntp_timestamp_ms) const = 0;
+                                    int64_t* ntp_timestamp_ms,
+                                    int64_t* remote_ntp_timestamp_ms) const = 0;
   // A snapshot of Report Blocks with additional data of interest to statistics.
   // Within this list, the sender-source SSRC pair is unique and per-pair the
   // ReportBlockData represents the latest Report Block that was received for
diff --git a/video/rtp_video_stream_receiver2.cc b/video/rtp_video_stream_receiver2.cc
index 05447ac3bd..094f8f4a54 100644
--- a/video/rtp_video_stream_receiver2.cc
+++ b/video/rtp_video_stream_receiver2.cc
@@ -1067,9 +1067,10 @@ absl::optional<int64_t> RtpVideoStreamReceiver2::LastReceivedKeyframePacketMs()
 // seem to be any support for these stats right now. So, we hack this in.
 void RtpVideoStreamReceiver2::RemoteRTCPSenderInfo(
     uint32_t* packet_count, uint32_t* octet_count,
-    int64_t* ntp_timestamp_ms) const {
+    int64_t* ntp_timestamp_ms, int64_t* remote_ntp_timestamp_ms) const {
   RTC_DCHECK_RUN_ON(&worker_task_checker_);
-  rtp_rtcp_->RemoteRTCPSenderInfo(packet_count, octet_count, ntp_timestamp_ms);
+  rtp_rtcp_->RemoteRTCPSenderInfo(packet_count, octet_count, ntp_timestamp_ms,
+                                  remote_ntp_timestamp_ms);
 }
 
 void RtpVideoStreamReceiver2::ManageFrame(
diff --git a/video/rtp_video_stream_receiver2.h b/video/rtp_video_stream_receiver2.h
index 21f125ae2f..6bf4bf8453 100644
--- a/video/rtp_video_stream_receiver2.h
+++ b/video/rtp_video_stream_receiver2.h
@@ -215,7 +215,8 @@ class RtpVideoStreamReceiver2 : public LossNotificationSender,
   // stats at all, and even on the most recent libwebrtc code there does not
   // seem to be any support for these stats right now. So, we hack this in.
   void RemoteRTCPSenderInfo(uint32_t* packet_count, uint32_t* octet_count,
-                            int64_t* ntp_timestamp_ms) const;
+                            int64_t* ntp_timestamp_ms,
+                            int64_t* remote_ntp_timestamp_ms) const;
 
  private:
   // Implements RtpVideoFrameReceiver.
diff --git a/video/video_receive_stream2.cc b/video/video_receive_stream2.cc
index be850834d6..7cbd49d322 100644
--- a/video/video_receive_stream2.cc
+++ b/video/video_receive_stream2.cc
@@ -603,7 +603,8 @@ VideoReceiveStreamInterface::Stats VideoReceiveStream2::GetStats() const {
   // seem to be any support for these stats right now. So, we hack this in.
   rtp_video_stream_receiver_.RemoteRTCPSenderInfo(
       &stats.rtcp_sender_packets_sent, &stats.rtcp_sender_octets_sent,
-      &stats.rtcp_sender_ntp_timestamp_ms);
+      &stats.rtcp_sender_ntp_timestamp_ms,
+      &stats.rtcp_sender_remote_ntp_timestamp_ms);
 
   return stats;
 }
-- 
2.34.1