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/compound_packet.h"
12 :
13 : #include "webrtc/base/checks.h"
14 :
15 : namespace webrtc {
16 : namespace rtcp {
17 :
18 0 : void CompoundPacket::Append(RtcpPacket* packet) {
19 0 : RTC_CHECK(packet);
20 0 : appended_packets_.push_back(packet);
21 0 : }
22 :
23 0 : bool CompoundPacket::Create(uint8_t* packet,
24 : size_t* index,
25 : size_t max_length,
26 : RtcpPacket::PacketReadyCallback* callback) const {
27 0 : for (RtcpPacket* appended : appended_packets_) {
28 0 : if (!appended->Create(packet, index, max_length, callback))
29 0 : return false;
30 : }
31 0 : return true;
32 : }
33 :
34 0 : size_t CompoundPacket::BlockLength() const {
35 0 : size_t block_length = 0;
36 0 : for (RtcpPacket* appended : appended_packets_) {
37 0 : block_length += appended->BlockLength();
38 : }
39 0 : return block_length;
40 : }
41 :
42 : } // namespace rtcp
43 : } // namespace webrtc
|