Commit 0c6afb90 authored by Matthew Cary's avatar Matthew Cary Committed by Commit Bot

media/gpu shared memory: Update fake UnalignedSharedMemory.

Uses the new WritableUnalignedMapping class, which changes the ownership
semantics. See the bug for details on the overall plan.

Bug: 849207
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I84bf28d0da5b6c6d9e764b6f30d48f263550e37f
Reviewed-on: https://chromium-review.googlesource.com/1117689Reviewed-by: default avatarDan Sanders <sandersd@chromium.org>
Commit-Queue: Matthew Cary <mattcary@chromium.org>
Cr-Commit-Position: refs/heads/master@{#571872}
parent a0bbf4e4
......@@ -41,10 +41,13 @@ void FakeJpegDecodeAccelerator::Decode(
const scoped_refptr<VideoFrame>& video_frame) {
DCHECK(io_task_runner_->BelongsToCurrentThread());
// src_shm will take over the |bitstream_buffer.handle()|.
std::unique_ptr<UnalignedSharedMemory> src_shm(new UnalignedSharedMemory(
bitstream_buffer.handle(), bitstream_buffer.size(), true));
if (!src_shm->MapAt(bitstream_buffer.offset(), bitstream_buffer.size())) {
std::unique_ptr<WritableUnalignedMapping> src_shm(
new WritableUnalignedMapping(bitstream_buffer.handle(),
bitstream_buffer.size(),
bitstream_buffer.offset()));
// The handle is no longer needed.
bitstream_buffer.handle().Close();
if (!src_shm->IsValid()) {
DLOG(ERROR) << "Unable to map shared memory in FakeJpegDecodeAccelerator";
NotifyError(bitstream_buffer.id(), JpegDecodeAccelerator::UNREADABLE_INPUT);
return;
......@@ -60,7 +63,7 @@ void FakeJpegDecodeAccelerator::Decode(
void FakeJpegDecodeAccelerator::DecodeOnDecoderThread(
const BitstreamBuffer& bitstream_buffer,
const scoped_refptr<VideoFrame>& video_frame,
std::unique_ptr<UnalignedSharedMemory> src_shm) {
std::unique_ptr<WritableUnalignedMapping> src_shm) {
DCHECK(decoder_task_runner_->BelongsToCurrentThread());
// Do not actually decode the Jpeg data.
......
......@@ -22,8 +22,6 @@ class SingleThreadTaskRunner;
namespace media {
class UnalignedSharedMemory;
// Uses software-based decoding. The purpose of this class is to enable testing
// of communication to the JpegDecodeAccelerator without requiring an actual
// hardware decoder.
......@@ -43,7 +41,7 @@ class MEDIA_GPU_EXPORT FakeJpegDecodeAccelerator
private:
void DecodeOnDecoderThread(const BitstreamBuffer& bitstream_buffer,
const scoped_refptr<VideoFrame>& video_frame,
std::unique_ptr<UnalignedSharedMemory> src_shm);
std::unique_ptr<WritableUnalignedMapping> src_shm);
void NotifyError(int32_t bitstream_buffer_id, Error error);
void NotifyErrorOnClientThread(int32_t bitstream_buffer_id, Error error);
void OnDecodeDoneOnClientThread(int32_t input_buffer_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment