summaryrefslogtreecommitdiffstats
path: root/media/base/video_frame.cc
diff options
context:
space:
mode:
authorfischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-10 01:03:23 +0000
committerfischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-10 01:03:23 +0000
commit907bc6fb0e9db6b31eef1d3403b116e43ea7bec9 (patch)
treeeb41d143dab8fca0cb5c55296125160462617833 /media/base/video_frame.cc
parentbb12d853e4af985379bd56ba3025ec0d2b087148 (diff)
downloadchromium_src-907bc6fb0e9db6b31eef1d3403b116e43ea7bec9.zip
chromium_src-907bc6fb0e9db6b31eef1d3403b116e43ea7bec9.tar.gz
chromium_src-907bc6fb0e9db6b31eef1d3403b116e43ea7bec9.tar.bz2
Revert 113895 - <video> decode in hardware!
This uses the GpuVideoDecodeAccelerator machinery (already written to enable ppapi to take advantage of OpenMAX HW where available) to decode <video> data. This increases idle CPU from 20% to 45% on one particularly large (internal) test video (red0.mp4), on an ARM crosbook. HW decode is done on a best-effort basis; if the GPU code doesn't know how to deal with a codec/profile we still fall back to ffmpeg for decode. Because the vast majority of chrome installs will be on HW with no video decode support (yet) we only attempt HW video decode on platforms we know have a shot at it. BUG=104579 TEST=manual testing w/ video test matrix, trybots. Review URL: http://codereview.chromium.org/8686010 TBR=fischman@chromium.org Review URL: http://codereview.chromium.org/8897022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113908 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base/video_frame.cc')
-rw-r--r--media/base/video_frame.cc48
1 files changed, 6 insertions, 42 deletions
diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc
index 29c4223..a0dc579 100644
--- a/media/base/video_frame.cc
+++ b/media/base/video_frame.cc
@@ -17,8 +17,9 @@ scoped_refptr<VideoFrame> VideoFrame::CreateFrame(
base::TimeDelta duration) {
DCHECK(width > 0 && height > 0);
DCHECK(width * height < 100000000);
- scoped_refptr<VideoFrame> frame(new VideoFrame(
- format, width, height, timestamp, duration));
+ scoped_refptr<VideoFrame> frame(new VideoFrame(format, width, height));
+ frame->SetTimestamp(timestamp);
+ frame->SetDuration(duration);
switch (format) {
case VideoFrame::RGB555:
case VideoFrame::RGB565:
@@ -46,25 +47,8 @@ scoped_refptr<VideoFrame> VideoFrame::CreateFrame(
}
// static
-scoped_refptr<VideoFrame> VideoFrame::WrapNativeTexture(
- uint32 texture_id,
- size_t width,
- size_t height,
- base::TimeDelta timestamp,
- base::TimeDelta duration,
- const base::Closure& no_longer_needed) {
- scoped_refptr<VideoFrame> frame(
- new VideoFrame(NATIVE_TEXTURE, width, height, timestamp, duration));
- frame->planes_ = 0;
- frame->texture_id_ = texture_id;
- frame->texture_no_longer_needed_ = no_longer_needed;
- return frame;
-}
-
-// static
scoped_refptr<VideoFrame> VideoFrame::CreateEmptyFrame() {
- return new VideoFrame(
- VideoFrame::EMPTY, 0, 0, base::TimeDelta(), base::TimeDelta());
+ return new VideoFrame(VideoFrame::EMPTY, 0, 0);
}
// static
@@ -154,26 +138,16 @@ void VideoFrame::AllocateYUV() {
VideoFrame::VideoFrame(VideoFrame::Format format,
size_t width,
- size_t height,
- base::TimeDelta timestamp,
- base::TimeDelta duration)
+ size_t height)
: format_(format),
width_(width),
height_(height),
- planes_(0),
- texture_id_(0) {
- SetTimestamp(timestamp);
- SetDuration(duration);
+ planes_(0) {
memset(&strides_, 0, sizeof(strides_));
memset(&data_, 0, sizeof(data_));
}
VideoFrame::~VideoFrame() {
- if (format_ == NATIVE_TEXTURE && !texture_no_longer_needed_.is_null()) {
- texture_no_longer_needed_.Run();
- texture_no_longer_needed_.Reset();
- }
-
// In multi-plane allocations, only a single block of memory is allocated
// on the heap, and other |data| pointers point inside the same, single block
// so just delete index 0.
@@ -193,10 +167,6 @@ bool VideoFrame::IsValidPlane(size_t plane) const {
case YV16:
return plane == kYPlane || plane == kUPlane || plane == kVPlane;
- case NATIVE_TEXTURE:
- NOTREACHED() << "NATIVE_TEXTUREs don't use plane-related methods!";
- return false;
-
default:
break;
}
@@ -266,12 +236,6 @@ uint8* VideoFrame::data(size_t plane) const {
return data_[plane];
}
-uint32 VideoFrame::texture_id() const {
- DCHECK_EQ(format_, NATIVE_TEXTURE);
- DCHECK_EQ(planes_, 0U);
- return texture_id_;
-}
-
bool VideoFrame::IsEndOfStream() const {
return format_ == VideoFrame::EMPTY;
}