| Index: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_audio.cc
|
| 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 2a01b97bf2f2c7546d43a6a2419af4d1ba84b884..18558e6370a576a8848024d31cb1264e2047642f 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,6 +15,7 @@
|
| #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"
|
| @@ -29,19 +30,6 @@ 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() :
|
| @@ -65,7 +53,8 @@ PluginAudio::~PluginAudio() {
|
| GetInterface()->StopPlayback(resource_);
|
| // Unmap the shared memory buffer, if present.
|
| if (shm_buffer_) {
|
| - munmap(shm_buffer_, ceil64k(TotalAudioSharedMemorySizeInBytes(shm_size_)));
|
| + munmap(shm_buffer_,
|
| + ceil64k(media::TotalSharedMemorySizeInBytes(shm_size_)));
|
| shm_buffer_ = NULL;
|
| shm_size_ = 0;
|
| }
|
| @@ -103,9 +92,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.)
|
| - SetAudioActualDataSizeInBytes(audio->shm_buffer_,
|
| - audio->shm_size_,
|
| - audio->shm_size_);
|
| + media::SetActualDataSizeInBytes(audio->shm_buffer_,
|
| + audio->shm_size_,
|
| + audio->shm_size_);
|
| }
|
| }
|
|
|
| @@ -117,7 +106,7 @@ void PluginAudio::StreamCreated(NaClSrpcImcDescType socket,
|
| shm_ = shm;
|
| shm_size_ = shm_size;
|
| shm_buffer_ = mmap(NULL,
|
| - ceil64k(TotalAudioSharedMemorySizeInBytes(shm_size)),
|
| + ceil64k(media::TotalSharedMemorySizeInBytes(shm_size)),
|
| PROT_READ | PROT_WRITE,
|
| MAP_SHARED,
|
| shm,
|
|
|