| Index: content/common/gpu/media/vaapi_jpeg_decode_accelerator.cc
|
| diff --git a/content/common/gpu/media/vaapi_jpeg_decode_accelerator.cc b/content/common/gpu/media/vaapi_jpeg_decode_accelerator.cc
|
| index 8efb362180dce6690939cd39fd2e8ee4c50b9664..c2388c48c2571721b99b814bb07d57085aef728d 100644
|
| --- a/content/common/gpu/media/vaapi_jpeg_decode_accelerator.cc
|
| +++ b/content/common/gpu/media/vaapi_jpeg_decode_accelerator.cc
|
| @@ -14,6 +14,7 @@
|
| #include "base/thread_task_runner_handle.h"
|
| #include "base/trace_event/trace_event.h"
|
| #include "content/common/gpu/gpu_channel.h"
|
| +#include "content/common/gpu/media/shared_memory_region.h"
|
| #include "content/common/gpu/media/vaapi_picture.h"
|
| #include "media/base/video_frame.h"
|
| #include "media/filters/jpeg_parser.h"
|
| @@ -76,10 +77,10 @@ static unsigned int VaSurfaceFormatForJpeg(
|
| } // namespace
|
|
|
| VaapiJpegDecodeAccelerator::DecodeRequest::DecodeRequest(
|
| - const media::BitstreamBuffer& bitstream_buffer,
|
| - scoped_ptr<base::SharedMemory> shm,
|
| + int32_t bitstream_buffer_id,
|
| + scoped_ptr<SharedMemoryRegion> shm,
|
| const scoped_refptr<media::VideoFrame>& video_frame)
|
| - : bitstream_buffer(bitstream_buffer),
|
| + : bitstream_buffer_id(bitstream_buffer_id),
|
| shm(std::move(shm)),
|
| video_frame(video_frame) {}
|
|
|
| @@ -226,9 +227,9 @@ void VaapiJpegDecodeAccelerator::DecodeTask(
|
| media::JpegParseResult parse_result;
|
| if (!media::ParseJpegPicture(
|
| reinterpret_cast<const uint8_t*>(request->shm->memory()),
|
| - request->bitstream_buffer.size(), &parse_result)) {
|
| + request->shm->size(), &parse_result)) {
|
| DLOG(ERROR) << "ParseJpegPicture failed";
|
| - NotifyErrorFromDecoderThread(request->bitstream_buffer.id(),
|
| + NotifyErrorFromDecoderThread(request->bitstream_buffer_id,
|
| PARSE_JPEG_FAILED);
|
| return;
|
| }
|
| @@ -237,7 +238,7 @@ void VaapiJpegDecodeAccelerator::DecodeTask(
|
| VaSurfaceFormatForJpeg(parse_result.frame_header);
|
| if (!new_va_rt_format) {
|
| DLOG(ERROR) << "Unsupported subsampling";
|
| - NotifyErrorFromDecoderThread(request->bitstream_buffer.id(),
|
| + NotifyErrorFromDecoderThread(request->bitstream_buffer_id,
|
| UNSUPPORTED_JPEG);
|
| return;
|
| }
|
| @@ -255,7 +256,7 @@ void VaapiJpegDecodeAccelerator::DecodeTask(
|
| if (!vaapi_wrapper_->CreateSurfaces(va_rt_format_, new_coded_size, 1,
|
| &va_surfaces)) {
|
| LOG(ERROR) << "Create VA surface failed";
|
| - NotifyErrorFromDecoderThread(request->bitstream_buffer.id(),
|
| + NotifyErrorFromDecoderThread(request->bitstream_buffer_id,
|
| PLATFORM_FAILURE);
|
| return;
|
| }
|
| @@ -266,15 +267,15 @@ void VaapiJpegDecodeAccelerator::DecodeTask(
|
| if (!VaapiJpegDecoder::Decode(vaapi_wrapper_.get(), parse_result,
|
| va_surface_id_)) {
|
| LOG(ERROR) << "Decode JPEG failed";
|
| - NotifyErrorFromDecoderThread(request->bitstream_buffer.id(),
|
| + NotifyErrorFromDecoderThread(request->bitstream_buffer_id,
|
| PLATFORM_FAILURE);
|
| return;
|
| }
|
|
|
| - if (!OutputPicture(va_surface_id_, request->bitstream_buffer.id(),
|
| + if (!OutputPicture(va_surface_id_, request->bitstream_buffer_id,
|
| request->video_frame)) {
|
| LOG(ERROR) << "Output picture failed";
|
| - NotifyErrorFromDecoderThread(request->bitstream_buffer.id(),
|
| + NotifyErrorFromDecoderThread(request->bitstream_buffer_id,
|
| PLATFORM_FAILURE);
|
| return;
|
| }
|
| @@ -289,17 +290,17 @@ void VaapiJpegDecodeAccelerator::Decode(
|
|
|
| DVLOG(4) << "Mapping new input buffer id: " << bitstream_buffer.id()
|
| << " size: " << bitstream_buffer.size();
|
| - scoped_ptr<base::SharedMemory> shm(
|
| - new base::SharedMemory(bitstream_buffer.handle(), true));
|
| + scoped_ptr<SharedMemoryRegion> shm(
|
| + new SharedMemoryRegion(bitstream_buffer, true));
|
|
|
| - if (!shm->Map(bitstream_buffer.size())) {
|
| + if (!shm->Map()) {
|
| LOG(ERROR) << "Failed to map input buffer";
|
| NotifyErrorFromDecoderThread(bitstream_buffer.id(), UNREADABLE_INPUT);
|
| return;
|
| }
|
|
|
| scoped_ptr<DecodeRequest> request(
|
| - new DecodeRequest(bitstream_buffer, std::move(shm), video_frame));
|
| + new DecodeRequest(bitstream_buffer.id(), std::move(shm), video_frame));
|
|
|
| decoder_task_runner_->PostTask(
|
| FROM_HERE, base::Bind(&VaapiJpegDecodeAccelerator::DecodeTask,
|
|
|