| OLD | NEW |
| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 193 |
| 194 int NetEqImpl::GetAudio(AudioFrame* audio_frame, bool* muted) { | 194 int NetEqImpl::GetAudio(AudioFrame* audio_frame, bool* muted) { |
| 195 TRACE_EVENT0("webrtc", "NetEqImpl::GetAudio"); | 195 TRACE_EVENT0("webrtc", "NetEqImpl::GetAudio"); |
| 196 rtc::CritScope lock(&crit_sect_); | 196 rtc::CritScope lock(&crit_sect_); |
| 197 if (GetAudioInternal(audio_frame, muted) != 0) { | 197 if (GetAudioInternal(audio_frame, muted) != 0) { |
| 198 return kFail; | 198 return kFail; |
| 199 } | 199 } |
| 200 RTC_DCHECK_EQ( | 200 RTC_DCHECK_EQ( |
| 201 audio_frame->sample_rate_hz_, | 201 audio_frame->sample_rate_hz_, |
| 202 rtc::dchecked_cast<int>(audio_frame->samples_per_channel_ * 100)); | 202 rtc::dchecked_cast<int>(audio_frame->samples_per_channel_ * 100)); |
| 203 RTC_DCHECK_EQ(*muted, audio_frame->muted()); |
| 203 SetAudioFrameActivityAndType(vad_->enabled(), LastOutputType(), | 204 SetAudioFrameActivityAndType(vad_->enabled(), LastOutputType(), |
| 204 last_vad_activity_, audio_frame); | 205 last_vad_activity_, audio_frame); |
| 205 last_vad_activity_ = audio_frame->vad_activity_; | 206 last_vad_activity_ = audio_frame->vad_activity_; |
| 206 last_output_sample_rate_hz_ = audio_frame->sample_rate_hz_; | 207 last_output_sample_rate_hz_ = audio_frame->sample_rate_hz_; |
| 207 RTC_DCHECK(last_output_sample_rate_hz_ == 8000 || | 208 RTC_DCHECK(last_output_sample_rate_hz_ == 8000 || |
| 208 last_output_sample_rate_hz_ == 16000 || | 209 last_output_sample_rate_hz_ == 16000 || |
| 209 last_output_sample_rate_hz_ == 32000 || | 210 last_output_sample_rate_hz_ == 32000 || |
| 210 last_output_sample_rate_hz_ == 48000) | 211 last_output_sample_rate_hz_ == 48000) |
| 211 << "Unexpected sample rate " << last_output_sample_rate_hz_; | 212 << "Unexpected sample rate " << last_output_sample_rate_hz_; |
| 212 return kOK; | 213 return kOK; |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 Operations operation; | 824 Operations operation; |
| 824 bool play_dtmf; | 825 bool play_dtmf; |
| 825 *muted = false; | 826 *muted = false; |
| 826 last_decoded_timestamps_.clear(); | 827 last_decoded_timestamps_.clear(); |
| 827 tick_timer_->Increment(); | 828 tick_timer_->Increment(); |
| 828 stats_.IncreaseCounter(output_size_samples_, fs_hz_); | 829 stats_.IncreaseCounter(output_size_samples_, fs_hz_); |
| 829 | 830 |
| 830 // Check for muted state. | 831 // Check for muted state. |
| 831 if (enable_muted_state_ && expand_->Muted() && packet_buffer_->Empty()) { | 832 if (enable_muted_state_ && expand_->Muted() && packet_buffer_->Empty()) { |
| 832 RTC_DCHECK_EQ(last_mode_, kModeExpand); | 833 RTC_DCHECK_EQ(last_mode_, kModeExpand); |
| 834 audio_frame->Reset(); |
| 835 RTC_DCHECK(audio_frame->muted()); // Reset() should mute the frame. |
| 833 playout_timestamp_ += static_cast<uint32_t>(output_size_samples_); | 836 playout_timestamp_ += static_cast<uint32_t>(output_size_samples_); |
| 834 audio_frame->sample_rate_hz_ = fs_hz_; | 837 audio_frame->sample_rate_hz_ = fs_hz_; |
| 835 audio_frame->samples_per_channel_ = output_size_samples_; | 838 audio_frame->samples_per_channel_ = output_size_samples_; |
| 836 audio_frame->timestamp_ = | 839 audio_frame->timestamp_ = |
| 837 first_packet_ | 840 first_packet_ |
| 838 ? 0 | 841 ? 0 |
| 839 : timestamp_scaler_->ToExternal(playout_timestamp_) - | 842 : timestamp_scaler_->ToExternal(playout_timestamp_) - |
| 840 static_cast<uint32_t>(audio_frame->samples_per_channel_); | 843 static_cast<uint32_t>(audio_frame->samples_per_channel_); |
| 841 audio_frame->num_channels_ = sync_buffer_->Channels(); | 844 audio_frame->num_channels_ = sync_buffer_->Channels(); |
| 842 stats_.ExpandedNoiseSamples(output_size_samples_); | 845 stats_.ExpandedNoiseSamples(output_size_samples_); |
| (...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2107 } | 2110 } |
| 2108 } | 2111 } |
| 2109 | 2112 |
| 2110 void NetEqImpl::CreateDecisionLogic() { | 2113 void NetEqImpl::CreateDecisionLogic() { |
| 2111 decision_logic_.reset(DecisionLogic::Create( | 2114 decision_logic_.reset(DecisionLogic::Create( |
| 2112 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(), | 2115 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(), |
| 2113 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(), | 2116 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(), |
| 2114 tick_timer_.get())); | 2117 tick_timer_.get())); |
| 2115 } | 2118 } |
| 2116 } // namespace webrtc | 2119 } // namespace webrtc |
| OLD | NEW |