Correcting two nits in InputAudioFile
First, the fread function returns number of elements read, not necessarily the number of bytes. In this case, it is the number of samples. Second, a spelling mistake was corrected. R=tina.legrand@webrtc.org Review URL: https://webrtc-codereview.appspot.com/2161004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4658 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
8d32066073
commit
8fb89533af
@ -23,11 +23,11 @@ bool InputAudioFile::Read(size_t samples, int16_t* destination) {
|
||||
if (!fp_) {
|
||||
return false;
|
||||
}
|
||||
size_t bytes_read = fread(destination, sizeof(int16_t), samples, fp_);
|
||||
if (bytes_read < samples) {
|
||||
// Rewind and read the missing sampels.
|
||||
size_t samples_read = fread(destination, sizeof(int16_t), samples, fp_);
|
||||
if (samples_read < samples) {
|
||||
// Rewind and read the missing samples.
|
||||
rewind(fp_);
|
||||
size_t missing_samples = samples - bytes_read;
|
||||
size_t missing_samples = samples - samples_read;
|
||||
if (fread(destination, sizeof(int16_t), missing_samples, fp_) <
|
||||
missing_samples) {
|
||||
// Could not read enough even after rewinding the file.
|
||||
|
Loading…
x
Reference in New Issue
Block a user