Index: media/base/video_frame.cc |
diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc |
index 456cf6e9d887bc089e4c899db1cb84d9e99fd3d3..6b3427db1aa936c1707b507f13e1070ed33710b0 100644 |
--- a/media/base/video_frame.cc |
+++ b/media/base/video_frame.cc |
@@ -689,19 +689,20 @@ VideoFrame::~VideoFrame() { |
base::ResetAndReturn(&no_longer_needed_cb_).Run(); |
} |
-bool VideoFrame::IsValidPlane(size_t plane) const { |
- return (plane < NumPlanes(format_)); |
+// static |
+bool VideoFrame::IsValidPlane(size_t plane, VideoFrame::Format format) { |
+ return (plane < NumPlanes(format)); |
} |
int VideoFrame::stride(size_t plane) const { |
- DCHECK(IsValidPlane(plane)); |
+ DCHECK(IsValidPlane(plane, format_)); |
return strides_[plane]; |
} |
-int VideoFrame::row_bytes(size_t plane) const { |
- DCHECK(IsValidPlane(plane)); |
- int width = coded_size_.width(); |
- switch (format_) { |
+// static |
+int VideoFrame::RowBytes(size_t plane, VideoFrame::Format format, int width) { |
+ DCHECK(IsValidPlane(plane, format)); |
+ switch (format) { |
case VideoFrame::YV24: |
switch (plane) { |
case kYPlane: |
@@ -754,13 +755,17 @@ int VideoFrame::row_bytes(size_t plane) const { |
case VideoFrame::NATIVE_TEXTURE: |
break; |
} |
- NOTREACHED() << "Unsupported video frame format/plane: " |
- << format_ << "/" << plane; |
+ NOTREACHED() << "Unsupported video frame format/plane: " << format << "/" |
Pawel Osciak
2014/08/18 07:52:03
We could do FormatToString() here while we are at
wuchengli
2014/08/18 09:09:00
If we reach here, the format is invalid and Format
|
+ << plane; |
return 0; |
} |
+int VideoFrame::row_bytes(size_t plane) const { |
+ return RowBytes(plane, format_, coded_size_.width()); |
+} |
+ |
int VideoFrame::rows(size_t plane) const { |
henryhsu
2014/08/18 08:18:57
Can we make rows function as static also?
wuchengli
2014/08/18 09:09:00
That is not related to this CL. You'll need to cre
|
- DCHECK(IsValidPlane(plane)); |
+ DCHECK(IsValidPlane(plane, format_)); |
int height = coded_size_.height(); |
switch (format_) { |
case VideoFrame::YV24: |
@@ -822,7 +827,7 @@ int VideoFrame::rows(size_t plane) const { |
} |
uint8* VideoFrame::data(size_t plane) const { |
- DCHECK(IsValidPlane(plane)); |
+ DCHECK(IsValidPlane(plane, format_)); |
return data_[plane]; |
} |
@@ -854,7 +859,7 @@ int VideoFrame::dmabuf_fd(size_t plane) const { |
void VideoFrame::HashFrameForTesting(base::MD5Context* context) { |
for (int plane = 0; plane < kMaxPlanes; ++plane) { |
- if (!IsValidPlane(plane)) |
+ if (!IsValidPlane(plane, format_)) |
break; |
for (int row = 0; row < rows(plane); ++row) { |
base::MD5Update(context, base::StringPiece( |