OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 << static_cast<int>(header->payloadType) | 206 << static_cast<int>(header->payloadType) |
207 << " Failed to insert packet"; | 207 << " Failed to insert packet"; |
208 return -1; | 208 return -1; |
209 } | 209 } |
210 return 0; | 210 return 0; |
211 } | 211 } |
212 | 212 |
213 int AcmReceiver::GetAudio(int desired_freq_hz, AudioFrame* audio_frame) { | 213 int AcmReceiver::GetAudio(int desired_freq_hz, AudioFrame* audio_frame) { |
214 enum NetEqOutputType type; | 214 enum NetEqOutputType type; |
215 size_t samples_per_channel; | 215 size_t samples_per_channel; |
216 int num_channels; | 216 size_t num_channels; |
217 | 217 |
218 // Accessing members, take the lock. | 218 // Accessing members, take the lock. |
219 CriticalSectionScoped lock(crit_sect_.get()); | 219 CriticalSectionScoped lock(crit_sect_.get()); |
220 | 220 |
221 // Always write the output to |audio_buffer_| first. | 221 // Always write the output to |audio_buffer_| first. |
222 if (neteq_->GetAudio(AudioFrame::kMaxDataSizeSamples, | 222 if (neteq_->GetAudio(AudioFrame::kMaxDataSizeSamples, |
223 audio_buffer_.get(), | 223 audio_buffer_.get(), |
224 &samples_per_channel, | 224 &samples_per_channel, |
225 &num_channels, | 225 &num_channels, |
226 &type) != NetEq::kOK) { | 226 &type) != NetEq::kOK) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 } else { | 294 } else { |
295 // Remain 0 until we have a valid |playout_timestamp|. | 295 // Remain 0 until we have a valid |playout_timestamp|. |
296 audio_frame->timestamp_ = 0; | 296 audio_frame->timestamp_ = 0; |
297 } | 297 } |
298 | 298 |
299 return 0; | 299 return 0; |
300 } | 300 } |
301 | 301 |
302 int32_t AcmReceiver::AddCodec(int acm_codec_id, | 302 int32_t AcmReceiver::AddCodec(int acm_codec_id, |
303 uint8_t payload_type, | 303 uint8_t payload_type, |
304 int channels, | 304 size_t channels, |
305 int sample_rate_hz, | 305 int sample_rate_hz, |
306 AudioDecoder* audio_decoder, | 306 AudioDecoder* audio_decoder, |
307 const std::string& name) { | 307 const std::string& name) { |
308 const auto neteq_decoder = [acm_codec_id, channels]() -> NetEqDecoder { | 308 const auto neteq_decoder = [acm_codec_id, channels]() -> NetEqDecoder { |
309 if (acm_codec_id == -1) | 309 if (acm_codec_id == -1) |
310 return NetEqDecoder::kDecoderArbitrary; // External decoder. | 310 return NetEqDecoder::kDecoderArbitrary; // External decoder. |
311 const rtc::Optional<RentACodec::CodecId> cid = | 311 const rtc::Optional<RentACodec::CodecId> cid = |
312 RentACodec::CodecIdFromIndex(acm_codec_id); | 312 RentACodec::CodecIdFromIndex(acm_codec_id); |
313 RTC_DCHECK(cid) << "Invalid codec index: " << acm_codec_id; | 313 RTC_DCHECK(cid) << "Invalid codec index: " << acm_codec_id; |
314 const rtc::Optional<NetEqDecoder> ned = | 314 const rtc::Optional<NetEqDecoder> ned = |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 | 532 |
533 void AcmReceiver::GetDecodingCallStatistics( | 533 void AcmReceiver::GetDecodingCallStatistics( |
534 AudioDecodingCallStats* stats) const { | 534 AudioDecodingCallStats* stats) const { |
535 CriticalSectionScoped lock(crit_sect_.get()); | 535 CriticalSectionScoped lock(crit_sect_.get()); |
536 *stats = call_stats_.GetDecodingStatistics(); | 536 *stats = call_stats_.GetDecodingStatistics(); |
537 } | 537 } |
538 | 538 |
539 } // namespace acm2 | 539 } // namespace acm2 |
540 | 540 |
541 } // namespace webrtc | 541 } // namespace webrtc |
OLD | NEW |