OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/compound_packet.h" | 11 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/compound_packet.h" |
12 | 12 |
| 13 #include "webrtc/base/checks.h" |
| 14 |
13 namespace webrtc { | 15 namespace webrtc { |
14 namespace rtcp { | 16 namespace rtcp { |
15 | 17 |
| 18 void CompoundPacket::Append(RtcpPacket* packet) { |
| 19 RTC_CHECK(packet); |
| 20 appended_packets_.push_back(packet); |
| 21 } |
| 22 |
16 bool CompoundPacket::Create(uint8_t* packet, | 23 bool CompoundPacket::Create(uint8_t* packet, |
17 size_t* index, | 24 size_t* index, |
18 size_t max_length, | 25 size_t max_length, |
19 RtcpPacket::PacketReadyCallback* callback) const { | 26 RtcpPacket::PacketReadyCallback* callback) const { |
| 27 for (RtcpPacket* appended : appended_packets_) { |
| 28 if (!appended->Create(packet, index, max_length, callback)) |
| 29 return false; |
| 30 } |
20 return true; | 31 return true; |
21 } | 32 } |
22 | 33 |
23 size_t CompoundPacket::BlockLength() const { | 34 size_t CompoundPacket::BlockLength() const { |
24 return 0; | 35 size_t block_length = 0; |
| 36 for (RtcpPacket* appended : appended_packets_) { |
| 37 block_length += appended->BlockLength(); |
| 38 } |
| 39 return block_length; |
25 } | 40 } |
26 | 41 |
27 } // namespace rtcp | 42 } // namespace rtcp |
28 } // namespace webrtc | 43 } // namespace webrtc |
OLD | NEW |