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

Side by Side Diff: content/renderer/media/media_stream_audio_processor.h

Issue 1357013006: Add detection for repeated audio in capturing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: decoupling uma reporting from detection Created 5 years, 2 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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_ 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_
7 7
8 #include "base/atomicops.h" 8 #include "base/atomicops.h"
9 #include "base/files/file.h" 9 #include "base/files/file.h"
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
11 #include "base/synchronization/lock.h" 11 #include "base/synchronization/lock.h"
12 #include "base/threading/thread_checker.h" 12 #include "base/threading/thread_checker.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
15 #include "content/public/common/media_stream_request.h" 15 #include "content/public/common/media_stream_request.h"
16 #include "content/renderer/media/aec_dump_message_filter.h" 16 #include "content/renderer/media/aec_dump_message_filter.h"
17 #include "content/renderer/media/audio_repetition_detector.h"
17 #include "content/renderer/media/webrtc_audio_device_impl.h" 18 #include "content/renderer/media/webrtc_audio_device_impl.h"
18 #include "media/base/audio_converter.h" 19 #include "media/base/audio_converter.h"
19 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" 20 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h"
20 #include "third_party/webrtc/modules/audio_processing/include/audio_processing.h " 21 #include "third_party/webrtc/modules/audio_processing/include/audio_processing.h "
21 22
22 namespace blink { 23 namespace blink {
23 class WebMediaConstraints; 24 class WebMediaConstraints;
24 } 25 }
25 26
26 namespace media { 27 namespace media {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // AecDumpMessageFilter::AecDumpDelegate implementation. 106 // AecDumpMessageFilter::AecDumpDelegate implementation.
106 // Called on the main render thread. 107 // Called on the main render thread.
107 void OnAecDumpFile(const IPC::PlatformFileForTransit& file_handle) override; 108 void OnAecDumpFile(const IPC::PlatformFileForTransit& file_handle) override;
108 void OnDisableAecDump() override; 109 void OnDisableAecDump() override;
109 void OnIpcClosing() override; 110 void OnIpcClosing() override;
110 111
111 protected: 112 protected:
112 ~MediaStreamAudioProcessor() override; 113 ~MediaStreamAudioProcessor() override;
113 114
114 private: 115 private:
116 class AudioRepetitionReporter : public AudioRepetitionDetector {
Henrik Grunell 2015/10/20 08:50:16 Comment on the class.
Henrik Grunell 2015/10/20 08:50:16 Let this class own a detector instead of inheritin
minyue 2015/10/23 12:05:23 Per offline discussion with Tommi, we use base::Ca
117 public:
118 AudioRepetitionReporter(int min_length_ms, size_t max_frames,
119 const int* look_back_times, size_t num_look_back);
120 private:
121 void ReportRepetition(int look_back_ms) override;
122 };
123
115 friend class MediaStreamAudioProcessorTest; 124 friend class MediaStreamAudioProcessorTest;
125
116 FRIEND_TEST_ALL_PREFIXES(MediaStreamAudioProcessorTest, 126 FRIEND_TEST_ALL_PREFIXES(MediaStreamAudioProcessorTest,
117 GetAecDumpMessageFilter); 127 GetAecDumpMessageFilter);
118 128
119 // WebRtcPlayoutDataSource::Sink implementation. 129 // WebRtcPlayoutDataSource::Sink implementation.
120 void OnPlayoutData(media::AudioBus* audio_bus, 130 void OnPlayoutData(media::AudioBus* audio_bus,
121 int sample_rate, 131 int sample_rate,
122 int audio_delay_milliseconds) override; 132 int audio_delay_milliseconds) override;
123 void OnPlayoutDataSourceChanged() override; 133 void OnPlayoutDataSourceChanged() override;
124 134
125 // webrtc::AudioProcessorInterface implementation. 135 // webrtc::AudioProcessorInterface implementation.
(...skipping 20 matching lines...) Expand all
146 int process_frames, 156 int process_frames,
147 base::TimeDelta capture_delay, 157 base::TimeDelta capture_delay,
148 int volume, 158 int volume,
149 bool key_pressed, 159 bool key_pressed,
150 float* const* output_ptrs); 160 float* const* output_ptrs);
151 161
152 // Cached value for the render delay latency. This member is accessed by 162 // Cached value for the render delay latency. This member is accessed by
153 // both the capture audio thread and the render audio thread. 163 // both the capture audio thread and the render audio thread.
154 base::subtle::Atomic32 render_delay_ms_; 164 base::subtle::Atomic32 render_delay_ms_;
155 165
166 // Module to detect and report (to UMA) bit exact audio repetition.
167 scoped_ptr<AudioRepetitionReporter> audio_repetition_reporter_;
168
156 // Module to handle processing and format conversion. 169 // Module to handle processing and format conversion.
157 scoped_ptr<webrtc::AudioProcessing> audio_processing_; 170 scoped_ptr<webrtc::AudioProcessing> audio_processing_;
158 171
159 // FIFO to provide 10 ms capture chunks. 172 // FIFO to provide 10 ms capture chunks.
160 scoped_ptr<MediaStreamAudioFifo> capture_fifo_; 173 scoped_ptr<MediaStreamAudioFifo> capture_fifo_;
161 // Receives processing output. 174 // Receives processing output.
162 scoped_ptr<MediaStreamAudioBus> output_bus_; 175 scoped_ptr<MediaStreamAudioBus> output_bus_;
163 176
164 // FIFO to provide 10 ms render chunks when the AEC is enabled. 177 // FIFO to provide 10 ms render chunks when the AEC is enabled.
165 scoped_ptr<MediaStreamAudioFifo> render_fifo_; 178 scoped_ptr<MediaStreamAudioFifo> render_fifo_;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 // Object for logging echo information when the AEC is enabled. Accessible by 214 // Object for logging echo information when the AEC is enabled. Accessible by
202 // the libjingle thread through GetStats(). 215 // the libjingle thread through GetStats().
203 scoped_ptr<EchoInformation> echo_information_; 216 scoped_ptr<EchoInformation> echo_information_;
204 217
205 DISALLOW_COPY_AND_ASSIGN(MediaStreamAudioProcessor); 218 DISALLOW_COPY_AND_ASSIGN(MediaStreamAudioProcessor);
206 }; 219 };
207 220
208 } // namespace content 221 } // namespace content
209 222
210 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_ 223 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698