| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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_receiver_help.h" | 11 #include "webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.h" |
| 12 | 12 |
| 13 #include <assert.h> // assert | 13 #include <assert.h> // assert |
| 14 #include <string.h> // memset | 14 #include <string.h> // memset |
| 15 | 15 |
| 16 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" | 16 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" |
| 17 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 17 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
| 18 | 18 |
| 19 namespace webrtc { | 19 namespace webrtc { |
| 20 namespace RTCPHelp { | 20 namespace RTCPHelp { |
| 21 | 21 |
| 22 RTCPPacketInformation::RTCPPacketInformation() | 22 RTCPPacketInformation::RTCPPacketInformation() |
| 23 : rtcpPacketTypeFlags(0), | 23 : rtcpPacketTypeFlags(0), |
| 24 remoteSSRC(0), | 24 remoteSSRC(0), |
| 25 nackSequenceNumbers(), | 25 nackSequenceNumbers(), |
| 26 applicationSubType(0), | |
| 27 applicationName(0), | |
| 28 applicationData(), | |
| 29 applicationLength(0), | |
| 30 rtt(0), | 26 rtt(0), |
| 31 interArrivalJitter(0), | |
| 32 sliPictureId(0), | 27 sliPictureId(0), |
| 33 rpsiPictureId(0), | 28 rpsiPictureId(0), |
| 34 receiverEstimatedMaxBitrate(0), | 29 receiverEstimatedMaxBitrate(0), |
| 35 ntp_secs(0), | 30 ntp_secs(0), |
| 36 ntp_frac(0), | 31 ntp_frac(0), |
| 37 rtp_timestamp(0), | 32 rtp_timestamp(0), |
| 38 xr_originator_ssrc(0), | 33 xr_originator_ssrc(0), |
| 39 xr_dlrr_item(false), | 34 xr_dlrr_item(false) {} |
| 40 VoIPMetric(nullptr) {} | |
| 41 | 35 |
| 42 RTCPPacketInformation::~RTCPPacketInformation() { | 36 RTCPPacketInformation::~RTCPPacketInformation() {} |
| 43 delete[] applicationData; | |
| 44 } | |
| 45 | |
| 46 void RTCPPacketInformation::AddVoIPMetric(const RTCPVoIPMetric* metric) { | |
| 47 VoIPMetric.reset(new RTCPVoIPMetric()); | |
| 48 memcpy(VoIPMetric.get(), metric, sizeof(RTCPVoIPMetric)); | |
| 49 } | |
| 50 | |
| 51 void RTCPPacketInformation::AddApplicationData(const uint8_t* data, | |
| 52 const uint16_t size) { | |
| 53 uint8_t* oldData = applicationData; | |
| 54 uint16_t oldLength = applicationLength; | |
| 55 | |
| 56 // Don't copy more than kRtcpAppCode_DATA_SIZE bytes. | |
| 57 uint16_t copySize = size; | |
| 58 if (size > kRtcpAppCode_DATA_SIZE) { | |
| 59 copySize = kRtcpAppCode_DATA_SIZE; | |
| 60 } | |
| 61 | |
| 62 applicationLength += copySize; | |
| 63 applicationData = new uint8_t[applicationLength]; | |
| 64 | |
| 65 if (oldData) { | |
| 66 memcpy(applicationData, oldData, oldLength); | |
| 67 memcpy(applicationData + oldLength, data, copySize); | |
| 68 delete[] oldData; | |
| 69 } else { | |
| 70 memcpy(applicationData, data, copySize); | |
| 71 } | |
| 72 } | |
| 73 | 37 |
| 74 void RTCPPacketInformation::ResetNACKPacketIdArray() { | 38 void RTCPPacketInformation::ResetNACKPacketIdArray() { |
| 75 nackSequenceNumbers.clear(); | 39 nackSequenceNumbers.clear(); |
| 76 } | 40 } |
| 77 | 41 |
| 78 void RTCPPacketInformation::AddNACKPacket(const uint16_t packetID) { | 42 void RTCPPacketInformation::AddNACKPacket(const uint16_t packetID) { |
| 79 if (nackSequenceNumbers.size() >= kSendSideNackListSizeSanity) { | 43 if (nackSequenceNumbers.size() >= kSendSideNackListSizeSanity) { |
| 80 return; | 44 return; |
| 81 } | 45 } |
| 82 nackSequenceNumbers.push_back(packetID); | 46 nackSequenceNumbers.push_back(packetID); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 } | 92 } |
| 129 } | 93 } |
| 130 } | 94 } |
| 131 | 95 |
| 132 void RTCPReceiveInformation::ClearTmmbr() { | 96 void RTCPReceiveInformation::ClearTmmbr() { |
| 133 tmmbr_.clear(); | 97 tmmbr_.clear(); |
| 134 } | 98 } |
| 135 | 99 |
| 136 } // namespace RTCPHelp | 100 } // namespace RTCPHelp |
| 137 } // namespace webrtc | 101 } // namespace webrtc |
| OLD | NEW |