Revert of Supporting 48kHz PCM file. (patchset #1 id:1 of https://codereview.webrtc.org/2790493004/ )
Reason for revert:
broke internal project
Original issue's description:
> Supporting 48kHz PCM file.
>
> BUG=None
>
> Review-Url: https://codereview.webrtc.org/2790493004
> Cr-Commit-Position: refs/heads/master@{#17493}
> Committed: https://chromium.googlesource.com/external/webrtc/+/5f93709e7c65faa9616f09368a92d47087b778f5
TBR=niklas.enbom@webrtc.org,solenberg@webrtc.org,minyue@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=None
Review-Url: https://codereview.webrtc.org/2791453004
Cr-Original-Commit-Position: refs/heads/master@{#17496}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: bc436ede076cff1b1c12045c3bf0bb9b9a1c0e24
diff --git a/common_types.h b/common_types.h
index cbad3b8..e1a4c77 100644
--- a/common_types.h
+++ b/common_types.h
@@ -139,8 +139,7 @@
kFileFormatPreencodedFile = 4,
kFileFormatPcm16kHzFile = 7,
kFileFormatPcm8kHzFile = 8,
- kFileFormatPcm32kHzFile = 9,
- kFileFormatPcm48kHzFile = 10
+ kFileFormatPcm32kHzFile = 9
};
enum FrameType {
diff --git a/modules/media_file/media_file_impl.cc b/modules/media_file/media_file_impl.cc
index 88310a5..e35626c 100644
--- a/modules/media_file/media_file_impl.cc
+++ b/modules/media_file/media_file_impl.cc
@@ -132,7 +132,6 @@
switch(_fileFormat)
{
- case kFileFormatPcm48kHzFile:
case kFileFormatPcm32kHzFile:
case kFileFormatPcm16kHzFile:
case kFileFormatPcm8kHzFile:
@@ -480,7 +479,6 @@
case kFileFormatPcm8kHzFile:
case kFileFormatPcm16kHzFile:
case kFileFormatPcm32kHzFile:
- case kFileFormatPcm48kHzFile:
{
// ValidFileFormat() called in the beginneing of this function
// prevents codecInst from being NULL here.
@@ -633,7 +631,6 @@
case kFileFormatPcm8kHzFile:
case kFileFormatPcm16kHzFile:
case kFileFormatPcm32kHzFile:
- case kFileFormatPcm48kHzFile:
bytesWritten = _ptrFileUtilityObj->WritePCMData(
*_ptrOutStream,
buffer,
@@ -848,15 +845,13 @@
}
case kFileFormatPcm8kHzFile:
case kFileFormatPcm16kHzFile:
- case kFileFormatPcm32kHzFile:
- case kFileFormatPcm48kHzFile:
{
if(!ValidFrequency(codecInst.plfreq) ||
_ptrFileUtilityObj->InitPCMWriting(stream, codecInst.plfreq) ==
-1)
{
WEBRTC_TRACE(kTraceError, kTraceFile, _id,
- "Failed to initialize PCM file!");
+ "Failed to initialize 8 or 16KHz PCM file!");
delete _ptrFileUtilityObj;
_ptrFileUtilityObj = NULL;
return -1;
@@ -1075,8 +1070,7 @@
if(format == kFileFormatPreencodedFile ||
format == kFileFormatPcm8kHzFile ||
format == kFileFormatPcm16kHzFile ||
- format == kFileFormatPcm32kHzFile ||
- format == kFileFormatPcm48kHzFile)
+ format == kFileFormatPcm32kHzFile)
{
WEBRTC_TRACE(kTraceError, kTraceFile, -1,
"Codec info required for file format specified!");
@@ -1121,12 +1115,12 @@
bool MediaFileImpl::ValidFrequency(const uint32_t frequency)
{
- if((frequency == 8000) || (frequency == 16000)|| (frequency == 32000) || (frequency == 48000))
+ if((frequency == 8000) || (frequency == 16000)|| (frequency == 32000))
{
return true;
}
WEBRTC_TRACE(kTraceError, kTraceFile, -1,
- "Frequency should be 8000, 16000, 32000, or 48000 (Hz)");
+ "Frequency should be 8000, 16000 or 32000 (Hz)");
return false;
}
} // namespace webrtc
diff --git a/modules/media_file/media_file_utility.cc b/modules/media_file/media_file_utility.cc
index 6c60b05..ae8d06f 100644
--- a/modules/media_file/media_file_utility.cc
+++ b/modules/media_file/media_file_utility.cc
@@ -1178,16 +1178,6 @@
codec_info_.rate = 512000;
_codecId = kCodecL16_32Khz;
}
- else if(freq == 48000)
- {
- strcpy(codec_info_.plname, "L16");
- codec_info_.pltype = -1;
- codec_info_.plfreq = 48000;
- codec_info_.pacsize = 480;
- codec_info_.channels = 1;
- codec_info_.rate = 768000;
- _codecId = kCodecL16_48Khz;
- }
// Readsize for 10ms of audio data (2 bytes per sample).
_readSizeBytes = 2 * codec_info_. plfreq / 100;
@@ -1323,24 +1313,12 @@
_codecId = kCodecL16_32Khz;
}
- else if(freq == 48000)
- {
- strcpy(codec_info_.plname, "L16");
- codec_info_.pltype = -1;
- codec_info_.plfreq = 48000;
- codec_info_.pacsize = 480;
- codec_info_.channels = 1;
- codec_info_.rate = 768000;
-
- _codecId = kCodecL16_48Khz;
- }
if((_codecId != kCodecL16_8Khz) &&
(_codecId != kCodecL16_16kHz) &&
- (_codecId != kCodecL16_32Khz) &&
- (_codecId != kCodecL16_48Khz))
+ (_codecId != kCodecL16_32Khz))
{
WEBRTC_TRACE(kTraceError, kTraceFile, _id,
- "CodecInst is not 8KHz, 16KHz, 32kHz or 48kHz PCM!");
+ "CodecInst is not 8KHz PCM or 16KHz PCM!");
return -1;
}
_writing = true;
@@ -1411,10 +1389,6 @@
{
_codecId = kCodecL16_32Khz;
}
- else if(codecInst.plfreq == 48000)
- {
- _codecId = kCodecL16_48Khz;
- }
}
#ifdef WEBRTC_CODEC_ILBC
else if(STR_CASE_CMP(codecInst.plname, "ilbc") == 0)
diff --git a/modules/media_file/media_file_utility.h b/modules/media_file/media_file_utility.h
index 659ddd0..52cd807 100644
--- a/modules/media_file/media_file_utility.h
+++ b/modules/media_file/media_file_utility.h
@@ -228,7 +228,6 @@
kCodecL16_8Khz,
kCodecL16_16kHz,
kCodecL16_32Khz,
- kCodecL16_48Khz,
kCodecPcmu,
kCodecPcma,
kCodecIlbc20Ms,
diff --git a/voice_engine/file_player.cc b/voice_engine/file_player.cc
index 81ba34f..4ee1322 100644
--- a/voice_engine/file_player.cc
+++ b/voice_engine/file_player.cc
@@ -100,7 +100,7 @@
} else if (_codec.plfreq == 44000) {
return 32000;
} else if (_codec.plfreq == 48000) {
- return 48000;
+ return 32000;
} else {
return _codec.plfreq;
}
@@ -220,18 +220,16 @@
codecInstL16.rate = 128000;
codecInstL16.plfreq = 8000;
codecInstL16.pacsize = 80;
+
} else if (_fileFormat == kFileFormatPcm16kHzFile) {
codecInstL16.rate = 256000;
codecInstL16.plfreq = 16000;
codecInstL16.pacsize = 160;
+
} else if (_fileFormat == kFileFormatPcm32kHzFile) {
codecInstL16.rate = 512000;
codecInstL16.plfreq = 32000;
- codecInstL16.pacsize = 320;
- } else if (_fileFormat == kFileFormatPcm48kHzFile) {
- codecInstL16.rate = 768000;
- codecInstL16.plfreq = 48000;
- codecInstL16.pacsize = 480;
+ codecInstL16.pacsize = 160;
} else {
LOG(LS_ERROR) << "StartPlayingFile() sample frequency not "
<< "supported for PCM format.";
@@ -279,8 +277,7 @@
const CodecInst* codecInst) {
if (_fileFormat == kFileFormatPcm16kHzFile ||
_fileFormat == kFileFormatPcm32kHzFile ||
- _fileFormat == kFileFormatPcm8kHzFile ||
- _fileFormat == kFileFormatPcm48kHzFile) {
+ _fileFormat == kFileFormatPcm8kHzFile) {
CodecInst codecInstL16;
strncpy(codecInstL16.plname, "L16", 32);
codecInstL16.pltype = 93;
@@ -290,18 +287,16 @@
codecInstL16.rate = 128000;
codecInstL16.plfreq = 8000;
codecInstL16.pacsize = 80;
+
} else if (_fileFormat == kFileFormatPcm16kHzFile) {
codecInstL16.rate = 256000;
codecInstL16.plfreq = 16000;
codecInstL16.pacsize = 160;
+
} else if (_fileFormat == kFileFormatPcm32kHzFile) {
codecInstL16.rate = 512000;
codecInstL16.plfreq = 32000;
- codecInstL16.pacsize = 320;
- } else if (_fileFormat == kFileFormatPcm48kHzFile) {
- codecInstL16.rate = 768000;
- codecInstL16.plfreq = 48000;
- codecInstL16.pacsize = 480;
+ codecInstL16.pacsize = 160;
} else {
LOG(LS_ERROR) << "StartPlayingFile() sample frequency not "
<< "supported for PCM format.";
@@ -384,7 +379,6 @@
case kFileFormatPcm16kHzFile:
case kFileFormatPcm8kHzFile:
case kFileFormatPcm32kHzFile:
- case kFileFormatPcm48kHzFile:
// audio formats
return std::unique_ptr<FilePlayer>(
new FilePlayerImpl(instanceID, fileFormat));
diff --git a/voice_engine/file_player.h b/voice_engine/file_player.h
index 1a321f6..956016f 100644
--- a/voice_engine/file_player.h
+++ b/voice_engine/file_player.h
@@ -23,8 +23,8 @@
class FilePlayer {
public:
- // The largest decoded frame size in samples (120ms with 48kHz sample rate).
- enum { MAX_AUDIO_BUFFER_IN_SAMPLES = 120 * 48 };
+ // The largest decoded frame size in samples (60ms with 32kHz sample rate).
+ enum { MAX_AUDIO_BUFFER_IN_SAMPLES = 60 * 32 };
enum { MAX_AUDIO_BUFFER_IN_BYTES = MAX_AUDIO_BUFFER_IN_SAMPLES * 2 };
// Note: will return NULL for unsupported formats.