Supporting 48kHz PCM file.
BUG=None
Review-Url: https://codereview.webrtc.org/2790493004
Cr-Commit-Position: refs/heads/master@{#17493}
diff --git a/webrtc/modules/media_file/media_file_impl.cc b/webrtc/modules/media_file/media_file_impl.cc
index e35626c..88310a5 100644
--- a/webrtc/modules/media_file/media_file_impl.cc
+++ b/webrtc/modules/media_file/media_file_impl.cc
@@ -132,6 +132,7 @@
switch(_fileFormat)
{
+ case kFileFormatPcm48kHzFile:
case kFileFormatPcm32kHzFile:
case kFileFormatPcm16kHzFile:
case kFileFormatPcm8kHzFile:
@@ -479,6 +480,7 @@
case kFileFormatPcm8kHzFile:
case kFileFormatPcm16kHzFile:
case kFileFormatPcm32kHzFile:
+ case kFileFormatPcm48kHzFile:
{
// ValidFileFormat() called in the beginneing of this function
// prevents codecInst from being NULL here.
@@ -631,6 +633,7 @@
case kFileFormatPcm8kHzFile:
case kFileFormatPcm16kHzFile:
case kFileFormatPcm32kHzFile:
+ case kFileFormatPcm48kHzFile:
bytesWritten = _ptrFileUtilityObj->WritePCMData(
*_ptrOutStream,
buffer,
@@ -845,13 +848,15 @@
}
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 8 or 16KHz PCM file!");
+ "Failed to initialize PCM file!");
delete _ptrFileUtilityObj;
_ptrFileUtilityObj = NULL;
return -1;
@@ -1070,7 +1075,8 @@
if(format == kFileFormatPreencodedFile ||
format == kFileFormatPcm8kHzFile ||
format == kFileFormatPcm16kHzFile ||
- format == kFileFormatPcm32kHzFile)
+ format == kFileFormatPcm32kHzFile ||
+ format == kFileFormatPcm48kHzFile)
{
WEBRTC_TRACE(kTraceError, kTraceFile, -1,
"Codec info required for file format specified!");
@@ -1115,12 +1121,12 @@
bool MediaFileImpl::ValidFrequency(const uint32_t frequency)
{
- if((frequency == 8000) || (frequency == 16000)|| (frequency == 32000))
+ if((frequency == 8000) || (frequency == 16000)|| (frequency == 32000) || (frequency == 48000))
{
return true;
}
WEBRTC_TRACE(kTraceError, kTraceFile, -1,
- "Frequency should be 8000, 16000 or 32000 (Hz)");
+ "Frequency should be 8000, 16000, 32000, or 48000 (Hz)");
return false;
}
} // namespace webrtc