Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Unified Diff: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_audio.cc

Issue 10837350: Revert 152406 - Introduce shared_memory_support media target for PPAPI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_audio.cc
===================================================================
--- ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_audio.cc (revision 152430)
+++ ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_audio.cc (working copy)
@@ -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 @@
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 @@
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 @@
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 @@
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,
Property changes on: ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_audio.cc
___________________________________________________________________
Added: svn:mergeinfo

Powered by Google App Engine
This is Rietveld 408576698