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

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

Issue 1425233003: Hide ACMCodecDB::database_ behind accessors (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@rac-static
Patch Set: rebase Created 5 years, 1 month 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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 int AcmReceiver::last_audio_codec_id() const { 432 int AcmReceiver::last_audio_codec_id() const {
433 CriticalSectionScoped lock(crit_sect_.get()); 433 CriticalSectionScoped lock(crit_sect_.get());
434 return last_audio_decoder_ ? last_audio_decoder_->acm_codec_id : -1; 434 return last_audio_decoder_ ? last_audio_decoder_->acm_codec_id : -1;
435 } 435 }
436 436
437 int AcmReceiver::LastAudioCodec(CodecInst* codec) const { 437 int AcmReceiver::LastAudioCodec(CodecInst* codec) const {
438 CriticalSectionScoped lock(crit_sect_.get()); 438 CriticalSectionScoped lock(crit_sect_.get());
439 if (!last_audio_decoder_) { 439 if (!last_audio_decoder_) {
440 return -1; 440 return -1;
441 } 441 }
442 memcpy(codec, &ACMCodecDB::database_[last_audio_decoder_->acm_codec_id], 442 *codec = *RentACodec::CodecInstById(
443 sizeof(CodecInst)); 443 *RentACodec::CodecIdFromIndex(last_audio_decoder_->acm_codec_id));
444 codec->pltype = last_audio_decoder_->payload_type; 444 codec->pltype = last_audio_decoder_->payload_type;
445 codec->channels = last_audio_decoder_->channels; 445 codec->channels = last_audio_decoder_->channels;
446 codec->plfreq = last_audio_decoder_->sample_rate_hz; 446 codec->plfreq = last_audio_decoder_->sample_rate_hz;
447 return 0; 447 return 0;
448 } 448 }
449 449
450 void AcmReceiver::GetNetworkStatistics(NetworkStatistics* acm_stat) { 450 void AcmReceiver::GetNetworkStatistics(NetworkStatistics* acm_stat) {
451 NetEqNetworkStatistics neteq_stat; 451 NetEqNetworkStatistics neteq_stat;
452 // NetEq function always returns zero, so we don't check the return value. 452 // NetEq function always returns zero, so we don't check the return value.
453 neteq_->NetworkStatistics(&neteq_stat); 453 neteq_->NetworkStatistics(&neteq_stat);
(...skipping 19 matching lines...) Expand all
473 int AcmReceiver::DecoderByPayloadType(uint8_t payload_type, 473 int AcmReceiver::DecoderByPayloadType(uint8_t payload_type,
474 CodecInst* codec) const { 474 CodecInst* codec) const {
475 CriticalSectionScoped lock(crit_sect_.get()); 475 CriticalSectionScoped lock(crit_sect_.get());
476 auto it = decoders_.find(payload_type); 476 auto it = decoders_.find(payload_type);
477 if (it == decoders_.end()) { 477 if (it == decoders_.end()) {
478 LOG(LERROR) << "AcmReceiver::DecoderByPayloadType " 478 LOG(LERROR) << "AcmReceiver::DecoderByPayloadType "
479 << static_cast<int>(payload_type); 479 << static_cast<int>(payload_type);
480 return -1; 480 return -1;
481 } 481 }
482 const Decoder& decoder = it->second; 482 const Decoder& decoder = it->second;
483 memcpy(codec, &ACMCodecDB::database_[decoder.acm_codec_id], 483 *codec = *RentACodec::CodecInstById(
484 sizeof(CodecInst)); 484 *RentACodec::CodecIdFromIndex(decoder.acm_codec_id));
485 codec->pltype = decoder.payload_type; 485 codec->pltype = decoder.payload_type;
486 codec->channels = decoder.channels; 486 codec->channels = decoder.channels;
487 codec->plfreq = decoder.sample_rate_hz; 487 codec->plfreq = decoder.sample_rate_hz;
488 return 0; 488 return 0;
489 } 489 }
490 490
491 int AcmReceiver::EnableNack(size_t max_nack_list_size) { 491 int AcmReceiver::EnableNack(size_t max_nack_list_size) {
492 neteq_->EnableNack(max_nack_list_size); 492 neteq_->EnableNack(max_nack_list_size);
493 return 0; 493 return 0;
494 } 494 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 536
537 void AcmReceiver::GetDecodingCallStatistics( 537 void AcmReceiver::GetDecodingCallStatistics(
538 AudioDecodingCallStats* stats) const { 538 AudioDecodingCallStats* stats) const {
539 CriticalSectionScoped lock(crit_sect_.get()); 539 CriticalSectionScoped lock(crit_sect_.get());
540 *stats = call_stats_.GetDecodingStatistics(); 540 *stats = call_stats_.GetDecodingStatistics();
541 } 541 }
542 542
543 } // namespace acm2 543 } // namespace acm2
544 544
545 } // namespace webrtc 545 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698