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

Side by Side Diff: content/renderer/renderer_webaudiodevice_impl.cc

Issue 8909006: Fix start/stop of html5 audio stream and race condition when pausing. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/renderer_webaudiodevice_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/renderer/renderer_webaudiodevice_impl.h" 5 #include "content/renderer/renderer_webaudiodevice_impl.h"
6 6
7 using WebKit::WebAudioDevice; 7 using WebKit::WebAudioDevice;
8 using WebKit::WebVector; 8 using WebKit::WebVector;
9 9
10 RendererWebAudioDeviceImpl::RendererWebAudioDeviceImpl(size_t buffer_size, 10 RendererWebAudioDeviceImpl::RendererWebAudioDeviceImpl(size_t buffer_size,
(...skipping 18 matching lines...) Expand all
29 if (is_running_) { 29 if (is_running_) {
30 audio_device_->Stop(); 30 audio_device_->Stop();
31 is_running_ = false; 31 is_running_ = false;
32 } 32 }
33 } 33 }
34 34
35 double RendererWebAudioDeviceImpl::sampleRate() { 35 double RendererWebAudioDeviceImpl::sampleRate() {
36 return 44100.0; 36 return 44100.0;
37 } 37 }
38 38
39 void RendererWebAudioDeviceImpl::Render(const std::vector<float*>& audio_data, 39 size_t RendererWebAudioDeviceImpl::Render(const std::vector<float*>& audio_data,
40 size_t number_of_frames, 40 size_t number_of_frames,
41 size_t audio_delay_milliseconds) { 41 size_t audio_delay_milliseconds) {
42 // Make the client callback to get rendered audio. 42 // Make the client callback to get rendered audio.
43 DCHECK(client_callback_); 43 DCHECK(client_callback_);
44 if (client_callback_) { 44 if (client_callback_) {
45 // Wrap the pointers using WebVector. 45 // Wrap the pointers using WebVector.
46 WebVector<float*> web_audio_data(audio_data.size()); 46 WebVector<float*> web_audio_data(audio_data.size());
47 for (size_t i = 0; i < audio_data.size(); ++i) 47 for (size_t i = 0; i < audio_data.size(); ++i)
48 web_audio_data[i] = audio_data[i]; 48 web_audio_data[i] = audio_data[i];
49 49
50 client_callback_->render(web_audio_data, number_of_frames); 50 client_callback_->render(web_audio_data, number_of_frames);
51 } 51 }
52 return number_of_frames;
52 } 53 }
OLDNEW
« no previous file with comments | « content/renderer/renderer_webaudiodevice_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698