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

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

Issue 1439533004: Remove dead code paths around PIXEL_STORAGE_TEXTURE in capture pipeline. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: REBASE Created 5 years, 1 month 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
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/bind.h" 10 #include "base/bind.h"
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 const gfx::Size& coded_size, 823 const gfx::Size& coded_size,
824 const gfx::Rect& visible_rect, 824 const gfx::Rect& visible_rect,
825 const gfx::Size& natural_size, 825 const gfx::Size& natural_size,
826 uint8* data, 826 uint8* data,
827 size_t data_size, 827 size_t data_size,
828 base::TimeDelta timestamp, 828 base::TimeDelta timestamp,
829 base::SharedMemoryHandle handle, 829 base::SharedMemoryHandle handle,
830 size_t data_offset) { 830 size_t data_offset) {
831 DCHECK(IsStorageTypeMappable(storage_type)); 831 DCHECK(IsStorageTypeMappable(storage_type));
832 832
833 // TODO(miu): This function should support any pixel format.
834 // http://crbug.com/555909
833 if (format != PIXEL_FORMAT_I420) { 835 if (format != PIXEL_FORMAT_I420) {
834 DLOG(ERROR) << "Only PIXEL_FORMAT_I420 format supported: " 836 DLOG(ERROR) << "Only PIXEL_FORMAT_I420 format supported: "
835 << VideoPixelFormatToString(format); 837 << VideoPixelFormatToString(format);
836 return nullptr; 838 return nullptr;
837 } 839 }
838 840
839 if (!IsValidConfig(format, storage_type, coded_size, visible_rect, 841 if (!IsValidConfig(format, storage_type, coded_size, visible_rect,
840 natural_size)) { 842 natural_size)) {
841 DLOG(ERROR) << __FUNCTION__ << " Invalid config." 843 DLOG(ERROR) << __FUNCTION__ << " Invalid config."
842 << ConfigToString(format, storage_type, coded_size, 844 << ConfigToString(format, storage_type, coded_size,
843 visible_rect, natural_size); 845 visible_rect, natural_size);
844 return nullptr; 846 return nullptr;
845 } 847 }
846 848
847 scoped_refptr<VideoFrame> frame; 849 scoped_refptr<VideoFrame> frame;
848 if (storage_type == STORAGE_SHMEM) { 850 if (storage_type == STORAGE_SHMEM) {
849 frame = new VideoFrame(format, storage_type, coded_size, visible_rect, 851 frame = new VideoFrame(format, storage_type, coded_size, visible_rect,
850 natural_size, timestamp, handle, data_offset); 852 natural_size, timestamp, handle, data_offset);
851 } else { 853 } else {
852 frame = new VideoFrame(format, storage_type, coded_size, visible_rect, 854 frame = new VideoFrame(format, storage_type, coded_size, visible_rect,
853 natural_size, timestamp); 855 natural_size, timestamp);
854 } 856 }
855 frame->strides_[kYPlane] = coded_size.width(); 857 frame->strides_[kYPlane] = coded_size.width();
858 // TODO(miu): This always rounds widths down, whereas VideoFrame::RowBytes()
859 // always rounds up. This inconsistency must be resolved. Perhaps a
860 // CommonAlignment() check should be made in IsValidConfig()?
861 // http://crbug.com/555909
856 frame->strides_[kUPlane] = coded_size.width() / 2; 862 frame->strides_[kUPlane] = coded_size.width() / 2;
857 frame->strides_[kVPlane] = coded_size.width() / 2; 863 frame->strides_[kVPlane] = coded_size.width() / 2;
858 frame->data_[kYPlane] = data; 864 frame->data_[kYPlane] = data;
859 frame->data_[kUPlane] = data + coded_size.GetArea(); 865 frame->data_[kUPlane] = data + coded_size.GetArea();
860 frame->data_[kVPlane] = data + (coded_size.GetArea() * 5 / 4); 866 frame->data_[kVPlane] = data + (coded_size.GetArea() * 5 / 4);
861 return frame; 867 return frame;
862 } 868 }
863 869
864 VideoFrame::VideoFrame(VideoPixelFormat format, 870 VideoFrame::VideoFrame(VideoPixelFormat format,
865 StorageType storage_type, 871 StorageType storage_type,
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 if (zero_initialize_memory) 1009 if (zero_initialize_memory)
1004 memset(data, 0, data_size); 1010 memset(data, 0, data_size);
1005 1011
1006 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) 1012 for (size_t plane = 0; plane < NumPlanes(format_); ++plane)
1007 data_[plane] = data + offset[plane]; 1013 data_[plane] = data + offset[plane];
1008 1014
1009 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); 1015 AddDestructionObserver(base::Bind(&base::AlignedFree, data));
1010 } 1016 }
1011 1017
1012 } // namespace media 1018 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698