Index: webrtc/modules/rtp_rtcp/source/playout_delay_oracle.h |
diff --git a/webrtc/modules/rtp_rtcp/source/playout_delay_oracle.h b/webrtc/modules/rtp_rtcp/source/playout_delay_oracle.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a3d1d308d786985d7c26e5d60c6bb1600ae8e919 |
--- /dev/null |
+++ b/webrtc/modules/rtp_rtcp/source/playout_delay_oracle.h |
@@ -0,0 +1,66 @@ |
+/* |
+ * Copyright (c) 2016 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 WEBRTC_MODULES_RTP_RTCP_SOURCE_PLAYOUT_DELAY_ORACLE_H_ |
+#define WEBRTC_MODULES_RTP_RTCP_SOURCE_PLAYOUT_DELAY_ORACLE_H_ |
+ |
+#include <stdint.h> |
danilchap
2016/05/24 13:28:24
#include "webrtc/base/basictypes.h" instead of <st
Irfan
2016/05/25 09:32:53
Done.
|
+ |
+#include <unordered_map> |
+ |
+#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
+ |
+namespace webrtc { |
+ |
+// This class tracks the application requests to limit minimum and maximum |
+// playout delay and makes a decision on whether the current RTP frame |
+// should include the playout out delay extension header. |
+// |
+// Playout delay can be defined in terms of capture and render time as follows: |
+// |
+// Render time = Capture time in receiver time + playout delay |
+// |
+// The application specifies a minimum and maximum limit for the playout delay |
+// which are both communicated to the receiver and the receiver can adapt |
+// the playout delay within this range based on observed network jitter. |
+class PlayoutDelayOracle { |
+ public: |
+ PlayoutDelayOracle(); |
+ ~PlayoutDelayOracle(); |
+ |
+ // Returns true if the current frame should include the playout delay |
+ // extension |
+ bool ShouldIncludePlayoutDelayExtension(int ssrc) const; |
danilchap
2016/05/24 13:28:24
We use uint32_t for ssrcs (it is always 32bits)
Irfan
2016/05/25 09:32:53
Done.
Irfan
2016/05/25 09:32:53
Done.
|
+ |
+ // Returns current minimum playout delay in milliseconds. |
+ int MinPlayoutDelayMs(int ssrc) const; |
+ |
+ // Returns current maximum playout delay in milliseconds. |
+ int MaxPlayoutDelayMs(int ssrc) const; |
+ |
+ void Update(int ssrc, |
+ int min_playout_delay_ms, |
+ int max_playout_delay_ms, |
+ int seq_num); |
+ |
+ void OnReceivedRtcpReceiverReport(const ReportBlockList& report_blocks); |
+ |
+ private: |
+ std::unordered_map<uint32_t, uint32_t> ssrc_to_high_seq_num_; |
danilchap
2016/05/24 13:28:24
PlayoutDelayOracle lives inside RtpSender that is
sprang_webrtc
2016/05/24 14:46:08
+1 to not have a map here if not necessary. Otherw
Irfan
2016/05/25 09:32:53
Thanks for pointing this out Danil. Makes it much
|
+ std::unordered_map<uint32_t, bool> send_playout_delay_ssrc_; |
+ std::unordered_map<uint32_t, int> ssrc_to_min_playout_delay_; |
+ std::unordered_map<uint32_t, int> ssrc_to_max_playout_delay_; |
+ |
+ RTC_DISALLOW_COPY_AND_ASSIGN(PlayoutDelayOracle); |
+}; |
+ |
+} // namespace webrtc |
+ |
+#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_PLAYOUT_DELAY_ORACLE_H_ |