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

Side by Side Diff: third_party/WebKit/Source/platform/audio/AudioDestination.cpp

Issue 2060833002: Implementation of 'AudioContext.getOutputTimestamp' method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Implementation of 'AudioContext.getOutputTimestamp' method 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 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 float AudioDestination::hardwareSampleRate() 139 float AudioDestination::hardwareSampleRate()
140 { 140 {
141 return static_cast<float>(Platform::current()->audioHardwareSampleRate()); 141 return static_cast<float>(Platform::current()->audioHardwareSampleRate());
142 } 142 }
143 143
144 unsigned long AudioDestination::maxChannelCount() 144 unsigned long AudioDestination::maxChannelCount()
145 { 145 {
146 return static_cast<float>(Platform::current()->audioHardwareOutputChannels() ); 146 return static_cast<float>(Platform::current()->audioHardwareOutputChannels() );
147 } 147 }
148 148
149 void AudioDestination::render(const WebVector<float*>& sourceData, const WebVect or<float*>& audioData, size_t numberOfFrames) 149 void AudioDestination::render(const WebVector<float*>& sourceData, const WebVect or<float*>& audioData, size_t numberOfFrames, const WebAudioTimestamp& timestamp )
150 { 150 {
151 m_outputTimestamp = timestamp;
Raymond Toy 2016/06/14 16:42:40 Does this need to be protected by the mutex?
Mikhail 2016/06/17 09:36:57 it looks like here it is always accessed on the sa
151 bool isNumberOfChannelsGood = audioData.size() == m_numberOfOutputChannels; 152 bool isNumberOfChannelsGood = audioData.size() == m_numberOfOutputChannels;
152 if (!isNumberOfChannelsGood) { 153 if (!isNumberOfChannelsGood) {
153 ASSERT_NOT_REACHED(); 154 ASSERT_NOT_REACHED();
154 return; 155 return;
155 } 156 }
156 157
157 bool isBufferSizeGood = numberOfFrames == m_callbackBufferSize; 158 bool isBufferSizeGood = numberOfFrames == m_callbackBufferSize;
158 if (!isBufferSizeGood) { 159 if (!isBufferSizeGood) {
159 ASSERT_NOT_REACHED(); 160 ASSERT_NOT_REACHED();
160 return; 161 return;
(...skipping 15 matching lines...) Expand all
176 } 177 }
177 178
178 void AudioDestination::provideInput(AudioBus* bus, size_t framesToProcess) 179 void AudioDestination::provideInput(AudioBus* bus, size_t framesToProcess)
179 { 180 {
180 AudioBus* sourceBus = nullptr; 181 AudioBus* sourceBus = nullptr;
181 if (m_inputFifo->framesInFifo() >= framesToProcess) { 182 if (m_inputFifo->framesInFifo() >= framesToProcess) {
182 m_inputFifo->consume(m_inputBus.get(), framesToProcess); 183 m_inputFifo->consume(m_inputBus.get(), framesToProcess);
183 sourceBus = m_inputBus.get(); 184 sourceBus = m_inputBus.get();
184 } 185 }
185 186
186 m_callback.render(sourceBus, bus, framesToProcess); 187 m_callback.render(sourceBus, bus, framesToProcess, m_outputTimestamp);
187 } 188 }
188 189
189 } // namespace blink 190 } // namespace blink
190 191
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698