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 11ff91a9d6cf18986406eb57660aaa79fdfb4514..a811ea0f662e2040a3bf3eda28daa9dd968859e9 100644 |
--- a/content/common/gpu/media/vaapi_jpeg_decode_accelerator.cc |
+++ b/content/common/gpu/media/vaapi_jpeg_decode_accelerator.cc |
@@ -10,6 +10,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" |
@@ -72,13 +73,12 @@ 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), |
- shm(shm.Pass()), |
- video_frame(video_frame) { |
-} |
+ : bitstream_buffer_id(bitstream_buffer_id), |
+ shm(std::move(shm)), |
+ video_frame(video_frame) {} |
VaapiJpegDecodeAccelerator::DecodeRequest::~DecodeRequest() { |
} |
@@ -223,9 +223,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; |
} |
@@ -234,7 +234,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; |
} |
@@ -252,7 +252,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; |
} |
@@ -263,15 +263,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; |
} |
@@ -286,17 +286,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, shm.Pass(), video_frame)); |
+ new DecodeRequest(bitstream_buffer.id(), std::move(shm), video_frame)); |
decoder_task_runner_->PostTask( |
FROM_HERE, base::Bind(&VaapiJpegDecodeAccelerator::DecodeTask, |