summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/renderer/pepper_devices.cc5
-rw-r--r--chrome/renderer/pepper_devices.h1
-rw-r--r--chrome/renderer/webplugin_delegate_pepper.cc11
-rw-r--r--third_party/npapi/bindings/npapi_extensions.h1
-rw-r--r--third_party/npapi/bindings/npapi_extensions_private.h5
-rw-r--r--webkit/tools/pepper_test_plugin/plugin_object.cc1
6 files changed, 20 insertions, 4 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;
}
diff --git a/third_party/npapi/bindings/npapi_extensions.h b/third_party/npapi/bindings/npapi_extensions.h
index 4bfac2c..fca509e 100644
--- a/third_party/npapi/bindings/npapi_extensions.h
+++ b/third_party/npapi/bindings/npapi_extensions.h
@@ -398,6 +398,7 @@ typedef struct _NPDeviceContextAudioConfig {
int32 outputChannelMap;
int32 inputChannelMap;
int32 sampleFrameCount;
+ uint32 startThread;
uint32 flags;
NPAudioCallback callback;
void *userData;
diff --git a/third_party/npapi/bindings/npapi_extensions_private.h b/third_party/npapi/bindings/npapi_extensions_private.h
index ea84024..b333d21 100644
--- a/third_party/npapi/bindings/npapi_extensions_private.h
+++ b/third_party/npapi/bindings/npapi_extensions_private.h
@@ -10,9 +10,12 @@
// Some reserved GetStateContext/SetStateContext selectors.
typedef enum {
- NPExtensionsReservedStateSharedMemory = 66536
+ NPExtensionsReservedStateSharedMemory = 66536,
// Used by the Device2D and Audio devices to return a pointer to the
// structure used to implement the shared memory buffer for the device.
+ NPExtensionsReservedStateSyncChannel = 66537
+ // Used by the Audio device to return a pointer to the
+ // structure used to implement the synchronization channel for the device.
} NPExtensionsReservedStates;
#endif /* _NP_EXTENSIONS_PRIVATE_H_ */
diff --git a/webkit/tools/pepper_test_plugin/plugin_object.cc b/webkit/tools/pepper_test_plugin/plugin_object.cc
index 4c1b2a6..35c2a2c 100644
--- a/webkit/tools/pepper_test_plugin/plugin_object.cc
+++ b/webkit/tools/pepper_test_plugin/plugin_object.cc
@@ -399,6 +399,7 @@ void PluginObject::SetWindow(const NPWindow& window) {
cfg.outputChannelMap = NPAudioChannelStereo;
cfg.inputChannelMap = NPAudioChannelNone;
cfg.sampleFrameCount = 2048;
+ cfg.startThread = 1; // Start a thread for the audio producer.
cfg.flags = 0;
cfg.callback = &SineWaveCallback<200, int16>;
deviceaudio_->initializeContext(npp_, &cfg, &context_audio_);