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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 last_vad_activity_ = audio_frame->vad_activity_; | 205 last_vad_activity_ = audio_frame->vad_activity_; |
206 last_output_sample_rate_hz_ = audio_frame->sample_rate_hz_; | 206 last_output_sample_rate_hz_ = audio_frame->sample_rate_hz_; |
207 RTC_DCHECK(last_output_sample_rate_hz_ == 8000 || | 207 RTC_DCHECK(last_output_sample_rate_hz_ == 8000 || |
208 last_output_sample_rate_hz_ == 16000 || | 208 last_output_sample_rate_hz_ == 16000 || |
209 last_output_sample_rate_hz_ == 32000 || | 209 last_output_sample_rate_hz_ == 32000 || |
210 last_output_sample_rate_hz_ == 48000) | 210 last_output_sample_rate_hz_ == 48000) |
211 << "Unexpected sample rate " << last_output_sample_rate_hz_; | 211 << "Unexpected sample rate " << last_output_sample_rate_hz_; |
212 return kOK; | 212 return kOK; |
213 } | 213 } |
214 | 214 |
| 215 void NetEqImpl::SetCodecs(const std::map<int, SdpAudioFormat>& codecs) { |
| 216 rtc::CritScope lock(&crit_sect_); |
| 217 const std::vector<int> changed_payload_types = |
| 218 decoder_database_->SetCodecs(codecs); |
| 219 for (const int pt : changed_payload_types) { |
| 220 packet_buffer_->DiscardPacketsWithPayloadType(pt); |
| 221 } |
| 222 } |
| 223 |
215 int NetEqImpl::RegisterPayloadType(NetEqDecoder codec, | 224 int NetEqImpl::RegisterPayloadType(NetEqDecoder codec, |
216 const std::string& name, | 225 const std::string& name, |
217 uint8_t rtp_payload_type) { | 226 uint8_t rtp_payload_type) { |
218 rtc::CritScope lock(&crit_sect_); | 227 rtc::CritScope lock(&crit_sect_); |
219 LOG(LS_VERBOSE) << "RegisterPayloadType " | 228 LOG(LS_VERBOSE) << "RegisterPayloadType " |
220 << static_cast<int>(rtp_payload_type) << " " | 229 << static_cast<int>(rtp_payload_type) << " " |
221 << static_cast<int>(codec); | 230 << static_cast<int>(codec); |
222 int ret = decoder_database_->RegisterPayload(rtp_payload_type, codec, name); | 231 int ret = decoder_database_->RegisterPayload(rtp_payload_type, codec, name); |
223 if (ret != DecoderDatabase::kOK) { | 232 if (ret != DecoderDatabase::kOK) { |
224 switch (ret) { | 233 switch (ret) { |
(...skipping 1903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2128 } | 2137 } |
2129 } | 2138 } |
2130 | 2139 |
2131 void NetEqImpl::CreateDecisionLogic() { | 2140 void NetEqImpl::CreateDecisionLogic() { |
2132 decision_logic_.reset(DecisionLogic::Create( | 2141 decision_logic_.reset(DecisionLogic::Create( |
2133 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(), | 2142 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(), |
2134 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(), | 2143 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(), |
2135 tick_timer_.get())); | 2144 tick_timer_.get())); |
2136 } | 2145 } |
2137 } // namespace webrtc | 2146 } // namespace webrtc |
OLD | NEW |