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

Side by Side Diff: webkit/plugins/ppapi/ppb_audio_impl.cc

Issue 10832285: Switch OnMoreData() to use AudioBus. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Comments. Created 8 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 | Annotate | Revision Log
« no previous file with comments | « webkit/plugins/ppapi/ppb_audio_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) 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 "webkit/plugins/ppapi/ppb_audio_impl.h" 5 #include "webkit/plugins/ppapi/ppb_audio_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "media/audio/audio_output_controller.h" 8 #include "media/audio/audio_output_controller.h"
9 #include "ppapi/c/pp_completion_callback.h" 9 #include "ppapi/c/pp_completion_callback.h"
10 #include "ppapi/c/ppb_audio.h" 10 #include "ppapi/c/ppb_audio.h"
(...skipping 12 matching lines...) Expand all
23 using ppapi::thunk::PPB_AudioConfig_API; 23 using ppapi::thunk::PPB_AudioConfig_API;
24 using ppapi::TrackedCallback; 24 using ppapi::TrackedCallback;
25 25
26 namespace webkit { 26 namespace webkit {
27 namespace ppapi { 27 namespace ppapi {
28 28
29 // PPB_Audio_Impl -------------------------------------------------------------- 29 // PPB_Audio_Impl --------------------------------------------------------------
30 30
31 PPB_Audio_Impl::PPB_Audio_Impl(PP_Instance instance) 31 PPB_Audio_Impl::PPB_Audio_Impl(PP_Instance instance)
32 : Resource(::ppapi::OBJECT_IS_IMPL, instance), 32 : Resource(::ppapi::OBJECT_IS_IMPL, instance),
33 audio_(NULL) { 33 audio_(NULL),
34 sample_frame_count_(0) {
34 } 35 }
35 36
36 PPB_Audio_Impl::~PPB_Audio_Impl() { 37 PPB_Audio_Impl::~PPB_Audio_Impl() {
37 // Calling ShutDown() makes sure StreamCreated cannot be called anymore and 38 // Calling ShutDown() makes sure StreamCreated cannot be called anymore and
38 // releases the audio data associated with the pointer. Note however, that 39 // releases the audio data associated with the pointer. Note however, that
39 // until ShutDown returns, StreamCreated may still be called. This will be 40 // until ShutDown returns, StreamCreated may still be called. This will be
40 // OK since we'll just immediately clean up the data it stored later in this 41 // OK since we'll just immediately clean up the data it stored later in this
41 // destructor. 42 // destructor.
42 if (audio_) { 43 if (audio_) {
43 audio_->ShutDown(); 44 audio_->ShutDown();
(...skipping 30 matching lines...) Expand all
74 75
75 PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this); 76 PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this);
76 if (!plugin_delegate) 77 if (!plugin_delegate)
77 return false; 78 return false;
78 79
79 // When the stream is created, we'll get called back on StreamCreated(). 80 // When the stream is created, we'll get called back on StreamCreated().
80 CHECK(!audio_); 81 CHECK(!audio_);
81 audio_ = plugin_delegate->CreateAudioOutput( 82 audio_ = plugin_delegate->CreateAudioOutput(
82 enter.object()->GetSampleRate(), enter.object()->GetSampleFrameCount(), 83 enter.object()->GetSampleRate(), enter.object()->GetSampleFrameCount(),
83 this); 84 this);
85 sample_frame_count_ = enter.object()->GetSampleFrameCount();
84 return audio_ != NULL; 86 return audio_ != NULL;
85 } 87 }
86 88
87 PP_Resource PPB_Audio_Impl::GetCurrentConfig() { 89 PP_Resource PPB_Audio_Impl::GetCurrentConfig() {
88 // AddRef on behalf of caller, while keeping a ref for ourselves. 90 // AddRef on behalf of caller, while keeping a ref for ourselves.
89 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(config_); 91 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(config_);
90 return config_; 92 return config_;
91 } 93 }
92 94
93 PP_Bool PPB_Audio_Impl::StartPlayback() { 95 PP_Bool PPB_Audio_Impl::StartPlayback() {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 int32_t PPB_Audio_Impl::GetSharedMemory(int* shm_handle, 148 int32_t PPB_Audio_Impl::GetSharedMemory(int* shm_handle,
147 uint32_t* shm_size) { 149 uint32_t* shm_size) {
148 return GetSharedMemoryImpl(shm_handle, shm_size); 150 return GetSharedMemoryImpl(shm_handle, shm_size);
149 } 151 }
150 152
151 void PPB_Audio_Impl::OnSetStreamInfo( 153 void PPB_Audio_Impl::OnSetStreamInfo(
152 base::SharedMemoryHandle shared_memory_handle, 154 base::SharedMemoryHandle shared_memory_handle,
153 size_t shared_memory_size, 155 size_t shared_memory_size,
154 base::SyncSocket::Handle socket_handle) { 156 base::SyncSocket::Handle socket_handle) {
155 SetStreamInfo(pp_instance(), shared_memory_handle, shared_memory_size, 157 SetStreamInfo(pp_instance(), shared_memory_handle, shared_memory_size,
156 socket_handle); 158 socket_handle, sample_frame_count_);
157 } 159 }
158 160
159 } // namespace ppapi 161 } // namespace ppapi
160 } // namespace webkit 162 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppb_audio_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698