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

Side by Side Diff: media/base/video_frame.cc

Issue 2087673002: Remove CreateGpuMemoryBufferFromClientId and plumbing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 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
« no previous file with comments | « media/base/video_frame.h ('k') | media/video/gpu_memory_buffer_video_frame_pool.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 << ConfigToString(format, storage, coded_size, visible_rect, 181 << ConfigToString(format, storage, coded_size, visible_rect,
182 natural_size); 182 natural_size);
183 return nullptr; 183 return nullptr;
184 } 184 }
185 185
186 return new VideoFrame(format, storage, coded_size, visible_rect, natural_size, 186 return new VideoFrame(format, storage, coded_size, visible_rect, natural_size,
187 mailbox_holders, mailbox_holder_release_cb, timestamp); 187 mailbox_holders, mailbox_holder_release_cb, timestamp);
188 } 188 }
189 189
190 // static 190 // static
191 scoped_refptr<VideoFrame> VideoFrame::WrapGpuMemoryBufferBackedNativeTextures(
192 VideoPixelFormat format,
193 const gpu::MailboxHolder (&mailbox_holders)[kMaxPlanes],
194 const gfx::GpuMemoryBufferId (&gpu_memory_buffer_ids)[kMaxPlanes],
195 const ReleaseMailboxCB& mailbox_holder_release_cb,
196 const gfx::Size& coded_size,
197 const gfx::Rect& visible_rect,
198 const gfx::Size& natural_size,
199 base::TimeDelta timestamp) {
200 scoped_refptr<VideoFrame> frame =
201 WrapNativeTextures(format, mailbox_holders, mailbox_holder_release_cb,
202 coded_size, visible_rect, natural_size, timestamp);
203 if (frame) {
204 frame->storage_type_ = STORAGE_GPU_MEMORY_BUFFERS;
205 for (size_t i = 0; i < kMaxPlanes; ++i)
206 frame->texture_gpu_memory_buffer_ids_[i] = gpu_memory_buffer_ids[i];
207 }
208 return frame;
209 }
210
211 // static
212 scoped_refptr<VideoFrame> VideoFrame::WrapExternalData( 191 scoped_refptr<VideoFrame> VideoFrame::WrapExternalData(
213 VideoPixelFormat format, 192 VideoPixelFormat format,
214 const gfx::Size& coded_size, 193 const gfx::Size& coded_size,
215 const gfx::Rect& visible_rect, 194 const gfx::Rect& visible_rect,
216 const gfx::Size& natural_size, 195 const gfx::Size& natural_size,
217 uint8_t* data, 196 uint8_t* data,
218 size_t data_size, 197 size_t data_size,
219 base::TimeDelta timestamp) { 198 base::TimeDelta timestamp) {
220 return WrapExternalStorage(format, STORAGE_UNOWNED_MEMORY, coded_size, 199 return WrapExternalStorage(format, STORAGE_UNOWNED_MEMORY, coded_size,
221 visible_rect, natural_size, data, data_size, 200 visible_rect, natural_size, data, data_size,
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 static_cast<const VideoFrame*>(this)->visible_data(plane)); 658 static_cast<const VideoFrame*>(this)->visible_data(plane));
680 } 659 }
681 660
682 const gpu::MailboxHolder& 661 const gpu::MailboxHolder&
683 VideoFrame::mailbox_holder(size_t texture_index) const { 662 VideoFrame::mailbox_holder(size_t texture_index) const {
684 DCHECK(HasTextures()); 663 DCHECK(HasTextures());
685 DCHECK(IsValidPlane(texture_index, format_)); 664 DCHECK(IsValidPlane(texture_index, format_));
686 return mailbox_holders_[texture_index]; 665 return mailbox_holders_[texture_index];
687 } 666 }
688 667
689 const gfx::GpuMemoryBufferId& VideoFrame::texture_gpu_memory_buffer_id(
690 size_t texture_index) const {
691 DCHECK(HasTextures());
692 DCHECK(IsValidPlane(texture_index, format_));
693 return texture_gpu_memory_buffer_ids_[texture_index];
694 }
695
696 base::SharedMemoryHandle VideoFrame::shared_memory_handle() const { 668 base::SharedMemoryHandle VideoFrame::shared_memory_handle() const {
697 DCHECK_EQ(storage_type_, STORAGE_SHMEM); 669 DCHECK_EQ(storage_type_, STORAGE_SHMEM);
698 DCHECK(shared_memory_handle_ != base::SharedMemory::NULLHandle()); 670 DCHECK(shared_memory_handle_ != base::SharedMemory::NULLHandle());
699 return shared_memory_handle_; 671 return shared_memory_handle_;
700 } 672 }
701 673
702 size_t VideoFrame::shared_memory_offset() const { 674 size_t VideoFrame::shared_memory_offset() const {
703 DCHECK_EQ(storage_type_, STORAGE_SHMEM); 675 DCHECK_EQ(storage_type_, STORAGE_SHMEM);
704 DCHECK(shared_memory_handle_ != base::SharedMemory::NULLHandle()); 676 DCHECK(shared_memory_handle_ != base::SharedMemory::NULLHandle());
705 return shared_memory_offset_; 677 return shared_memory_offset_;
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 if (zero_initialize_memory) 1088 if (zero_initialize_memory)
1117 memset(data, 0, data_size); 1089 memset(data, 0, data_size);
1118 1090
1119 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) 1091 for (size_t plane = 0; plane < NumPlanes(format_); ++plane)
1120 data_[plane] = data + offset[plane]; 1092 data_[plane] = data + offset[plane];
1121 1093
1122 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); 1094 AddDestructionObserver(base::Bind(&base::AlignedFree, data));
1123 } 1095 }
1124 1096
1125 } // namespace media 1097 } // namespace media
OLDNEW
« no previous file with comments | « media/base/video_frame.h ('k') | media/video/gpu_memory_buffer_video_frame_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698