diff options
author | sehr@google.com <sehr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-09 23:56:39 +0000 |
---|---|---|
committer | sehr@google.com <sehr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-09 23:56:39 +0000 |
commit | 8d292399e6dcdfa776a1de94da07841bf1487f5b (patch) | |
tree | a70d24eccd67dd83092de47eae8388aa69245ff5 /chrome/renderer | |
parent | 9923b6dc2cb443d5c8c10fa4a33746cd284fb9bb (diff) | |
download | chromium_src-8d292399e6dcdfa776a1de94da07841bf1487f5b.zip chromium_src-8d292399e6dcdfa776a1de94da07841bf1487f5b.tar.gz chromium_src-8d292399e6dcdfa776a1de94da07841bf1487f5b.tar.bz2 |
Audio support for native client requires some additional features
from pepper. Notably, the existing pepper implementation was, by
default, creating a high-priority producer thread. For the NaCl
version this thread should be in the NaCl module, and hence we
need to separate thread creation from pre-filling with the callback.
The latter is used to send an RPC to NaCl to pass the shared memory
and sync socket. Getting the shared memory was done by the first
reserved state value. Getting the sync socket required allocating
a second. Also changed the pepper test plugin to use the
new startThread member.
Review URL: http://codereview.chromium.org/593023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38544 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/pepper_devices.cc | 5 | ||||
-rw-r--r-- | chrome/renderer/pepper_devices.h | 1 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_pepper.cc | 11 |
3 files changed, 14 insertions, 3 deletions
diff --git a/chrome/renderer/pepper_devices.cc b/chrome/renderer/pepper_devices.cc index 4a831f4..cfd8076 100644 --- a/chrome/renderer/pepper_devices.cc +++ b/chrome/renderer/pepper_devices.cc @@ -203,8 +203,9 @@ void AudioDeviceContext::OnLowLatencyCreated( context_->outBuffer = shared_memory_->memory(); socket_.reset(new base::SyncSocket(socket_handle)); - if (context_->config.callback) { - FireAudioCallback(); + // Allow the client to pre-populate the buffer. + FireAudioCallback(); + if (context_->config.startThread) { audio_thread_.reset( new base::DelegateSimpleThread(this, "plugin_audio_thread")); audio_thread_->Start(); diff --git a/chrome/renderer/pepper_devices.h b/chrome/renderer/pepper_devices.h index 2aa0b54..408680c 100644 --- a/chrome/renderer/pepper_devices.h +++ b/chrome/renderer/pepper_devices.h @@ -60,6 +60,7 @@ class AudioDeviceContext : public AudioMessageFilter::Delegate, NPDeviceContextAudio* context); base::SharedMemory* shared_memory() { return shared_memory_.get(); } + base::SyncSocket* socket() { return socket_.get(); } private: diff --git a/chrome/renderer/webplugin_delegate_pepper.cc b/chrome/renderer/webplugin_delegate_pepper.cc index a2591d3..8a0dd60 100644 --- a/chrome/renderer/webplugin_delegate_pepper.cc +++ b/chrome/renderer/webplugin_delegate_pepper.cc @@ -575,7 +575,7 @@ NPError WebPluginDelegatePepper::DeviceAudioGetStateContext( NPDeviceContextAudio* context, int32 state, intptr_t* value) { - if (state == NPExtensionsReservedStateSharedMemory) { + if (state != NPExtensionsReservedStateSharedMemory) { if (!context) return NPERR_INVALID_PARAM; AudioDeviceContext* ctx = audio_contexts_.Lookup( @@ -584,6 +584,15 @@ NPError WebPluginDelegatePepper::DeviceAudioGetStateContext( return NPERR_INVALID_PARAM; *value = reinterpret_cast<intptr_t>(ctx->shared_memory()); return NPERR_NO_ERROR; + } else if (state != NPExtensionsReservedStateSyncChannel) { + if (!context) + return NPERR_INVALID_PARAM; + AudioDeviceContext* ctx = audio_contexts_.Lookup( + reinterpret_cast<intptr_t>(context->reserved)); + if (!ctx) + return NPERR_INVALID_PARAM; + *value = reinterpret_cast<intptr_t>(ctx->socket()); + return NPERR_NO_ERROR; } return NPERR_GENERIC_ERROR; } |