Add support to 96kHz sampling rate to Windows CoreAudio interface.

Review URL: http://webrtc-codereview.appspot.com/295003

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1018 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
braveyao@webrtc.org 2011-11-25 02:45:39 +00:00
parent 2740f66d22
commit 0a18522e1b
3 changed files with 10 additions and 9 deletions

View File

@ -393,7 +393,7 @@ WebRtc_Word32 AudioDeviceBuffer::StopOutputFileRecording()
// Examples:
//
// 16-bit,48kHz mono, 10ms => nSamples=480 => _recSize=2*480=960 bytes
// 16-bit,48kHz stereo,10ms => nSamples=480 => _recSize=4*960=1920 bytes
// 16-bit,48kHz stereo,10ms => nSamples=480 => _recSize=4*480=1920 bytes
// ----------------------------------------------------------------------------
WebRtc_Word32 AudioDeviceBuffer::SetRecordedBuffer(const WebRtc_Word8* audioBuffer, WebRtc_UWord32 nSamples)
@ -408,7 +408,7 @@ WebRtc_Word32 AudioDeviceBuffer::SetRecordedBuffer(const WebRtc_Word8* audioBuff
_recSamples = nSamples;
_recSize = _recBytesPerSample*nSamples; // {2,4}*nSamples
if (_recSize > 1920)
if (_recSize > kMaxBufferSizeBytes)
{
assert(false);
return -1;
@ -535,7 +535,7 @@ WebRtc_Word32 AudioDeviceBuffer::RequestPlayoutData(WebRtc_UWord32 nSamples)
_playSamples = nSamples;
_playSize = _playBytesPerSample * nSamples; // {2,4}*nSamples
if (_playSize > 1920)
if (_playSize > kMaxBufferSizeBytes)
{
assert(false);
return -1;

View File

@ -21,6 +21,7 @@ namespace webrtc {
class CriticalSectionWrapper;
const WebRtc_UWord32 kPulsePeriodMs = 1000;
const WebRtc_UWord32 kMaxBufferSizeBytes = 3840; // 10ms in stereo @ 96kHz
class AudioDeviceObserver;
class MediaFile;
@ -86,15 +87,15 @@ private:
WebRtc_UWord8 _recBytesPerSample;
WebRtc_UWord8 _playBytesPerSample;
// 10ms in stereo @ 48kHz
WebRtc_Word8 _recBuffer[1920];
// 10ms in stereo @ 96kHz
WebRtc_Word8 _recBuffer[kMaxBufferSizeBytes];
// one sample <=> 2 or 4 bytes
WebRtc_UWord32 _recSamples;
WebRtc_UWord32 _recSize; // in bytes
// 10ms in stereo @ 48kHz
WebRtc_Word8 _playBuffer[1920];
// 10ms in stereo @ 96kHz
WebRtc_Word8 _playBuffer[kMaxBufferSizeBytes];
// one sample <=> 2 or 4 bytes
WebRtc_UWord32 _playSamples;

View File

@ -3108,8 +3108,8 @@ void CWinTestDlg::OnBnClickedCheckNs1()
void CWinTestDlg::OnBnClickedCheckPlayFileIn()
{
// File path is relative to the location of 'voice_engine.gyp'.
const char micFile[] = "../test/data/voice_engine/audio_short16.pcm";
// const char micFile[] = "../test/data/voice_engine/audio_long16noise.pcm";
const char micFile[] = "../../test/data/voice_engine/audio_short16.pcm";
// const char micFile[] = "../../test/data/voice_engine/audio_long16noise.pcm";
int ret(0);
int channel(-1);