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

Side by Side Diff: webrtc/modules/audio_coding/acm2/acm_receiver.cc

Issue 1484343003: NetEq: Add codec name and RTP timestamp rate to DecoderInfo (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase Created 5 years 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
OLDNEW
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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 int 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 auto neteq_decoder = [acm_codec_id, channels]() -> NetEqDecoder { 308 const auto neteq_decoder = [acm_codec_id, channels]() -> NetEqDecoder {
308 if (acm_codec_id == -1) 309 if (acm_codec_id == -1)
309 return NetEqDecoder::kDecoderArbitrary; // External decoder. 310 return NetEqDecoder::kDecoderArbitrary; // External decoder.
310 const rtc::Optional<RentACodec::CodecId> cid = 311 const rtc::Optional<RentACodec::CodecId> cid =
311 RentACodec::CodecIdFromIndex(acm_codec_id); 312 RentACodec::CodecIdFromIndex(acm_codec_id);
312 RTC_DCHECK(cid) << "Invalid codec index: " << acm_codec_id; 313 RTC_DCHECK(cid) << "Invalid codec index: " << acm_codec_id;
313 const rtc::Optional<NetEqDecoder> ned = 314 const rtc::Optional<NetEqDecoder> ned =
314 RentACodec::NetEqDecoderFromCodecId(*cid, channels); 315 RentACodec::NetEqDecoderFromCodecId(*cid, channels);
315 RTC_DCHECK(ned) << "Invalid codec ID: " << static_cast<int>(*cid); 316 RTC_DCHECK(ned) << "Invalid codec ID: " << static_cast<int>(*cid);
316 return *ned; 317 return *ned;
(...skipping 18 matching lines...) Expand all
335 if (neteq_->RemovePayloadType(payload_type) != NetEq::kOK) { 336 if (neteq_->RemovePayloadType(payload_type) != NetEq::kOK) {
336 LOG(LERROR) << "Cannot remove payload " << static_cast<int>(payload_type); 337 LOG(LERROR) << "Cannot remove payload " << static_cast<int>(payload_type);
337 return -1; 338 return -1;
338 } 339 }
339 340
340 decoders_.erase(it); 341 decoders_.erase(it);
341 } 342 }
342 343
343 int ret_val; 344 int ret_val;
344 if (!audio_decoder) { 345 if (!audio_decoder) {
345 ret_val = neteq_->RegisterPayloadType(neteq_decoder, payload_type); 346 ret_val = neteq_->RegisterPayloadType(neteq_decoder, name, payload_type);
346 } else { 347 } else {
347 ret_val = neteq_->RegisterExternalDecoder(audio_decoder, neteq_decoder, 348 ret_val = neteq_->RegisterExternalDecoder(
348 payload_type, sample_rate_hz); 349 audio_decoder, neteq_decoder, name, payload_type, sample_rate_hz);
349 } 350 }
350 if (ret_val != NetEq::kOK) { 351 if (ret_val != NetEq::kOK) {
351 LOG(LERROR) << "AcmReceiver::AddCodec " << acm_codec_id 352 LOG(LERROR) << "AcmReceiver::AddCodec " << acm_codec_id
352 << static_cast<int>(payload_type) 353 << static_cast<int>(payload_type)
353 << " channels: " << channels; 354 << " channels: " << channels;
354 return -1; 355 return -1;
355 } 356 }
356 357
357 Decoder decoder; 358 Decoder decoder;
358 decoder.acm_codec_id = acm_codec_id; 359 decoder.acm_codec_id = acm_codec_id;
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 532
532 void AcmReceiver::GetDecodingCallStatistics( 533 void AcmReceiver::GetDecodingCallStatistics(
533 AudioDecodingCallStats* stats) const { 534 AudioDecodingCallStats* stats) const {
534 CriticalSectionScoped lock(crit_sect_.get()); 535 CriticalSectionScoped lock(crit_sect_.get());
535 *stats = call_stats_.GetDecodingStatistics(); 536 *stats = call_stats_.GetDecodingStatistics();
536 } 537 }
537 538
538 } // namespace acm2 539 } // namespace acm2
539 540
540 } // namespace webrtc 541 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/acm2/acm_receiver.h ('k') | webrtc/modules/audio_coding/acm2/acm_receiver_unittest_oldapi.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698