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

Unified Diff: content/renderer/pepper/ppb_audio_impl.cc

Issue 22320004: Add a new parameter |latency| to PPB_Audio. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/pepper/ppb_audio_impl.cc
diff --git a/content/renderer/pepper/ppb_audio_impl.cc b/content/renderer/pepper/ppb_audio_impl.cc
index ba9a836f479e4c35c566f6282f9c84dd00f37eb0..2190991f1b190fa892ca3ad66cb7059e4851b75b 100644
--- a/content/renderer/pepper/ppb_audio_impl.cc
+++ b/content/renderer/pepper/ppb_audio_impl.cc
@@ -31,8 +31,7 @@ namespace content {
PPB_Audio_Impl::PPB_Audio_Impl(PP_Instance instance)
: Resource(::ppapi::OBJECT_IS_IMPL, instance),
- audio_(NULL),
- sample_frame_count_(0) {
+ audio_(NULL) {
}
PPB_Audio_Impl::~PPB_Audio_Impl() {
@@ -50,7 +49,7 @@ PPB_Audio_Impl::~PPB_Audio_Impl() {
// static
PP_Resource PPB_Audio_Impl::Create(PP_Instance instance,
PP_Resource config,
- PPB_Audio_Callback audio_callback,
+ const ppapi::AudioCallback& audio_callback,
void* user_data) {
scoped_refptr<PPB_Audio_Impl> audio(new PPB_Audio_Impl(instance));
if (!audio->Init(config, audio_callback, user_data))
@@ -63,14 +62,15 @@ PPB_Audio_API* PPB_Audio_Impl::AsPPB_Audio_API() {
}
bool PPB_Audio_Impl::Init(PP_Resource config,
- PPB_Audio_Callback callback, void* user_data) {
+ const ppapi::AudioCallback& callback,
+ void* user_data) {
// Validate the config and keep a reference to it.
EnterResourceNoLock<PPB_AudioConfig_API> enter(config, true);
if (enter.failed())
return false;
config_ = config;
- if (!callback)
+ if (!callback.IsValid())
return false;
SetCallback(callback, user_data);
@@ -85,7 +85,6 @@ bool PPB_Audio_Impl::Init(PP_Resource config,
static_cast<int>(enter.object()->GetSampleFrameCount()),
instance->GetRenderView()->GetRoutingID(),
this);
- sample_frame_count_ = enter.object()->GetSampleFrameCount();
return audio_ != NULL;
}
@@ -159,8 +158,10 @@ void PPB_Audio_Impl::OnSetStreamInfo(
base::SharedMemoryHandle shared_memory_handle,
size_t shared_memory_size,
base::SyncSocket::Handle socket_handle) {
+ EnterResourceNoLock<PPB_AudioConfig_API> enter(config_, true);
dmichael (off chromium) 2013/08/06 19:43:25 I think this could fail if the plugin releases con
yzshen1 2013/08/07 20:51:06 This class also holds a ref to config_, so it shou
dmichael (off chromium) 2013/08/07 21:11:38 Thanks, I missed that it's a ScopedPPResource inst
SetStreamInfo(pp_instance(), shared_memory_handle, shared_memory_size,
- socket_handle, sample_frame_count_);
+ socket_handle, enter.object()->GetSampleRate(),
+ enter.object()->GetSampleFrameCount());
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698