OLD | NEW |
---|---|
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 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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_); | |
pwestin
2013/09/25 21:24:46
This is needed to avoid a memory leak; why did you
Alpha Left Google
2013/09/25 21:26:21
I can't find reference to ACM::Destroy() in the he
| |
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 if (!have_received_packets_) return false; | 58 if (!have_received_packets_) return false; |
60 | 59 |
61 for (int i = 0; i < number_of_10ms_blocks; ++i) { | 60 for (int i = 0; i < number_of_10ms_blocks; ++i) { |
62 webrtc::AudioFrame webrtc_audio_frame; | 61 webrtc::AudioFrame webrtc_audio_frame; |
(...skipping 26 matching lines...) Expand all Loading... | |
89 } | 88 } |
90 | 89 |
91 void AudioDecoder::IncomingParsedRtpPacket(const uint8* payload_data, | 90 void AudioDecoder::IncomingParsedRtpPacket(const uint8* payload_data, |
92 int payload_size, | 91 int payload_size, |
93 const RtpCastHeader& rtp_header) { | 92 const RtpCastHeader& rtp_header) { |
94 have_received_packets_ = true; | 93 have_received_packets_ = true; |
95 audio_decoder_->IncomingPacket(payload_data, payload_size, rtp_header.webrtc); | 94 audio_decoder_->IncomingPacket(payload_data, payload_size, rtp_header.webrtc); |
96 } | 95 } |
97 | 96 |
98 } // namespace cast | 97 } // namespace cast |
99 } // namespace media | 98 } // namespace media |
OLD | NEW |