| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 113 |
| 114 // Parse turns. | 114 // Parse turns. |
| 115 for (size_t turn_index = 0; turn_index < number_of_turns; ++turn_index) { | 115 for (size_t turn_index = 0; turn_index < number_of_turns; ++turn_index) { |
| 116 const Turn& turn = timing_[turn_index]; | 116 const Turn& turn = timing_[turn_index]; |
| 117 auto it = audiotrack_readers_.find(turn.audiotrack_file_name); | 117 auto it = audiotrack_readers_.find(turn.audiotrack_file_name); |
| 118 RTC_CHECK(it != audiotrack_readers_.end()) | 118 RTC_CHECK(it != audiotrack_readers_.end()) |
| 119 << "Audio track reader not created"; | 119 << "Audio track reader not created"; |
| 120 | 120 |
| 121 // Begin and end timestamps for the current turn. | 121 // Begin and end timestamps for the current turn. |
| 122 int offset_samples = millisecond_to_samples( | 122 int offset_samples = millisecond_to_samples( |
| 123 turn.offset, it->second->sample_rate()); | 123 turn.offset, it->second->SampleRate()); |
| 124 size_t begin_timestamp = last_turn.end + offset_samples; | 124 std::size_t begin_timestamp = last_turn.end + offset_samples; |
| 125 size_t end_timestamp = begin_timestamp + it->second->num_samples(); | 125 std::size_t end_timestamp = begin_timestamp + it->second->NumSamples(); |
| 126 LOG(LS_INFO) << "turn #" << turn_index << " " << begin_timestamp | 126 LOG(LS_INFO) << "turn #" << turn_index << " " << begin_timestamp |
| 127 << "-" << end_timestamp << " ms"; | 127 << "-" << end_timestamp << " ms"; |
| 128 | 128 |
| 129 // The order is invalid if the offset is negative and its absolute value is | 129 // The order is invalid if the offset is negative and its absolute value is |
| 130 // larger then the duration of the previous turn. | 130 // larger then the duration of the previous turn. |
| 131 if (offset_samples < 0 && -offset_samples > static_cast<int>( | 131 if (offset_samples < 0 && -offset_samples > static_cast<int>( |
| 132 last_turn.end - last_turn.begin)) { | 132 last_turn.end - last_turn.begin)) { |
| 133 LOG(LS_ERROR) << "invalid order"; | 133 LOG(LS_ERROR) << "invalid order"; |
| 134 return false; | 134 return false; |
| 135 } | 135 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 return false; | 186 return false; |
| 187 } | 187 } |
| 188 } | 188 } |
| 189 | 189 |
| 190 return true; | 190 return true; |
| 191 } | 191 } |
| 192 | 192 |
| 193 } // namespace conversational_speech | 193 } // namespace conversational_speech |
| 194 } // namespace test | 194 } // namespace test |
| 195 } // namespace webrtc | 195 } // namespace webrtc |
| OLD | NEW |