Fix the crash at playing 48kHz stereo wav file.
http://code.google.com/p/webrtc/issues/detail?id=208 Review URL: https://webrtc-codereview.appspot.com/396001 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1681 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -233,8 +233,8 @@ public:
|
|||||||
WebRtc_Word32 codec_info(CodecInst& codecInst);
|
WebRtc_Word32 codec_info(CodecInst& codecInst);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Biggest WAV frame supported is 10 ms at 32kHz of 2 channel, 16 bit audio.
|
// Biggest WAV frame supported is 10 ms at 48kHz of 2 channel, 16 bit audio.
|
||||||
enum{WAV_MAX_BUFFER_SIZE = 320*2*2};
|
enum{WAV_MAX_BUFFER_SIZE = 480*2*2};
|
||||||
|
|
||||||
|
|
||||||
WebRtc_Word32 InitWavCodec(WebRtc_UWord32 samplesPerSec,
|
WebRtc_Word32 InitWavCodec(WebRtc_UWord32 samplesPerSec,
|
||||||
|
@ -2382,7 +2382,8 @@ void CWinTestDlg::OnBnClickedCheckPlayFileIn2()
|
|||||||
|
|
||||||
void CWinTestDlg::OnBnClickedCheckPlayFileOut1()
|
void CWinTestDlg::OnBnClickedCheckPlayFileOut1()
|
||||||
{
|
{
|
||||||
const FileFormats formats[7] = {{kFileFormatPcm16kHzFile},
|
const FileFormats formats[8] = {{kFileFormatPcm16kHzFile},
|
||||||
|
{kFileFormatWavFile},
|
||||||
{kFileFormatWavFile},
|
{kFileFormatWavFile},
|
||||||
{kFileFormatWavFile},
|
{kFileFormatWavFile},
|
||||||
{kFileFormatWavFile},
|
{kFileFormatWavFile},
|
||||||
@ -2390,14 +2391,14 @@ void CWinTestDlg::OnBnClickedCheckPlayFileOut1()
|
|||||||
{kFileFormatWavFile},
|
{kFileFormatWavFile},
|
||||||
{kFileFormatWavFile}};
|
{kFileFormatWavFile}};
|
||||||
// File path is relative to the location of 'voice_engine.gyp'.
|
// File path is relative to the location of 'voice_engine.gyp'.
|
||||||
const char spkrFiles[8][64] = {{"../test/data/voice_engine/audio_short16.pcm"},
|
const char spkrFiles[8][64] = {{"../../test/data/voice_engine/audio_short16.pcm"},
|
||||||
{"../test/data/voice_engine/audio_tiny8.wav"},
|
{"../../test/data/voice_engine/audio_tiny8.wav"},
|
||||||
{"../test/data/voice_engine/audio_tiny11.wav"},
|
{"../../test/data/voice_engine/audio_tiny11.wav"},
|
||||||
{"../test/data/voice_engine/audio_tiny16.wav"},
|
{"../../test/data/voice_engine/audio_tiny16.wav"},
|
||||||
{"../test/data/voice_engine/audio_tiny22.wav"},
|
{"../../test/data/voice_engine/audio_tiny22.wav"},
|
||||||
{"../test/data/voice_engine/audio_tiny32.wav"},
|
{"../../test/data/voice_engine/audio_tiny32.wav"},
|
||||||
{"../test/data/voice_engine/audio_tiny44.wav"},
|
{"../../test/data/voice_engine/audio_tiny44.wav"},
|
||||||
{"../test/data/voice_engine/audio_tiny48.wav"}};
|
{"../../test/data/voice_engine/audio_tiny48.wav"}};
|
||||||
int ret(0);
|
int ret(0);
|
||||||
int channel = GetDlgItemInt(IDC_EDIT_1);
|
int channel = GetDlgItemInt(IDC_EDIT_1);
|
||||||
CButton* button = (CButton*)GetDlgItem(IDC_CHECK_PLAY_FILE_OUT_1);
|
CButton* button = (CButton*)GetDlgItem(IDC_CHECK_PLAY_FILE_OUT_1);
|
||||||
@ -2409,11 +2410,11 @@ void CWinTestDlg::OnBnClickedCheckPlayFileOut1()
|
|||||||
const float volumeScaling(1.0);
|
const float volumeScaling(1.0);
|
||||||
const int startPointMs(0);
|
const int startPointMs(0);
|
||||||
const int stopPointMs(0);
|
const int stopPointMs(0);
|
||||||
const FileFormats format = formats[_checkPlayFileOut1 % 7];
|
const FileFormats format = formats[_checkPlayFileOut1 % 8];
|
||||||
const char* spkrFile = spkrFiles[_checkPlayFileOut1 % 7];
|
const char* spkrFile = spkrFiles[_checkPlayFileOut1 % 8];
|
||||||
|
|
||||||
CString str;
|
CString str;
|
||||||
if (_checkPlayFileOut1 % 7 == 0)
|
if (_checkPlayFileOut1 % 8 == 0)
|
||||||
{
|
{
|
||||||
str = _T("kFileFormatPcm16kHzFile");
|
str = _T("kFileFormatPcm16kHzFile");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user