Fix wrong data type in ReadWavHeader

BUG=409
TEST=media file unit test
Review URL: https://webrtc-codereview.appspot.com/474001

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1980 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
leozwang@webrtc.org 2012-04-03 15:11:01 +00:00
parent 4365d9881d
commit 0dc8efe6e6
2 changed files with 36 additions and 7 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@ -8,10 +8,39 @@
* be found in the AUTHORS file in the root of the source tree.
*/
/*
* Empty test just to get code coverage metrics for this dir.
*/
#include "media_file.h"
#include "gtest/gtest.h"
#include "modules/media_file/interface/media_file.h"
#include "testsupport/fileutils.h"
#include "voice_engine/main/source/voice_engine_defines.h" // defines SLEEP
TEST(MediaFileTest, EmptyTestToGetCodeCoverage) {}
class MediaFileTest : public testing::Test {
protected:
void SetUp() {
// Use number 0 as the the identifier and pass to CreateMediaFile.
media_file_ = webrtc::MediaFile::CreateMediaFile(0);
ASSERT_TRUE(media_file_ != NULL);
}
void TearDown() {
webrtc::MediaFile::DestroyMediaFile(media_file_);
media_file_ = NULL;
}
webrtc::MediaFile* media_file_;
};
TEST_F(MediaFileTest, StartPlayingAudioFileWithoutError) {
// TODO(leozwang): Use hard coded filename here, we want to
// loop through all audio files in future
const std::string audio_file = webrtc::test::ProjectRootPath() +
"test/data/voice_engine/audio_tiny48.wav";
ASSERT_EQ(0, media_file_->StartPlayingAudioFile(
audio_file.c_str(),
0,
false,
webrtc::kFileFormatWavFile));
ASSERT_EQ(true, media_file_->IsPlaying());
SLEEP(1);
ASSERT_EQ(0, media_file_->StopPlaying());
}

View File

@ -446,7 +446,7 @@ WebRtc_Word32 ModuleFileUtility::ReadWavHeader(InStream& wav)
WAVE_CHUNK_header CHUNKheaderObj;
// TODO (hellner): tmpStr and tmpStr2 seems unnecessary here.
char tmpStr[6] = "FOUR";
char tmpStr2[4];
unsigned char tmpStr2[4];
WebRtc_Word32 i, len;
bool dataFound = false;
bool fmtFound = false;