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 |
11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_MULTIEND_CALL
_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_MULTIEND_CALL
_H_ |
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_MULTIEND_CALL
_H_ | 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_MULTIEND_CALL
_H_ |
13 | 13 |
| 14 #include <stddef.h> |
14 #include <map> | 15 #include <map> |
15 #include <memory> | 16 #include <memory> |
16 #include <set> | 17 #include <set> |
17 #include <string> | 18 #include <string> |
| 19 #include <utility> |
| 20 #include <vector> |
18 | 21 |
19 #include "webrtc/base/array_view.h" | 22 #include "webrtc/base/array_view.h" |
20 #include "webrtc/base/constructormagic.h" | 23 #include "webrtc/base/constructormagic.h" |
21 #include "webrtc/modules/audio_processing/test/conversational_speech/timing.h" | 24 #include "webrtc/modules/audio_processing/test/conversational_speech/timing.h" |
22 #include "webrtc/modules/audio_processing/test/conversational_speech/wavreader_a
bstract_factory.h" | 25 #include "webrtc/modules/audio_processing/test/conversational_speech/wavreader_a
bstract_factory.h" |
23 #include "webrtc/modules/audio_processing/test/conversational_speech/wavreader_i
nterface.h" | 26 #include "webrtc/modules/audio_processing/test/conversational_speech/wavreader_i
nterface.h" |
24 | 27 |
25 namespace webrtc { | 28 namespace webrtc { |
26 namespace test { | 29 namespace test { |
27 namespace conversational_speech { | 30 namespace conversational_speech { |
28 | 31 |
29 class MultiEndCall { | 32 class MultiEndCall { |
30 public: | 33 public: |
| 34 struct SpeakingTurn { |
| 35 // Constructor required in order to use std::vector::emplace_back(). |
| 36 SpeakingTurn(std::string new_speaker_name, |
| 37 std::string new_audiotrack_file_name, |
| 38 size_t new_begin, size_t new_end) |
| 39 : speaker_name(std::move(new_speaker_name)), |
| 40 audiotrack_file_name(std::move(new_audiotrack_file_name)), |
| 41 begin(new_begin), end(new_end) {} |
| 42 std::string speaker_name; |
| 43 std::string audiotrack_file_name; |
| 44 size_t begin; |
| 45 size_t end; |
| 46 }; |
| 47 |
31 MultiEndCall( | 48 MultiEndCall( |
32 rtc::ArrayView<const Turn> timing, const std::string& audiotracks_path, | 49 rtc::ArrayView<const Turn> timing, const std::string& audiotracks_path, |
33 std::unique_ptr<WavReaderAbstractFactory> wavreader_abstract_factory); | 50 std::unique_ptr<WavReaderAbstractFactory> wavreader_abstract_factory); |
34 ~MultiEndCall(); | 51 ~MultiEndCall(); |
35 | 52 |
36 const std::set<std::string>& speaker_names() const; | 53 const std::set<std::string>& speaker_names() const; |
37 const std::map<std::string, std::unique_ptr<WavReaderInterface>>& | 54 const std::map<std::string, std::unique_ptr<WavReaderInterface>>& |
38 audiotrack_readers() const; | 55 audiotrack_readers() const; |
| 56 bool valid() const; |
| 57 size_t total_duration_samples() const; |
| 58 const std::vector<SpeakingTurn>& speaking_turns() const; |
39 | 59 |
40 private: | 60 private: |
41 // Find unique speaker names. | 61 // Finds unique speaker names. |
42 void FindSpeakerNames(); | 62 void FindSpeakerNames(); |
43 | 63 |
44 // Create one WavReader instance for each unique audiotrack. | 64 // Creates one WavReader instance for each unique audiotrack. |
45 void CreateAudioTrackReaders(); | 65 void CreateAudioTrackReaders(); |
46 | 66 |
47 // Check the speaking turns timing. | 67 // Validates the speaking turns timing information. Accepts cross-talk, but |
48 void CheckTiming(); | 68 // only up to 2 speakers. Rejects unordered turns and self cross-talk. |
| 69 bool CheckTiming(); |
49 | 70 |
50 rtc::ArrayView<const Turn> timing_; | 71 rtc::ArrayView<const Turn> timing_; |
51 const std::string& audiotracks_path_; | 72 const std::string& audiotracks_path_; |
52 std::unique_ptr<WavReaderAbstractFactory> wavreader_abstract_factory_; | 73 std::unique_ptr<WavReaderAbstractFactory> wavreader_abstract_factory_; |
53 std::set<std::string> speaker_names_; | 74 std::set<std::string> speaker_names_; |
54 std::map<std::string, std::unique_ptr<WavReaderInterface>> | 75 std::map<std::string, std::unique_ptr<WavReaderInterface>> |
55 audiotrack_readers_; | 76 audiotrack_readers_; |
| 77 bool valid_; |
| 78 size_t total_duration_samples_; |
| 79 std::vector<SpeakingTurn> speaking_turns_; |
56 | 80 |
57 RTC_DISALLOW_COPY_AND_ASSIGN(MultiEndCall); | 81 RTC_DISALLOW_COPY_AND_ASSIGN(MultiEndCall); |
58 }; | 82 }; |
59 | 83 |
60 } // namespace conversational_speech | 84 } // namespace conversational_speech |
61 } // namespace test | 85 } // namespace test |
62 } // namespace webrtc | 86 } // namespace webrtc |
63 | 87 |
64 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_MULTIEND_C
ALL_H_ | 88 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_MULTIEND_C
ALL_H_ |
OLD | NEW |