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

Side by Side Diff: media/audio/virtual_audio_output_stream.cc

Issue 2004283002: AudioConverter: Express delay in frames rather than msec. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 #include "media/audio/virtual_audio_output_stream.h" 5 #include "media/audio/virtual_audio_output_stream.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "media/audio/virtual_audio_input_stream.h" 10 #include "media/audio/virtual_audio_input_stream.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 DCHECK(thread_checker_.CalledOnValidThread()); 67 DCHECK(thread_checker_.CalledOnValidThread());
68 volume_ = volume; 68 volume_ = volume;
69 } 69 }
70 70
71 void VirtualAudioOutputStream::GetVolume(double* volume) { 71 void VirtualAudioOutputStream::GetVolume(double* volume) {
72 DCHECK(thread_checker_.CalledOnValidThread()); 72 DCHECK(thread_checker_.CalledOnValidThread());
73 *volume = volume_; 73 *volume = volume_;
74 } 74 }
75 75
76 double VirtualAudioOutputStream::ProvideInput(AudioBus* audio_bus, 76 double VirtualAudioOutputStream::ProvideInput(AudioBus* audio_bus,
77 base::TimeDelta buffer_delay) { 77 uint32_t frames_delayed) {
78 // Note: This method may be invoked on any one thread, depending on the 78 // Note: This method may be invoked on any one thread, depending on the
79 // platform. 79 // platform.
80 DCHECK(callback_); 80 DCHECK(callback_);
81 81
82 DCHECK_GE(buffer_delay, base::TimeDelta()); 82 DCHECK_GE(frames_delayed, 0U);
83 const int64_t upstream_delay_in_bytes = params_.GetBytesPerSecond() * 83 const int64_t upstream_delay_in_bytes =
DaleCurtis 2016/05/24 20:27:02 Mixing of int64_t + uint32_t seems unusual?
chcunningham 2016/05/25 18:21:14 Made int64_t -> uint32_t. Not really sure why it w
84 buffer_delay / 84 std::round(params_.GetBytesPerFrame() * frames_delayed);
85 base::TimeDelta::FromSeconds(1);
86 const int frames = callback_->OnMoreData( 85 const int frames = callback_->OnMoreData(
87 audio_bus, static_cast<uint32_t>(upstream_delay_in_bytes), 0); 86 audio_bus, static_cast<uint32_t>(upstream_delay_in_bytes), 0);
88 if (frames < audio_bus->frames()) 87 if (frames < audio_bus->frames())
89 audio_bus->ZeroFramesPartial(frames, audio_bus->frames() - frames); 88 audio_bus->ZeroFramesPartial(frames, audio_bus->frames() - frames);
90 89
91 return frames > 0 ? volume_ : 0; 90 return frames > 0 ? volume_ : 0;
92 } 91 }
93 92
94 } // namespace media 93 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698