LCOV - code coverage report
Current view: top level - media/webrtc/trunk/webrtc/modules/rtp_rtcp/source - playout_delay_oracle.cc (source / functions) Hit Total Coverage
Test: output.info Lines: 0 28 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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           0 : PlayoutDelayOracle::PlayoutDelayOracle()
      21             :     : high_sequence_number_(0),
      22             :       send_playout_delay_(false),
      23             :       ssrc_(0),
      24           0 :       playout_delay_{-1, -1} {}
      25             : 
      26           0 : PlayoutDelayOracle::~PlayoutDelayOracle() {}
      27             : 
      28           0 : void PlayoutDelayOracle::UpdateRequest(uint32_t ssrc,
      29             :                                        PlayoutDelay playout_delay,
      30             :                                        uint16_t seq_num) {
      31           0 :   rtc::CritScope lock(&crit_sect_);
      32           0 :   RTC_DCHECK_LE(playout_delay.min_ms, kPlayoutDelayMaxMs);
      33           0 :   RTC_DCHECK_LE(playout_delay.max_ms, kPlayoutDelayMaxMs);
      34           0 :   RTC_DCHECK_LE(playout_delay.min_ms, playout_delay.max_ms);
      35           0 :   int64_t unwrapped_seq_num = unwrapper_.Unwrap(seq_num);
      36           0 :   if (playout_delay.min_ms >= 0 &&
      37           0 :       playout_delay.min_ms != playout_delay_.min_ms) {
      38           0 :     send_playout_delay_ = true;
      39           0 :     playout_delay_.min_ms = playout_delay.min_ms;
      40           0 :     high_sequence_number_ = unwrapped_seq_num;
      41             :   }
      42             : 
      43           0 :   if (playout_delay.max_ms >= 0 &&
      44           0 :       playout_delay.max_ms != playout_delay_.max_ms) {
      45           0 :     send_playout_delay_ = true;
      46           0 :     playout_delay_.max_ms = playout_delay.max_ms;
      47           0 :     high_sequence_number_ = unwrapped_seq_num;
      48             :   }
      49           0 :   ssrc_ = ssrc;
      50           0 : }
      51             : 
      52             : // If an ACK is received on the packet containing the playout delay extension,
      53             : // we stop sending the extension on future packets.
      54           0 : void PlayoutDelayOracle::OnReceivedRtcpReportBlocks(
      55             :     const ReportBlockList& report_blocks) {
      56           0 :   rtc::CritScope lock(&crit_sect_);
      57           0 :   for (const RTCPReportBlock& report_block : report_blocks) {
      58           0 :     if ((ssrc_ == report_block.sourceSSRC) && send_playout_delay_ &&
      59           0 :         (report_block.extendedHighSeqNum > high_sequence_number_)) {
      60           0 :       send_playout_delay_ = false;
      61             :     }
      62             :   }
      63           0 : }
      64             : 
      65             : }  // namespace webrtc

Generated by: LCOV version 1.13