LCOV - code coverage report
Current view: top level - media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtcp_packet - rapid_resync_request.cc (source / functions) Hit Total Coverage
Test: output.info Lines: 0 19 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 2 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/rtcp_packet/rapid_resync_request.h"
      12             : 
      13             : #include "webrtc/base/checks.h"
      14             : #include "webrtc/base/logging.h"
      15             : #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h"
      16             : 
      17             : namespace webrtc {
      18             : namespace rtcp {
      19             : constexpr uint8_t RapidResyncRequest::kFeedbackMessageType;
      20             : // RFC 4585: Feedback format.
      21             : // Rapid Resynchronisation Request (draft-perkins-avt-rapid-rtp-sync-03).
      22             : //
      23             : //   0                   1                   2                   3
      24             : //   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
      25             : //  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      26             : //  |V=2|P|  FMT=5  |     PT=205    |         length=2              |
      27             : //  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      28             : //  |                  SSRC of packet sender                        |
      29             : //  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      30             : //  |                  SSRC of media source                         |
      31             : //  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      32           0 : bool RapidResyncRequest::Parse(const CommonHeader& packet) {
      33           0 :   RTC_DCHECK_EQ(packet.type(), kPacketType);
      34           0 :   RTC_DCHECK_EQ(packet.fmt(), kFeedbackMessageType);
      35             : 
      36           0 :   if (packet.payload_size_bytes() != kCommonFeedbackLength) {
      37           0 :     LOG(LS_WARNING) << "Packet payload size should be " << kCommonFeedbackLength
      38           0 :                     << " instead of " << packet.payload_size_bytes()
      39           0 :                     << " to be a valid Rapid Resynchronisation Request";
      40           0 :     return false;
      41             :   }
      42             : 
      43           0 :   ParseCommonFeedback(packet.payload());
      44           0 :   return true;
      45             : }
      46             : 
      47           0 : bool RapidResyncRequest::Create(
      48             :     uint8_t* packet,
      49             :     size_t* index,
      50             :     size_t max_length,
      51             :     RtcpPacket::PacketReadyCallback* callback) const {
      52           0 :   while (*index + BlockLength() > max_length) {
      53           0 :     if (!OnBufferFull(packet, index, callback))
      54           0 :       return false;
      55             :   }
      56             : 
      57           0 :   CreateHeader(kFeedbackMessageType, kPacketType, HeaderLength(), packet,
      58           0 :                index);
      59           0 :   CreateCommonFeedback(packet + *index);
      60           0 :   *index += kCommonFeedbackLength;
      61           0 :   return true;
      62             : }
      63             : }  // namespace rtcp
      64             : }  // namespace webrtc

Generated by: LCOV version 1.13