Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: webrtc/voice_engine/file_player.cc

Issue 2791453004: Revert of Supporting 48kHz PCM file. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/voice_engine/file_player.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 } 93 }
94 // Make sure that sample rate is 8,16 or 32 kHz. E.g. WAVE files may have 94 // Make sure that sample rate is 8,16 or 32 kHz. E.g. WAVE files may have
95 // other sampling rates. 95 // other sampling rates.
96 if (_codec.plfreq == 11000) { 96 if (_codec.plfreq == 11000) {
97 return 16000; 97 return 16000;
98 } else if (_codec.plfreq == 22000) { 98 } else if (_codec.plfreq == 22000) {
99 return 32000; 99 return 32000;
100 } else if (_codec.plfreq == 44000) { 100 } else if (_codec.plfreq == 44000) {
101 return 32000; 101 return 32000;
102 } else if (_codec.plfreq == 48000) { 102 } else if (_codec.plfreq == 48000) {
103 return 48000; 103 return 32000;
104 } else { 104 } else {
105 return _codec.plfreq; 105 return _codec.plfreq;
106 } 106 }
107 } 107 }
108 108
109 int32_t FilePlayerImpl::AudioCodec(CodecInst* audioCodec) const { 109 int32_t FilePlayerImpl::AudioCodec(CodecInst* audioCodec) const {
110 *audioCodec = _codec; 110 *audioCodec = _codec;
111 return 0; 111 return 0;
112 } 112 }
113 113
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 _fileFormat == kFileFormatPcm32kHzFile) { 213 _fileFormat == kFileFormatPcm32kHzFile) {
214 CodecInst codecInstL16; 214 CodecInst codecInstL16;
215 strncpy(codecInstL16.plname, "L16", 32); 215 strncpy(codecInstL16.plname, "L16", 32);
216 codecInstL16.pltype = 93; 216 codecInstL16.pltype = 93;
217 codecInstL16.channels = 1; 217 codecInstL16.channels = 1;
218 218
219 if (_fileFormat == kFileFormatPcm8kHzFile) { 219 if (_fileFormat == kFileFormatPcm8kHzFile) {
220 codecInstL16.rate = 128000; 220 codecInstL16.rate = 128000;
221 codecInstL16.plfreq = 8000; 221 codecInstL16.plfreq = 8000;
222 codecInstL16.pacsize = 80; 222 codecInstL16.pacsize = 80;
223
223 } else if (_fileFormat == kFileFormatPcm16kHzFile) { 224 } else if (_fileFormat == kFileFormatPcm16kHzFile) {
224 codecInstL16.rate = 256000; 225 codecInstL16.rate = 256000;
225 codecInstL16.plfreq = 16000; 226 codecInstL16.plfreq = 16000;
226 codecInstL16.pacsize = 160; 227 codecInstL16.pacsize = 160;
228
227 } else if (_fileFormat == kFileFormatPcm32kHzFile) { 229 } else if (_fileFormat == kFileFormatPcm32kHzFile) {
228 codecInstL16.rate = 512000; 230 codecInstL16.rate = 512000;
229 codecInstL16.plfreq = 32000; 231 codecInstL16.plfreq = 32000;
230 codecInstL16.pacsize = 320; 232 codecInstL16.pacsize = 160;
231 } else if (_fileFormat == kFileFormatPcm48kHzFile) {
232 codecInstL16.rate = 768000;
233 codecInstL16.plfreq = 48000;
234 codecInstL16.pacsize = 480;
235 } else { 233 } else {
236 LOG(LS_ERROR) << "StartPlayingFile() sample frequency not " 234 LOG(LS_ERROR) << "StartPlayingFile() sample frequency not "
237 << "supported for PCM format."; 235 << "supported for PCM format.";
238 return -1; 236 return -1;
239 } 237 }
240 238
241 if (_fileModule.StartPlayingAudioFile(fileName, notification, loop, 239 if (_fileModule.StartPlayingAudioFile(fileName, notification, loop,
242 _fileFormat, &codecInstL16, 240 _fileFormat, &codecInstL16,
243 startPosition, stopPosition) == -1) { 241 startPosition, stopPosition) == -1) {
244 LOG(LS_WARNING) << "StartPlayingFile() failed to initialize " 242 LOG(LS_WARNING) << "StartPlayingFile() failed to initialize "
(...skipping 27 matching lines...) Expand all
272 } 270 }
273 271
274 int32_t FilePlayerImpl::StartPlayingFile(InStream* sourceStream, 272 int32_t FilePlayerImpl::StartPlayingFile(InStream* sourceStream,
275 uint32_t startPosition, 273 uint32_t startPosition,
276 float volumeScaling, 274 float volumeScaling,
277 uint32_t notification, 275 uint32_t notification,
278 uint32_t stopPosition, 276 uint32_t stopPosition,
279 const CodecInst* codecInst) { 277 const CodecInst* codecInst) {
280 if (_fileFormat == kFileFormatPcm16kHzFile || 278 if (_fileFormat == kFileFormatPcm16kHzFile ||
281 _fileFormat == kFileFormatPcm32kHzFile || 279 _fileFormat == kFileFormatPcm32kHzFile ||
282 _fileFormat == kFileFormatPcm8kHzFile || 280 _fileFormat == kFileFormatPcm8kHzFile) {
283 _fileFormat == kFileFormatPcm48kHzFile) {
284 CodecInst codecInstL16; 281 CodecInst codecInstL16;
285 strncpy(codecInstL16.plname, "L16", 32); 282 strncpy(codecInstL16.plname, "L16", 32);
286 codecInstL16.pltype = 93; 283 codecInstL16.pltype = 93;
287 codecInstL16.channels = 1; 284 codecInstL16.channels = 1;
288 285
289 if (_fileFormat == kFileFormatPcm8kHzFile) { 286 if (_fileFormat == kFileFormatPcm8kHzFile) {
290 codecInstL16.rate = 128000; 287 codecInstL16.rate = 128000;
291 codecInstL16.plfreq = 8000; 288 codecInstL16.plfreq = 8000;
292 codecInstL16.pacsize = 80; 289 codecInstL16.pacsize = 80;
290
293 } else if (_fileFormat == kFileFormatPcm16kHzFile) { 291 } else if (_fileFormat == kFileFormatPcm16kHzFile) {
294 codecInstL16.rate = 256000; 292 codecInstL16.rate = 256000;
295 codecInstL16.plfreq = 16000; 293 codecInstL16.plfreq = 16000;
296 codecInstL16.pacsize = 160; 294 codecInstL16.pacsize = 160;
295
297 } else if (_fileFormat == kFileFormatPcm32kHzFile) { 296 } else if (_fileFormat == kFileFormatPcm32kHzFile) {
298 codecInstL16.rate = 512000; 297 codecInstL16.rate = 512000;
299 codecInstL16.plfreq = 32000; 298 codecInstL16.plfreq = 32000;
300 codecInstL16.pacsize = 320; 299 codecInstL16.pacsize = 160;
301 } else if (_fileFormat == kFileFormatPcm48kHzFile) {
302 codecInstL16.rate = 768000;
303 codecInstL16.plfreq = 48000;
304 codecInstL16.pacsize = 480;
305 } else { 300 } else {
306 LOG(LS_ERROR) << "StartPlayingFile() sample frequency not " 301 LOG(LS_ERROR) << "StartPlayingFile() sample frequency not "
307 << "supported for PCM format."; 302 << "supported for PCM format.";
308 return -1; 303 return -1;
309 } 304 }
310 if (_fileModule.StartPlayingAudioStream( 305 if (_fileModule.StartPlayingAudioStream(
311 *sourceStream, notification, _fileFormat, &codecInstL16, 306 *sourceStream, notification, _fileFormat, &codecInstL16,
312 startPosition, stopPosition) == -1) { 307 startPosition, stopPosition) == -1) {
313 LOG(LS_ERROR) << "StartPlayingFile() failed to initialize stream " 308 LOG(LS_ERROR) << "StartPlayingFile() failed to initialize stream "
314 << "playout."; 309 << "playout.";
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 std::unique_ptr<FilePlayer> FilePlayer::CreateFilePlayer( 372 std::unique_ptr<FilePlayer> FilePlayer::CreateFilePlayer(
378 uint32_t instanceID, 373 uint32_t instanceID,
379 FileFormats fileFormat) { 374 FileFormats fileFormat) {
380 switch (fileFormat) { 375 switch (fileFormat) {
381 case kFileFormatWavFile: 376 case kFileFormatWavFile:
382 case kFileFormatCompressedFile: 377 case kFileFormatCompressedFile:
383 case kFileFormatPreencodedFile: 378 case kFileFormatPreencodedFile:
384 case kFileFormatPcm16kHzFile: 379 case kFileFormatPcm16kHzFile:
385 case kFileFormatPcm8kHzFile: 380 case kFileFormatPcm8kHzFile:
386 case kFileFormatPcm32kHzFile: 381 case kFileFormatPcm32kHzFile:
387 case kFileFormatPcm48kHzFile:
388 // audio formats 382 // audio formats
389 return std::unique_ptr<FilePlayer>( 383 return std::unique_ptr<FilePlayer>(
390 new FilePlayerImpl(instanceID, fileFormat)); 384 new FilePlayerImpl(instanceID, fileFormat));
391 default: 385 default:
392 assert(false); 386 assert(false);
393 return nullptr; 387 return nullptr;
394 } 388 }
395 } 389 }
396 390
397 } // namespace webrtc 391 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/voice_engine/file_player.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698