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

Side by Side Diff: media/cast/receiver/audio_decoder.cc

Issue 308043006: [Cast] Clean-up: Merge RtpReceiver+AudioReceiver+VideoReceiver-->FrameReceiver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed hclam's comments. Created 6 years, 6 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 | « media/cast/receiver/audio_decoder.h ('k') | media/cast/receiver/audio_decoder_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/cast/audio_receiver/audio_decoder.h" 5 #include "media/cast/receiver/audio_decoder.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/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/sys_byteorder.h" 12 #include "base/sys_byteorder.h"
13 #include "media/cast/cast_defines.h" 13 #include "media/cast/cast_defines.h"
14 #include "third_party/opus/src/include/opus.h" 14 #include "third_party/opus/src/include/opus.h"
15 15
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 audio_bus = AudioBus::Create(num_channels_, num_samples).Pass(); 193 audio_bus = AudioBus::Create(num_channels_, num_samples).Pass();
194 audio_bus->FromInterleaved(pcm_data, num_samples, sizeof(int16)); 194 audio_bus->FromInterleaved(pcm_data, num_samples, sizeof(int16));
195 return audio_bus.Pass(); 195 return audio_bus.Pass();
196 } 196 }
197 197
198 DISALLOW_COPY_AND_ASSIGN(Pcm16Impl); 198 DISALLOW_COPY_AND_ASSIGN(Pcm16Impl);
199 }; 199 };
200 200
201 AudioDecoder::AudioDecoder( 201 AudioDecoder::AudioDecoder(
202 const scoped_refptr<CastEnvironment>& cast_environment, 202 const scoped_refptr<CastEnvironment>& cast_environment,
203 const FrameReceiverConfig& audio_config) 203 int channels,
204 int sampling_rate,
205 transport::AudioCodec codec)
204 : cast_environment_(cast_environment) { 206 : cast_environment_(cast_environment) {
205 switch (audio_config.codec.audio) { 207 switch (codec) {
206 case transport::kOpus: 208 case transport::kOpus:
207 impl_ = new OpusImpl(cast_environment, 209 impl_ = new OpusImpl(cast_environment, channels, sampling_rate);
208 audio_config.channels,
209 audio_config.frequency);
210 break; 210 break;
211 case transport::kPcm16: 211 case transport::kPcm16:
212 impl_ = new Pcm16Impl(cast_environment, 212 impl_ = new Pcm16Impl(cast_environment, channels, sampling_rate);
213 audio_config.channels,
214 audio_config.frequency);
215 break; 213 break;
216 default: 214 default:
217 NOTREACHED() << "Unknown or unspecified codec."; 215 NOTREACHED() << "Unknown or unspecified codec.";
218 break; 216 break;
219 } 217 }
220 } 218 }
221 219
222 AudioDecoder::~AudioDecoder() {} 220 AudioDecoder::~AudioDecoder() {}
223 221
224 CastInitializationStatus AudioDecoder::InitializationResult() const { 222 CastInitializationStatus AudioDecoder::InitializationResult() const {
(...skipping 14 matching lines...) Expand all
239 cast_environment_->PostTask(CastEnvironment::AUDIO, 237 cast_environment_->PostTask(CastEnvironment::AUDIO,
240 FROM_HERE, 238 FROM_HERE,
241 base::Bind(&AudioDecoder::ImplBase::DecodeFrame, 239 base::Bind(&AudioDecoder::ImplBase::DecodeFrame,
242 impl_, 240 impl_,
243 base::Passed(&encoded_frame), 241 base::Passed(&encoded_frame),
244 callback)); 242 callback));
245 } 243 }
246 244
247 } // namespace cast 245 } // namespace cast
248 } // namespace media 246 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/receiver/audio_decoder.h ('k') | media/cast/receiver/audio_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698