Chromium Code Reviews| Index: webrtc/modules/audio_processing/test/conversational_speech/multiend_call.h |
| diff --git a/webrtc/modules/audio_processing/test/conversational_speech/multiend_call.h b/webrtc/modules/audio_processing/test/conversational_speech/multiend_call.h |
| index 234cb2799e34a45db318dcb5e7bd2cd9a580bc8f..6dae8220661e5d41ec909dc9a2e923e6f08e827e 100644 |
| --- a/webrtc/modules/audio_processing/test/conversational_speech/multiend_call.h |
| +++ b/webrtc/modules/audio_processing/test/conversational_speech/multiend_call.h |
| @@ -15,6 +15,8 @@ |
| #include <memory> |
| #include <set> |
| #include <string> |
| +#include <utility> |
| +#include <vector> |
| #include "webrtc/base/array_view.h" |
| #include "webrtc/base/constructormagic.h" |
| @@ -28,6 +30,20 @@ namespace conversational_speech { |
| class MultiEndCall { |
| public: |
| + struct SpeakingTurn { |
| + // Constructor required in order to use std::vector::emaplace(). |
| + SpeakingTurn(std::string new_speaker_name, |
| + std::string new_audiotrack_file_name, |
| + std::size_t new_begin, std::size_t new_end) |
|
hlundin-webrtc
2017/04/06 08:10:04
We tend to use size_t instead of std::size_t. Incl
AleBzk
2017/04/06 16:42:42
Done.
|
| + : speaker_name(std::move(new_speaker_name)), |
|
hlundin-webrtc
2017/04/06 08:10:04
In not an expert in move semantics, but this looks
kwiberg-webrtc
2017/04/06 08:35:32
Well, yes. It's up to the caller to create the B t
AleBzk
2017/04/06 16:42:42
Thanks for your comments on this point.
Before ans
hlundin-webrtc
2017/04/07 10:24:09
You can keep this as is. I was mainly concerned th
AleBzk
2017/04/07 11:37:06
Acknowledged.
|
| + audiotrack_file_name(std::move(new_audiotrack_file_name)), |
| + begin(new_begin), end(new_end) {} |
| + std::string speaker_name; |
| + std::string audiotrack_file_name; |
| + std::size_t begin; |
| + std::size_t end; |
| + }; |
| + |
| MultiEndCall( |
| rtc::ArrayView<const Turn> timing, const std::string& audiotracks_path, |
| std::unique_ptr<WavReaderAbstractFactory> wavreader_abstract_factory); |
| @@ -36,16 +52,25 @@ class MultiEndCall { |
| const std::set<std::string>& speaker_names() const; |
| const std::map<std::string, std::unique_ptr<WavReaderInterface>>& |
| audiotrack_readers() const; |
| + bool valid() const; |
| + std::size_t total_duration_samples() const; |
|
hlundin-webrtc
2017/04/06 08:10:04
size_t
AleBzk
2017/04/06 16:42:42
Done.
|
| + const std::vector<SpeakingTurn>& speaking_turns() const; |
| private: |
| - // Find unique speaker names. |
| + // Finds unique speaker names. |
| void FindSpeakerNames(); |
| - // Create one WavReader instance for each unique audiotrack. |
| + // Creates one WavReader instance for each unique audiotrack. |
| void CreateAudioTrackReaders(); |
| - // Check the speaking turns timing. |
| - void CheckTiming(); |
| + // Validates the speaking turns timing information. Accepts cross-talk, but |
| + // only up to 2 speakers. Rejects unordered turns and self cross-talk. |
| + bool CheckTiming(); |
| + |
| + // Detects cross-talk, which occurs when two turns from the same speaker |
| + // overlap in time. |
| + bool DetectSelfCrossTalk( |
| + const std::vector<std::size_t>& speaking_turn_indices) const; |
|
hlundin-webrtc
2017/04/06 08:10:04
size_t
AleBzk
2017/04/06 16:42:42
Done.
|
| rtc::ArrayView<const Turn> timing_; |
| const std::string& audiotracks_path_; |
| @@ -53,6 +78,9 @@ class MultiEndCall { |
| std::set<std::string> speaker_names_; |
| std::map<std::string, std::unique_ptr<WavReaderInterface>> |
| audiotrack_readers_; |
| + bool valid_; |
| + std::size_t total_duration_samples_; |
|
hlundin-webrtc
2017/04/06 08:10:04
size_t
AleBzk
2017/04/06 16:42:42
Done.
|
| + std::vector<SpeakingTurn> speaking_turns_; |
| RTC_DISALLOW_COPY_AND_ASSIGN(MultiEndCall); |
| }; |