| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 int16_t ChooseCodec(CodecInst& codecInst) { | 104 int16_t ChooseCodec(CodecInst& codecInst) { |
| 105 | 105 |
| 106 PrintCodecs(); | 106 PrintCodecs(); |
| 107 //AudioCodingModule* tmpACM = AudioCodingModule::Create(0); | 107 //AudioCodingModule* tmpACM = AudioCodingModule::Create(0); |
| 108 uint8_t noCodec = AudioCodingModule::NumberOfCodecs(); | 108 uint8_t noCodec = AudioCodingModule::NumberOfCodecs(); |
| 109 int8_t codecID; | 109 int8_t codecID; |
| 110 bool outOfRange = false; | 110 bool outOfRange = false; |
| 111 char myStr[15] = ""; | 111 char myStr[15] = ""; |
| 112 do { | 112 do { |
| 113 printf("\nChoose a codec [0]: "); | 113 printf("\nChoose a codec [0]: "); |
| 114 EXPECT_TRUE(fgets(myStr, 10, stdin) != NULL); | 114 EXPECT_TRUE(fgets(myStr, 10, stdin) != nullptr); |
| 115 codecID = atoi(myStr); | 115 codecID = atoi(myStr); |
| 116 if ((codecID < 0) || (codecID >= noCodec)) { | 116 if ((codecID < 0) || (codecID >= noCodec)) { |
| 117 printf("\nOut of range.\n"); | 117 printf("\nOut of range.\n"); |
| 118 outOfRange = true; | 118 outOfRange = true; |
| 119 } | 119 } |
| 120 } while (outOfRange); | 120 } while (outOfRange); |
| 121 | 121 |
| 122 CHECK_ERROR(AudioCodingModule::Codec((uint8_t )codecID, &codecInst)); | 122 CHECK_ERROR(AudioCodingModule::Codec((uint8_t )codecID, &codecInst)); |
| 123 return 0; | 123 return 0; |
| 124 } | 124 } |
| 125 | 125 |
| 126 void PrintCodecs() { | 126 void PrintCodecs() { |
| 127 uint8_t noCodec = AudioCodingModule::NumberOfCodecs(); | 127 uint8_t noCodec = AudioCodingModule::NumberOfCodecs(); |
| 128 | 128 |
| 129 CodecInst codecInst; | 129 CodecInst codecInst; |
| 130 printf("No Name [Hz] [bps]\n"); | 130 printf("No Name [Hz] [bps]\n"); |
| 131 for (uint8_t codecCntr = 0; codecCntr < noCodec; codecCntr++) { | 131 for (uint8_t codecCntr = 0; codecCntr < noCodec; codecCntr++) { |
| 132 AudioCodingModule::Codec(codecCntr, &codecInst); | 132 AudioCodingModule::Codec(codecCntr, &codecInst); |
| 133 printf("%2d- %-18s %5d %6d\n", codecCntr, codecInst.plname, | 133 printf("%2d- %-18s %5d %6d\n", codecCntr, codecInst.plname, |
| 134 codecInst.plfreq, codecInst.rate); | 134 codecInst.plfreq, codecInst.rate); |
| 135 } | 135 } |
| 136 | 136 |
| 137 } | 137 } |
| 138 | 138 |
| 139 CircularBuffer::CircularBuffer(uint32_t len) | 139 CircularBuffer::CircularBuffer(uint32_t len) |
| 140 : _buff(NULL), | 140 : _buff(nullptr), |
| 141 _idx(0), | 141 _idx(0), |
| 142 _buffIsFull(false), | 142 _buffIsFull(false), |
| 143 _calcAvg(false), | 143 _calcAvg(false), |
| 144 _calcVar(false), | 144 _calcVar(false), |
| 145 _sum(0), | 145 _sum(0), |
| 146 _sumSqr(0) { | 146 _sumSqr(0) { |
| 147 _buff = new double[len]; | 147 _buff = new double[len]; |
| 148 if (_buff == NULL) { | 148 if (_buff == nullptr) { |
| 149 _buffLen = 0; | 149 _buffLen = 0; |
| 150 } else { | 150 } else { |
| 151 for (uint32_t n = 0; n < len; n++) { | 151 for (uint32_t n = 0; n < len; n++) { |
| 152 _buff[n] = 0; | 152 _buff[n] = 0; |
| 153 } | 153 } |
| 154 _buffLen = len; | 154 _buffLen = len; |
| 155 } | 155 } |
| 156 } | 156 } |
| 157 | 157 |
| 158 CircularBuffer::~CircularBuffer() { | 158 CircularBuffer::~CircularBuffer() { |
| 159 if (_buff != NULL) { | 159 if (_buff != nullptr) { |
| 160 delete[] _buff; | 160 delete[] _buff; |
| 161 _buff = NULL; | 161 _buff = nullptr; |
| 162 } | 162 } |
| 163 } | 163 } |
| 164 | 164 |
| 165 void CircularBuffer::Update(const double newVal) { | 165 void CircularBuffer::Update(const double newVal) { |
| 166 assert(_buffLen > 0); | 166 assert(_buffLen > 0); |
| 167 | 167 |
| 168 // store the value that is going to be overwritten | 168 // store the value that is going to be overwritten |
| 169 double oldVal = _buff[_idx]; | 169 double oldVal = _buff[_idx]; |
| 170 // record the new value | 170 // record the new value |
| 171 _buff[_idx] = newVal; | 171 _buff[_idx] = newVal; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 printf("kVideoFrameKey...... %d\n", _numFrameTypes[kVideoFrameKey]); | 293 printf("kVideoFrameKey...... %d\n", _numFrameTypes[kVideoFrameKey]); |
| 294 printf("kVideoFrameDelta.... %d\n", _numFrameTypes[kVideoFrameDelta]); | 294 printf("kVideoFrameDelta.... %d\n", _numFrameTypes[kVideoFrameDelta]); |
| 295 } | 295 } |
| 296 | 296 |
| 297 int32_t VADCallback::InFrameType(FrameType frame_type) { | 297 int32_t VADCallback::InFrameType(FrameType frame_type) { |
| 298 _numFrameTypes[frame_type]++; | 298 _numFrameTypes[frame_type]++; |
| 299 return 0; | 299 return 0; |
| 300 } | 300 } |
| 301 | 301 |
| 302 } // namespace webrtc | 302 } // namespace webrtc |
| OLD | NEW |