summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--content/browser/renderer_host/media/audio_renderer_host.cc2
-rw-r--r--content/browser/renderer_host/media/audio_sync_reader.cc4
-rw-r--r--content/content_common.gypi1
-rw-r--r--content/content_tests.gypi1
-rw-r--r--media/audio/audio_output_controller.cc4
-rw-r--r--media/audio/audio_output_controller.h4
-rw-r--r--media/audio/audio_output_device.cc3
-rw-r--r--media/audio/audio_output_device_unittest.cc2
-rw-r--r--media/audio/audio_util.cc59
-rw-r--r--media/audio/audio_util.h15
-rw-r--r--media/audio/shared_memory_util.cc70
-rw-r--r--media/audio/shared_memory_util.h39
-rw-r--r--media/base/channel_layout.cc2
-rw-r--r--media/base/channel_layout.h6
-rw-r--r--media/media.gyp30
-rw-r--r--media/media_untrusted.gyp44
-rw-r--r--media/shared_memory_support.gypi23
-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
-rw-r--r--webkit/plugins/ppapi/ppb_audio_impl.cc2
31 files changed, 159 insertions, 264 deletions
diff --git a/content/browser/renderer_host/media/audio_renderer_host.cc b/content/browser/renderer_host/media/audio_renderer_host.cc
index 0042f28..27b8825 100644
--- a/content/browser/renderer_host/media/audio_renderer_host.cc
+++ b/content/browser/renderer_host/media/audio_renderer_host.cc
@@ -12,7 +12,7 @@
#include "content/browser/renderer_host/media/audio_sync_reader.h"
#include "content/common/media/audio_messages.h"
#include "content/public/browser/media_observer.h"
-#include "media/audio/shared_memory_util.h"
+#include "media/audio/audio_util.h"
using content::BrowserMessageFilter;
using content::BrowserThread;
diff --git a/content/browser/renderer_host/media/audio_sync_reader.cc b/content/browser/renderer_host/media/audio_sync_reader.cc
index 2f06f55..113c4fc 100644
--- a/content/browser/renderer_host/media/audio_sync_reader.cc
+++ b/content/browser/renderer_host/media/audio_sync_reader.cc
@@ -10,7 +10,7 @@
#include "base/shared_memory.h"
#include "base/threading/platform_thread.h"
#include "media/audio/audio_buffers_state.h"
-#include "media/audio/shared_memory_util.h"
+#include "media/audio/audio_util.h"
#if defined(OS_WIN)
const int kMinIntervalBetweenReadCallsInMs = 10;
@@ -31,7 +31,7 @@ bool AudioSyncReader::DataReady() {
// media::AudioOutputController::SyncReader implementations.
void AudioSyncReader::UpdatePendingBytes(uint32 bytes) {
- if (bytes != static_cast<uint32>(media::kPauseMark)) {
+ if (bytes != static_cast<uint32>(media::AudioOutputController::kPauseMark)) {
// Store unknown length of data into buffer, so we later
// can find out if data became available.
media::SetUnknownDataSize(
diff --git a/content/content_common.gypi b/content/content_common.gypi
index 749b93b..54974ae 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -10,7 +10,6 @@
'../gpu/gpu.gyp:gpu_ipc',
'../ipc/ipc.gyp:ipc',
'../media/media.gyp:media',
- '../media/media.gyp:shared_memory_support',
'../net/net.gyp:net',
'../ppapi/ppapi_internal.gyp:ppapi_shared',
'../skia/skia.gyp:skia',
diff --git a/content/content_tests.gypi b/content/content_tests.gypi
index 469f112..7c46308 100644
--- a/content/content_tests.gypi
+++ b/content/content_tests.gypi
@@ -216,7 +216,6 @@
'../ipc/ipc.gyp:test_support_ipc',
'../jingle/jingle.gyp:jingle_glue_test_util',
'../media/media.gyp:media_test_support',
- '../media/media.gyp:shared_memory_support',
'../net/net.gyp:net_test_support',
'../skia/skia.gyp:skia',
'../testing/gmock.gyp:gmock',
diff --git a/media/audio/audio_output_controller.cc b/media/audio/audio_output_controller.cc
index 69b7797..60dd285 100644
--- a/media/audio/audio_output_controller.cc
+++ b/media/audio/audio_output_controller.cc
@@ -11,7 +11,6 @@
#include "base/threading/platform_thread.h"
#include "base/threading/thread_restrictions.h"
#include "base/time.h"
-#include "media/audio/shared_memory_util.h"
using base::Time;
using base::TimeDelta;
@@ -19,6 +18,9 @@ using base::WaitableEvent;
namespace media {
+// Signal a pause in low-latency mode.
+const int AudioOutputController::kPauseMark = -1;
+
// Polling-related constants.
const int AudioOutputController::kPollNumAttempts = 3;
const int AudioOutputController::kPollPauseInMilliseconds = 3;
diff --git a/media/audio/audio_output_controller.h b/media/audio/audio_output_controller.h
index 03b0959..a8857a2 100644
--- a/media/audio/audio_output_controller.h
+++ b/media/audio/audio_output_controller.h
@@ -68,6 +68,10 @@ class MEDIA_EXPORT AudioOutputController
: public base::RefCountedThreadSafe<AudioOutputController>,
public AudioOutputStream::AudioSourceCallback {
public:
+ // Value sent by the controller to the renderer in low-latency mode
+ // indicating that the stream is paused.
+ static const int kPauseMark;
+
// An event handler that receives events from the AudioOutputController. The
// following methods are called on the audio manager thread.
class MEDIA_EXPORT EventHandler {
diff --git a/media/audio/audio_output_device.cc b/media/audio/audio_output_device.cc
index da86f97..994fa40 100644
--- a/media/audio/audio_output_device.cc
+++ b/media/audio/audio_output_device.cc
@@ -10,7 +10,6 @@
#include "base/time.h"
#include "media/audio/audio_output_controller.h"
#include "media/audio/audio_util.h"
-#include "media/audio/shared_memory_util.h"
namespace media {
@@ -254,7 +253,7 @@ void AudioOutputDevice::AudioThreadCallback::MapSharedMemory() {
// Called whenever we receive notifications about pending data.
void AudioOutputDevice::AudioThreadCallback::Process(int pending_data) {
- if (pending_data == kPauseMark) {
+ if (pending_data == AudioOutputController::kPauseMark) {
memset(shared_memory_.memory(), 0, memory_length_);
SetActualDataSizeInBytes(&shared_memory_, memory_length_, 0);
return;
diff --git a/media/audio/audio_output_device_unittest.cc b/media/audio/audio_output_device_unittest.cc
index 14a7a35..152e958 100644
--- a/media/audio/audio_output_device_unittest.cc
+++ b/media/audio/audio_output_device_unittest.cc
@@ -11,8 +11,8 @@
#include "base/sync_socket.h"
#include "base/test/test_timeouts.h"
#include "media/audio/audio_output_device.h"
+#include "media/audio/audio_util.h"
#include "media/audio/sample_rates.h"
-#include "media/audio/shared_memory_util.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gmock_mutant.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/media/audio/audio_util.cc b/media/audio/audio_util.cc
index 1dabae9..d54f277 100644
--- a/media/audio/audio_util.cc
+++ b/media/audio/audio_util.cc
@@ -12,15 +12,16 @@
// that a lot of the functions can be simplified and made more elegant. Revisit
// after other audio cleanup is done. (crbug.com/120319)
-#include "media/audio/audio_util.h"
-
#include <algorithm>
#include <limits>
+#include "base/atomicops.h"
#include "base/basictypes.h"
#include "base/logging.h"
+#include "base/shared_memory.h"
#include "base/time.h"
#include "media/audio/audio_parameters.h"
+#include "media/audio/audio_util.h"
#include "media/base/audio_bus.h"
#if defined(OS_MACOSX)
@@ -35,6 +36,10 @@
#include "media/base/media_switches.h"
#endif
+using base::subtle::Atomic32;
+
+const uint32 kUnknownDataSize = static_cast<uint32>(-1);
+
namespace media {
// TODO(fbarchard): Convert to intrinsics for better efficiency.
@@ -478,6 +483,56 @@ size_t GetHighLatencyOutputBufferSize(int sample_rate) {
return samples;
}
+// When transferring data in the shared memory, first word is size of data
+// in bytes. Actual data starts immediately after it.
+
+uint32 TotalSharedMemorySizeInBytes(uint32 packet_size) {
+ // Need to reserve extra 4 bytes for size of data.
+ return packet_size + sizeof(Atomic32);
+}
+
+uint32 PacketSizeSizeInBytes(uint32 shared_memory_created_size) {
+ return shared_memory_created_size - sizeof(Atomic32);
+}
+
+uint32 GetActualDataSizeInBytes(base::SharedMemory* shared_memory,
+ uint32 shared_memory_size) {
+ char* ptr = static_cast<char*>(shared_memory->memory()) + shared_memory_size;
+ DCHECK_EQ(0u, reinterpret_cast<size_t>(ptr) & 3);
+
+ // Actual data size stored at the end of the buffer.
+ uint32 actual_data_size =
+ base::subtle::Acquire_Load(reinterpret_cast<volatile Atomic32*>(ptr));
+ return std::min(actual_data_size, shared_memory_size);
+}
+
+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);
+}
+
+void SetUnknownDataSize(base::SharedMemory* shared_memory,
+ uint32 shared_memory_size) {
+ SetActualDataSizeInBytes(shared_memory, shared_memory_size, kUnknownDataSize);
+}
+
+bool IsUnknownDataSize(base::SharedMemory* shared_memory,
+ uint32 shared_memory_size) {
+ char* ptr = static_cast<char*>(shared_memory->memory()) + shared_memory_size;
+ DCHECK_EQ(0u, reinterpret_cast<size_t>(ptr) & 3);
+
+ // Actual data size stored at the end of the buffer.
+ uint32 actual_data_size =
+ base::subtle::Acquire_Load(reinterpret_cast<volatile Atomic32*>(ptr));
+ return actual_data_size == kUnknownDataSize;
+}
+
#if defined(OS_WIN)
bool IsWASAPISupported() {
diff --git a/media/audio/audio_util.h b/media/audio/audio_util.h
index b329be1..d25fdf9 100644
--- a/media/audio/audio_util.h
+++ b/media/audio/audio_util.h
@@ -111,6 +111,21 @@ MEDIA_EXPORT ChannelLayout GetAudioInputHardwareChannelLayout(
// conjunction with AUDIO_PCM_LINEAR.
MEDIA_EXPORT size_t GetHighLatencyOutputBufferSize(int sample_rate);
+// Functions that handle data buffer passed between processes in the shared
+// memory. Called on both IPC sides.
+
+MEDIA_EXPORT uint32 TotalSharedMemorySizeInBytes(uint32 packet_size);
+MEDIA_EXPORT uint32 PacketSizeSizeInBytes(uint32 shared_memory_created_size);
+MEDIA_EXPORT uint32 GetActualDataSizeInBytes(base::SharedMemory* shared_memory,
+ uint32 shared_memory_size);
+MEDIA_EXPORT void SetActualDataSizeInBytes(base::SharedMemory* shared_memory,
+ uint32 shared_memory_size,
+ uint32 actual_data_size);
+MEDIA_EXPORT void SetUnknownDataSize(base::SharedMemory* shared_memory,
+ uint32 shared_memory_size);
+MEDIA_EXPORT bool IsUnknownDataSize(base::SharedMemory* shared_memory,
+ uint32 shared_memory_size);
+
#if defined(OS_WIN)
// Does Windows support WASAPI? We are checking in lot of places, and
diff --git a/media/audio/shared_memory_util.cc b/media/audio/shared_memory_util.cc
deleted file mode 100644
index d79f54d..0000000
--- a/media/audio/shared_memory_util.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "media/audio/shared_memory_util.h"
-
-#include "base/atomicops.h"
-#include "base/logging.h"
-
-using base::subtle::Atomic32;
-
-static const uint32 kUnknownDataSize = static_cast<uint32>(-1);
-
-namespace media {
-
-uint32 TotalSharedMemorySizeInBytes(uint32 packet_size) {
- // Need to reserve extra 4 bytes for size of data.
- return packet_size + sizeof(Atomic32);
-}
-
-uint32 PacketSizeSizeInBytes(uint32 shared_memory_created_size) {
- return shared_memory_created_size - sizeof(Atomic32);
-}
-
-uint32 GetActualDataSizeInBytes(base::SharedMemory* shared_memory,
- uint32 shared_memory_size) {
- char* ptr = static_cast<char*>(shared_memory->memory()) + shared_memory_size;
- DCHECK_EQ(0u, reinterpret_cast<size_t>(ptr) & 3);
-
- // Actual data size stored at the end of the buffer.
- uint32 actual_data_size =
- base::subtle::Acquire_Load(reinterpret_cast<volatile Atomic32*>(ptr));
- return std::min(actual_data_size, shared_memory_size);
-}
-
-void SetActualDataSizeInBytes(void* shared_memory_ptr,
- uint32 shared_memory_size,
- uint32 actual_data_size) {
- char* ptr = static_cast<char*>(shared_memory_ptr) + 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);
-}
-
-void SetActualDataSizeInBytes(base::SharedMemory* shared_memory,
- uint32 shared_memory_size,
- uint32 actual_data_size) {
- SetActualDataSizeInBytes(shared_memory->memory(),
- shared_memory_size, actual_data_size);
-}
-
-void SetUnknownDataSize(base::SharedMemory* shared_memory,
- uint32 shared_memory_size) {
- SetActualDataSizeInBytes(shared_memory, shared_memory_size, kUnknownDataSize);
-}
-
-bool IsUnknownDataSize(base::SharedMemory* shared_memory,
- uint32 shared_memory_size) {
- char* ptr = static_cast<char*>(shared_memory->memory()) + shared_memory_size;
- DCHECK_EQ(0u, reinterpret_cast<size_t>(ptr) & 3);
-
- // Actual data size stored at the end of the buffer.
- uint32 actual_data_size =
- base::subtle::Acquire_Load(reinterpret_cast<volatile Atomic32*>(ptr));
- return actual_data_size == kUnknownDataSize;
-}
-
-} // namespace media
diff --git a/media/audio/shared_memory_util.h b/media/audio/shared_memory_util.h
deleted file mode 100644
index 1255b92..0000000
--- a/media/audio/shared_memory_util.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef MEDIA_AUDIO_SHARED_MEMORY_UTIL_H_
-#define MEDIA_AUDIO_SHARED_MEMORY_UTIL_H_
-
-#include "base/basictypes.h"
-#include "base/shared_memory.h"
-#include "media/base/media_export.h"
-
-namespace media {
-
-// Value sent by the controller to the renderer in low-latency mode
-// indicating that the stream is paused.
-enum { kPauseMark = -1 };
-
-// Functions that handle data buffer passed between processes in the shared
-// memory. Called on both IPC sides. These are necessary because the shared
-// memory has a layout: the last word in the block is the data size in bytes.
-
-MEDIA_EXPORT uint32 TotalSharedMemorySizeInBytes(uint32 packet_size);
-MEDIA_EXPORT uint32 PacketSizeSizeInBytes(uint32 shared_memory_created_size);
-MEDIA_EXPORT uint32 GetActualDataSizeInBytes(base::SharedMemory* shared_memory,
- uint32 shared_memory_size);
-MEDIA_EXPORT void SetActualDataSizeInBytes(base::SharedMemory* shared_memory,
- uint32 shared_memory_size,
- uint32 actual_data_size);
-MEDIA_EXPORT void SetActualDataSizeInBytes(void* shared_memory_ptr,
- uint32 shared_memory_size,
- uint32 actual_data_size);
-MEDIA_EXPORT void SetUnknownDataSize(base::SharedMemory* shared_memory,
- uint32 shared_memory_size);
-MEDIA_EXPORT bool IsUnknownDataSize(base::SharedMemory* shared_memory,
- uint32 shared_memory_size);
-
-} // namespace media
-
-#endif // MEDIA_AUDIO_SHARED_MEMORY_UTIL_H_
diff --git a/media/base/channel_layout.cc b/media/base/channel_layout.cc
index 8bf02ea..f65828d 100644
--- a/media/base/channel_layout.cc
+++ b/media/base/channel_layout.cc
@@ -23,6 +23,7 @@ static const int kLayoutToChannels[] = {
8, // CHANNEL_LAYOUT_7POINT1_WIDE
2}; // CHANNEL_LAYOUT_STEREO_DOWNMIX
+#if defined(OS_MACOSX) || defined(USE_PULSEAUDIO)
const int kChannelOrderings[CHANNEL_LAYOUT_MAX][CHANNELS_MAX] = {
// FL | FR | FC | LFE | BL | BR | FLofC | FRofC | BC | SL | SR | StL | StR
@@ -79,6 +80,7 @@ const int kChannelOrderings[CHANNEL_LAYOUT_MAX][CHANNELS_MAX] = {
// FL | FR | FC | LFE | BL | BR | FLofC | FRofC | BC | SL | SR | StL | StR
};
+#endif
int ChannelLayoutToChannelCount(ChannelLayout layout) {
return kLayoutToChannels[layout];
diff --git a/media/base/channel_layout.h b/media/base/channel_layout.h
index 9e88420..ac10661 100644
--- a/media/base/channel_layout.h
+++ b/media/base/channel_layout.h
@@ -5,6 +5,7 @@
#ifndef MEDIA_BASE_CHANNEL_LAYOUT_H_
#define MEDIA_BASE_CHANNEL_LAYOUT_H_
+#include "build/build_config.h"
#include "media/base/media_export.h"
enum ChannelLayout {
@@ -77,14 +78,15 @@ enum Channels {
CHANNELS_MAX
};
+#if defined(OS_MACOSX) || defined(USE_PULSEAUDIO)
// The channel orderings for each layout as specified by FFmpeg.
// Values represent the index of each channel in each layout. For example, the
// left side surround sound channel in FFmpeg's 5.1 layout is in the 5th
// position (because the order is L, R, C, LFE, LS, RS), so
// kChannelOrderings[CHANNEL_LAYOUT_5POINT1][SIDE_LEFT] = 4;
// Values of -1 mean the channel at that index is not used for that layout.
-MEDIA_EXPORT extern const int
-kChannelOrderings[CHANNEL_LAYOUT_MAX][CHANNELS_MAX];
+extern const int kChannelOrderings[CHANNEL_LAYOUT_MAX][CHANNELS_MAX];
+#endif
// Returns the number of channels in a given ChannelLayout.
MEDIA_EXPORT int ChannelLayoutToChannelCount(ChannelLayout layout);
diff --git a/media/media.gyp b/media/media.gyp
index 94f5227..17e3c39 100644
--- a/media/media.gyp
+++ b/media/media.gyp
@@ -12,27 +12,6 @@
},
'targets': [
{
- # Minimal target for NaCl and other renderer side media clients which only
- # need to send audio data across the shared memory to the browser process.
- 'target_name': 'shared_memory_support',
- 'type': '<(component)',
- 'dependencies': [
- '../base/base.gyp:base',
- ],
- 'defines': [
- 'MEDIA_IMPLEMENTATION',
- ],
- 'include_dirs': [
- '..',
- ],
- 'includes': [
- 'shared_memory_support.gypi',
- ],
- 'sources': [
- '<@(shared_memory_support_sources)',
- ],
- },
- {
'target_name': 'media',
'type': '<(component)',
'dependencies': [
@@ -40,7 +19,6 @@
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'../build/temp_gyp/googleurl.gyp:googleurl',
'../crypto/crypto.gyp:crypto',
- 'shared_memory_support',
'../ui/ui.gyp:ui',
'yuv_convert',
],
@@ -95,6 +73,8 @@
'audio/audio_output_mixer.h',
'audio/audio_output_proxy.cc',
'audio/audio_output_proxy.h',
+ 'audio/audio_parameters.cc',
+ 'audio/audio_parameters.h',
'audio/audio_util.cc',
'audio/audio_util.h',
'audio/cross_process_notification.cc',
@@ -157,6 +137,8 @@
'audio/win/waveout_output_win.h',
'base/android/media_jni_registrar.cc',
'base/android/media_jni_registrar.h',
+ 'base/audio_bus.cc',
+ 'base/audio_bus.h',
'base/audio_decoder.cc',
'base/audio_decoder.h',
'base/audio_decoder_config.cc',
@@ -175,6 +157,8 @@
'base/buffers.h',
'base/byte_queue.cc',
'base/byte_queue.h',
+ 'base/channel_layout.cc',
+ 'base/channel_layout.h',
'base/clock.cc',
'base/clock.h',
'base/data_buffer.cc',
@@ -197,6 +181,7 @@
'base/filter_collection.h',
'base/media.h',
'base/media_android.cc',
+ 'base/media_export.h',
'base/media_log.cc',
'base/media_log.h',
'base/media_log_event.h',
@@ -686,7 +671,6 @@
'dependencies': [
'media',
'media_test_support',
- 'shared_memory_support',
'yuv_convert',
'../base/base.gyp:base',
'../base/base.gyp:base_i18n',
diff --git a/media/media_untrusted.gyp b/media/media_untrusted.gyp
deleted file mode 100644
index 4abbe56..0000000
--- a/media/media_untrusted.gyp
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-{
- 'variables': {
- 'chromium_code': 1,
- },
- 'includes': [
- '../native_client/build/untrusted.gypi',
- ],
- 'conditions': [
- ['disable_nacl==0 and disable_nacl_untrusted==0', {
- 'targets': [
- {
- 'target_name': 'shared_memory_support_untrusted',
- 'type': 'none',
- 'variables': {
- 'nacl_untrusted_build': 1,
- 'nlib_target': 'libshared_memory_support_untrusted.a',
- 'build_glibc': 0,
- 'build_newlib': 1,
- },
- 'dependencies': [
- '../native_client/tools.gyp:prep_toolchain',
- '../base/base_untrusted.gyp:base_untrusted',
- ],
- 'defines': [
- 'MEDIA_IMPLEMENTATION',
- ],
- 'include_dirs': [
- '..',
- ],
- 'includes': [
- 'shared_memory_support.gypi',
- ],
- 'sources': [
- '<@(shared_memory_support_sources)',
- ],
- },
- ],
- }],
- ],
-}
diff --git a/media/shared_memory_support.gypi b/media/shared_memory_support.gypi
deleted file mode 100644
index f91edf5..0000000
--- a/media/shared_memory_support.gypi
+++ /dev/null
@@ -1,23 +0,0 @@
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-{
- 'variables': {
- 'chromium_code': 1,
- # These are defined here because we need to build this library both for
- # the general media pipeline and again for the untrusted NaCl target.
- 'shared_memory_support_sources': [
- 'audio/audio_parameters.cc',
- 'audio/audio_parameters.h',
- 'audio/shared_memory_util.cc',
- 'audio/shared_memory_util.h',
- 'base/audio_bus.cc',
- 'base/audio_bus.h',
- 'base/channel_layout.cc',
- 'base/channel_layout.h',
- 'base/limits.h',
- 'base/media_export.h',
- ],
- },
-}
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
diff --git a/webkit/plugins/ppapi/ppb_audio_impl.cc b/webkit/plugins/ppapi/ppb_audio_impl.cc
index 96504aa..7024aea 100644
--- a/webkit/plugins/ppapi/ppb_audio_impl.cc
+++ b/webkit/plugins/ppapi/ppb_audio_impl.cc
@@ -53,6 +53,8 @@ PP_Resource PPB_Audio_Impl::Create(PP_Instance instance,
scoped_refptr<PPB_Audio_Impl> audio(new PPB_Audio_Impl(instance));
if (!audio->Init(config, audio_callback, user_data))
return 0;
+ CHECK(media::AudioOutputController::kPauseMark ==
+ ::ppapi::PPB_Audio_Shared::kPauseMark);
return audio->GetReference();
}