| OLD | NEW |
| 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_OPTIONS_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_OPTIONS_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_OPTIONS_H_ | 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_OPTIONS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/threading/thread_checker.h" |
| 12 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 13 #include "content/public/common/media_stream_request.h" | 14 #include "content/public/common/media_stream_request.h" |
| 14 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 15 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
| 15 #include "third_party/webrtc/api/mediastreaminterface.h" | 16 #include "third_party/webrtc/api/mediastreaminterface.h" |
| 16 #include "third_party/webrtc/media/base/mediachannel.h" | 17 #include "third_party/webrtc/media/base/mediachannel.h" |
| 17 #include "third_party/webrtc/modules/audio_processing/include/audio_processing.h
" | 18 #include "third_party/webrtc/modules/audio_processing/include/audio_processing.h
" |
| 18 | 19 |
| 19 namespace webrtc { | 20 namespace webrtc { |
| 20 | 21 |
| 21 class EchoCancellation; | 22 class EchoCancellation; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 bool default_audio_processing_constraint_value_; | 97 bool default_audio_processing_constraint_value_; |
| 97 }; | 98 }; |
| 98 | 99 |
| 99 // A helper class to log echo information in general and Echo Cancellation | 100 // A helper class to log echo information in general and Echo Cancellation |
| 100 // quality in particular. | 101 // quality in particular. |
| 101 class CONTENT_EXPORT EchoInformation { | 102 class CONTENT_EXPORT EchoInformation { |
| 102 public: | 103 public: |
| 103 EchoInformation(); | 104 EchoInformation(); |
| 104 virtual ~EchoInformation(); | 105 virtual ~EchoInformation(); |
| 105 | 106 |
| 106 void UpdateAecDelayStats(webrtc::EchoCancellation* echo_cancellation); | 107 // Updates stats, and reports delay metrics as UMA stats every 5 seconds. |
| 108 // Must be called every time AudioProcessing::ProcessStream() is called. |
| 109 void UpdateAecStats(webrtc::EchoCancellation* echo_cancellation); |
| 110 |
| 111 // Reports AEC divergent filter metrics as UMA and resets the associated data. |
| 112 void ReportAndResetAecDivergentFilterStats(); |
| 107 | 113 |
| 108 private: | 114 private: |
| 109 // Counter to track 5 seconds of processed 10 ms chunks in order to query a | 115 void UpdateAecDelayStats(webrtc::EchoCancellation* echo_cancellation); |
| 110 // new metric from webrtc::EchoCancellation::GetEchoDelayMetrics(). | 116 void UpdateAecDivergentFilterStats( |
| 111 int num_chunks_; | 117 webrtc::EchoCancellation* echo_cancellation); |
| 118 |
| 119 // Counter to track 5 seconds of data in order to query a new metric from |
| 120 // webrtc::EchoCancellation::GetEchoDelayMetrics(). |
| 121 int delay_stats_time_ms_; |
| 112 bool echo_frames_received_; | 122 bool echo_frames_received_; |
| 113 | 123 |
| 124 // Counter to track 1 second of data in order to query a new divergent filter |
| 125 // fraction metric from webrtc::EchoCancellation::GetMetrics(). |
| 126 int divergent_filter_stats_time_ms_; |
| 127 |
| 128 // Total number of times we queried for the divergent filter fraction metric. |
| 129 int num_divergent_filter_fraction_; |
| 130 |
| 131 // Number of non-zero divergent filter fraction metrics. |
| 132 int num_non_zero_divergent_filter_fraction_; |
| 133 |
| 134 // Ensures that this class is accessed on the same thread. |
| 135 base::ThreadChecker thread_checker_; |
| 136 |
| 114 DISALLOW_COPY_AND_ASSIGN(EchoInformation); | 137 DISALLOW_COPY_AND_ASSIGN(EchoInformation); |
| 115 }; | 138 }; |
| 116 | 139 |
| 117 // Enables the echo cancellation in |audio_processing|. | 140 // Enables the echo cancellation in |audio_processing|. |
| 118 void EnableEchoCancellation(AudioProcessing* audio_processing); | 141 void EnableEchoCancellation(AudioProcessing* audio_processing); |
| 119 | 142 |
| 120 // Enables the noise suppression in |audio_processing|. | 143 // Enables the noise suppression in |audio_processing|. |
| 121 void EnableNoiseSuppression(AudioProcessing* audio_processing, | 144 void EnableNoiseSuppression(AudioProcessing* audio_processing, |
| 122 webrtc::NoiseSuppression::Level ns_level); | 145 webrtc::NoiseSuppression::Level ns_level); |
| 123 | 146 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 144 | 167 |
| 145 // Returns the array geometry from the media constraints if existing and | 168 // Returns the array geometry from the media constraints if existing and |
| 146 // otherwise that provided by the input device. | 169 // otherwise that provided by the input device. |
| 147 CONTENT_EXPORT std::vector<webrtc::Point> GetArrayGeometryPreferringConstraints( | 170 CONTENT_EXPORT std::vector<webrtc::Point> GetArrayGeometryPreferringConstraints( |
| 148 const MediaAudioConstraints& audio_constraints, | 171 const MediaAudioConstraints& audio_constraints, |
| 149 const MediaStreamDevice::AudioDeviceParameters& input_params); | 172 const MediaStreamDevice::AudioDeviceParameters& input_params); |
| 150 | 173 |
| 151 } // namespace content | 174 } // namespace content |
| 152 | 175 |
| 153 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_OPTIONS_H_ | 176 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_PROCESSOR_OPTIONS_H_ |
| OLD | NEW |