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

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: Comment. 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 // TODO(dalecurtis): Speculative CHECK for http://crbug.com/233026, should be
92 // converted to a DCHECK once resolved.
93 CHECK(std::find(transform_inputs_.begin(), transform_inputs_.end(), input) ==
94 transform_inputs_.end());
91 transform_inputs_.push_back(input); 95 transform_inputs_.push_back(input);
92 } 96 }
93 97
94 void AudioConverter::RemoveInput(InputCallback* input) { 98 void AudioConverter::RemoveInput(InputCallback* input) {
95 DCHECK(std::find(transform_inputs_.begin(), transform_inputs_.end(), input) != 99 DCHECK(std::find(transform_inputs_.begin(), transform_inputs_.end(), input) !=
96 transform_inputs_.end()); 100 transform_inputs_.end());
97 transform_inputs_.remove(input); 101 transform_inputs_.remove(input);
98 102
99 if (transform_inputs_.empty()) 103 if (transform_inputs_.empty())
100 Reset(); 104 Reset();
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 214
211 void AudioConverter::ProvideInput(int resampler_frame_delay, AudioBus* dest) { 215 void AudioConverter::ProvideInput(int resampler_frame_delay, AudioBus* dest) {
212 resampler_frame_delay_ = resampler_frame_delay; 216 resampler_frame_delay_ = resampler_frame_delay;
213 if (audio_fifo_) 217 if (audio_fifo_)
214 audio_fifo_->Consume(dest, dest->frames()); 218 audio_fifo_->Consume(dest, dest->frames());
215 else 219 else
216 SourceCallback(0, dest); 220 SourceCallback(0, dest);
217 } 221 }
218 222
219 } // namespace media 223 } // 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