summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authordalecurtis@google.com <dalecurtis@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-20 23:51:13 +0000
committerdalecurtis@google.com <dalecurtis@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-20 23:51:13 +0000
commitab17025f9e68b3e4ac6156e5b668e5bfba7901fc (patch)
treed5b2c90d896b74120a42f332f6dd4486db60481c /ppapi
parentdb26138ce3cd2ac975f01a93dcd278049707abbd (diff)
downloadchromium_src-ab17025f9e68b3e4ac6156e5b668e5bfba7901fc.zip
chromium_src-ab17025f9e68b3e4ac6156e5b668e5bfba7901fc.tar.gz
chromium_src-ab17025f9e68b3e4ac6156e5b668e5bfba7901fc.tar.bz2
Revert 152406 - Introduce shared_memory_support media target for PPAPI.
Allows PPAPI to directly utilize shared memory utility code instead of duplicating it and CHECK'ing for equivalency. Required to eventually convert PPAPI to using an AudioBus and floats in PPB_Audio_Shared::Run(). http://crbug.com/114700 BUG=123203 TEST=unittests Review URL: https://chromiumcodereview.appspot.com/10826296 TBR=dalecurtis@chromium.org Review URL: https://chromiumcodereview.appspot.com/10837350 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152431 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/native_client/native_client.gyp27
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/DEPS1
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_audio_rpc_server.cc3
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/plugin_globals.h8
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_audio.cc25
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy_untrusted.gyp4
-rw-r--r--ppapi/native_client/src/trusted/plugin/plugin.gyp2
-rw-r--r--ppapi/ppapi_host.gypi1
-rw-r--r--ppapi/ppapi_internal.gyp1
-rw-r--r--ppapi/ppapi_shared_untrusted.gyp1
-rw-r--r--ppapi/ppapi_tests.gypi1
-rw-r--r--ppapi/shared_impl/ppb_audio_shared.cc35
-rw-r--r--ppapi/shared_impl/ppb_audio_shared.h3
13 files changed, 60 insertions, 52 deletions
diff --git a/ppapi/native_client/native_client.gyp b/ppapi/native_client/native_client.gyp
index 37a9564..b528c0e 100644
--- a/ppapi/native_client/native_client.gyp
+++ b/ppapi/native_client/native_client.gyp
@@ -76,8 +76,6 @@
'-lsrpc',
'-limc_syscalls',
'-lplatform',
- '-lbase_untrusted',
- '-lshared_memory_support_untrusted',
'-lgio',
'-Wl,--end-group',
'-lm',
@@ -115,9 +113,7 @@
# once native_client/build/untrusted.gypi no longer needs them.
'extra_deps64': [
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libppruntime.a',
- '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libbase_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libirt_browser.a',
- '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libshared_memory_support_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libimc_syscalls.a',
@@ -125,9 +121,7 @@
],
'extra_deps32': [
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libppruntime.a',
- '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libbase_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libirt_browser.a',
- '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libshared_memory_support_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libimc_syscalls.a',
@@ -135,9 +129,7 @@
],
'extra_deps_newlib64': [
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libppruntime.a',
- '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libbase_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libirt_browser.a',
- '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libshared_memory_support_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libimc_syscalls.a',
@@ -145,9 +137,7 @@
],
'extra_deps_newlib32': [
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libppruntime.a',
- '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libbase_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libirt_browser.a',
- '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libshared_memory_support_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libimc_syscalls.a',
@@ -155,9 +145,7 @@
],
'extra_deps_glibc64': [
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libppruntime.a',
- '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libbase_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libirt_browser.a',
- '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libshared_memory_support_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libimc_syscalls.a',
@@ -165,9 +153,7 @@
],
'extra_deps_glibc32': [
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libppruntime.a',
- '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libbase_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libirt_browser.a',
- '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libshared_memory_support_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libimc_syscalls.a',
@@ -175,9 +161,7 @@
],
'extra_deps_arm': [
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libppruntime.a',
- '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libbase_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libirt_browser.a',
- '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libshared_memory_support_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libimc_syscalls.a',
@@ -186,8 +170,6 @@
},
'dependencies': [
'src/shared/ppapi_proxy/ppapi_proxy_untrusted.gyp:ppruntime_lib',
- '../../base/base_untrusted.gyp:base_untrusted',
- '../../media/media_untrusted.gyp:shared_memory_support_untrusted',
'../../native_client/src/untrusted/irt/irt.gyp:irt_browser_lib',
'../../native_client/src/shared/srpc/srpc.gyp:srpc_lib',
'../../native_client/src/shared/platform/platform.gyp:platform_lib',
@@ -228,7 +210,6 @@
'-lgpu_ipc_untrusted',
'-lipc_untrusted',
'-lbase_untrusted',
- '-lshared_memory_support_untrusted',
'-lsrpc',
'-limc_syscalls',
'-lplatform',
@@ -279,7 +260,6 @@
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libipc_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libbase_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libirt_browser.a',
- '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libshared_memory_support_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libimc_syscalls.a',
@@ -297,7 +277,6 @@
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libipc_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libbase_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libirt_browser.a',
- '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libshared_memory_support_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libimc_syscalls.a',
@@ -315,7 +294,6 @@
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libipc_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libbase_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libirt_browser.a',
- '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libshared_memory_support_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libimc_syscalls.a',
@@ -333,7 +311,6 @@
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libipc_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libbase_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libirt_browser.a',
- '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libshared_memory_support_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libimc_syscalls.a',
@@ -351,7 +328,6 @@
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libipc_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libbase_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libirt_browser.a',
- '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libshared_memory_support_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libimc_syscalls.a',
@@ -369,7 +345,6 @@
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libipc_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libbase_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libirt_browser.a',
- '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libshared_memory_support_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libimc_syscalls.a',
@@ -387,7 +362,6 @@
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libipc_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libbase_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libirt_browser.a',
- '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libshared_memory_support_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libimc_syscalls.a',
@@ -405,7 +379,6 @@
'../../gpu/gpu_untrusted.gyp:gpu_ipc_untrusted',
'../../ipc/ipc_untrusted.gyp:ipc_untrusted',
'../../base/base_untrusted.gyp:base_untrusted',
- '../../media/media_untrusted.gyp:shared_memory_support_untrusted',
'../../native_client/src/untrusted/irt/irt.gyp:irt_browser_lib',
'../../native_client/src/shared/srpc/srpc.gyp:srpc_lib',
'../../native_client/src/shared/platform/platform.gyp:platform_lib',
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/DEPS b/ppapi/native_client/src/shared/ppapi_proxy/DEPS
index f8bca48..1b9100d 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/DEPS
+++ b/ppapi/native_client/src/shared/ppapi_proxy/DEPS
@@ -4,7 +4,6 @@ include_rules = [
"+native_client/src/trusted/plugin",
"+gpu",
- "+media",
"+native_client/src/shared/imc",
"+native_client/src/shared/srpc",
"+native_client/src/trusted/desc",
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_audio_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_audio_rpc_server.cc
index 4224a85..c3f480c 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_audio_rpc_server.cc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_audio_rpc_server.cc
@@ -13,7 +13,6 @@
#include "native_client/src/shared/ppapi_proxy/utility.h"
#include "native_client/src/trusted/desc/nacl_desc_invalid.h"
#include "native_client/src/trusted/desc/nacl_desc_wrapper.h"
-#include "media/audio/shared_memory_util.h"
#include "ppapi/c/ppb_audio.h"
#include "ppapi/c/ppb_audio_config.h"
#include "ppapi/c/pp_errors.h"
@@ -89,7 +88,7 @@ void StreamCreatedCallback(void* user_data, int32_t result) {
return;
}
size_t total_shared_memory_size =
- media::TotalSharedMemorySizeInBytes(audio_buffer_size);
+ ppapi_proxy::TotalAudioSharedMemorySizeInBytes(audio_buffer_size);
nacl::DescWrapperFactory factory;
NaClHandle nacl_shm_handle = NaClHandle(shared_memory_handle);
NaClHandle nacl_sync_handle = NaClHandle(sync_socket_handle);
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_globals.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_globals.h
index 600f098..e23cd9d 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_globals.h
+++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_globals.h
@@ -81,6 +81,14 @@ const struct PP_ThreadFunctions* GetThreadCreator();
// PPAPI constants used in the proxy.
extern const PP_Resource kInvalidResourceId;
+// The following function TotalSharedMemorySizeInBytes, is copied & similar
+// to the one in audio_util.cc. This function includes optional fields
+// stored at the end of the audio buffer.
+inline size_t TotalAudioSharedMemorySizeInBytes(size_t audio_buffer_size) {
+ // Include optional field that communicates the number of bytes written.
+ return audio_buffer_size + sizeof(uint32_t);
+}
+
} // namespace ppapi_proxy
#endif // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_GLOBALS_H_
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_audio.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_audio.cc
index 18558e6..2a01b97 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_audio.cc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_audio.cc
@@ -15,7 +15,6 @@
#include "native_client/src/shared/ppapi_proxy/plugin_resource.h"
#include "native_client/src/shared/ppapi_proxy/utility.h"
#include "native_client/src/shared/srpc/nacl_srpc.h"
-#include "media/audio/shared_memory_util.h"
#include "ppapi/c/ppb_audio.h"
#include "ppapi/c/ppb_audio_config.h"
#include "ppapi/cpp/module_impl.h"
@@ -30,6 +29,19 @@ size_t ceil64k(size_t n) {
return (n + 0xFFFF) & (~0xFFFF);
}
+// The following function SetAudioActualDataSizeInBytes, is copied & similar
+// to the one in audio_util.cc.
+void SetAudioActualDataSizeInBytes(void* audio_buffer,
+ uint32_t buffer_size_in_bytes,
+ uint32_t actual_size_in_bytes) {
+ char* end = static_cast<char*>(audio_buffer) + buffer_size_in_bytes;
+ DCHECK(0 == (reinterpret_cast<size_t>(end) & 3));
+ volatile uint32_t* end32 = reinterpret_cast<volatile uint32_t*>(end);
+ // Set actual data size at the end of the buffer.
+ __sync_synchronize();
+ *end32 = actual_size_in_bytes;
+}
+
} // namespace
PluginAudio::PluginAudio() :
@@ -53,8 +65,7 @@ PluginAudio::~PluginAudio() {
GetInterface()->StopPlayback(resource_);
// Unmap the shared memory buffer, if present.
if (shm_buffer_) {
- munmap(shm_buffer_,
- ceil64k(media::TotalSharedMemorySizeInBytes(shm_size_)));
+ munmap(shm_buffer_, ceil64k(TotalAudioSharedMemorySizeInBytes(shm_size_)));
shm_buffer_ = NULL;
shm_size_ = 0;
}
@@ -92,9 +103,9 @@ void PluginAudio::AudioThread(void* self) {
audio->user_data_);
// Signal audio backend by writing buffer length at end of buffer.
// (Note: NaCl applications will always write the entire buffer.)
- media::SetActualDataSizeInBytes(audio->shm_buffer_,
- audio->shm_size_,
- audio->shm_size_);
+ SetAudioActualDataSizeInBytes(audio->shm_buffer_,
+ audio->shm_size_,
+ audio->shm_size_);
}
}
@@ -106,7 +117,7 @@ void PluginAudio::StreamCreated(NaClSrpcImcDescType socket,
shm_ = shm;
shm_size_ = shm_size;
shm_buffer_ = mmap(NULL,
- ceil64k(media::TotalSharedMemorySizeInBytes(shm_size)),
+ ceil64k(TotalAudioSharedMemorySizeInBytes(shm_size)),
PROT_READ | PROT_WRITE,
MAP_SHARED,
shm,
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy_untrusted.gyp b/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy_untrusted.gyp
index 6aa09c5..558e1a9 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy_untrusted.gyp
+++ b/ppapi/native_client/src/shared/ppapi_proxy/ppapi_proxy_untrusted.gyp
@@ -11,8 +11,7 @@
'target_name': 'ppruntime_lib',
'type': 'none',
'dependencies': [
- '<(DEPTH)/native_client/tools.gyp:prep_toolchain',
- '<(DEPTH)/media/media_untrusted.gyp:shared_memory_support_untrusted',
+ '<(DEPTH)/native_client/tools.gyp:prep_toolchain'
],
'variables': {
'nlib_target': 'libppruntime.a',
@@ -20,7 +19,6 @@
'build_newlib': 1,
'include_dirs': [
'<(DEPTH)/gpu',
- '<(DEPTH)/media',
'<(DEPTH)/third_party/khronos',
'<(DEPTH)/ppapi/native_client/src/shared/ppapi_proxy/untrusted',
],
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.gyp b/ppapi/native_client/src/trusted/plugin/plugin.gyp
index 3521409..f080c49 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.gyp
+++ b/ppapi/native_client/src/trusted/plugin/plugin.gyp
@@ -60,7 +60,6 @@
'target_base': 'ppNaClPlugin',
},
'dependencies': [
- '<(DEPTH)/media/media.gyp:shared_memory_support',
'<(DEPTH)/native_client/src/shared/gio/gio.gyp:gio',
'<(DEPTH)/native_client/src/shared/imc/imc.gyp:imc',
'<(DEPTH)/native_client/src/shared/platform/platform.gyp:platform',
@@ -93,7 +92,6 @@
],
},
'dependencies': [
- '<(DEPTH)/media/media.gyp:shared_memory_support',
'<(DEPTH)/native_client/src/shared/gio/gio.gyp:gio',
'<(DEPTH)/native_client/src/shared/imc/imc.gyp:imc',
'<(DEPTH)/native_client/src/shared/platform/platform.gyp:platform',
diff --git a/ppapi/ppapi_host.gypi b/ppapi/ppapi_host.gypi
index 8357033..c0cdfa0 100644
--- a/ppapi/ppapi_host.gypi
+++ b/ppapi/ppapi_host.gypi
@@ -13,7 +13,6 @@
'ppapi_internal.gyp:ppapi_shared',
'../base/base.gyp:base',
'../ipc/ipc.gyp:ipc',
- '../media/media.gyp:shared_memory_support',
'../ui/surface/surface.gyp:surface',
],
'defines': [
diff --git a/ppapi/ppapi_internal.gyp b/ppapi/ppapi_internal.gyp
index 8eed2eb..d4f1497 100644
--- a/ppapi/ppapi_internal.gyp
+++ b/ppapi/ppapi_internal.gyp
@@ -46,7 +46,6 @@
'../gpu/command_buffer/command_buffer.gyp:gles2_utils',
'../gpu/gpu.gyp:command_buffer_client',
'../gpu/gpu.gyp:gles2_implementation',
- '../media/media.gyp:shared_memory_support',
'../net/net.gyp:net',
'../skia/skia.gyp:skia',
'../third_party/icu/icu.gyp:icuuc',
diff --git a/ppapi/ppapi_shared_untrusted.gyp b/ppapi/ppapi_shared_untrusted.gyp
index fb6a765..e0a08b4 100644
--- a/ppapi/ppapi_shared_untrusted.gyp
+++ b/ppapi/ppapi_shared_untrusted.gyp
@@ -36,7 +36,6 @@
'../gpu/command_buffer/command_buffer_untrusted.gyp:gles2_utils_untrusted',
'../gpu/gpu_untrusted.gyp:command_buffer_client_untrusted',
'../gpu/gpu_untrusted.gyp:gles2_implementation_untrusted',
- '../media/media_untrusted.gyp:shared_memory_support_untrusted',
],
},
],
diff --git a/ppapi/ppapi_tests.gypi b/ppapi/ppapi_tests.gypi
index ba244c9..0f52b17 100644
--- a/ppapi/ppapi_tests.gypi
+++ b/ppapi/ppapi_tests.gypi
@@ -133,7 +133,6 @@
'../gpu/gpu.gyp:gpu_ipc',
'../ipc/ipc.gyp:ipc',
'../ipc/ipc.gyp:test_support_ipc',
- '../media/media.gyp:shared_memory_support',
'../testing/gmock.gyp:gmock',
'../testing/gtest.gyp:gtest',
'../ui/surface/surface.gyp:surface',
diff --git a/ppapi/shared_impl/ppb_audio_shared.cc b/ppapi/shared_impl/ppb_audio_shared.cc
index 5cf3002..1a62130 100644
--- a/ppapi/shared_impl/ppb_audio_shared.cc
+++ b/ppapi/shared_impl/ppb_audio_shared.cc
@@ -5,9 +5,10 @@
#include "ppapi/shared_impl/ppb_audio_shared.h"
#include "base/logging.h"
-#include "media/audio/shared_memory_util.h"
#include "ppapi/shared_impl/ppapi_globals.h"
+using base::subtle::Atomic32;
+
namespace ppapi {
#if defined(OS_NACL)
@@ -17,6 +18,29 @@ PP_ThreadFunctions thread_functions;
}
#endif // defined(OS_NACL)
+// FIXME: The following two functions (TotalSharedMemorySizeInBytes,
+// SetActualDataSizeInBytes) are copied from audio_util.cc.
+// Remove these functions once a minimal media library is provided for them.
+// code.google.com/p/chromium/issues/detail?id=123203
+
+uint32 TotalSharedMemorySizeInBytes(uint32 packet_size) {
+ // Need to reserve extra 4 bytes for size of data.
+ return packet_size + sizeof(Atomic32);
+}
+
+void SetActualDataSizeInBytes(base::SharedMemory* shared_memory,
+ uint32 shared_memory_size,
+ uint32 actual_data_size) {
+ char* ptr = static_cast<char*>(shared_memory->memory()) + shared_memory_size;
+ DCHECK_EQ(0u, reinterpret_cast<size_t>(ptr) & 3);
+
+ // Set actual data size at the end of the buffer.
+ base::subtle::Release_Store(reinterpret_cast<volatile Atomic32*>(ptr),
+ actual_data_size);
+}
+
+const int PPB_Audio_Shared::kPauseMark = -1;
+
PPB_Audio_Shared::PPB_Audio_Shared()
: playing_(false),
shared_memory_size_(0),
@@ -69,8 +93,7 @@ void PPB_Audio_Shared::SetStreamInfo(
shared_memory_.reset(new base::SharedMemory(shared_memory_handle, false));
shared_memory_size_ = shared_memory_size;
- if (!shared_memory_->Map(
- media::TotalSharedMemorySizeInBytes(shared_memory_size_))) {
+ if (!shared_memory_->Map(TotalSharedMemorySizeInBytes(shared_memory_size_))) {
PpapiGlobals::Get()->LogWithSource(instance, PP_LOGLEVEL_WARNING, "",
"Failed to map shared memory for PPB_Audio_Shared.");
}
@@ -144,12 +167,12 @@ void PPB_Audio_Shared::Run() {
while (sizeof(pending_data) ==
socket_->Receive(&pending_data, sizeof(pending_data)) &&
- pending_data != media::kPauseMark) {
+ pending_data != kPauseMark) {
callback_(buffer, shared_memory_size_, user_data_);
// Let the host know we are done.
- media::SetActualDataSizeInBytes(
- shared_memory_.get(), shared_memory_size_, shared_memory_size_);
+ SetActualDataSizeInBytes(shared_memory_.get(), shared_memory_size_,
+ shared_memory_size_);
}
}
diff --git a/ppapi/shared_impl/ppb_audio_shared.h b/ppapi/shared_impl/ppb_audio_shared.h
index 8858e5c..cde075b 100644
--- a/ppapi/shared_impl/ppb_audio_shared.h
+++ b/ppapi/shared_impl/ppb_audio_shared.h
@@ -29,6 +29,9 @@ class PPAPI_SHARED_EXPORT PPB_Audio_Shared
PPB_Audio_Shared();
virtual ~PPB_Audio_Shared();
+ // Keep in sync with media::AudioOutputController::kPauseMark.
+ static const int kPauseMark;
+
bool playing() const { return playing_; }
// Sets the callback information that the background thread will use. This