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

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

Issue 1467183002: Add new method AcmReceiver::last_packet_sample_rate_hz() (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@neteq-last-output-rate
Patch Set: Updates after second review 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
« no previous file with comments | « webrtc/modules/audio_coding/main/acm2/acm_receiver_unittest_oldapi.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
526 // Get current receive frequency. 526 // Get current receive frequency.
527 int AudioCodingModuleImpl::ReceiveFrequency() const { 527 int AudioCodingModuleImpl::ReceiveFrequency() const {
528 WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_, 528 const auto last_packet_sample_rate = receiver_.last_packet_sample_rate_hz();
529 "ReceiveFrequency()"); 529 return last_packet_sample_rate ? *last_packet_sample_rate
530 530 : receiver_.last_output_sample_rate_hz();
531 CriticalSectionScoped lock(acm_crit_sect_.get());
532
533 auto codec_id = RentACodec::CodecIdFromIndex(receiver_.last_audio_codec_id());
534 return codec_id ? RentACodec::CodecInstById(*codec_id)->plfreq
535 : receiver_.last_output_sample_rate_hz();
536 } 531 }
537 532
538 // Get current playout frequency. 533 // Get current playout frequency.
539 int AudioCodingModuleImpl::PlayoutFrequency() const { 534 int AudioCodingModuleImpl::PlayoutFrequency() const {
540 WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_, 535 WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceAudioCoding, id_,
541 "PlayoutFrequency()"); 536 "PlayoutFrequency()");
542 return receiver_.last_output_sample_rate_hz(); 537 return receiver_.last_output_sample_rate_hz();
543 } 538 }
544 539
545 // Register possible receive codecs, can be called multiple times, 540 // Register possible receive codecs, can be called multiple times,
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 return receiver_.LeastRequiredDelayMs(); 777 return receiver_.LeastRequiredDelayMs();
783 } 778 }
784 779
785 void AudioCodingModuleImpl::GetDecodingCallStatistics( 780 void AudioCodingModuleImpl::GetDecodingCallStatistics(
786 AudioDecodingCallStats* call_stats) const { 781 AudioDecodingCallStats* call_stats) const {
787 receiver_.GetDecodingCallStatistics(call_stats); 782 receiver_.GetDecodingCallStatistics(call_stats);
788 } 783 }
789 784
790 } // namespace acm2 785 } // namespace acm2
791 } // namespace webrtc 786 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/main/acm2/acm_receiver_unittest_oldapi.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698