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

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

Issue 10918098: Introduce AudioOutputResampler for browser side resampling. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: First draft! Created 8 years, 3 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 (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/multi_channel_resampler.h" 5 #include "media/base/multi_channel_resampler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "media/base/audio_bus.h" 10 #include "media/base/audio_bus.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // All channels must ask for the same amount. This should always be the 87 // All channels must ask for the same amount. This should always be the
88 // case, but let's just make sure. 88 // case, but let's just make sure.
89 DCHECK_EQ(frames, last_frame_count_); 89 DCHECK_EQ(frames, last_frame_count_);
90 90
91 // Copy the channel data from what we received from |read_cb_|. 91 // Copy the channel data from what we received from |read_cb_|.
92 memcpy(destination, resampler_audio_bus_->channel(channel), 92 memcpy(destination, resampler_audio_bus_->channel(channel),
93 sizeof(*resampler_audio_bus_->channel(channel)) * frames); 93 sizeof(*resampler_audio_bus_->channel(channel)) * frames);
94 } 94 }
95 } 95 }
96 96
97 void MultiChannelResampler::Flush() {
98 last_frame_count_ = 0;
99 for (size_t i = 0; i < resamplers_.size(); ++i)
100 resamplers_[i]->Flush();
101 }
102
97 } // namespace media 103 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698