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

Side by Side Diff: webrtc/modules/audio_coding/neteq/decision_logic.cc

Issue 2326953003: Added a ParsePayload method to AudioDecoder. (Closed)
Patch Set: Added some casts from size_t to int. Created 4 years, 3 months 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 101 }
102 102
103 Operations DecisionLogic::GetDecision(const SyncBuffer& sync_buffer, 103 Operations DecisionLogic::GetDecision(const SyncBuffer& sync_buffer,
104 const Expand& expand, 104 const Expand& expand,
105 size_t decoder_frame_length, 105 size_t decoder_frame_length,
106 const RTPHeader* packet_header, 106 const RTPHeader* packet_header,
107 Modes prev_mode, 107 Modes prev_mode,
108 bool play_dtmf, 108 bool play_dtmf,
109 size_t generated_noise_samples, 109 size_t generated_noise_samples,
110 bool* reset_decoder) { 110 bool* reset_decoder) {
111 if (prev_mode == kModeRfc3389Cng || 111 // If last mode was CNG (or Expand, since this could be covering up for
112 prev_mode == kModeCodecInternalCng || 112 // a lost CNG packet), remember that CNG is on. This is needed if comfort
113 prev_mode == kModeExpand) { 113 // noise is interrupted by DTMF.
114 // If last mode was CNG (or Expand, since this could be covering up for 114 if (prev_mode == kModeRfc3389Cng) {
115 // a lost CNG packet), remember that CNG is on. This is needed if comfort 115 cng_state_ = kCngRfc3389On;
116 // noise is interrupted by DTMF. 116 } else if (prev_mode == kModeCodecInternalCng) {
117 if (prev_mode == kModeRfc3389Cng) { 117 cng_state_ = kCngInternalOn;
118 cng_state_ = kCngRfc3389On;
119 } else if (prev_mode == kModeCodecInternalCng) {
120 cng_state_ = kCngInternalOn;
121 }
122 } 118 }
123 119
124 const size_t samples_left = 120 const size_t samples_left =
125 sync_buffer.FutureLength() - expand.overlap_length(); 121 sync_buffer.FutureLength() - expand.overlap_length();
126 const size_t cur_size_samples = 122 const size_t cur_size_samples =
127 samples_left + packet_buffer_.NumSamplesInBuffer(decoder_database_, 123 samples_left + packet_buffer_.NumSamplesInBuffer(decoder_frame_length);
128 decoder_frame_length);
129 124
130 prev_time_scale_ = prev_time_scale_ && 125 prev_time_scale_ = prev_time_scale_ &&
131 (prev_mode == kModeAccelerateSuccess || 126 (prev_mode == kModeAccelerateSuccess ||
132 prev_mode == kModeAccelerateLowEnergy || 127 prev_mode == kModeAccelerateLowEnergy ||
133 prev_mode == kModePreemptiveExpandSuccess || 128 prev_mode == kModePreemptiveExpandSuccess ||
134 prev_mode == kModePreemptiveExpandLowEnergy); 129 prev_mode == kModePreemptiveExpandLowEnergy);
135 130
136 FilterBufferLevel(cur_size_samples, prev_mode); 131 FilterBufferLevel(cur_size_samples, prev_mode);
137 132
138 return GetDecisionSpecialized(sync_buffer, expand, decoder_frame_length, 133 return GetDecisionSpecialized(sync_buffer, expand, decoder_frame_length,
(...skipping 28 matching lines...) Expand all
167 timescale_countdown_ = 162 timescale_countdown_ =
168 tick_timer_->GetNewCountdown(kMinTimescaleInterval); 163 tick_timer_->GetNewCountdown(kMinTimescaleInterval);
169 } 164 }
170 buffer_level_filter_->Update(buffer_size_packets, sample_memory_local, 165 buffer_level_filter_->Update(buffer_size_packets, sample_memory_local,
171 packet_length_samples_); 166 packet_length_samples_);
172 prev_time_scale_ = false; 167 prev_time_scale_ = false;
173 } 168 }
174 } 169 }
175 170
176 } // namespace webrtc 171 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/codecs/audio_decoder.cc ('k') | webrtc/modules/audio_coding/neteq/neteq_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698