| 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 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 } | 43 } |
| 44 if (frameType == kEmptyFrame) { | 44 if (frameType == kEmptyFrame) { |
| 45 // When frame is empty, we should not transmit it. The frame size of the | 45 // When frame is empty, we should not transmit it. The frame size of the |
| 46 // next non-empty frame will be based on the previous frame size. | 46 // next non-empty frame will be based on the previous frame size. |
| 47 _useLastFrameSize = _lastFrameSizeSample > 0; | 47 _useLastFrameSize = _lastFrameSizeSample > 0; |
| 48 return 0; | 48 return 0; |
| 49 } | 49 } |
| 50 | 50 |
| 51 rtpInfo.type.Audio.channel = 1; | 51 rtpInfo.type.Audio.channel = 1; |
| 52 // Treat fragmentation separately | 52 // Treat fragmentation separately |
| 53 if (fragmentation != NULL) { | 53 if (fragmentation != nullptr) { |
| 54 // If silence for too long, send only new data. | 54 // If silence for too long, send only new data. |
| 55 if ((fragmentation->fragmentationVectorSize == 2) && | 55 if ((fragmentation->fragmentationVectorSize == 2) && |
| 56 (fragmentation->fragmentationTimeDiff[1] <= 0x3fff)) { | 56 (fragmentation->fragmentationTimeDiff[1] <= 0x3fff)) { |
| 57 // only 0x80 if we have multiple blocks | 57 // only 0x80 if we have multiple blocks |
| 58 _payloadData[0] = 0x80 + fragmentation->fragmentationPlType[1]; | 58 _payloadData[0] = 0x80 + fragmentation->fragmentationPlType[1]; |
| 59 size_t REDheader = (fragmentation->fragmentationTimeDiff[1] << 10) + | 59 size_t REDheader = (fragmentation->fragmentationTimeDiff[1] << 10) + |
| 60 fragmentation->fragmentationLength[1]; | 60 fragmentation->fragmentationLength[1]; |
| 61 _payloadData[1] = uint8_t((REDheader >> 16) & 0x000000FF); | 61 _payloadData[1] = uint8_t((REDheader >> 16) & 0x000000FF); |
| 62 _payloadData[2] = uint8_t((REDheader >> 8) & 0x000000FF); | 62 _payloadData[2] = uint8_t((REDheader >> 8) & 0x000000FF); |
| 63 _payloadData[3] = uint8_t(REDheader & 0x000000FF); | 63 _payloadData[3] = uint8_t(REDheader & 0x000000FF); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 for (n = 0; n < MAX_NUM_PAYLOADS; n++) { | 137 for (n = 0; n < MAX_NUM_PAYLOADS; n++) { |
| 138 if (_lastPayloadType == _payloadStats[n].payloadType) { | 138 if (_lastPayloadType == _payloadStats[n].payloadType) { |
| 139 _payloadStats[n].newPacket = true; | 139 _payloadStats[n].newPacket = true; |
| 140 break; | 140 break; |
| 141 } | 141 } |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 _lastPayloadType = rtpInfo.header.payloadType; | 144 _lastPayloadType = rtpInfo.header.payloadType; |
| 145 | 145 |
| 146 bool newPayload = true; | 146 bool newPayload = true; |
| 147 ACMTestPayloadStats* currentPayloadStr = NULL; | 147 ACMTestPayloadStats* currentPayloadStr = nullptr; |
| 148 for (n = 0; n < MAX_NUM_PAYLOADS; n++) { | 148 for (n = 0; n < MAX_NUM_PAYLOADS; n++) { |
| 149 if (rtpInfo.header.payloadType == _payloadStats[n].payloadType) { | 149 if (rtpInfo.header.payloadType == _payloadStats[n].payloadType) { |
| 150 newPayload = false; | 150 newPayload = false; |
| 151 currentPayloadStr = &_payloadStats[n]; | 151 currentPayloadStr = &_payloadStats[n]; |
| 152 break; | 152 break; |
| 153 } | 153 } |
| 154 } | 154 } |
| 155 | 155 |
| 156 if (!newPayload) { | 156 if (!newPayload) { |
| 157 if (!currentPayloadStr->newPacket) { | 157 if (!currentPayloadStr->newPacket) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 _payloadStats[n].newPacket = false; | 215 _payloadStats[n].newPacket = false; |
| 216 _payloadStats[n].lastPayloadLenByte = payloadSize; | 216 _payloadStats[n].lastPayloadLenByte = payloadSize; |
| 217 _payloadStats[n].lastTimestamp = rtpInfo.header.timestamp; | 217 _payloadStats[n].lastTimestamp = rtpInfo.header.timestamp; |
| 218 _payloadStats[n].payloadType = rtpInfo.header.payloadType; | 218 _payloadStats[n].payloadType = rtpInfo.header.payloadType; |
| 219 memset(_payloadStats[n].frameSizeStats, 0, MAX_NUM_FRAMESIZES * | 219 memset(_payloadStats[n].frameSizeStats, 0, MAX_NUM_FRAMESIZES * |
| 220 sizeof(ACMTestFrameSizeStats)); | 220 sizeof(ACMTestFrameSizeStats)); |
| 221 } | 221 } |
| 222 } | 222 } |
| 223 | 223 |
| 224 Channel::Channel(int16_t chID) | 224 Channel::Channel(int16_t chID) |
| 225 : _receiverACM(NULL), | 225 : _receiverACM(nullptr), |
| 226 _seqNo(0), | 226 _seqNo(0), |
| 227 _bitStreamFile(NULL), | 227 _bitStreamFile(nullptr), |
| 228 _saveBitStream(false), | 228 _saveBitStream(false), |
| 229 _lastPayloadType(-1), | 229 _lastPayloadType(-1), |
| 230 _isStereo(false), | 230 _isStereo(false), |
| 231 _leftChannel(true), | 231 _leftChannel(true), |
| 232 _lastInTimestamp(0), | 232 _lastInTimestamp(0), |
| 233 _useLastFrameSize(false), | 233 _useLastFrameSize(false), |
| 234 _lastFrameSizeSample(0), | 234 _lastFrameSizeSample(0), |
| 235 _packetLoss(0), | 235 _packetLoss(0), |
| 236 _useFECTestWithPacketLoss(false), | 236 _useFECTestWithPacketLoss(false), |
| 237 _beginTime(rtc::TimeMillis()), | 237 _beginTime(rtc::TimeMillis()), |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 double Channel::BitRate() { | 412 double Channel::BitRate() { |
| 413 double rate; | 413 double rate; |
| 414 uint64_t currTime = rtc::TimeMillis(); | 414 uint64_t currTime = rtc::TimeMillis(); |
| 415 _channelCritSect.Enter(); | 415 _channelCritSect.Enter(); |
| 416 rate = ((double) _totalBytes * 8.0) / (double) (currTime - _beginTime); | 416 rate = ((double) _totalBytes * 8.0) / (double) (currTime - _beginTime); |
| 417 _channelCritSect.Leave(); | 417 _channelCritSect.Leave(); |
| 418 return rate; | 418 return rate; |
| 419 } | 419 } |
| 420 | 420 |
| 421 } // namespace webrtc | 421 } // namespace webrtc |
| OLD | NEW |