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

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

Issue 1706023003: Moving the validation of bitstream_buffer into VDA implementations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ready for review Created 4 years, 10 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 <stddef.h> 7 #include <stddef.h>
8 #include <string.h> 8 #include <string.h>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 282
283 void VaapiJpegDecodeAccelerator::Decode( 283 void VaapiJpegDecodeAccelerator::Decode(
284 const media::BitstreamBuffer& bitstream_buffer, 284 const media::BitstreamBuffer& bitstream_buffer,
285 const scoped_refptr<media::VideoFrame>& video_frame) { 285 const scoped_refptr<media::VideoFrame>& video_frame) {
286 DVLOG(3) << __func__; 286 DVLOG(3) << __func__;
287 DCHECK(io_task_runner_->BelongsToCurrentThread()); 287 DCHECK(io_task_runner_->BelongsToCurrentThread());
288 TRACE_EVENT1("jpeg", "Decode", "input_id", bitstream_buffer.id()); 288 TRACE_EVENT1("jpeg", "Decode", "input_id", bitstream_buffer.id());
289 289
290 DVLOG(4) << "Mapping new input buffer id: " << bitstream_buffer.id() 290 DVLOG(4) << "Mapping new input buffer id: " << bitstream_buffer.id()
291 << " size: " << bitstream_buffer.size(); 291 << " size: " << bitstream_buffer.size();
292
293 if (bitstream_buffer.id() < 0) {
294 LOG(ERROR) << "Invalid bitstream_buffer, id: " << bitstream_buffer.id();
295 if (base::SharedMemory::IsHandleValid(bitstream_buffer.handle()))
296 base::SharedMemory::CloseHandle(bitstream_buffer.handle());
297 NotifyErrorFromDecoderThread(bitstream_buffer.id(), INVALID_ARGUMENT);
298 return;
299 }
300
292 scoped_ptr<base::SharedMemory> shm( 301 scoped_ptr<base::SharedMemory> shm(
293 new base::SharedMemory(bitstream_buffer.handle(), true)); 302 new base::SharedMemory(bitstream_buffer.handle(), true));
294 303
295 if (!shm->Map(bitstream_buffer.size())) { 304 if (!shm->Map(bitstream_buffer.size())) {
296 LOG(ERROR) << "Failed to map input buffer"; 305 LOG(ERROR) << "Failed to map input buffer";
297 NotifyErrorFromDecoderThread(bitstream_buffer.id(), UNREADABLE_INPUT); 306 NotifyErrorFromDecoderThread(bitstream_buffer.id(), UNREADABLE_INPUT);
298 return; 307 return;
299 } 308 }
300 309
301 scoped_ptr<DecodeRequest> request( 310 scoped_ptr<DecodeRequest> request(
302 new DecodeRequest(bitstream_buffer, std::move(shm), video_frame)); 311 new DecodeRequest(bitstream_buffer, std::move(shm), video_frame));
303 312
304 decoder_task_runner_->PostTask( 313 decoder_task_runner_->PostTask(
305 FROM_HERE, base::Bind(&VaapiJpegDecodeAccelerator::DecodeTask, 314 FROM_HERE, base::Bind(&VaapiJpegDecodeAccelerator::DecodeTask,
306 base::Unretained(this), base::Passed(&request))); 315 base::Unretained(this), base::Passed(&request)));
307 } 316 }
308 317
309 bool VaapiJpegDecodeAccelerator::IsSupported() { 318 bool VaapiJpegDecodeAccelerator::IsSupported() {
310 return VaapiWrapper::IsJpegDecodeSupported(); 319 return VaapiWrapper::IsJpegDecodeSupported();
311 } 320 }
312 321
313 } // namespace content 322 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698