Index: webrtc/modules/audio_processing/test/conversational_speech/multiend_call.cc |
diff --git a/webrtc/modules/audio_processing/test/conversational_speech/multiend_call.cc b/webrtc/modules/audio_processing/test/conversational_speech/multiend_call.cc |
index f83923cb15fe8412030836211799aad574050794..624f981ae51f0e22b3928652a875c2e1618812f2 100644 |
--- a/webrtc/modules/audio_processing/test/conversational_speech/multiend_call.cc |
+++ b/webrtc/modules/audio_processing/test/conversational_speech/multiend_call.cc |
@@ -24,14 +24,35 @@ |
rtc::ArrayView<const Turn> timing, const std::string& audiotracks_path, |
std::unique_ptr<WavReaderAbstractFactory> wavreader_abstract_factory) |
: timing_(timing), audiotracks_path_(audiotracks_path), |
- wavreader_abstract_factory_(std::move(wavreader_abstract_factory)), |
- valid_(false) { |
+ wavreader_abstract_factory_(std::move(wavreader_abstract_factory)) { |
FindSpeakerNames(); |
- if (CreateAudioTrackReaders()) |
- valid_ = CheckTiming(); |
+ CreateAudioTrackReaders(); |
+ valid_ = CheckTiming(); |
} |
MultiEndCall::~MultiEndCall() = default; |
+ |
+const std::set<std::string>& MultiEndCall::speaker_names() const { |
+ return speaker_names_; |
+} |
+ |
+const std::map<std::string, std::unique_ptr<WavReaderInterface>>& |
+ MultiEndCall::audiotrack_readers() const { |
+ return audiotrack_readers_; |
+} |
+ |
+bool MultiEndCall::valid() const { |
+ return valid_; |
+} |
+ |
+size_t MultiEndCall::total_duration_samples() const { |
+ return total_duration_samples_; |
+} |
+ |
+const std::vector<MultiEndCall::SpeakingTurn>& MultiEndCall::speaking_turns() |
+ const { |
+ return speaking_turns_; |
+} |
void MultiEndCall::FindSpeakerNames() { |
RTC_DCHECK(speaker_names_.empty()); |
@@ -40,9 +61,8 @@ |
} |
} |
-bool MultiEndCall::CreateAudioTrackReaders() { |
+void MultiEndCall::CreateAudioTrackReaders() { |
RTC_DCHECK(audiotrack_readers_.empty()); |
- sample_rate_hz_ = 0; // Sample rate will be set when reading the first track. |
for (const Turn& turn : timing_) { |
auto it = audiotrack_readers_.find(turn.audiotrack_file_name); |
if (it != audiotrack_readers_.end()) |
@@ -55,24 +75,9 @@ |
// Map the audiotrack file name to a new instance of WavReaderInterface. |
std::unique_ptr<WavReaderInterface> wavreader = |
wavreader_abstract_factory_->Create(audiotrack_file_path.pathname()); |
- |
- if (sample_rate_hz_ == 0) { |
- sample_rate_hz_ = wavreader->SampleRate(); |
- } else if (sample_rate_hz_ != wavreader->SampleRate()) { |
- LOG(LS_ERROR) << "All the audio tracks should have the same sample rate."; |
- return false; |
- } |
- |
- if (wavreader->NumChannels() != 1) { |
- LOG(LS_ERROR) << "Only mono audio tracks supported."; |
- return false; |
- } |
- |
audiotrack_readers_.emplace( |
turn.audiotrack_file_name, std::move(wavreader)); |
} |
- |
- return true; |
} |
bool MultiEndCall::CheckTiming() { |