| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 samples_10ms_(160), | 39 samples_10ms_(160), |
| 40 frequency_(16000), | 40 frequency_(16000), |
| 41 end_of_file_(false), | 41 end_of_file_(false), |
| 42 auto_rewind_(false), | 42 auto_rewind_(false), |
| 43 rewinded_(false), | 43 rewinded_(false), |
| 44 read_stereo_(false), | 44 read_stereo_(false), |
| 45 save_stereo_(false) { | 45 save_stereo_(false) { |
| 46 timestamp_ = timestamp; | 46 timestamp_ = timestamp; |
| 47 } | 47 } |
| 48 | 48 |
| 49 PCMFile::~PCMFile() { |
| 50 if (pcm_file_) { |
| 51 fclose(pcm_file_); |
| 52 } |
| 53 } |
| 54 |
| 49 int16_t PCMFile::ChooseFile(std::string* file_name, int16_t max_len, | 55 int16_t PCMFile::ChooseFile(std::string* file_name, int16_t max_len, |
| 50 uint16_t* frequency_hz) { | 56 uint16_t* frequency_hz) { |
| 51 char tmp_name[MAX_FILE_NAME_LENGTH_BYTE]; | 57 char tmp_name[MAX_FILE_NAME_LENGTH_BYTE]; |
| 52 | 58 |
| 53 EXPECT_TRUE(fgets(tmp_name, MAX_FILE_NAME_LENGTH_BYTE, stdin) != NULL); | 59 EXPECT_TRUE(fgets(tmp_name, MAX_FILE_NAME_LENGTH_BYTE, stdin) != NULL); |
| 54 tmp_name[MAX_FILE_NAME_LENGTH_BYTE - 1] = '\0'; | 60 tmp_name[MAX_FILE_NAME_LENGTH_BYTE - 1] = '\0'; |
| 55 int16_t n = 0; | 61 int16_t n = 0; |
| 56 | 62 |
| 57 // Removing trailing spaces. | 63 // Removing trailing spaces. |
| 58 while ((isspace(tmp_name[n]) || iscntrl(tmp_name[n])) && (tmp_name[n] != 0) | 64 while ((isspace(tmp_name[n]) || iscntrl(tmp_name[n])) && (tmp_name[n] != 0) |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 218 |
| 213 void PCMFile::ReadStereo(bool is_stereo) { | 219 void PCMFile::ReadStereo(bool is_stereo) { |
| 214 read_stereo_ = is_stereo; | 220 read_stereo_ = is_stereo; |
| 215 } | 221 } |
| 216 | 222 |
| 217 void PCMFile::SetNum10MsBlocksToRead(int value) { | 223 void PCMFile::SetNum10MsBlocksToRead(int value) { |
| 218 num_10ms_blocks_to_read_ = rtc::Optional<int>(value); | 224 num_10ms_blocks_to_read_ = rtc::Optional<int>(value); |
| 219 } | 225 } |
| 220 | 226 |
| 221 } // namespace webrtc | 227 } // namespace webrtc |
| OLD | NEW |