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

Unified Diff: content/renderer/media/audio_repetition_detector.cc

Issue 2705073003: Remove ScopedVector from content/renderer/. (Closed)
Patch Set: Rebase only Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/media/audio_repetition_detector.h ('k') | content/renderer/media/gpu/rtc_video_encoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/audio_repetition_detector.cc
diff --git a/content/renderer/media/audio_repetition_detector.cc b/content/renderer/media/audio_repetition_detector.cc
index 468772c1ae03337a1721652ed9e4c145719721e2..ced9a7fdd07b76ee5af1374277bc94a1839877c7 100644
--- a/content/renderer/media/audio_repetition_detector.cc
+++ b/content/renderer/media/audio_repetition_detector.cc
@@ -9,6 +9,7 @@
#include <algorithm>
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
namespace {
@@ -40,7 +41,7 @@ AudioRepetitionDetector::AudioRepetitionDetector(
max_look_back_ms_ = temp.back();
for (int look_back : temp)
- states_.push_back(new State(look_back));
+ states_.push_back(base::MakeUnique<State>(look_back));
}
AudioRepetitionDetector::~AudioRepetitionDetector() {
@@ -70,7 +71,7 @@ void AudioRepetitionDetector::Detect(const float* data, size_t num_frames,
AddFramesToBuffer(data, num_frames);
for (size_t idx = num_frames; idx > 0; --idx, data += num_channels) {
- for (State* state : states_) {
+ for (const auto& state : states_) {
// Look back position depends on the sample rate. It is rounded down to
// the closest integer.
const size_t look_back_frames =
@@ -81,7 +82,7 @@ void AudioRepetitionDetector::Detect(const float* data, size_t num_frames,
if (Equal(data, look_back_frames + idx)) {
if (!state->reported()) {
state->Increment(data, num_channels);
- if (HasValidReport(state)) {
+ if (HasValidReport(state.get())) {
repetition_callback_.Run(state->look_back_ms());
state->set_reported(true);
}
@@ -138,7 +139,7 @@ void AudioRepetitionDetector::Reset(size_t num_channels, int sample_rate) {
(max_look_back_ms_ * sample_rate_ + 999) / 1000 + max_frames_;
audio_buffer_.resize(buffer_size_frames_ * num_channels_);
- for (State* state : states_)
+ for (const auto& state : states_)
state->Reset();
}
« no previous file with comments | « content/renderer/media/audio_repetition_detector.h ('k') | content/renderer/media/gpu/rtc_video_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698