OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright (c) 2016 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 WEBRTC_MODULES_RTP_RTCP_SOURCE_PLAYOUT_DELAY_ORACLE_H_ | |
12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_PLAYOUT_DELAY_ORACLE_H_ | |
13 | |
14 #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.
| |
15 | |
16 #include <unordered_map> | |
17 | |
18 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | |
19 | |
20 namespace webrtc { | |
21 | |
22 // This class tracks the application requests to limit minimum and maximum | |
23 // playout delay and makes a decision on whether the current RTP frame | |
24 // should include the playout out delay extension header. | |
25 // | |
26 // Playout delay can be defined in terms of capture and render time as follows: | |
27 // | |
28 // Render time = Capture time in receiver time + playout delay | |
29 // | |
30 // The application specifies a minimum and maximum limit for the playout delay | |
31 // which are both communicated to the receiver and the receiver can adapt | |
32 // the playout delay within this range based on observed network jitter. | |
33 class PlayoutDelayOracle { | |
34 public: | |
35 PlayoutDelayOracle(); | |
36 ~PlayoutDelayOracle(); | |
37 | |
38 // Returns true if the current frame should include the playout delay | |
39 // extension | |
40 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.
| |
41 | |
42 // Returns current minimum playout delay in milliseconds. | |
43 int MinPlayoutDelayMs(int ssrc) const; | |
44 | |
45 // Returns current maximum playout delay in milliseconds. | |
46 int MaxPlayoutDelayMs(int ssrc) const; | |
47 | |
48 void Update(int ssrc, | |
49 int min_playout_delay_ms, | |
50 int max_playout_delay_ms, | |
51 int seq_num); | |
52 | |
53 void OnReceivedRtcpReceiverReport(const ReportBlockList& report_blocks); | |
54 | |
55 private: | |
56 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
| |
57 std::unordered_map<uint32_t, bool> send_playout_delay_ssrc_; | |
58 std::unordered_map<uint32_t, int> ssrc_to_min_playout_delay_; | |
59 std::unordered_map<uint32_t, int> ssrc_to_max_playout_delay_; | |
60 | |
61 RTC_DISALLOW_COPY_AND_ASSIGN(PlayoutDelayOracle); | |
62 }; | |
63 | |
64 } // namespace webrtc | |
65 | |
66 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_PLAYOUT_DELAY_ORACLE_H_ | |
OLD | NEW |