| Index: content/common/gpu/media/vaapi_video_encode_accelerator.cc
|
| diff --git a/content/common/gpu/media/vaapi_video_encode_accelerator.cc b/content/common/gpu/media/vaapi_video_encode_accelerator.cc
|
| index 495f2f1b6876dfd7f6f8916dd9b612e7991deb83..737abfd2272f8e55177be3edb54e8c57ff877bc7 100644
|
| --- a/content/common/gpu/media/vaapi_video_encode_accelerator.cc
|
| +++ b/content/common/gpu/media/vaapi_video_encode_accelerator.cc
|
| @@ -9,6 +9,7 @@
|
| #include "base/metrics/histogram.h"
|
| #include "base/numerics/safe_conversions.h"
|
| #include "content/common/gpu/media/h264_dpb.h"
|
| +#include "content/common/gpu/media/shared_memory_region.h"
|
| #include "media/base/bind_to_current_loop.h"
|
| #include "third_party/libva/va/va_enc_h264.h"
|
|
|
| @@ -96,11 +97,10 @@ struct VaapiVideoEncodeAccelerator::InputFrameRef {
|
| };
|
|
|
| struct VaapiVideoEncodeAccelerator::BitstreamBufferRef {
|
| - BitstreamBufferRef(int32 id, scoped_ptr<base::SharedMemory> shm, size_t size)
|
| - : id(id), shm(shm.Pass()), size(size) {}
|
| + BitstreamBufferRef(int32 id, scoped_ptr<SharedMemoryRegion> shm)
|
| + : id(id), shm(std::move(shm)) {}
|
| const int32 id;
|
| - const scoped_ptr<base::SharedMemory> shm;
|
| - const size_t size;
|
| + const scoped_ptr<SharedMemoryRegion> shm;
|
| };
|
|
|
| media::VideoEncodeAccelerator::SupportedProfiles
|
| @@ -540,11 +540,8 @@ void VaapiVideoEncodeAccelerator::TryToReturnBitstreamBuffer() {
|
|
|
| size_t data_size = 0;
|
| if (!vaapi_wrapper_->DownloadAndDestroyCodedBuffer(
|
| - encode_job->coded_buffer,
|
| - encode_job->input_surface->id(),
|
| - target_data,
|
| - buffer->size,
|
| - &data_size)) {
|
| + encode_job->coded_buffer, encode_job->input_surface->id(),
|
| + target_data, buffer->shm->size(), &data_size)) {
|
| NOTIFY_ERROR(kPlatformFailureError, "Failed downloading coded buffer");
|
| return;
|
| }
|
| @@ -663,15 +660,14 @@ void VaapiVideoEncodeAccelerator::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, "Failed mapping shared memory.");
|
| return;
|
| }
|
|
|
| scoped_ptr<BitstreamBufferRef> buffer_ref(
|
| - new BitstreamBufferRef(buffer.id(), shm.Pass(), buffer.size()));
|
| + new BitstreamBufferRef(buffer.id(), std::move(shm)));
|
|
|
| encoder_thread_task_runner_->PostTask(
|
| FROM_HERE,
|
|
|