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 |
(...skipping 26 matching lines...) Expand all Loading... |
37 LOG(LS_WARNING) << "Packet payload size should be " << kCommonFeedbackLength | 37 LOG(LS_WARNING) << "Packet payload size should be " << kCommonFeedbackLength |
38 << " instead of " << packet.payload_size_bytes() | 38 << " instead of " << packet.payload_size_bytes() |
39 << " to be a valid Rapid Resynchronisation Request"; | 39 << " to be a valid Rapid Resynchronisation Request"; |
40 return false; | 40 return false; |
41 } | 41 } |
42 | 42 |
43 ParseCommonFeedback(packet.payload()); | 43 ParseCommonFeedback(packet.payload()); |
44 return true; | 44 return true; |
45 } | 45 } |
46 | 46 |
| 47 size_t RapidResyncRequest::BlockLength() const { |
| 48 return kHeaderLength + kCommonFeedbackLength; |
| 49 } |
| 50 |
47 bool RapidResyncRequest::Create( | 51 bool RapidResyncRequest::Create( |
48 uint8_t* packet, | 52 uint8_t* packet, |
49 size_t* index, | 53 size_t* index, |
50 size_t max_length, | 54 size_t max_length, |
51 RtcpPacket::PacketReadyCallback* callback) const { | 55 RtcpPacket::PacketReadyCallback* callback) const { |
52 while (*index + BlockLength() > max_length) { | 56 while (*index + BlockLength() > max_length) { |
53 if (!OnBufferFull(packet, index, callback)) | 57 if (!OnBufferFull(packet, index, callback)) |
54 return false; | 58 return false; |
55 } | 59 } |
56 | 60 |
57 CreateHeader(kFeedbackMessageType, kPacketType, HeaderLength(), packet, | 61 CreateHeader(kFeedbackMessageType, kPacketType, HeaderLength(), packet, |
58 index); | 62 index); |
59 CreateCommonFeedback(packet + *index); | 63 CreateCommonFeedback(packet + *index); |
60 *index += kCommonFeedbackLength; | 64 *index += kCommonFeedbackLength; |
61 return true; | 65 return true; |
62 } | 66 } |
63 } // namespace rtcp | 67 } // namespace rtcp |
64 } // namespace webrtc | 68 } // namespace webrtc |
OLD | NEW |