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

Unified Diff: webrtc/modules/media_file/media_file_utility.cc

Issue 2790493004: Supporting 48kHz PCM file. (Closed)
Patch Set: Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/media_file/media_file_utility.cc
diff --git a/webrtc/modules/media_file/media_file_utility.cc b/webrtc/modules/media_file/media_file_utility.cc
index ae8d06f634054ef7738167840c6e9a2c45e33a7d..6c60b056b703e9db4bcf02ab82a9b9a00cd24f1a 100644
--- a/webrtc/modules/media_file/media_file_utility.cc
+++ b/webrtc/modules/media_file/media_file_utility.cc
@@ -1178,6 +1178,16 @@ int32_t ModuleFileUtility::InitPCMReading(InStream& pcm,
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;
@@ -1313,12 +1323,24 @@ int32_t ModuleFileUtility::InitPCMWriting(OutStream& out, uint32_t freq)
_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_32Khz) &&
+ (_codecId != kCodecL16_48Khz))
{
WEBRTC_TRACE(kTraceError, kTraceFile, _id,
- "CodecInst is not 8KHz PCM or 16KHz PCM!");
+ "CodecInst is not 8KHz, 16KHz, 32kHz or 48kHz PCM!");
return -1;
}
_writing = true;
@@ -1389,6 +1411,10 @@ int32_t ModuleFileUtility::set_codec_info(const CodecInst& codecInst)
{
_codecId = kCodecL16_32Khz;
}
+ else if(codecInst.plfreq == 48000)
+ {
+ _codecId = kCodecL16_48Khz;
+ }
}
#ifdef WEBRTC_CODEC_ILBC
else if(STR_CASE_CMP(codecInst.plname, "ilbc") == 0)

Powered by Google App Engine
This is Rietveld 408576698