| OLD | NEW |
| 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 "media/base/video_frame.h" | 5 #include "media/base/video_frame.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <climits> | 8 #include <climits> |
| 9 | 9 |
| 10 #include "base/atomic_sequence_num.h" | 10 #include "base/atomic_sequence_num.h" |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 | 705 |
| 706 const gpu::MailboxHolder& | 706 const gpu::MailboxHolder& |
| 707 VideoFrame::mailbox_holder(size_t texture_index) const { | 707 VideoFrame::mailbox_holder(size_t texture_index) const { |
| 708 DCHECK(HasTextures()); | 708 DCHECK(HasTextures()); |
| 709 DCHECK(IsValidPlane(texture_index, format_)); | 709 DCHECK(IsValidPlane(texture_index, format_)); |
| 710 return mailbox_holders_[texture_index]; | 710 return mailbox_holders_[texture_index]; |
| 711 } | 711 } |
| 712 | 712 |
| 713 base::SharedMemoryHandle VideoFrame::shared_memory_handle() const { | 713 base::SharedMemoryHandle VideoFrame::shared_memory_handle() const { |
| 714 DCHECK_EQ(storage_type_, STORAGE_SHMEM); | 714 DCHECK_EQ(storage_type_, STORAGE_SHMEM); |
| 715 DCHECK(shared_memory_handle_ != base::SharedMemory::NULLHandle()); | 715 DCHECK(shared_memory_handle_.IsValid()); |
| 716 return shared_memory_handle_; | 716 return shared_memory_handle_; |
| 717 } | 717 } |
| 718 | 718 |
| 719 size_t VideoFrame::shared_memory_offset() const { | 719 size_t VideoFrame::shared_memory_offset() const { |
| 720 DCHECK_EQ(storage_type_, STORAGE_SHMEM); | 720 DCHECK_EQ(storage_type_, STORAGE_SHMEM); |
| 721 DCHECK(shared_memory_handle_ != base::SharedMemory::NULLHandle()); | 721 DCHECK(shared_memory_handle_.IsValid()); |
| 722 return shared_memory_offset_; | 722 return shared_memory_offset_; |
| 723 } | 723 } |
| 724 | 724 |
| 725 #if defined(OS_LINUX) | 725 #if defined(OS_LINUX) |
| 726 int VideoFrame::DmabufFd(size_t plane) const { | 726 int VideoFrame::DmabufFd(size_t plane) const { |
| 727 DCHECK_EQ(storage_type_, STORAGE_DMABUFS); | 727 DCHECK_EQ(storage_type_, STORAGE_DMABUFS); |
| 728 DCHECK(IsValidPlane(plane, format_)); | 728 DCHECK(IsValidPlane(plane, format_)); |
| 729 return dmabuf_fds_[plane].get(); | 729 return dmabuf_fds_[plane].get(); |
| 730 } | 730 } |
| 731 | 731 |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1206 if (zero_initialize_memory) | 1206 if (zero_initialize_memory) |
| 1207 memset(data, 0, data_size); | 1207 memset(data, 0, data_size); |
| 1208 | 1208 |
| 1209 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) | 1209 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) |
| 1210 data_[plane] = data + offset[plane]; | 1210 data_[plane] = data + offset[plane]; |
| 1211 | 1211 |
| 1212 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); | 1212 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); |
| 1213 } | 1213 } |
| 1214 | 1214 |
| 1215 } // namespace media | 1215 } // namespace media |
| OLD | NEW |