OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/modules/rtp_rtcp/source/playout_delay_oracle.h" | 11 #include "webrtc/modules/rtp_rtcp/source/playout_delay_oracle.h" |
12 | 12 |
13 #include "webrtc/base/checks.h" | 13 #include "webrtc/base/checks.h" |
14 #include "webrtc/base/logging.h" | 14 #include "webrtc/base/logging.h" |
15 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 15 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
16 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" | 16 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" |
17 | 17 |
18 namespace webrtc { | 18 namespace webrtc { |
19 | 19 |
20 PlayoutDelayOracle::PlayoutDelayOracle() | 20 PlayoutDelayOracle::PlayoutDelayOracle() |
21 : high_sequence_number_(0), | 21 : high_sequence_number_(0), |
22 send_playout_delay_(false), | 22 send_playout_delay_(false), |
23 ssrc_(0), | 23 ssrc_(0), |
24 min_playout_delay_ms_(-1), | 24 min_playout_delay_ms_(-1), |
25 max_playout_delay_ms_(-1) { | 25 max_playout_delay_ms_(-1) {} |
26 thread_checker_.DetachFromThread(); | 26 |
27 } | |
28 PlayoutDelayOracle::~PlayoutDelayOracle() {} | 27 PlayoutDelayOracle::~PlayoutDelayOracle() {} |
29 | 28 |
30 void PlayoutDelayOracle::UpdateRequest(uint32_t ssrc, | 29 void PlayoutDelayOracle::UpdateRequest(uint32_t ssrc, |
31 PlayoutDelay playout_delay, | 30 PlayoutDelay playout_delay, |
32 uint16_t seq_num) { | 31 uint16_t seq_num) { |
33 rtc::CritScope lock(&crit_sect_); | 32 rtc::CritScope lock(&crit_sect_); |
34 RTC_DCHECK_RUN_ON(&thread_checker_); | |
35 RTC_DCHECK_LE(playout_delay.min_ms, kPlayoutDelayMaxMs); | 33 RTC_DCHECK_LE(playout_delay.min_ms, kPlayoutDelayMaxMs); |
36 RTC_DCHECK_LE(playout_delay.max_ms, kPlayoutDelayMaxMs); | 34 RTC_DCHECK_LE(playout_delay.max_ms, kPlayoutDelayMaxMs); |
37 RTC_DCHECK_LE(playout_delay.min_ms, playout_delay.max_ms); | 35 RTC_DCHECK_LE(playout_delay.min_ms, playout_delay.max_ms); |
38 int64_t unwrapped_seq_num = unwrapper_.Unwrap(seq_num); | 36 int64_t unwrapped_seq_num = unwrapper_.Unwrap(seq_num); |
39 if (playout_delay.min_ms >= 0 && | 37 if (playout_delay.min_ms >= 0 && |
40 playout_delay.min_ms != min_playout_delay_ms_) { | 38 playout_delay.min_ms != min_playout_delay_ms_) { |
41 send_playout_delay_ = true; | 39 send_playout_delay_ = true; |
42 min_playout_delay_ms_ = playout_delay.min_ms; | 40 min_playout_delay_ms_ = playout_delay.min_ms; |
43 high_sequence_number_ = unwrapped_seq_num; | 41 high_sequence_number_ = unwrapped_seq_num; |
44 } | 42 } |
(...skipping 14 matching lines...) Expand all Loading... |
59 rtc::CritScope lock(&crit_sect_); | 57 rtc::CritScope lock(&crit_sect_); |
60 for (const RTCPReportBlock& report_block : report_blocks) { | 58 for (const RTCPReportBlock& report_block : report_blocks) { |
61 if ((ssrc_ == report_block.sourceSSRC) && send_playout_delay_ && | 59 if ((ssrc_ == report_block.sourceSSRC) && send_playout_delay_ && |
62 (report_block.extendedHighSeqNum > high_sequence_number_)) { | 60 (report_block.extendedHighSeqNum > high_sequence_number_)) { |
63 send_playout_delay_ = false; | 61 send_playout_delay_ = false; |
64 } | 62 } |
65 } | 63 } |
66 } | 64 } |
67 | 65 |
68 } // namespace webrtc | 66 } // namespace webrtc |
OLD | NEW |