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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152406 0039d316-1c4b-4281-b951-d872f2087c98
parent b6c1d7cd
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include "content/browser/renderer_host/media/audio_sync_reader.h" #include "content/browser/renderer_host/media/audio_sync_reader.h"
#include "content/common/media/audio_messages.h" #include "content/common/media/audio_messages.h"
#include "content/public/browser/media_observer.h" #include "content/public/browser/media_observer.h"
#include "media/audio/audio_util.h" #include "media/audio/shared_memory_util.h"
using content::BrowserMessageFilter; using content::BrowserMessageFilter;
using content::BrowserThread; using content::BrowserThread;
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include "base/shared_memory.h" #include "base/shared_memory.h"
#include "base/threading/platform_thread.h" #include "base/threading/platform_thread.h"
#include "media/audio/audio_buffers_state.h" #include "media/audio/audio_buffers_state.h"
#include "media/audio/audio_util.h" #include "media/audio/shared_memory_util.h"
#if defined(OS_WIN) #if defined(OS_WIN)
const int kMinIntervalBetweenReadCallsInMs = 10; const int kMinIntervalBetweenReadCallsInMs = 10;
...@@ -31,7 +31,7 @@ bool AudioSyncReader::DataReady() { ...@@ -31,7 +31,7 @@ bool AudioSyncReader::DataReady() {
// media::AudioOutputController::SyncReader implementations. // media::AudioOutputController::SyncReader implementations.
void AudioSyncReader::UpdatePendingBytes(uint32 bytes) { void AudioSyncReader::UpdatePendingBytes(uint32 bytes) {
if (bytes != static_cast<uint32>(media::AudioOutputController::kPauseMark)) { if (bytes != static_cast<uint32>(media::kPauseMark)) {
// Store unknown length of data into buffer, so we later // Store unknown length of data into buffer, so we later
// can find out if data became available. // can find out if data became available.
media::SetUnknownDataSize( media::SetUnknownDataSize(
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
'../gpu/gpu.gyp:gpu_ipc', '../gpu/gpu.gyp:gpu_ipc',
'../ipc/ipc.gyp:ipc', '../ipc/ipc.gyp:ipc',
'../media/media.gyp:media', '../media/media.gyp:media',
'../media/media.gyp:shared_memory_support',
'../net/net.gyp:net', '../net/net.gyp:net',
'../ppapi/ppapi_internal.gyp:ppapi_shared', '../ppapi/ppapi_internal.gyp:ppapi_shared',
'../skia/skia.gyp:skia', '../skia/skia.gyp:skia',
......
...@@ -216,6 +216,7 @@ ...@@ -216,6 +216,7 @@
'../ipc/ipc.gyp:test_support_ipc', '../ipc/ipc.gyp:test_support_ipc',
'../jingle/jingle.gyp:jingle_glue_test_util', '../jingle/jingle.gyp:jingle_glue_test_util',
'../media/media.gyp:media_test_support', '../media/media.gyp:media_test_support',
'../media/media.gyp:shared_memory_support',
'../net/net.gyp:net_test_support', '../net/net.gyp:net_test_support',
'../skia/skia.gyp:skia', '../skia/skia.gyp:skia',
'../testing/gmock.gyp:gmock', '../testing/gmock.gyp:gmock',
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/threading/platform_thread.h" #include "base/threading/platform_thread.h"
#include "base/threading/thread_restrictions.h" #include "base/threading/thread_restrictions.h"
#include "base/time.h" #include "base/time.h"
#include "media/audio/shared_memory_util.h"
using base::Time; using base::Time;
using base::TimeDelta; using base::TimeDelta;
...@@ -18,9 +19,6 @@ using base::WaitableEvent; ...@@ -18,9 +19,6 @@ using base::WaitableEvent;
namespace media { namespace media {
// Signal a pause in low-latency mode.
const int AudioOutputController::kPauseMark = -1;
// Polling-related constants. // Polling-related constants.
const int AudioOutputController::kPollNumAttempts = 3; const int AudioOutputController::kPollNumAttempts = 3;
const int AudioOutputController::kPollPauseInMilliseconds = 3; const int AudioOutputController::kPollPauseInMilliseconds = 3;
......
...@@ -68,10 +68,6 @@ class MEDIA_EXPORT AudioOutputController ...@@ -68,10 +68,6 @@ class MEDIA_EXPORT AudioOutputController
: public base::RefCountedThreadSafe<AudioOutputController>, : public base::RefCountedThreadSafe<AudioOutputController>,
public AudioOutputStream::AudioSourceCallback { public AudioOutputStream::AudioSourceCallback {
public: 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 // An event handler that receives events from the AudioOutputController. The
// following methods are called on the audio manager thread. // following methods are called on the audio manager thread.
class MEDIA_EXPORT EventHandler { class MEDIA_EXPORT EventHandler {
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/time.h" #include "base/time.h"
#include "media/audio/audio_output_controller.h" #include "media/audio/audio_output_controller.h"
#include "media/audio/audio_util.h" #include "media/audio/audio_util.h"
#include "media/audio/shared_memory_util.h"
namespace media { namespace media {
...@@ -253,7 +254,7 @@ void AudioOutputDevice::AudioThreadCallback::MapSharedMemory() { ...@@ -253,7 +254,7 @@ void AudioOutputDevice::AudioThreadCallback::MapSharedMemory() {
// Called whenever we receive notifications about pending data. // Called whenever we receive notifications about pending data.
void AudioOutputDevice::AudioThreadCallback::Process(int pending_data) { void AudioOutputDevice::AudioThreadCallback::Process(int pending_data) {
if (pending_data == AudioOutputController::kPauseMark) { if (pending_data == kPauseMark) {
memset(shared_memory_.memory(), 0, memory_length_); memset(shared_memory_.memory(), 0, memory_length_);
SetActualDataSizeInBytes(&shared_memory_, memory_length_, 0); SetActualDataSizeInBytes(&shared_memory_, memory_length_, 0);
return; return;
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
#include "base/sync_socket.h" #include "base/sync_socket.h"
#include "base/test/test_timeouts.h" #include "base/test/test_timeouts.h"
#include "media/audio/audio_output_device.h" #include "media/audio/audio_output_device.h"
#include "media/audio/audio_util.h"
#include "media/audio/sample_rates.h" #include "media/audio/sample_rates.h"
#include "media/audio/shared_memory_util.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gmock_mutant.h" #include "testing/gmock_mutant.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
......
...@@ -12,16 +12,15 @@ ...@@ -12,16 +12,15 @@
// that a lot of the functions can be simplified and made more elegant. Revisit // that a lot of the functions can be simplified and made more elegant. Revisit
// after other audio cleanup is done. (crbug.com/120319) // after other audio cleanup is done. (crbug.com/120319)
#include "media/audio/audio_util.h"
#include <algorithm> #include <algorithm>
#include <limits> #include <limits>
#include "base/atomicops.h"
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/shared_memory.h"
#include "base/time.h" #include "base/time.h"
#include "media/audio/audio_parameters.h" #include "media/audio/audio_parameters.h"
#include "media/audio/audio_util.h"
#include "media/base/audio_bus.h" #include "media/base/audio_bus.h"
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
...@@ -36,10 +35,6 @@ ...@@ -36,10 +35,6 @@
#include "media/base/media_switches.h" #include "media/base/media_switches.h"
#endif #endif
using base::subtle::Atomic32;
const uint32 kUnknownDataSize = static_cast<uint32>(-1);
namespace media { namespace media {
// TODO(fbarchard): Convert to intrinsics for better efficiency. // TODO(fbarchard): Convert to intrinsics for better efficiency.
...@@ -483,56 +478,6 @@ size_t GetHighLatencyOutputBufferSize(int sample_rate) { ...@@ -483,56 +478,6 @@ size_t GetHighLatencyOutputBufferSize(int sample_rate) {
return samples; 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) #if defined(OS_WIN)
bool IsWASAPISupported() { bool IsWASAPISupported() {
......
...@@ -111,21 +111,6 @@ MEDIA_EXPORT ChannelLayout GetAudioInputHardwareChannelLayout( ...@@ -111,21 +111,6 @@ MEDIA_EXPORT ChannelLayout GetAudioInputHardwareChannelLayout(
// conjunction with AUDIO_PCM_LINEAR. // conjunction with AUDIO_PCM_LINEAR.
MEDIA_EXPORT size_t GetHighLatencyOutputBufferSize(int sample_rate); 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) #if defined(OS_WIN)
// Does Windows support WASAPI? We are checking in lot of places, and // Does Windows support WASAPI? We are checking in lot of places, and
......
// 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
// 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_
...@@ -23,7 +23,6 @@ static const int kLayoutToChannels[] = { ...@@ -23,7 +23,6 @@ static const int kLayoutToChannels[] = {
8, // CHANNEL_LAYOUT_7POINT1_WIDE 8, // CHANNEL_LAYOUT_7POINT1_WIDE
2}; // CHANNEL_LAYOUT_STEREO_DOWNMIX 2}; // CHANNEL_LAYOUT_STEREO_DOWNMIX
#if defined(OS_MACOSX) || defined(USE_PULSEAUDIO)
const int kChannelOrderings[CHANNEL_LAYOUT_MAX][CHANNELS_MAX] = { const int kChannelOrderings[CHANNEL_LAYOUT_MAX][CHANNELS_MAX] = {
// FL | FR | FC | LFE | BL | BR | FLofC | FRofC | BC | SL | SR | StL | StR // FL | FR | FC | LFE | BL | BR | FLofC | FRofC | BC | SL | SR | StL | StR
...@@ -80,7 +79,6 @@ const int kChannelOrderings[CHANNEL_LAYOUT_MAX][CHANNELS_MAX] = { ...@@ -80,7 +79,6 @@ const int kChannelOrderings[CHANNEL_LAYOUT_MAX][CHANNELS_MAX] = {
// FL | FR | FC | LFE | BL | BR | FLofC | FRofC | BC | SL | SR | StL | StR // FL | FR | FC | LFE | BL | BR | FLofC | FRofC | BC | SL | SR | StL | StR
}; };
#endif
int ChannelLayoutToChannelCount(ChannelLayout layout) { int ChannelLayoutToChannelCount(ChannelLayout layout) {
return kLayoutToChannels[layout]; return kLayoutToChannels[layout];
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#ifndef MEDIA_BASE_CHANNEL_LAYOUT_H_ #ifndef MEDIA_BASE_CHANNEL_LAYOUT_H_
#define MEDIA_BASE_CHANNEL_LAYOUT_H_ #define MEDIA_BASE_CHANNEL_LAYOUT_H_
#include "build/build_config.h"
#include "media/base/media_export.h" #include "media/base/media_export.h"
enum ChannelLayout { enum ChannelLayout {
...@@ -78,15 +77,14 @@ enum Channels { ...@@ -78,15 +77,14 @@ enum Channels {
CHANNELS_MAX CHANNELS_MAX
}; };
#if defined(OS_MACOSX) || defined(USE_PULSEAUDIO)
// The channel orderings for each layout as specified by FFmpeg. // The channel orderings for each layout as specified by FFmpeg.
// Values represent the index of each channel in each layout. For example, the // 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 // 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 // position (because the order is L, R, C, LFE, LS, RS), so
// kChannelOrderings[CHANNEL_LAYOUT_5POINT1][SIDE_LEFT] = 4; // kChannelOrderings[CHANNEL_LAYOUT_5POINT1][SIDE_LEFT] = 4;
// Values of -1 mean the channel at that index is not used for that layout. // Values of -1 mean the channel at that index is not used for that layout.
extern const int kChannelOrderings[CHANNEL_LAYOUT_MAX][CHANNELS_MAX]; MEDIA_EXPORT extern const int
#endif kChannelOrderings[CHANNEL_LAYOUT_MAX][CHANNELS_MAX];
// Returns the number of channels in a given ChannelLayout. // Returns the number of channels in a given ChannelLayout.
MEDIA_EXPORT int ChannelLayoutToChannelCount(ChannelLayout layout); MEDIA_EXPORT int ChannelLayoutToChannelCount(ChannelLayout layout);
......
...@@ -11,6 +11,27 @@ ...@@ -11,6 +11,27 @@
'use_cras%': 0, 'use_cras%': 0,
}, },
'targets': [ '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', 'target_name': 'media',
'type': '<(component)', 'type': '<(component)',
...@@ -19,6 +40,7 @@ ...@@ -19,6 +40,7 @@
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'../build/temp_gyp/googleurl.gyp:googleurl', '../build/temp_gyp/googleurl.gyp:googleurl',
'../crypto/crypto.gyp:crypto', '../crypto/crypto.gyp:crypto',
'shared_memory_support',
'../ui/ui.gyp:ui', '../ui/ui.gyp:ui',
'yuv_convert', 'yuv_convert',
], ],
...@@ -73,8 +95,6 @@ ...@@ -73,8 +95,6 @@
'audio/audio_output_mixer.h', 'audio/audio_output_mixer.h',
'audio/audio_output_proxy.cc', 'audio/audio_output_proxy.cc',
'audio/audio_output_proxy.h', 'audio/audio_output_proxy.h',
'audio/audio_parameters.cc',
'audio/audio_parameters.h',
'audio/audio_util.cc', 'audio/audio_util.cc',
'audio/audio_util.h', 'audio/audio_util.h',
'audio/cross_process_notification.cc', 'audio/cross_process_notification.cc',
...@@ -137,8 +157,6 @@ ...@@ -137,8 +157,6 @@
'audio/win/waveout_output_win.h', 'audio/win/waveout_output_win.h',
'base/android/media_jni_registrar.cc', 'base/android/media_jni_registrar.cc',
'base/android/media_jni_registrar.h', 'base/android/media_jni_registrar.h',
'base/audio_bus.cc',
'base/audio_bus.h',
'base/audio_decoder.cc', 'base/audio_decoder.cc',
'base/audio_decoder.h', 'base/audio_decoder.h',
'base/audio_decoder_config.cc', 'base/audio_decoder_config.cc',
...@@ -157,8 +175,6 @@ ...@@ -157,8 +175,6 @@
'base/buffers.h', 'base/buffers.h',
'base/byte_queue.cc', 'base/byte_queue.cc',
'base/byte_queue.h', 'base/byte_queue.h',
'base/channel_layout.cc',
'base/channel_layout.h',
'base/clock.cc', 'base/clock.cc',
'base/clock.h', 'base/clock.h',
'base/data_buffer.cc', 'base/data_buffer.cc',
...@@ -181,7 +197,6 @@ ...@@ -181,7 +197,6 @@
'base/filter_collection.h', 'base/filter_collection.h',
'base/media.h', 'base/media.h',
'base/media_android.cc', 'base/media_android.cc',
'base/media_export.h',
'base/media_log.cc', 'base/media_log.cc',
'base/media_log.h', 'base/media_log.h',
'base/media_log_event.h', 'base/media_log_event.h',
...@@ -671,6 +686,7 @@ ...@@ -671,6 +686,7 @@
'dependencies': [ 'dependencies': [
'media', 'media',
'media_test_support', 'media_test_support',
'shared_memory_support',
'yuv_convert', 'yuv_convert',
'../base/base.gyp:base', '../base/base.gyp:base',
'../base/base.gyp:base_i18n', '../base/base.gyp:base_i18n',
......
# 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)',
],
},
],
}],
],
}
# 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',
],
},
}
...@@ -76,6 +76,8 @@ ...@@ -76,6 +76,8 @@
'-lsrpc', '-lsrpc',
'-limc_syscalls', '-limc_syscalls',
'-lplatform', '-lplatform',
'-lbase_untrusted',
'-lshared_memory_support_untrusted',
'-lgio', '-lgio',
'-Wl,--end-group', '-Wl,--end-group',
'-lm', '-lm',
...@@ -113,7 +115,9 @@ ...@@ -113,7 +115,9 @@
# once native_client/build/untrusted.gypi no longer needs them. # once native_client/build/untrusted.gypi no longer needs them.
'extra_deps64': [ 'extra_deps64': [
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libppruntime.a', '<(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/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/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libplatform.a', '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libimc_syscalls.a', '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libimc_syscalls.a',
...@@ -121,7 +125,9 @@ ...@@ -121,7 +125,9 @@
], ],
'extra_deps32': [ 'extra_deps32': [
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libppruntime.a', '<(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/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/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libplatform.a', '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libimc_syscalls.a', '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libimc_syscalls.a',
...@@ -129,7 +135,9 @@ ...@@ -129,7 +135,9 @@
], ],
'extra_deps_newlib64': [ 'extra_deps_newlib64': [
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libppruntime.a', '<(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/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/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libplatform.a', '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libimc_syscalls.a', '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libimc_syscalls.a',
...@@ -137,7 +145,9 @@ ...@@ -137,7 +145,9 @@
], ],
'extra_deps_newlib32': [ 'extra_deps_newlib32': [
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libppruntime.a', '<(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/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/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libplatform.a', '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libimc_syscalls.a', '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libimc_syscalls.a',
...@@ -145,7 +155,9 @@ ...@@ -145,7 +155,9 @@
], ],
'extra_deps_glibc64': [ 'extra_deps_glibc64': [
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libppruntime.a', '<(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/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/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libplatform.a', '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libimc_syscalls.a', '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libimc_syscalls.a',
...@@ -153,7 +165,9 @@ ...@@ -153,7 +165,9 @@
], ],
'extra_deps_glibc32': [ 'extra_deps_glibc32': [
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libppruntime.a', '<(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/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/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libplatform.a', '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libimc_syscalls.a', '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libimc_syscalls.a',
...@@ -161,7 +175,9 @@ ...@@ -161,7 +175,9 @@
], ],
'extra_deps_arm': [ 'extra_deps_arm': [
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libppruntime.a', '<(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/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/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libplatform.a', '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libimc_syscalls.a', '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libimc_syscalls.a',
...@@ -170,6 +186,8 @@ ...@@ -170,6 +186,8 @@
}, },
'dependencies': [ 'dependencies': [
'src/shared/ppapi_proxy/ppapi_proxy_untrusted.gyp:ppruntime_lib', '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/untrusted/irt/irt.gyp:irt_browser_lib',
'../../native_client/src/shared/srpc/srpc.gyp:srpc_lib', '../../native_client/src/shared/srpc/srpc.gyp:srpc_lib',
'../../native_client/src/shared/platform/platform.gyp:platform_lib', '../../native_client/src/shared/platform/platform.gyp:platform_lib',
...@@ -210,6 +228,7 @@ ...@@ -210,6 +228,7 @@
'-lgpu_ipc_untrusted', '-lgpu_ipc_untrusted',
'-lipc_untrusted', '-lipc_untrusted',
'-lbase_untrusted', '-lbase_untrusted',
'-lshared_memory_support_untrusted',
'-lsrpc', '-lsrpc',
'-limc_syscalls', '-limc_syscalls',
'-lplatform', '-lplatform',
...@@ -260,6 +279,7 @@ ...@@ -260,6 +279,7 @@
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libipc_untrusted.a', '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libipc_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libbase_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/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/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libplatform.a', '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libimc_syscalls.a', '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libimc_syscalls.a',
...@@ -277,6 +297,7 @@ ...@@ -277,6 +297,7 @@
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libipc_untrusted.a', '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libipc_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libbase_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/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/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libplatform.a', '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libimc_syscalls.a', '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libimc_syscalls.a',
...@@ -294,6 +315,7 @@ ...@@ -294,6 +315,7 @@
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libipc_untrusted.a', '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libipc_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libbase_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/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/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libplatform.a', '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libimc_syscalls.a', '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libimc_syscalls.a',
...@@ -311,6 +333,7 @@ ...@@ -311,6 +333,7 @@
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libipc_untrusted.a', '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libipc_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libbase_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/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/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libplatform.a', '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libimc_syscalls.a', '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libimc_syscalls.a',
...@@ -328,6 +351,7 @@ ...@@ -328,6 +351,7 @@
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libipc_untrusted.a', '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libipc_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libbase_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/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/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libplatform.a', '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libimc_syscalls.a', '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libimc_syscalls.a',
...@@ -345,6 +369,7 @@ ...@@ -345,6 +369,7 @@
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libipc_untrusted.a', '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libipc_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libbase_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/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/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libplatform.a', '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libimc_syscalls.a', '<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libimc_syscalls.a',
...@@ -362,6 +387,7 @@ ...@@ -362,6 +387,7 @@
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libipc_untrusted.a', '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libipc_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libbase_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/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/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libplatform.a', '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libimc_syscalls.a', '<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libimc_syscalls.a',
...@@ -379,6 +405,7 @@ ...@@ -379,6 +405,7 @@
'../../gpu/gpu_untrusted.gyp:gpu_ipc_untrusted', '../../gpu/gpu_untrusted.gyp:gpu_ipc_untrusted',
'../../ipc/ipc_untrusted.gyp:ipc_untrusted', '../../ipc/ipc_untrusted.gyp:ipc_untrusted',
'../../base/base_untrusted.gyp:base_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/untrusted/irt/irt.gyp:irt_browser_lib',
'../../native_client/src/shared/srpc/srpc.gyp:srpc_lib', '../../native_client/src/shared/srpc/srpc.gyp:srpc_lib',
'../../native_client/src/shared/platform/platform.gyp:platform_lib', '../../native_client/src/shared/platform/platform.gyp:platform_lib',
......
...@@ -4,6 +4,7 @@ include_rules = [ ...@@ -4,6 +4,7 @@ include_rules = [
"+native_client/src/trusted/plugin", "+native_client/src/trusted/plugin",
"+gpu", "+gpu",
"+media",
"+native_client/src/shared/imc", "+native_client/src/shared/imc",
"+native_client/src/shared/srpc", "+native_client/src/shared/srpc",
"+native_client/src/trusted/desc", "+native_client/src/trusted/desc",
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "native_client/src/shared/ppapi_proxy/utility.h" #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_invalid.h"
#include "native_client/src/trusted/desc/nacl_desc_wrapper.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.h"
#include "ppapi/c/ppb_audio_config.h" #include "ppapi/c/ppb_audio_config.h"
#include "ppapi/c/pp_errors.h" #include "ppapi/c/pp_errors.h"
...@@ -88,7 +89,7 @@ void StreamCreatedCallback(void* user_data, int32_t result) { ...@@ -88,7 +89,7 @@ void StreamCreatedCallback(void* user_data, int32_t result) {
return; return;
} }
size_t total_shared_memory_size = size_t total_shared_memory_size =
ppapi_proxy::TotalAudioSharedMemorySizeInBytes(audio_buffer_size); media::TotalSharedMemorySizeInBytes(audio_buffer_size);
nacl::DescWrapperFactory factory; nacl::DescWrapperFactory factory;
NaClHandle nacl_shm_handle = NaClHandle(shared_memory_handle); NaClHandle nacl_shm_handle = NaClHandle(shared_memory_handle);
NaClHandle nacl_sync_handle = NaClHandle(sync_socket_handle); NaClHandle nacl_sync_handle = NaClHandle(sync_socket_handle);
......
...@@ -81,14 +81,6 @@ const struct PP_ThreadFunctions* GetThreadCreator(); ...@@ -81,14 +81,6 @@ const struct PP_ThreadFunctions* GetThreadCreator();
// PPAPI constants used in the proxy. // PPAPI constants used in the proxy.
extern const PP_Resource kInvalidResourceId; 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 } // namespace ppapi_proxy
#endif // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_GLOBALS_H_ #endif // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_GLOBALS_H_
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "native_client/src/shared/ppapi_proxy/plugin_resource.h" #include "native_client/src/shared/ppapi_proxy/plugin_resource.h"
#include "native_client/src/shared/ppapi_proxy/utility.h" #include "native_client/src/shared/ppapi_proxy/utility.h"
#include "native_client/src/shared/srpc/nacl_srpc.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.h"
#include "ppapi/c/ppb_audio_config.h" #include "ppapi/c/ppb_audio_config.h"
#include "ppapi/cpp/module_impl.h" #include "ppapi/cpp/module_impl.h"
...@@ -29,19 +30,6 @@ size_t ceil64k(size_t n) { ...@@ -29,19 +30,6 @@ size_t ceil64k(size_t n) {
return (n + 0xFFFF) & (~0xFFFF); 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 } // namespace
PluginAudio::PluginAudio() : PluginAudio::PluginAudio() :
...@@ -65,7 +53,8 @@ PluginAudio::~PluginAudio() { ...@@ -65,7 +53,8 @@ PluginAudio::~PluginAudio() {
GetInterface()->StopPlayback(resource_); GetInterface()->StopPlayback(resource_);
// Unmap the shared memory buffer, if present. // Unmap the shared memory buffer, if present.
if (shm_buffer_) { if (shm_buffer_) {
munmap(shm_buffer_, ceil64k(TotalAudioSharedMemorySizeInBytes(shm_size_))); munmap(shm_buffer_,
ceil64k(media::TotalSharedMemorySizeInBytes(shm_size_)));
shm_buffer_ = NULL; shm_buffer_ = NULL;
shm_size_ = 0; shm_size_ = 0;
} }
...@@ -103,9 +92,9 @@ void PluginAudio::AudioThread(void* self) { ...@@ -103,9 +92,9 @@ void PluginAudio::AudioThread(void* self) {
audio->user_data_); audio->user_data_);
// Signal audio backend by writing buffer length at end of buffer. // Signal audio backend by writing buffer length at end of buffer.
// (Note: NaCl applications will always write the entire buffer.) // (Note: NaCl applications will always write the entire buffer.)
SetAudioActualDataSizeInBytes(audio->shm_buffer_, media::SetActualDataSizeInBytes(audio->shm_buffer_,
audio->shm_size_, audio->shm_size_,
audio->shm_size_); audio->shm_size_);
} }
} }
...@@ -117,7 +106,7 @@ void PluginAudio::StreamCreated(NaClSrpcImcDescType socket, ...@@ -117,7 +106,7 @@ void PluginAudio::StreamCreated(NaClSrpcImcDescType socket,
shm_ = shm; shm_ = shm;
shm_size_ = shm_size; shm_size_ = shm_size;
shm_buffer_ = mmap(NULL, shm_buffer_ = mmap(NULL,
ceil64k(TotalAudioSharedMemorySizeInBytes(shm_size)), ceil64k(media::TotalSharedMemorySizeInBytes(shm_size)),
PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE,
MAP_SHARED, MAP_SHARED,
shm, shm,
......
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
'target_name': 'ppruntime_lib', 'target_name': 'ppruntime_lib',
'type': 'none', 'type': 'none',
'dependencies': [ 'dependencies': [
'<(DEPTH)/native_client/tools.gyp:prep_toolchain' '<(DEPTH)/native_client/tools.gyp:prep_toolchain',
'<(DEPTH)/media/media_untrusted.gyp:shared_memory_support_untrusted',
], ],
'variables': { 'variables': {
'nlib_target': 'libppruntime.a', 'nlib_target': 'libppruntime.a',
...@@ -19,6 +20,7 @@ ...@@ -19,6 +20,7 @@
'build_newlib': 1, 'build_newlib': 1,
'include_dirs': [ 'include_dirs': [
'<(DEPTH)/gpu', '<(DEPTH)/gpu',
'<(DEPTH)/media',
'<(DEPTH)/third_party/khronos', '<(DEPTH)/third_party/khronos',
'<(DEPTH)/ppapi/native_client/src/shared/ppapi_proxy/untrusted', '<(DEPTH)/ppapi/native_client/src/shared/ppapi_proxy/untrusted',
], ],
......
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
'target_base': 'ppNaClPlugin', 'target_base': 'ppNaClPlugin',
}, },
'dependencies': [ 'dependencies': [
'<(DEPTH)/media/media.gyp:shared_memory_support',
'<(DEPTH)/native_client/src/shared/gio/gio.gyp:gio', '<(DEPTH)/native_client/src/shared/gio/gio.gyp:gio',
'<(DEPTH)/native_client/src/shared/imc/imc.gyp:imc', '<(DEPTH)/native_client/src/shared/imc/imc.gyp:imc',
'<(DEPTH)/native_client/src/shared/platform/platform.gyp:platform', '<(DEPTH)/native_client/src/shared/platform/platform.gyp:platform',
...@@ -92,6 +93,7 @@ ...@@ -92,6 +93,7 @@
], ],
}, },
'dependencies': [ 'dependencies': [
'<(DEPTH)/media/media.gyp:shared_memory_support',
'<(DEPTH)/native_client/src/shared/gio/gio.gyp:gio', '<(DEPTH)/native_client/src/shared/gio/gio.gyp:gio',
'<(DEPTH)/native_client/src/shared/imc/imc.gyp:imc', '<(DEPTH)/native_client/src/shared/imc/imc.gyp:imc',
'<(DEPTH)/native_client/src/shared/platform/platform.gyp:platform', '<(DEPTH)/native_client/src/shared/platform/platform.gyp:platform',
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
'ppapi_internal.gyp:ppapi_shared', 'ppapi_internal.gyp:ppapi_shared',
'../base/base.gyp:base', '../base/base.gyp:base',
'../ipc/ipc.gyp:ipc', '../ipc/ipc.gyp:ipc',
'../media/media.gyp:shared_memory_support',
'../ui/surface/surface.gyp:surface', '../ui/surface/surface.gyp:surface',
], ],
'defines': [ 'defines': [
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
'../gpu/command_buffer/command_buffer.gyp:gles2_utils', '../gpu/command_buffer/command_buffer.gyp:gles2_utils',
'../gpu/gpu.gyp:command_buffer_client', '../gpu/gpu.gyp:command_buffer_client',
'../gpu/gpu.gyp:gles2_implementation', '../gpu/gpu.gyp:gles2_implementation',
'../media/media.gyp:shared_memory_support',
'../net/net.gyp:net', '../net/net.gyp:net',
'../skia/skia.gyp:skia', '../skia/skia.gyp:skia',
'../third_party/icu/icu.gyp:icuuc', '../third_party/icu/icu.gyp:icuuc',
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
'../gpu/command_buffer/command_buffer_untrusted.gyp:gles2_utils_untrusted', '../gpu/command_buffer/command_buffer_untrusted.gyp:gles2_utils_untrusted',
'../gpu/gpu_untrusted.gyp:command_buffer_client_untrusted', '../gpu/gpu_untrusted.gyp:command_buffer_client_untrusted',
'../gpu/gpu_untrusted.gyp:gles2_implementation_untrusted', '../gpu/gpu_untrusted.gyp:gles2_implementation_untrusted',
'../media/media_untrusted.gyp:shared_memory_support_untrusted',
], ],
}, },
], ],
......
...@@ -133,6 +133,7 @@ ...@@ -133,6 +133,7 @@
'../gpu/gpu.gyp:gpu_ipc', '../gpu/gpu.gyp:gpu_ipc',
'../ipc/ipc.gyp:ipc', '../ipc/ipc.gyp:ipc',
'../ipc/ipc.gyp:test_support_ipc', '../ipc/ipc.gyp:test_support_ipc',
'../media/media.gyp:shared_memory_support',
'../testing/gmock.gyp:gmock', '../testing/gmock.gyp:gmock',
'../testing/gtest.gyp:gtest', '../testing/gtest.gyp:gtest',
'../ui/surface/surface.gyp:surface', '../ui/surface/surface.gyp:surface',
......
...@@ -5,10 +5,9 @@ ...@@ -5,10 +5,9 @@
#include "ppapi/shared_impl/ppb_audio_shared.h" #include "ppapi/shared_impl/ppb_audio_shared.h"
#include "base/logging.h" #include "base/logging.h"
#include "media/audio/shared_memory_util.h"
#include "ppapi/shared_impl/ppapi_globals.h" #include "ppapi/shared_impl/ppapi_globals.h"
using base::subtle::Atomic32;
namespace ppapi { namespace ppapi {
#if defined(OS_NACL) #if defined(OS_NACL)
...@@ -18,29 +17,6 @@ PP_ThreadFunctions thread_functions; ...@@ -18,29 +17,6 @@ PP_ThreadFunctions thread_functions;
} }
#endif // defined(OS_NACL) #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() PPB_Audio_Shared::PPB_Audio_Shared()
: playing_(false), : playing_(false),
shared_memory_size_(0), shared_memory_size_(0),
...@@ -93,7 +69,8 @@ void PPB_Audio_Shared::SetStreamInfo( ...@@ -93,7 +69,8 @@ void PPB_Audio_Shared::SetStreamInfo(
shared_memory_.reset(new base::SharedMemory(shared_memory_handle, false)); shared_memory_.reset(new base::SharedMemory(shared_memory_handle, false));
shared_memory_size_ = shared_memory_size; shared_memory_size_ = shared_memory_size;
if (!shared_memory_->Map(TotalSharedMemorySizeInBytes(shared_memory_size_))) { if (!shared_memory_->Map(
media::TotalSharedMemorySizeInBytes(shared_memory_size_))) {
PpapiGlobals::Get()->LogWithSource(instance, PP_LOGLEVEL_WARNING, "", PpapiGlobals::Get()->LogWithSource(instance, PP_LOGLEVEL_WARNING, "",
"Failed to map shared memory for PPB_Audio_Shared."); "Failed to map shared memory for PPB_Audio_Shared.");
} }
...@@ -167,12 +144,12 @@ void PPB_Audio_Shared::Run() { ...@@ -167,12 +144,12 @@ void PPB_Audio_Shared::Run() {
while (sizeof(pending_data) == while (sizeof(pending_data) ==
socket_->Receive(&pending_data, sizeof(pending_data)) && socket_->Receive(&pending_data, sizeof(pending_data)) &&
pending_data != kPauseMark) { pending_data != media::kPauseMark) {
callback_(buffer, shared_memory_size_, user_data_); callback_(buffer, shared_memory_size_, user_data_);
// Let the host know we are done. // Let the host know we are done.
SetActualDataSizeInBytes(shared_memory_.get(), shared_memory_size_, media::SetActualDataSizeInBytes(
shared_memory_size_); shared_memory_.get(), shared_memory_size_, shared_memory_size_);
} }
} }
......
...@@ -29,9 +29,6 @@ class PPAPI_SHARED_EXPORT PPB_Audio_Shared ...@@ -29,9 +29,6 @@ class PPAPI_SHARED_EXPORT PPB_Audio_Shared
PPB_Audio_Shared(); PPB_Audio_Shared();
virtual ~PPB_Audio_Shared(); virtual ~PPB_Audio_Shared();
// Keep in sync with media::AudioOutputController::kPauseMark.
static const int kPauseMark;
bool playing() const { return playing_; } bool playing() const { return playing_; }
// Sets the callback information that the background thread will use. This // Sets the callback information that the background thread will use. This
......
...@@ -53,8 +53,6 @@ PP_Resource PPB_Audio_Impl::Create(PP_Instance instance, ...@@ -53,8 +53,6 @@ PP_Resource PPB_Audio_Impl::Create(PP_Instance instance,
scoped_refptr<PPB_Audio_Impl> audio(new PPB_Audio_Impl(instance)); scoped_refptr<PPB_Audio_Impl> audio(new PPB_Audio_Impl(instance));
if (!audio->Init(config, audio_callback, user_data)) if (!audio->Init(config, audio_callback, user_data))
return 0; return 0;
CHECK(media::AudioOutputController::kPauseMark ==
::ppapi::PPB_Audio_Shared::kPauseMark);
return audio->GetReference(); return audio->GetReference();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment