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

Side by Side Diff: webrtc/modules/audio_coding/acm2/audio_coding_module_impl.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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 receiver_.SetMinimumDelay(0); 505 receiver_.SetMinimumDelay(0);
506 receiver_.SetMaximumDelay(0); 506 receiver_.SetMaximumDelay(0);
507 receiver_.FlushBuffers(); 507 receiver_.FlushBuffers();
508 508
509 // Register RED and CN. 509 // Register RED and CN.
510 auto db = RentACodec::Database(); 510 auto db = RentACodec::Database();
511 for (size_t i = 0; i < db.size(); i++) { 511 for (size_t i = 0; i < db.size(); i++) {
512 if (IsCodecRED(db[i]) || IsCodecCN(db[i])) { 512 if (IsCodecRED(db[i]) || IsCodecCN(db[i])) {
513 if (receiver_.AddCodec(static_cast<int>(i), 513 if (receiver_.AddCodec(static_cast<int>(i),
514 static_cast<uint8_t>(db[i].pltype), 1, 514 static_cast<uint8_t>(db[i].pltype), 1,
515 db[i].plfreq, nullptr) < 0) { 515 db[i].plfreq, nullptr, db[i].plname) < 0) {
516 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_, 516 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
517 "Cannot register master codec."); 517 "Cannot register master codec.");
518 return -1; 518 return -1;
519 } 519 }
520 } 520 }
521 } 521 }
522 receiver_initialized_ = true; 522 receiver_initialized_ = true;
523 return 0; 523 return 0;
524 } 524 }
525 525
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 // Check if the payload-type is valid. 559 // Check if the payload-type is valid.
560 if (!RentACodec::IsPayloadTypeValid(codec.pltype)) { 560 if (!RentACodec::IsPayloadTypeValid(codec.pltype)) {
561 LOG_F(LS_ERROR) << "Invalid payload type " << codec.pltype << " for " 561 LOG_F(LS_ERROR) << "Invalid payload type " << codec.pltype << " for "
562 << codec.plname; 562 << codec.plname;
563 return -1; 563 return -1;
564 } 564 }
565 565
566 // Get |decoder| associated with |codec|. |decoder| is NULL if |codec| does 566 // Get |decoder| associated with |codec|. |decoder| is NULL if |codec| does
567 // not own its decoder. 567 // not own its decoder.
568 return receiver_.AddCodec(*codec_index, codec.pltype, codec.channels, 568 return receiver_.AddCodec(*codec_index, codec.pltype, codec.channels,
569 codec.plfreq, 569 codec.plfreq, codec_manager_.GetAudioDecoder(codec),
570 codec_manager_.GetAudioDecoder(codec)); 570 codec.plname);
571 } 571 }
572 572
573 int AudioCodingModuleImpl::RegisterExternalReceiveCodec( 573 int AudioCodingModuleImpl::RegisterExternalReceiveCodec(
574 int rtp_payload_type, 574 int rtp_payload_type,
575 AudioDecoder* external_decoder, 575 AudioDecoder* external_decoder,
576 int sample_rate_hz, 576 int sample_rate_hz,
577 int num_channels) { 577 int num_channels,
578 const std::string& name) {
578 CriticalSectionScoped lock(acm_crit_sect_.get()); 579 CriticalSectionScoped lock(acm_crit_sect_.get());
579 RTC_DCHECK(receiver_initialized_); 580 RTC_DCHECK(receiver_initialized_);
580 if (num_channels > 2 || num_channels < 0) { 581 if (num_channels > 2 || num_channels < 0) {
581 LOG_F(LS_ERROR) << "Unsupported number of channels: " << num_channels; 582 LOG_F(LS_ERROR) << "Unsupported number of channels: " << num_channels;
582 return -1; 583 return -1;
583 } 584 }
584 585
585 // Check if the payload-type is valid. 586 // Check if the payload-type is valid.
586 if (!RentACodec::IsPayloadTypeValid(rtp_payload_type)) { 587 if (!RentACodec::IsPayloadTypeValid(rtp_payload_type)) {
587 LOG_F(LS_ERROR) << "Invalid payload-type " << rtp_payload_type 588 LOG_F(LS_ERROR) << "Invalid payload-type " << rtp_payload_type
588 << " for external decoder."; 589 << " for external decoder.";
589 return -1; 590 return -1;
590 } 591 }
591 592
592 return receiver_.AddCodec(-1 /* external */, rtp_payload_type, num_channels, 593 return receiver_.AddCodec(-1 /* external */, rtp_payload_type, num_channels,
593 sample_rate_hz, external_decoder); 594 sample_rate_hz, external_decoder, name);
594 } 595 }
595 596
596 // Get current received codec. 597 // Get current received codec.
597 int AudioCodingModuleImpl::ReceiveCodec(CodecInst* current_codec) const { 598 int AudioCodingModuleImpl::ReceiveCodec(CodecInst* current_codec) const {
598 CriticalSectionScoped lock(acm_crit_sect_.get()); 599 CriticalSectionScoped lock(acm_crit_sect_.get());
599 return receiver_.LastAudioCodec(current_codec); 600 return receiver_.LastAudioCodec(current_codec);
600 } 601 }
601 602
602 // Incoming packet from network parsed and ready for decode. 603 // Incoming packet from network parsed and ready for decode.
603 int AudioCodingModuleImpl::IncomingPacket(const uint8_t* incoming_payload, 604 int AudioCodingModuleImpl::IncomingPacket(const uint8_t* incoming_payload,
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 return receiver_.LeastRequiredDelayMs(); 778 return receiver_.LeastRequiredDelayMs();
778 } 779 }
779 780
780 void AudioCodingModuleImpl::GetDecodingCallStatistics( 781 void AudioCodingModuleImpl::GetDecodingCallStatistics(
781 AudioDecodingCallStats* call_stats) const { 782 AudioDecodingCallStats* call_stats) const {
782 receiver_.GetDecodingCallStatistics(call_stats); 783 receiver_.GetDecodingCallStatistics(call_stats);
783 } 784 }
784 785
785 } // namespace acm2 786 } // namespace acm2
786 } // namespace webrtc 787 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698