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

Side by Side Diff: media/base/audio_converter.cc

Issue 1954633002: MEDIA_LOG for large encoded timestamp gaps in decoder stream. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: New AudioTimestampValidator class and tests Created 4 years, 6 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // AudioConverter implementation. Uses MultiChannelSincResampler for resampling 5 // AudioConverter implementation. Uses MultiChannelSincResampler for resampling
6 // audio, ChannelMixer for channel mixing, and AudioPullFifo for buffering. 6 // audio, ChannelMixer for channel mixing, and AudioPullFifo for buffering.
7 // 7 //
8 // Delay estimates are provided to InputCallbacks based on the frame delay 8 // Delay estimates are provided to InputCallbacks based on the frame delay
9 // information reported via the resampler and FIFO units. 9 // information reported via the resampler and FIFO units.
10 10
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 CreateUnmixedAudioIfNecessary(dest->frames()); 183 CreateUnmixedAudioIfNecessary(dest->frames());
184 184
185 AudioBus* const temp_dest = needs_downmix ? unmixed_audio_.get() : dest; 185 AudioBus* const temp_dest = needs_downmix ? unmixed_audio_.get() : dest;
186 186
187 // Sanity check our inputs. 187 // Sanity check our inputs.
188 DCHECK_EQ(temp_dest->frames(), mixer_input_audio_bus_->frames()); 188 DCHECK_EQ(temp_dest->frames(), mixer_input_audio_bus_->frames());
189 DCHECK_EQ(temp_dest->channels(), mixer_input_audio_bus_->channels()); 189 DCHECK_EQ(temp_dest->channels(), mixer_input_audio_bus_->channels());
190 190
191 // Calculate the buffer delay for this callback. 191 // Calculate the buffer delay for this callback.
192 base::TimeDelta buffer_delay = initial_delay_; 192 base::TimeDelta buffer_delay = initial_delay_;
193 LOG(ERROR) << "initial delay:" << initial_delay_.InMicroseconds();
193 if (resampler_) { 194 if (resampler_) {
194 buffer_delay += base::TimeDelta::FromMicroseconds( 195 base::TimeDelta resampler_delay = base::TimeDelta::FromMicroseconds(
195 resampler_frame_delay_ * output_frame_duration_.InMicroseconds()); 196 resampler_frame_delay_ * output_frame_duration_.InMicroseconds());
197 LOG(ERROR) << "resampler delay:" << resampler_delay.InMicroseconds()
198 << " frames:" << resampler_frame_delay_
199 << " output_dur:" << output_frame_duration_.InMicroseconds();
200 buffer_delay += resampler_delay;
196 } 201 }
197 if (audio_fifo_) { 202 if (audio_fifo_) {
198 buffer_delay += base::TimeDelta::FromMicroseconds( 203 base::TimeDelta fifo_delay = base::TimeDelta::FromMicroseconds(
199 fifo_frame_delay * input_frame_duration_.InMicroseconds()); 204 fifo_frame_delay * input_frame_duration_.InMicroseconds());
205 LOG(ERROR) << "fifo delay:" << fifo_delay.InMicroseconds()
206 << " frames:" << fifo_frame_delay
207 << " input_dur:" << input_frame_duration_.InMicroseconds();
208 buffer_delay += fifo_delay;
200 } 209 }
201 210
202 // If we only have a single input, avoid an extra copy. 211 // If we only have a single input, avoid an extra copy.
203 AudioBus* const provide_input_dest = 212 AudioBus* const provide_input_dest =
204 transform_inputs_.size() == 1 ? temp_dest : mixer_input_audio_bus_.get(); 213 transform_inputs_.size() == 1 ? temp_dest : mixer_input_audio_bus_.get();
205 214
206 // Have each mixer render its data into an output buffer then mix the result. 215 // Have each mixer render its data into an output buffer then mix the result.
207 for (auto* input : transform_inputs_) { 216 for (auto* input : transform_inputs_) {
208 const float volume = input->ProvideInput(provide_input_dest, buffer_delay); 217 const float volume = input->ProvideInput(provide_input_dest, buffer_delay);
209 218
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 else 258 else
250 SourceCallback(0, dest); 259 SourceCallback(0, dest);
251 } 260 }
252 261
253 void AudioConverter::CreateUnmixedAudioIfNecessary(int frames) { 262 void AudioConverter::CreateUnmixedAudioIfNecessary(int frames) {
254 if (!unmixed_audio_ || unmixed_audio_->frames() != frames) 263 if (!unmixed_audio_ || unmixed_audio_->frames() != frames)
255 unmixed_audio_ = AudioBus::Create(input_channel_count_, frames); 264 unmixed_audio_ = AudioBus::Create(input_channel_count_, frames);
256 } 265 }
257 266
258 } // namespace media 267 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698