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

Side by Side Diff: content/common/gpu/media/vaapi_jpeg_decode_accelerator.cc

Issue 1541353002: Add offset support to BitstreamBuffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/gpu/media/vaapi_jpeg_decode_accelerator.h" 5 #include "content/common/gpu/media/vaapi_jpeg_decode_accelerator.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 const scoped_refptr<media::VideoFrame>& video_frame) { 282 const scoped_refptr<media::VideoFrame>& video_frame) {
283 DVLOG(3) << __func__; 283 DVLOG(3) << __func__;
284 DCHECK(io_task_runner_->BelongsToCurrentThread()); 284 DCHECK(io_task_runner_->BelongsToCurrentThread());
285 TRACE_EVENT1("jpeg", "Decode", "input_id", bitstream_buffer.id()); 285 TRACE_EVENT1("jpeg", "Decode", "input_id", bitstream_buffer.id());
286 286
287 DVLOG(4) << "Mapping new input buffer id: " << bitstream_buffer.id() 287 DVLOG(4) << "Mapping new input buffer id: " << bitstream_buffer.id()
288 << " size: " << bitstream_buffer.size(); 288 << " size: " << bitstream_buffer.size();
289 scoped_ptr<base::SharedMemory> shm( 289 scoped_ptr<base::SharedMemory> shm(
290 new base::SharedMemory(bitstream_buffer.handle(), true)); 290 new base::SharedMemory(bitstream_buffer.handle(), true));
291 291
292 if (!shm->Map(bitstream_buffer.size())) { 292 if (!shm->MapAt(bitstream_buffer.offset(), bitstream_buffer.size())) {
293 LOG(ERROR) << "Failed to map input buffer"; 293 LOG(ERROR) << "Failed to map input buffer";
294 NotifyErrorFromDecoderThread(bitstream_buffer.id(), UNREADABLE_INPUT); 294 NotifyErrorFromDecoderThread(bitstream_buffer.id(), UNREADABLE_INPUT);
295 return; 295 return;
296 } 296 }
297 297
298 scoped_ptr<DecodeRequest> request( 298 scoped_ptr<DecodeRequest> request(
299 new DecodeRequest(bitstream_buffer, shm.Pass(), video_frame)); 299 new DecodeRequest(bitstream_buffer, shm.Pass(), video_frame));
300 300
301 decoder_task_runner_->PostTask( 301 decoder_task_runner_->PostTask(
302 FROM_HERE, base::Bind(&VaapiJpegDecodeAccelerator::DecodeTask, 302 FROM_HERE, base::Bind(&VaapiJpegDecodeAccelerator::DecodeTask,
303 base::Unretained(this), base::Passed(&request))); 303 base::Unretained(this), base::Passed(&request)));
304 } 304 }
305 305
306 bool VaapiJpegDecodeAccelerator::IsSupported() { 306 bool VaapiJpegDecodeAccelerator::IsSupported() {
307 return VaapiWrapper::IsJpegDecodeSupported(); 307 return VaapiWrapper::IsJpegDecodeSupported();
308 } 308 }
309 309
310 } // namespace content 310 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698