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 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 // Make sure that all fds are closed if any dup() fails, | 772 // Make sure that all fds are closed if any dup() fails, |
773 base::ScopedFD temp_dmabuf_fds[kMaxPlanes]; | 773 base::ScopedFD temp_dmabuf_fds[kMaxPlanes]; |
774 for (size_t i = 0; i < in_fds.size(); ++i) { | 774 for (size_t i = 0; i < in_fds.size(); ++i) { |
775 temp_dmabuf_fds[i] = base::ScopedFD(HANDLE_EINTR(dup(in_fds[i]))); | 775 temp_dmabuf_fds[i] = base::ScopedFD(HANDLE_EINTR(dup(in_fds[i]))); |
776 if (!temp_dmabuf_fds[i].is_valid()) { | 776 if (!temp_dmabuf_fds[i].is_valid()) { |
777 DPLOG(ERROR) << "Failed duplicating a dmabuf fd"; | 777 DPLOG(ERROR) << "Failed duplicating a dmabuf fd"; |
778 return false; | 778 return false; |
779 } | 779 } |
780 } | 780 } |
781 for (size_t i = 0; i < kMaxPlanes; ++i) | 781 for (size_t i = 0; i < kMaxPlanes; ++i) |
782 dmabuf_fds_[i].reset(temp_dmabuf_fds[i].release()); | 782 dmabuf_fds_[i] = std::move(temp_dmabuf_fds[i]); |
783 | 783 |
784 return true; | 784 return true; |
785 } | 785 } |
786 #endif | 786 #endif |
787 | 787 |
788 void VideoFrame::AddSharedMemoryHandle(base::SharedMemoryHandle handle) { | 788 void VideoFrame::AddSharedMemoryHandle(base::SharedMemoryHandle handle) { |
789 storage_type_ = STORAGE_SHMEM; | 789 storage_type_ = STORAGE_SHMEM; |
790 shared_memory_handle_ = handle; | 790 shared_memory_handle_ = handle; |
791 } | 791 } |
792 | 792 |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1154 if (zero_initialize_memory) | 1154 if (zero_initialize_memory) |
1155 memset(data, 0, data_size); | 1155 memset(data, 0, data_size); |
1156 | 1156 |
1157 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) | 1157 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) |
1158 data_[plane] = data + offset[plane]; | 1158 data_[plane] = data + offset[plane]; |
1159 | 1159 |
1160 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); | 1160 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); |
1161 } | 1161 } |
1162 | 1162 |
1163 } // namespace media | 1163 } // namespace media |
OLD | NEW |