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

Side by Side Diff: remoting/codec/audio_encoder_opus.cc

Issue 11410012: Collapse AudioRendererMixer and OnMoreDataResampler into AudioTransform. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename. Comments. Created 8 years, 1 month 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 | « remoting/codec/audio_encoder_opus.h ('k') | 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 "remoting/codec/audio_encoder_opus.h" 5 #include "remoting/codec/audio_encoder_opus.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "media/base/audio_bus.h" 10 #include "media/base/audio_bus.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 << sampling_rate_ << " samples per second."; 117 << sampling_rate_ << " samples per second.";
118 return false; 118 return false;
119 } 119 }
120 120
121 InitEncoder(); 121 InitEncoder();
122 } 122 }
123 123
124 return encoder_ != NULL; 124 return encoder_ != NULL;
125 } 125 }
126 126
127 void AudioEncoderOpus::FetchBytesToResample(media::AudioBus* audio_bus) { 127 void AudioEncoderOpus::FetchBytesToResample(int resampler_frame_delay,
128 media::AudioBus* audio_bus) {
128 DCHECK(resampling_data_); 129 DCHECK(resampling_data_);
129 int samples_left = (resampling_data_size_ - resampling_data_pos_) / 130 int samples_left = (resampling_data_size_ - resampling_data_pos_) /
130 kBytesPerSample / channels_; 131 kBytesPerSample / channels_;
131 DCHECK_LE(audio_bus->frames(), samples_left); 132 DCHECK_LE(audio_bus->frames(), samples_left);
132 audio_bus->FromInterleaved( 133 audio_bus->FromInterleaved(
133 resampling_data_ + resampling_data_pos_, 134 resampling_data_ + resampling_data_pos_,
134 audio_bus->frames(), kBytesPerSample); 135 audio_bus->frames(), kBytesPerSample);
135 resampling_data_pos_ += audio_bus->frames() * kBytesPerSample * channels_; 136 resampling_data_pos_ += audio_bus->frames() * kBytesPerSample * channels_;
136 DCHECK_LE(resampling_data_pos_, static_cast<int>(resampling_data_size_)); 137 DCHECK_LE(resampling_data_pos_, static_cast<int>(resampling_data_size_));
137 } 138 }
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 } 232 }
232 233
233 // Return NULL if there's nothing in the packet. 234 // Return NULL if there's nothing in the packet.
234 if (encoded_packet->data_size() == 0) 235 if (encoded_packet->data_size() == 0)
235 return scoped_ptr<AudioPacket>(); 236 return scoped_ptr<AudioPacket>();
236 237
237 return encoded_packet.Pass(); 238 return encoded_packet.Pass();
238 } 239 }
239 240
240 } // namespace remoting 241 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/codec/audio_encoder_opus.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698