Chromium Code Reviews| Index: webrtc/modules/audio_coding/neteq/neteq_impl.cc |
| diff --git a/webrtc/modules/audio_coding/neteq/neteq_impl.cc b/webrtc/modules/audio_coding/neteq/neteq_impl.cc |
| index 09a32965ed70116d3c3066f528701a720f85f85c..786cb84aa3ed8beffb5d6d6bb9f7db8d74267afc 100644 |
| --- a/webrtc/modules/audio_coding/neteq/neteq_impl.cc |
| +++ b/webrtc/modules/audio_coding/neteq/neteq_impl.cc |
| @@ -199,7 +199,7 @@ int NetEqImpl::GetAudio(AudioFrame* audio_frame, bool* muted) { |
| } |
| RTC_DCHECK_EQ( |
| audio_frame->sample_rate_hz_, |
| - rtc::checked_cast<int>(audio_frame->samples_per_channel_ * 100)); |
| + rtc::dchecked_cast<int>(audio_frame->samples_per_channel_ * 100)); |
| SetAudioFrameActivityAndType(vad_->enabled(), LastOutputType(), |
| last_vad_activity_, audio_frame); |
| last_vad_activity_ = audio_frame->vad_activity_; |
| @@ -826,7 +826,7 @@ int NetEqImpl::InsertPacketInternal(const WebRtcRTPHeader& rtp_header, |
| if (packet_length_samples != decision_logic_->packet_length_samples()) { |
| decision_logic_->set_packet_length_samples(packet_length_samples); |
| delay_manager_->SetPacketAudioLength( |
| - rtc::checked_cast<int>((1000 * packet_length_samples) / fs_hz_)); |
| + rtc::dchecked_cast<int>((1000 * packet_length_samples) / fs_hz_)); |
| } |
| } |
| @@ -1131,7 +1131,7 @@ int NetEqImpl::GetDecision(Operations* operation, |
| last_mode_ == kModePreemptiveExpandLowEnergy) { |
| // Subtract (samples_left + output_size_samples_) from sampleMemory. |
| decision_logic_->AddSampleMemory( |
| - -(samples_left + rtc::checked_cast<int>(output_size_samples_))); |
| + -(samples_left + rtc::dchecked_cast<int>(output_size_samples_))); |
| } |
| // Check if it is time to play a DTMF event. |
| @@ -1157,11 +1157,9 @@ int NetEqImpl::GetDecision(Operations* operation, |
| // Check if we already have enough samples in the |sync_buffer_|. If so, |
| // change decision to normal, unless the decision was merge, accelerate, or |
| // preemptive expand. |
| - if (samples_left >= rtc::checked_cast<int>(output_size_samples_) && |
| - *operation != kMerge && |
| - *operation != kAccelerate && |
| - *operation != kFastAccelerate && |
| - *operation != kPreemptiveExpand) { |
| + if (samples_left >= rtc::dchecked_cast<int>(output_size_samples_) && |
| + *operation != kMerge && *operation != kAccelerate && |
| + *operation != kFastAccelerate && *operation != kPreemptiveExpand) { |
| *operation = kNormal; |
| return 0; |
| } |
| @@ -1454,7 +1452,7 @@ int NetEqImpl::DecodeCng(AudioDecoder* decoder, int* decoded_length, |
| return 0; |
| } |
| - while (*decoded_length < rtc::checked_cast<int>(output_size_samples_)) { |
| + while (*decoded_length < rtc::dchecked_cast<int>(output_size_samples_)) { |
| const int length = decoder->Decode( |
| nullptr, 0, fs_hz_, |
| (decoded_buffer_length_ - *decoded_length) * sizeof(int16_t), |
| @@ -1500,7 +1498,7 @@ int NetEqImpl::DecodeLoop(PacketList* packet_list, const Operations& operation, |
| const auto& result = *opt_result; |
| *speech_type = result.speech_type; |
| if (result.num_decoded_samples > 0) { |
| - *decoded_length += rtc::checked_cast<int>(result.num_decoded_samples); |
| + *decoded_length += rtc::dchecked_cast<int>(result.num_decoded_samples); |
|
ossu
2017/03/02 00:54:14
These decoded_length checks (above and below as we
kwiberg-webrtc
2017/03/02 02:13:37
Acknowledged.
|
| // Update |decoder_frame_length_| with number of samples per channel. |
| decoder_frame_length_ = |
| result.num_decoded_samples / decoder->Channels(); |
| @@ -1513,7 +1511,7 @@ int NetEqImpl::DecodeLoop(PacketList* packet_list, const Operations& operation, |
| packet_list->clear(); |
| break; |
| } |
| - if (*decoded_length > rtc::checked_cast<int>(decoded_buffer_length_)) { |
| + if (*decoded_length > rtc::dchecked_cast<int>(decoded_buffer_length_)) { |
| // Guard against overflow. |
| LOG(LS_WARNING) << "Decoded too much."; |
| packet_list->clear(); |
| @@ -1986,7 +1984,8 @@ int NetEqImpl::ExtractPackets(size_t required_samples, |
| packet_duration = packet->frame->Duration(); |
| // TODO(ossu): Is this the correct way to track Opus FEC packets? |
| if (packet->priority.codec_level > 0) { |
| - stats_.SecondaryDecodedSamples(rtc::checked_cast<int>(packet_duration)); |
| + stats_.SecondaryDecodedSamples( |
| + rtc::dchecked_cast<int>(packet_duration)); |
| } |
| } else if (!has_cng_packet) { |
| LOG(LS_WARNING) << "Unknown payload type " |
| @@ -2029,7 +2028,7 @@ int NetEqImpl::ExtractPackets(size_t required_samples, |
| packet_buffer_->DiscardAllOldPackets(timestamp_); |
| } |
| - return rtc::checked_cast<int>(extracted_samples); |
| + return rtc::dchecked_cast<int>(extracted_samples); |
| } |
| void NetEqImpl::UpdatePlcComponents(int fs_hz, size_t channels) { |