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

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

Issue 25544003: Fix code style and gyp files in cast to build cast_unittest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed gyp files Created 7 years, 2 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
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 "base/logging.h" 5 #include "base/logging.h"
6 #include "media/cast/audio_receiver/audio_decoder.h" 6 #include "media/cast/audio_receiver/audio_decoder.h"
7 7
8 #include "third_party/webrtc/modules/audio_coding/main/interface/audio_coding_mo dule.h" 8 #include "third_party/webrtc/modules/audio_coding/main/interface/audio_coding_mo dule.h"
9 #include "third_party/webrtc/modules/interface/module_common_types.h" 9 #include "third_party/webrtc/modules/interface/module_common_types.h"
10 10
11 namespace media { 11 namespace media {
12 namespace cast { 12 namespace cast {
13 13
14 AudioDecoder::AudioDecoder(scoped_refptr<CastThread> cast_thread, 14 AudioDecoder::AudioDecoder(scoped_refptr<CastThread> cast_thread,
15 const AudioReceiverConfig& audio_config) 15 const AudioReceiverConfig& audio_config)
16 : cast_thread_(cast_thread), 16 : audio_decoder_(webrtc::AudioCodingModule::Create(0)),
17 have_received_packets_(false) { 17 have_received_packets_(false),
18 audio_decoder_ = webrtc::AudioCodingModule::Create(0); 18 cast_thread_(cast_thread) {
19 audio_decoder_->InitializeReceiver(); 19 audio_decoder_->InitializeReceiver();
20 20
21 webrtc::CodecInst receive_codec; 21 webrtc::CodecInst receive_codec;
22 switch (audio_config.codec) { 22 switch (audio_config.codec) {
23 case kPcm16: 23 case kPcm16:
24 receive_codec.pltype = audio_config.rtp_payload_type; 24 receive_codec.pltype = audio_config.rtp_payload_type;
25 strncpy(receive_codec.plname, "L16", 4); 25 strncpy(receive_codec.plname, "L16", 4);
26 receive_codec.plfreq = audio_config.frequency; 26 receive_codec.plfreq = audio_config.frequency;
27 receive_codec.pacsize = -1; 27 receive_codec.pacsize = -1;
28 receive_codec.channels = audio_config.channels; 28 receive_codec.channels = audio_config.channels;
(...skipping 13 matching lines...) Expand all
42 } 42 }
43 if (audio_decoder_->RegisterReceiveCodec(receive_codec) != 0) { 43 if (audio_decoder_->RegisterReceiveCodec(receive_codec) != 0) {
44 DCHECK(false) << "Failed to register receive codec"; 44 DCHECK(false) << "Failed to register receive codec";
45 } 45 }
46 46
47 audio_decoder_->SetMaximumPlayoutDelay(audio_config.rtp_max_delay_ms); 47 audio_decoder_->SetMaximumPlayoutDelay(audio_config.rtp_max_delay_ms);
48 audio_decoder_->SetPlayoutMode(webrtc::streaming); 48 audio_decoder_->SetPlayoutMode(webrtc::streaming);
49 } 49 }
50 50
51 AudioDecoder::~AudioDecoder() { 51 AudioDecoder::~AudioDecoder() {
52 webrtc::AudioCodingModule::Destroy(audio_decoder_);
53 } 52 }
54 53
55 bool AudioDecoder::GetRawAudioFrame(int number_of_10ms_blocks, 54 bool AudioDecoder::GetRawAudioFrame(int number_of_10ms_blocks,
56 int desired_frequency, 55 int desired_frequency,
57 PcmAudioFrame* audio_frame, 56 PcmAudioFrame* audio_frame,
58 uint32* rtp_timestamp) { 57 uint32* rtp_timestamp) {
59 DCHECK(cast_thread_->CurrentlyOn(CastThread::AUDIO_DECODER)); 58 DCHECK(cast_thread_->CurrentlyOn(CastThread::AUDIO_DECODER));
60 if (!have_received_packets_) return false; 59 if (!have_received_packets_) return false;
61 60
62 for (int i = 0; i < number_of_10ms_blocks; ++i) { 61 for (int i = 0; i < number_of_10ms_blocks; ++i) {
(...skipping 27 matching lines...) Expand all
90 } 89 }
91 90
92 void AudioDecoder::IncomingParsedRtpPacket(const uint8* payload_data, 91 void AudioDecoder::IncomingParsedRtpPacket(const uint8* payload_data,
93 int payload_size, 92 int payload_size,
94 const RtpCastHeader& rtp_header) { 93 const RtpCastHeader& rtp_header) {
95 have_received_packets_ = true; 94 have_received_packets_ = true;
96 audio_decoder_->IncomingPacket(payload_data, payload_size, rtp_header.webrtc); 95 audio_decoder_->IncomingPacket(payload_data, payload_size, rtp_header.webrtc);
97 } 96 }
98 97
99 } // namespace cast 98 } // namespace cast
100 } // namespace media 99 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/audio_receiver/audio_decoder.h ('k') | media/cast/audio_receiver/audio_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698