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

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

Issue 1541353002: Add offset support to BitstreamBuffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address review comments and rebase Created 4 years, 9 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: content/common/gpu/media/v4l2_video_encode_accelerator.cc
diff --git a/content/common/gpu/media/v4l2_video_encode_accelerator.cc b/content/common/gpu/media/v4l2_video_encode_accelerator.cc
index 9f62cc51a5baee6b3014f9e1b2a17ef01f35dd7d..4cc8f267bce38147e177b8db9cbac47d6f006b16 100644
--- a/content/common/gpu/media/v4l2_video_encode_accelerator.cc
+++ b/content/common/gpu/media/v4l2_video_encode_accelerator.cc
@@ -17,6 +17,7 @@
#include "base/numerics/safe_conversions.h"
#include "base/thread_task_runner_handle.h"
#include "base/trace_event/trace_event.h"
+#include "content/common/gpu/media/shared_memory_region.h"
#include "content/common/gpu/media/v4l2_video_encode_accelerator.h"
#include "content/public/common/content_switches.h"
#include "media/base/bitstream_buffer.h"
@@ -51,13 +52,10 @@
namespace content {
struct V4L2VideoEncodeAccelerator::BitstreamBufferRef {
- BitstreamBufferRef(int32_t id,
- scoped_ptr<base::SharedMemory> shm,
- size_t size)
- : id(id), shm(std::move(shm)), size(size) {}
+ BitstreamBufferRef(int32_t id, scoped_ptr<SharedMemoryRegion> shm)
+ : id(id), shm(std::move(shm)) {}
const int32_t id;
- const scoped_ptr<base::SharedMemory> shm;
- const size_t size;
+ const scoped_ptr<SharedMemoryRegion> shm;
};
V4L2VideoEncodeAccelerator::InputRecord::InputRecord() : at_device(false) {
@@ -224,15 +222,14 @@ void V4L2VideoEncodeAccelerator::UseOutputBitstreamBuffer(
return;
}
- scoped_ptr<base::SharedMemory> shm(
- new base::SharedMemory(buffer.handle(), false));
- if (!shm->Map(buffer.size())) {
+ scoped_ptr<SharedMemoryRegion> shm(new SharedMemoryRegion(buffer, false));
+ if (!shm->Map()) {
NOTIFY_ERROR(kPlatformFailureError);
return;
}
scoped_ptr<BitstreamBufferRef> buffer_ref(
- new BitstreamBufferRef(buffer.id(), std::move(shm), buffer.size()));
+ new BitstreamBufferRef(buffer.id(), std::move(shm)));
encoder_thread_.message_loop()->PostTask(
FROM_HERE,
base::Bind(&V4L2VideoEncodeAccelerator::UseOutputBitstreamBufferTask,
« no previous file with comments | « content/common/gpu/media/v4l2_video_decode_accelerator.cc ('k') | content/common/gpu/media/vaapi_jpeg_decode_accelerator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698