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 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1171 else if(freq == 32000) | 1171 else if(freq == 32000) |
1172 { | 1172 { |
1173 strcpy(codec_info_.plname, "L16"); | 1173 strcpy(codec_info_.plname, "L16"); |
1174 codec_info_.pltype = -1; | 1174 codec_info_.pltype = -1; |
1175 codec_info_.plfreq = 32000; | 1175 codec_info_.plfreq = 32000; |
1176 codec_info_.pacsize = 320; | 1176 codec_info_.pacsize = 320; |
1177 codec_info_.channels = 1; | 1177 codec_info_.channels = 1; |
1178 codec_info_.rate = 512000; | 1178 codec_info_.rate = 512000; |
1179 _codecId = kCodecL16_32Khz; | 1179 _codecId = kCodecL16_32Khz; |
1180 } | 1180 } |
| 1181 else if(freq == 48000) |
| 1182 { |
| 1183 strcpy(codec_info_.plname, "L16"); |
| 1184 codec_info_.pltype = -1; |
| 1185 codec_info_.plfreq = 48000; |
| 1186 codec_info_.pacsize = 480; |
| 1187 codec_info_.channels = 1; |
| 1188 codec_info_.rate = 768000; |
| 1189 _codecId = kCodecL16_48Khz; |
| 1190 } |
1181 | 1191 |
1182 // Readsize for 10ms of audio data (2 bytes per sample). | 1192 // Readsize for 10ms of audio data (2 bytes per sample). |
1183 _readSizeBytes = 2 * codec_info_. plfreq / 100; | 1193 _readSizeBytes = 2 * codec_info_. plfreq / 100; |
1184 if(_startPointInMs > 0) | 1194 if(_startPointInMs > 0) |
1185 { | 1195 { |
1186 while (_playoutPositionMs < _startPointInMs) | 1196 while (_playoutPositionMs < _startPointInMs) |
1187 { | 1197 { |
1188 read_len = pcm.Read(dummy, _readSizeBytes); | 1198 read_len = pcm.Read(dummy, _readSizeBytes); |
1189 if(read_len != static_cast<int>(_readSizeBytes)) | 1199 if(read_len != static_cast<int>(_readSizeBytes)) |
1190 { | 1200 { |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1306 { | 1316 { |
1307 strcpy(codec_info_.plname, "L16"); | 1317 strcpy(codec_info_.plname, "L16"); |
1308 codec_info_.pltype = -1; | 1318 codec_info_.pltype = -1; |
1309 codec_info_.plfreq = 32000; | 1319 codec_info_.plfreq = 32000; |
1310 codec_info_.pacsize = 320; | 1320 codec_info_.pacsize = 320; |
1311 codec_info_.channels = 1; | 1321 codec_info_.channels = 1; |
1312 codec_info_.rate = 512000; | 1322 codec_info_.rate = 512000; |
1313 | 1323 |
1314 _codecId = kCodecL16_32Khz; | 1324 _codecId = kCodecL16_32Khz; |
1315 } | 1325 } |
| 1326 else if(freq == 48000) |
| 1327 { |
| 1328 strcpy(codec_info_.plname, "L16"); |
| 1329 codec_info_.pltype = -1; |
| 1330 codec_info_.plfreq = 48000; |
| 1331 codec_info_.pacsize = 480; |
| 1332 codec_info_.channels = 1; |
| 1333 codec_info_.rate = 768000; |
| 1334 |
| 1335 _codecId = kCodecL16_48Khz; |
| 1336 } |
1316 if((_codecId != kCodecL16_8Khz) && | 1337 if((_codecId != kCodecL16_8Khz) && |
1317 (_codecId != kCodecL16_16kHz) && | 1338 (_codecId != kCodecL16_16kHz) && |
1318 (_codecId != kCodecL16_32Khz)) | 1339 (_codecId != kCodecL16_32Khz) && |
| 1340 (_codecId != kCodecL16_48Khz)) |
1319 { | 1341 { |
1320 WEBRTC_TRACE(kTraceError, kTraceFile, _id, | 1342 WEBRTC_TRACE(kTraceError, kTraceFile, _id, |
1321 "CodecInst is not 8KHz PCM or 16KHz PCM!"); | 1343 "CodecInst is not 8KHz, 16KHz, 32kHz or 48kHz PCM!"); |
1322 return -1; | 1344 return -1; |
1323 } | 1345 } |
1324 _writing = true; | 1346 _writing = true; |
1325 _bytesWritten = 0; | 1347 _bytesWritten = 0; |
1326 return 0; | 1348 return 0; |
1327 } | 1349 } |
1328 | 1350 |
1329 int32_t ModuleFileUtility::WritePCMData(OutStream& out, | 1351 int32_t ModuleFileUtility::WritePCMData(OutStream& out, |
1330 const int8_t* buffer, | 1352 const int8_t* buffer, |
1331 const size_t dataLength) | 1353 const size_t dataLength) |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1382 _codecId = kCodecL16_8Khz; | 1404 _codecId = kCodecL16_8Khz; |
1383 } | 1405 } |
1384 else if(codecInst.plfreq == 16000) | 1406 else if(codecInst.plfreq == 16000) |
1385 { | 1407 { |
1386 _codecId = kCodecL16_16kHz; | 1408 _codecId = kCodecL16_16kHz; |
1387 } | 1409 } |
1388 else if(codecInst.plfreq == 32000) | 1410 else if(codecInst.plfreq == 32000) |
1389 { | 1411 { |
1390 _codecId = kCodecL16_32Khz; | 1412 _codecId = kCodecL16_32Khz; |
1391 } | 1413 } |
| 1414 else if(codecInst.plfreq == 48000) |
| 1415 { |
| 1416 _codecId = kCodecL16_48Khz; |
| 1417 } |
1392 } | 1418 } |
1393 #ifdef WEBRTC_CODEC_ILBC | 1419 #ifdef WEBRTC_CODEC_ILBC |
1394 else if(STR_CASE_CMP(codecInst.plname, "ilbc") == 0) | 1420 else if(STR_CASE_CMP(codecInst.plname, "ilbc") == 0) |
1395 { | 1421 { |
1396 if(codecInst.pacsize == 160) | 1422 if(codecInst.pacsize == 160) |
1397 { | 1423 { |
1398 _codecId = kCodecIlbc20Ms; | 1424 _codecId = kCodecIlbc20Ms; |
1399 } | 1425 } |
1400 else if(codecInst.pacsize == 240) | 1426 else if(codecInst.pacsize == 240) |
1401 { | 1427 { |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1549 } | 1575 } |
1550 | 1576 |
1551 uint32_t ModuleFileUtility::PlayoutPositionMs() | 1577 uint32_t ModuleFileUtility::PlayoutPositionMs() |
1552 { | 1578 { |
1553 WEBRTC_TRACE(kTraceStream, kTraceFile, _id, | 1579 WEBRTC_TRACE(kTraceStream, kTraceFile, _id, |
1554 "ModuleFileUtility::PlayoutPosition()"); | 1580 "ModuleFileUtility::PlayoutPosition()"); |
1555 | 1581 |
1556 return _reading ? _playoutPositionMs : 0; | 1582 return _reading ? _playoutPositionMs : 0; |
1557 } | 1583 } |
1558 } // namespace webrtc | 1584 } // namespace webrtc |
OLD | NEW |