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