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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 std::string audiotrack_file_name; | 43 std::string audiotrack_file_name; |
44 size_t begin; | 44 size_t begin; |
45 size_t end; | 45 size_t end; |
46 }; | 46 }; |
47 | 47 |
48 MultiEndCall( | 48 MultiEndCall( |
49 rtc::ArrayView<const Turn> timing, const std::string& audiotracks_path, | 49 rtc::ArrayView<const Turn> timing, const std::string& audiotracks_path, |
50 std::unique_ptr<WavReaderAbstractFactory> wavreader_abstract_factory); | 50 std::unique_ptr<WavReaderAbstractFactory> wavreader_abstract_factory); |
51 ~MultiEndCall(); | 51 ~MultiEndCall(); |
52 | 52 |
53 const std::set<std::string>& speaker_names() const; | 53 const std::set<std::string>& speaker_names() const { return speaker_names_; } |
54 const std::map<std::string, std::unique_ptr<WavReaderInterface>>& | 54 const std::map<std::string, std::unique_ptr<WavReaderInterface>>& |
55 audiotrack_readers() const; | 55 audiotrack_readers() const { return audiotrack_readers_; } |
56 bool valid() const; | 56 bool valid() const { return valid_; } |
57 size_t total_duration_samples() const; | 57 int sample_rate() const { return sample_rate_hz_; } |
58 const std::vector<SpeakingTurn>& speaking_turns() const; | 58 size_t total_duration_samples() const { return total_duration_samples_; } |
| 59 const std::vector<SpeakingTurn>& speaking_turns() const { |
| 60 return speaking_turns_; } |
59 | 61 |
60 private: | 62 private: |
61 // Finds unique speaker names. | 63 // Finds unique speaker names. |
62 void FindSpeakerNames(); | 64 void FindSpeakerNames(); |
63 | 65 |
64 // Creates one WavReader instance for each unique audiotrack. | 66 // Creates one WavReader instance for each unique audiotrack. It returns false |
65 void CreateAudioTrackReaders(); | 67 // if the audio tracks do not have the same sample rate or if they are not |
| 68 // mono. |
| 69 bool CreateAudioTrackReaders(); |
66 | 70 |
67 // Validates the speaking turns timing information. Accepts cross-talk, but | 71 // Validates the speaking turns timing information. Accepts cross-talk, but |
68 // only up to 2 speakers. Rejects unordered turns and self cross-talk. | 72 // only up to 2 speakers. Rejects unordered turns and self cross-talk. |
69 bool CheckTiming(); | 73 bool CheckTiming(); |
70 | 74 |
71 rtc::ArrayView<const Turn> timing_; | 75 rtc::ArrayView<const Turn> timing_; |
72 const std::string& audiotracks_path_; | 76 const std::string& audiotracks_path_; |
73 std::unique_ptr<WavReaderAbstractFactory> wavreader_abstract_factory_; | 77 std::unique_ptr<WavReaderAbstractFactory> wavreader_abstract_factory_; |
74 std::set<std::string> speaker_names_; | 78 std::set<std::string> speaker_names_; |
75 std::map<std::string, std::unique_ptr<WavReaderInterface>> | 79 std::map<std::string, std::unique_ptr<WavReaderInterface>> |
76 audiotrack_readers_; | 80 audiotrack_readers_; |
77 bool valid_; | 81 bool valid_; |
| 82 int sample_rate_hz_; |
78 size_t total_duration_samples_; | 83 size_t total_duration_samples_; |
79 std::vector<SpeakingTurn> speaking_turns_; | 84 std::vector<SpeakingTurn> speaking_turns_; |
80 | 85 |
81 RTC_DISALLOW_COPY_AND_ASSIGN(MultiEndCall); | 86 RTC_DISALLOW_COPY_AND_ASSIGN(MultiEndCall); |
82 }; | 87 }; |
83 | 88 |
84 } // namespace conversational_speech | 89 } // namespace conversational_speech |
85 } // namespace test | 90 } // namespace test |
86 } // namespace webrtc | 91 } // namespace webrtc |
87 | 92 |
88 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_MULTIEND_C
ALL_H_ | 93 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_MULTIEND_C
ALL_H_ |
OLD | NEW |