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

Unified Diff: content/common/gpu/media/gpu_video_encode_accelerator.cc

Issue 859313002: Pepper: Define PPB_VideoEncoder API + Implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « content/common/gpu/media/gpu_video_encode_accelerator.h ('k') | content/content_renderer.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/media/gpu_video_encode_accelerator.cc
diff --git a/content/common/gpu/media/gpu_video_encode_accelerator.cc b/content/common/gpu/media/gpu_video_encode_accelerator.cc
index df16d97839ac9b14e8a407ce06d25622df1e873b..d4f3e1e0353be582398818b6faa6575beae43df6 100644
--- a/content/common/gpu/media/gpu_video_encode_accelerator.cc
+++ b/content/common/gpu/media/gpu_video_encode_accelerator.cc
@@ -9,6 +9,7 @@
#include "base/logging.h"
#include "base/memory/shared_memory.h"
#include "base/message_loop/message_loop_proxy.h"
+#include "base/sys_info.h"
#include "build/build_config.h"
#include "content/common/gpu/gpu_channel.h"
#include "content/common/gpu/gpu_messages.h"
@@ -245,6 +246,7 @@ GpuVideoEncodeAccelerator::CreateAndroidVEA() {
void GpuVideoEncodeAccelerator::OnEncode(int32 frame_id,
base::SharedMemoryHandle buffer_handle,
+ uint32 buffer_offset,
uint32 buffer_size,
bool force_keyframe) {
DVLOG(3) << "GpuVideoEncodeAccelerator::OnEncode(): frame_id=" << frame_id
@@ -259,16 +261,28 @@ void GpuVideoEncodeAccelerator::OnEncode(int32 frame_id,
return;
}
+ off_t map_offset = buffer_offset -
+ (buffer_offset % base::SysInfo::VMAllocationGranularity());
+ size_t map_size = buffer_size + (buffer_offset - map_offset);
+
scoped_ptr<base::SharedMemory> shm(
new base::SharedMemory(buffer_handle, true));
- if (!shm->Map(buffer_size)) {
+ if (!shm->MapAt(map_offset, map_size)) {
DLOG(ERROR) << "GpuVideoEncodeAccelerator::OnEncode(): "
"could not map frame_id=" << frame_id;
NotifyError(media::VideoEncodeAccelerator::kPlatformFailureError);
return;
}
- uint8* shm_memory = reinterpret_cast<uint8*>(shm->memory());
+ LOG(ERROR) << "GpuVideoEncodeAccelerator::OnEncode"
+ << " buffer_offset=" << buffer_offset
+ << " buffer_size=" << buffer_size
+ << " map_offset=" << map_offset
+ << " map_size=" << map_size
+ << " ptr_offset=" << (buffer_offset - map_offset);
+
+ uint8* shm_memory = reinterpret_cast<uint8*>(shm->memory()) +
+ (buffer_offset - map_offset);
scoped_refptr<media::VideoFrame> frame =
media::VideoFrame::WrapExternalPackedMemory(
input_format_,
@@ -278,6 +292,7 @@ void GpuVideoEncodeAccelerator::OnEncode(int32 frame_id,
shm_memory,
buffer_size,
buffer_handle,
+ buffer_offset,
base::TimeDelta(),
// It's turtles all the way down...
base::Bind(base::IgnoreResult(&base::MessageLoopProxy::PostTask),
« no previous file with comments | « content/common/gpu/media/gpu_video_encode_accelerator.h ('k') | content/content_renderer.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698