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

Side by Side Diff: media/base/audio_converter.cc

Issue 14083011: CHECK for adding duplicate converter inputs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "media/base/audio_converter.h" 5 #include "media/base/audio_converter.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 input_params.channels(), 81 input_params.channels(),
82 input_params.frames_per_buffer(), base::Bind( 82 input_params.frames_per_buffer(), base::Bind(
83 &AudioConverter::SourceCallback, 83 &AudioConverter::SourceCallback,
84 base::Unretained(this)))); 84 base::Unretained(this))));
85 } 85 }
86 } 86 }
87 87
88 AudioConverter::~AudioConverter() {} 88 AudioConverter::~AudioConverter() {}
89 89
90 void AudioConverter::AddInput(InputCallback* input) { 90 void AudioConverter::AddInput(InputCallback* input) {
91 CHECK(std::find(transform_inputs_.begin(), transform_inputs_.end(), input) ==
scherkus (not reviewing) 2013/04/24 22:06:42 if this is a speculative CHECK() can you add TODO
DaleCurtis 2013/04/24 22:13:59 Done.
92 transform_inputs_.end());
91 transform_inputs_.push_back(input); 93 transform_inputs_.push_back(input);
92 } 94 }
93 95
94 void AudioConverter::RemoveInput(InputCallback* input) { 96 void AudioConverter::RemoveInput(InputCallback* input) {
95 DCHECK(std::find(transform_inputs_.begin(), transform_inputs_.end(), input) != 97 DCHECK(std::find(transform_inputs_.begin(), transform_inputs_.end(), input) !=
96 transform_inputs_.end()); 98 transform_inputs_.end());
97 transform_inputs_.remove(input); 99 transform_inputs_.remove(input);
98 100
99 if (transform_inputs_.empty()) 101 if (transform_inputs_.empty())
100 Reset(); 102 Reset();
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 212
211 void AudioConverter::ProvideInput(int resampler_frame_delay, AudioBus* dest) { 213 void AudioConverter::ProvideInput(int resampler_frame_delay, AudioBus* dest) {
212 resampler_frame_delay_ = resampler_frame_delay; 214 resampler_frame_delay_ = resampler_frame_delay;
213 if (audio_fifo_) 215 if (audio_fifo_)
214 audio_fifo_->Consume(dest, dest->frames()); 216 audio_fifo_->Consume(dest, dest->frames());
215 else 217 else
216 SourceCallback(0, dest); 218 SourceCallback(0, dest);
217 } 219 }
218 220
219 } // namespace media 221 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698