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 #include "webrtc/modules/rtp_rtcp/source/playout_delay_oracle.h" | |
12 | |
13 #include "webrtc/base/checks.h" | |
14 #include "webrtc/base/logging.h" | |
15 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | |
16 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" | |
17 | |
18 namespace webrtc { | |
19 | |
20 PlayoutDelayOracle::PlayoutDelayOracle() | |
21 : high_sequence_number_(0), | |
danilchap
2016/05/26 09:41:58
send_playout_delay_ initialization is missing
Irfan
2016/06/01 08:38:33
Done.
| |
22 ssrc_(0), | |
23 min_playout_delay_ms_(-1), | |
24 max_playout_delay_ms_(-1) {} | |
25 PlayoutDelayOracle::~PlayoutDelayOracle() {} | |
26 | |
27 void PlayoutDelayOracle::UpdateRequest(uint32_t ssrc, | |
28 PlayoutDelay playout_delay, | |
29 uint16_t seq_num) { | |
30 rtc::CritScope lock(&crit_sect_); | |
31 RTC_DCHECK_LE(playout_delay.min_ms, kPlayoutDelayMaxMs); | |
32 RTC_DCHECK_LE(playout_delay.max_ms, kPlayoutDelayMaxMs); | |
33 int64_t unwrapped_seq_num = unwrapper_.Unwrap(seq_num); | |
34 if (playout_delay.min_ms >= 0 && | |
35 playout_delay.min_ms != min_playout_delay_ms_) { | |
36 send_playout_delay_ = true; | |
37 min_playout_delay_ms_ = playout_delay.min_ms; | |
38 high_sequence_number_ = unwrapped_seq_num; | |
39 } | |
40 | |
41 if (playout_delay.max_ms >= 0 && | |
42 playout_delay.max_ms != max_playout_delay_ms_) { | |
43 send_playout_delay_ = true; | |
44 max_playout_delay_ms_ = playout_delay.max_ms; | |
45 high_sequence_number_ = unwrapped_seq_num; | |
46 } | |
47 ssrc_ = ssrc; | |
48 } | |
49 | |
50 // If an ACK is received on the packet containing the playout delay extension, | |
51 // we stop sending the extension on future packets. | |
52 void PlayoutDelayOracle::OnReceivedRtcpReceiverReport( | |
53 const ReportBlockList& report_blocks) { | |
54 rtc::CritScope lock(&crit_sect_); | |
55 for (const RTCPReportBlock& report_block : report_blocks) { | |
56 if ((ssrc_ == report_block.sourceSSRC) && send_playout_delay_ && | |
57 (report_block.extendedHighSeqNum > high_sequence_number_)) { | |
58 send_playout_delay_ = false; | |
59 } | |
60 } | |
61 } | |
62 | |
63 } // namespace webrtc | |
OLD | NEW |