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

Side by Side Diff: content/common/gpu/media/vaapi_video_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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_video_decode_accelerator.h" 5 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 requested_pic_size_, VaapiPicture::GetGLTextureTarget())); 666 requested_pic_size_, VaapiPicture::GetGLTextureTarget()));
667 } 667 }
668 668
669 void VaapiVideoDecodeAccelerator::Decode( 669 void VaapiVideoDecodeAccelerator::Decode(
670 const media::BitstreamBuffer& bitstream_buffer) { 670 const media::BitstreamBuffer& bitstream_buffer) {
671 DCHECK_EQ(message_loop_, base::MessageLoop::current()); 671 DCHECK_EQ(message_loop_, base::MessageLoop::current());
672 672
673 TRACE_EVENT1("Video Decoder", "VAVDA::Decode", "Buffer id", 673 TRACE_EVENT1("Video Decoder", "VAVDA::Decode", "Buffer id",
674 bitstream_buffer.id()); 674 bitstream_buffer.id());
675 675
676 RETURN_AND_NOTIFY_ON_FAILURE(
Pawel Osciak 2016/02/19 07:48:44 I think we need to close if < 0 and valid?
677 bitstream_buffer.id() >= 0 &&
678 base::SharedMemory::IsHandleValid(bitstream_buffer.handle()),
679 "Invalid bitstream_buffer, id: " << bitstream_buffer.id(),
680 INVALID_ARGUMENT, );
681
676 // We got a new input buffer from the client, map it and queue for later use. 682 // We got a new input buffer from the client, map it and queue for later use.
677 MapAndQueueNewInputBuffer(bitstream_buffer); 683 MapAndQueueNewInputBuffer(bitstream_buffer);
678 684
679 base::AutoLock auto_lock(lock_); 685 base::AutoLock auto_lock(lock_);
680 switch (state_) { 686 switch (state_) {
681 case kIdle: 687 case kIdle:
682 state_ = kDecoding; 688 state_ = kDecoding;
683 decoder_thread_task_runner_->PostTask( 689 decoder_thread_task_runner_->PostTask(
684 FROM_HERE, base::Bind(&VaapiVideoDecodeAccelerator::DecodeTask, 690 FROM_HERE, base::Bind(&VaapiVideoDecodeAccelerator::DecodeTask,
685 base::Unretained(this))); 691 base::Unretained(this)));
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after
1742 return vaapi_pic->dec_surface(); 1748 return vaapi_pic->dec_surface();
1743 } 1749 }
1744 1750
1745 // static 1751 // static
1746 media::VideoDecodeAccelerator::SupportedProfiles 1752 media::VideoDecodeAccelerator::SupportedProfiles
1747 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { 1753 VaapiVideoDecodeAccelerator::GetSupportedProfiles() {
1748 return VaapiWrapper::GetSupportedDecodeProfiles(); 1754 return VaapiWrapper::GetSupportedDecodeProfiles();
1749 } 1755 }
1750 1756
1751 } // namespace content 1757 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698