Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(667)

Side by Side Diff: webrtc/modules/audio_processing/test/conversational_speech/multiend_call.h

Issue 2781573002: Conversational Speech tool, MultiEndCall::CheckTiming() and tests (Closed)
Patch Set: rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <map> 14 #include <map>
15 #include <memory> 15 #include <memory>
16 #include <set> 16 #include <set>
17 #include <string> 17 #include <string>
18 #include <utility>
19 #include <vector>
18 20
19 #include "webrtc/base/array_view.h" 21 #include "webrtc/base/array_view.h"
20 #include "webrtc/base/constructormagic.h" 22 #include "webrtc/base/constructormagic.h"
21 #include "webrtc/modules/audio_processing/test/conversational_speech/timing.h" 23 #include "webrtc/modules/audio_processing/test/conversational_speech/timing.h"
22 #include "webrtc/modules/audio_processing/test/conversational_speech/wavreader_a bstract_factory.h" 24 #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" 25 #include "webrtc/modules/audio_processing/test/conversational_speech/wavreader_i nterface.h"
24 26
25 namespace webrtc { 27 namespace webrtc {
26 namespace test { 28 namespace test {
27 namespace conversational_speech { 29 namespace conversational_speech {
28 30
29 class MultiEndCall { 31 class MultiEndCall {
30 public: 32 public:
31 MultiEndCall( 33 MultiEndCall(
32 rtc::ArrayView<const Turn> timing, const std::string& audiotracks_path, 34 rtc::ArrayView<const Turn> timing, const std::string& audiotracks_path,
33 std::unique_ptr<WavReaderAbstractFactory> wavreader_abstract_factory); 35 std::unique_ptr<WavReaderAbstractFactory> wavreader_abstract_factory);
34 ~MultiEndCall(); 36 ~MultiEndCall();
35 37
36 const std::set<std::string>& speaker_names() const; 38 const std::set<std::string>& speaker_names() const;
37 const std::map<std::string, std::unique_ptr<WavReaderInterface>>& 39 const std::map<std::string, std::unique_ptr<WavReaderInterface>>&
38 audiotrack_readers() const; 40 audiotrack_readers() const;
41 bool valid();
39 42
40 private: 43 private:
41 // Find unique speaker names. 44 typedef std::pair<std::size_t, std::size_t> Interval;
45 typedef std::vector<Interval> IntervalsVector;
46
47 // Finds unique speaker names.
42 void FindSpeakerNames(); 48 void FindSpeakerNames();
43 49
44 // Create one WavReader instance for each unique audiotrack. 50 // Creates one WavReader instance for each unique audiotrack.
45 void CreateAudioTrackReaders(); 51 void CreateAudioTrackReaders();
46 52
47 // Check the speaking turns timing. 53 // Validates the speaking turns timing information. Accepts cross-talk, but
48 void CheckTiming(); 54 // only up to 2 speakers. Rejects unordered turns and self cross-talk.
55 bool CheckTiming() const;
56
57 // Detects cross-talk, which occurs when two turns from the same speaker
58 // overlap in time.
59 bool DetectSelfCrossTalk(IntervalsVector* speaker_intervals)
60 const;
49 61
50 rtc::ArrayView<const Turn> timing_; 62 rtc::ArrayView<const Turn> timing_;
51 const std::string& audiotracks_path_; 63 const std::string& audiotracks_path_;
52 std::unique_ptr<WavReaderAbstractFactory> wavreader_abstract_factory_; 64 std::unique_ptr<WavReaderAbstractFactory> wavreader_abstract_factory_;
53 std::set<std::string> speaker_names_; 65 std::set<std::string> speaker_names_;
54 std::map<std::string, std::unique_ptr<WavReaderInterface>> 66 std::map<std::string, std::unique_ptr<WavReaderInterface>>
55 audiotrack_readers_; 67 audiotrack_readers_;
68 bool valid_;
56 69
57 RTC_DISALLOW_COPY_AND_ASSIGN(MultiEndCall); 70 RTC_DISALLOW_COPY_AND_ASSIGN(MultiEndCall);
58 }; 71 };
59 72
60 } // namespace conversational_speech 73 } // namespace conversational_speech
61 } // namespace test 74 } // namespace test
62 } // namespace webrtc 75 } // namespace webrtc
63 76
64 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_MULTIEND_C ALL_H_ 77 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_MULTIEND_C ALL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698