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 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 const gfx::Size& natural_size, | 764 const gfx::Size& natural_size, |
765 base::TimeDelta timestamp) | 765 base::TimeDelta timestamp) |
766 : format_(format), | 766 : format_(format), |
767 storage_type_(storage_type), | 767 storage_type_(storage_type), |
768 coded_size_(coded_size), | 768 coded_size_(coded_size), |
769 visible_rect_(visible_rect), | 769 visible_rect_(visible_rect), |
770 natural_size_(natural_size), | 770 natural_size_(natural_size), |
771 shared_memory_handle_(base::SharedMemory::NULLHandle()), | 771 shared_memory_handle_(base::SharedMemory::NULLHandle()), |
772 shared_memory_offset_(0), | 772 shared_memory_offset_(0), |
773 timestamp_(timestamp), | 773 timestamp_(timestamp), |
774 release_sync_point_(0) { | 774 release_sync_point_(0), |
| 775 render_time_(base::TimeTicks()) { |
775 DCHECK(IsValidConfig(format_, storage_type, coded_size_, visible_rect_, | 776 DCHECK(IsValidConfig(format_, storage_type, coded_size_, visible_rect_, |
776 natural_size_)); | 777 natural_size_)); |
777 memset(&mailbox_holders_, 0, sizeof(mailbox_holders_)); | 778 memset(&mailbox_holders_, 0, sizeof(mailbox_holders_)); |
778 memset(&strides_, 0, sizeof(strides_)); | 779 memset(&strides_, 0, sizeof(strides_)); |
779 memset(&data_, 0, sizeof(data_)); | 780 memset(&data_, 0, sizeof(data_)); |
780 } | 781 } |
781 | 782 |
782 VideoFrame::VideoFrame(VideoPixelFormat format, | 783 VideoFrame::VideoFrame(VideoPixelFormat format, |
783 StorageType storage_type, | 784 StorageType storage_type, |
784 const gfx::Size& coded_size, | 785 const gfx::Size& coded_size, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 | 859 |
859 uint8* data = reinterpret_cast<uint8*>( | 860 uint8* data = reinterpret_cast<uint8*>( |
860 base::AlignedAlloc(data_size, kFrameAddressAlignment)); | 861 base::AlignedAlloc(data_size, kFrameAddressAlignment)); |
861 | 862 |
862 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) | 863 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) |
863 data_[plane] = data + offset[plane]; | 864 data_[plane] = data + offset[plane]; |
864 | 865 |
865 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); | 866 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); |
866 } | 867 } |
867 | 868 |
| 869 base::TimeTicks VideoFrame::render_time() { |
| 870 return render_time_; |
| 871 } |
| 872 |
| 873 void VideoFrame::set_render_time(base::TimeTicks render_time) { |
| 874 render_time_ = render_time; |
| 875 } |
| 876 |
868 } // namespace media | 877 } // namespace media |
OLD | NEW |