Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(358)

Side by Side Diff: webrtc/modules/rtp_rtcp/source/playout_delay_oracle.cc

Issue 2007743003: Add sender controlled playout delay limits (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@cleanup_rtp_hdr_extensions
Patch Set: Addressed comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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/source/rtp_header_extension.h"
16 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
danilchap 2016/05/25 19:08:48 includes in aplhabetical order: include < source
Irfan 2016/05/26 05:51:47 Done.
17
18 namespace webrtc {
19
20 PlayoutDelayOracle::PlayoutDelayOracle()
21 : high_sequence_number_(0),
22 min_playout_delay_ms_(-1),
23 max_playout_delay_ms_(-1),
24 ssrc_(0) {}
25 PlayoutDelayOracle::~PlayoutDelayOracle() {}
26
27 void PlayoutDelayOracle::UpdateRequest(uint32_t ssrc,
28 PlayoutDelay playout_delay,
29 uint16_t seq_num) {
30 RTC_DCHECK_LE(playout_delay.min_ms, kPlayoutDelayMaxMs);
31 RTC_DCHECK_LE(playout_delay.max_ms, kPlayoutDelayMaxMs);
32 int64_t unwrapped_seq_num = unwrapper_.Unwrap(seq_num);
33 if (playout_delay.min_ms >= 0 &&
34 playout_delay.min_ms != min_playout_delay_ms_) {
35 send_playout_delay_ = true;
36 min_playout_delay_ms_ = playout_delay.min_ms;
37 high_sequence_number_ = unwrapped_seq_num;
38 }
39
40 if (playout_delay.max_ms >= 0 &&
41 playout_delay.max_ms != max_playout_delay_ms_) {
42 send_playout_delay_ = true;
43 max_playout_delay_ms_ = playout_delay.max_ms;
44 high_sequence_number_ = unwrapped_seq_num;
45 }
46 ssrc_ = ssrc;
47 }
48
49 // If an ACK is received on the packet containing the playout delay extension,
50 // we stop sending the extension on future packets.
51 void PlayoutDelayOracle::OnReceivedRtcpReceiverReport(
52 const ReportBlockList& report_blocks) {
53 for (const RTCPReportBlock& report_block : report_blocks) {
54 if ((ssrc_ == report_block.sourceSSRC) && send_playout_delay_ &&
55 (report_block.extendedHighSeqNum > high_sequence_number_)) {
56 send_playout_delay_ = false;
57 }
58 }
59 }
60
61 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698