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