mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-14 22:30:40 +01:00

In https://webrtc-review.googlesource.com/c/src/+/1560 we moved WebRTC from src/webrtc to src/ (in order to preserve an healthy git history). This CL takes care of fixing header guards, #include paths, etc... NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true TBR=tommi@webrtc.org Bug: chromium:611808 Change-Id: Iea91618212bee0af16aa3f05071eab8f93706578 Reviewed-on: https://webrtc-review.googlesource.com/1561 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Henrik Kjellander <kjellander@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#19846}
66 lines
2.3 KiB
C++
66 lines
2.3 KiB
C++
/*
|
|
* 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.
|
|
*/
|
|
|
|
#include "modules/rtp_rtcp/source/playout_delay_oracle.h"
|
|
|
|
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
|
#include "modules/rtp_rtcp/source/rtp_header_extensions.h"
|
|
#include "rtc_base/checks.h"
|
|
#include "rtc_base/logging.h"
|
|
|
|
namespace webrtc {
|
|
|
|
PlayoutDelayOracle::PlayoutDelayOracle()
|
|
: high_sequence_number_(0),
|
|
send_playout_delay_(false),
|
|
ssrc_(0),
|
|
playout_delay_{-1, -1} {}
|
|
|
|
PlayoutDelayOracle::~PlayoutDelayOracle() {}
|
|
|
|
void PlayoutDelayOracle::UpdateRequest(uint32_t ssrc,
|
|
PlayoutDelay playout_delay,
|
|
uint16_t seq_num) {
|
|
rtc::CritScope lock(&crit_sect_);
|
|
RTC_DCHECK_LE(playout_delay.min_ms, PlayoutDelayLimits::kMaxMs);
|
|
RTC_DCHECK_LE(playout_delay.max_ms, PlayoutDelayLimits::kMaxMs);
|
|
RTC_DCHECK_LE(playout_delay.min_ms, playout_delay.max_ms);
|
|
int64_t unwrapped_seq_num = unwrapper_.Unwrap(seq_num);
|
|
if (playout_delay.min_ms >= 0 &&
|
|
playout_delay.min_ms != playout_delay_.min_ms) {
|
|
send_playout_delay_ = true;
|
|
playout_delay_.min_ms = playout_delay.min_ms;
|
|
high_sequence_number_ = unwrapped_seq_num;
|
|
}
|
|
|
|
if (playout_delay.max_ms >= 0 &&
|
|
playout_delay.max_ms != playout_delay_.max_ms) {
|
|
send_playout_delay_ = true;
|
|
playout_delay_.max_ms = playout_delay.max_ms;
|
|
high_sequence_number_ = unwrapped_seq_num;
|
|
}
|
|
ssrc_ = ssrc;
|
|
}
|
|
|
|
// If an ACK is received on the packet containing the playout delay extension,
|
|
// we stop sending the extension on future packets.
|
|
void PlayoutDelayOracle::OnReceivedRtcpReportBlocks(
|
|
const ReportBlockList& report_blocks) {
|
|
rtc::CritScope lock(&crit_sect_);
|
|
for (const RTCPReportBlock& report_block : report_blocks) {
|
|
if ((ssrc_ == report_block.source_ssrc) && send_playout_delay_ &&
|
|
(report_block.extended_highest_sequence_number >
|
|
high_sequence_number_)) {
|
|
send_playout_delay_ = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
} // namespace webrtc
|