| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_encode_accelerator.h" | 5 #include "content/common/gpu/media/vaapi_video_encode_accelerator.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/numerics/safe_conversions.h" | 10 #include "base/numerics/safe_conversions.h" |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 DVLOGF(4) << "id: " << buffer.id(); | 658 DVLOGF(4) << "id: " << buffer.id(); |
| 659 DCHECK(child_task_runner_->BelongsToCurrentThread()); | 659 DCHECK(child_task_runner_->BelongsToCurrentThread()); |
| 660 | 660 |
| 661 if (buffer.size() < output_buffer_byte_size_) { | 661 if (buffer.size() < output_buffer_byte_size_) { |
| 662 NOTIFY_ERROR(kInvalidArgumentError, "Provided bitstream buffer too small"); | 662 NOTIFY_ERROR(kInvalidArgumentError, "Provided bitstream buffer too small"); |
| 663 return; | 663 return; |
| 664 } | 664 } |
| 665 | 665 |
| 666 scoped_ptr<base::SharedMemory> shm( | 666 scoped_ptr<base::SharedMemory> shm( |
| 667 new base::SharedMemory(buffer.handle(), false)); | 667 new base::SharedMemory(buffer.handle(), false)); |
| 668 if (!shm->Map(buffer.size())) { | 668 if (!shm->MapAt(buffer.offset(), buffer.size())) { |
| 669 NOTIFY_ERROR(kPlatformFailureError, "Failed mapping shared memory."); | 669 NOTIFY_ERROR(kPlatformFailureError, "Failed mapping shared memory."); |
| 670 return; | 670 return; |
| 671 } | 671 } |
| 672 | 672 |
| 673 scoped_ptr<BitstreamBufferRef> buffer_ref( | 673 scoped_ptr<BitstreamBufferRef> buffer_ref( |
| 674 new BitstreamBufferRef(buffer.id(), shm.Pass(), buffer.size())); | 674 new BitstreamBufferRef(buffer.id(), shm.Pass(), buffer.size())); |
| 675 | 675 |
| 676 encoder_thread_task_runner_->PostTask( | 676 encoder_thread_task_runner_->PostTask( |
| 677 FROM_HERE, | 677 FROM_HERE, |
| 678 base::Bind(&VaapiVideoEncodeAccelerator::UseOutputBitstreamBufferTask, | 678 base::Bind(&VaapiVideoEncodeAccelerator::UseOutputBitstreamBufferTask, |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1052 } | 1052 } |
| 1053 | 1053 |
| 1054 VaapiVideoEncodeAccelerator::EncodeJob::EncodeJob() | 1054 VaapiVideoEncodeAccelerator::EncodeJob::EncodeJob() |
| 1055 : coded_buffer(VA_INVALID_ID), keyframe(false) { | 1055 : coded_buffer(VA_INVALID_ID), keyframe(false) { |
| 1056 } | 1056 } |
| 1057 | 1057 |
| 1058 VaapiVideoEncodeAccelerator::EncodeJob::~EncodeJob() { | 1058 VaapiVideoEncodeAccelerator::EncodeJob::~EncodeJob() { |
| 1059 } | 1059 } |
| 1060 | 1060 |
| 1061 } // namespace content | 1061 } // namespace content |
| OLD | NEW |