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

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: mcasas's second round comments 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
« no previous file with comments | « media/base/video_capture_types.cc ('k') | media/capture/content/screen_capture_device_core.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/bind.h" 10 #include "base/bind.h"
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 const gfx::Size& coded_size, 822 const gfx::Size& coded_size,
823 const gfx::Rect& visible_rect, 823 const gfx::Rect& visible_rect,
824 const gfx::Size& natural_size, 824 const gfx::Size& natural_size,
825 uint8* data, 825 uint8* data,
826 size_t data_size, 826 size_t data_size,
827 base::TimeDelta timestamp, 827 base::TimeDelta timestamp,
828 base::SharedMemoryHandle handle, 828 base::SharedMemoryHandle handle,
829 size_t data_offset) { 829 size_t data_offset) {
830 DCHECK(IsStorageTypeMappable(storage_type)); 830 DCHECK(IsStorageTypeMappable(storage_type));
831 831
832 // TODO(miu): This function should support any pixel format.
833 // http://crbug.com/555909
832 if (format != PIXEL_FORMAT_I420) { 834 if (format != PIXEL_FORMAT_I420) {
833 DLOG(ERROR) << "Only PIXEL_FORMAT_I420 format supported: " 835 DLOG(ERROR) << "Only PIXEL_FORMAT_I420 format supported: "
834 << VideoPixelFormatToString(format); 836 << VideoPixelFormatToString(format);
835 return nullptr; 837 return nullptr;
836 } 838 }
837 839
838 if (!IsValidConfig(format, storage_type, coded_size, visible_rect, 840 if (!IsValidConfig(format, storage_type, coded_size, visible_rect,
839 natural_size)) { 841 natural_size)) {
840 DLOG(ERROR) << __FUNCTION__ << " Invalid config." 842 DLOG(ERROR) << __FUNCTION__ << " Invalid config."
841 << ConfigToString(format, storage_type, coded_size, 843 << ConfigToString(format, storage_type, coded_size,
842 visible_rect, natural_size); 844 visible_rect, natural_size);
843 return nullptr; 845 return nullptr;
844 } 846 }
845 847
846 scoped_refptr<VideoFrame> frame; 848 scoped_refptr<VideoFrame> frame;
847 if (storage_type == STORAGE_SHMEM) { 849 if (storage_type == STORAGE_SHMEM) {
848 frame = new VideoFrame(format, storage_type, coded_size, visible_rect, 850 frame = new VideoFrame(format, storage_type, coded_size, visible_rect,
849 natural_size, timestamp, handle, data_offset); 851 natural_size, timestamp, handle, data_offset);
850 } else { 852 } else {
851 frame = new VideoFrame(format, storage_type, coded_size, visible_rect, 853 frame = new VideoFrame(format, storage_type, coded_size, visible_rect,
852 natural_size, timestamp); 854 natural_size, timestamp);
853 } 855 }
854 frame->strides_[kYPlane] = coded_size.width(); 856 frame->strides_[kYPlane] = coded_size.width();
857 // TODO(miu): This always rounds widths down, whereas VideoFrame::RowBytes()
858 // always rounds up. This inconsistency must be resolved. Perhaps a
859 // CommonAlignment() check should be made in IsValidConfig()?
860 // http://crbug.com/555909
855 frame->strides_[kUPlane] = coded_size.width() / 2; 861 frame->strides_[kUPlane] = coded_size.width() / 2;
856 frame->strides_[kVPlane] = coded_size.width() / 2; 862 frame->strides_[kVPlane] = coded_size.width() / 2;
857 frame->data_[kYPlane] = data; 863 frame->data_[kYPlane] = data;
858 frame->data_[kUPlane] = data + coded_size.GetArea(); 864 frame->data_[kUPlane] = data + coded_size.GetArea();
859 frame->data_[kVPlane] = data + (coded_size.GetArea() * 5 / 4); 865 frame->data_[kVPlane] = data + (coded_size.GetArea() * 5 / 4);
860 return frame; 866 return frame;
861 } 867 }
862 868
863 VideoFrame::VideoFrame(VideoPixelFormat format, 869 VideoFrame::VideoFrame(VideoPixelFormat format,
864 StorageType storage_type, 870 StorageType storage_type,
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 if (zero_initialize_memory) 1008 if (zero_initialize_memory)
1003 memset(data, 0, data_size); 1009 memset(data, 0, data_size);
1004 1010
1005 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) 1011 for (size_t plane = 0; plane < NumPlanes(format_); ++plane)
1006 data_[plane] = data + offset[plane]; 1012 data_[plane] = data + offset[plane];
1007 1013
1008 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); 1014 AddDestructionObserver(base::Bind(&base::AlignedFree, data));
1009 } 1015 }
1010 1016
1011 } // namespace media 1017 } // namespace media
OLDNEW
« no previous file with comments | « media/base/video_capture_types.cc ('k') | media/capture/content/screen_capture_device_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698