summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorsievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-23 16:30:18 +0000
committersievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-23 16:30:18 +0000
commit9ec4afdbc8197dac12c756bcf1055183a3c37063 (patch)
treecdb9bd8b4bf29f3d0f2fd9efcb113f8449832edd /media
parentd01f9ac7ec078617df5fc10b615757f62a52c572 (diff)
downloadchromium_src-9ec4afdbc8197dac12c756bcf1055183a3c37063.zip
chromium_src-9ec4afdbc8197dac12c756bcf1055183a3c37063.tar.gz
chromium_src-9ec4afdbc8197dac12c756bcf1055183a3c37063.tar.bz2
Add texture target field to video frame (for use by native textures).
To be used by https://bugs.webkit.org/show_bug.cgi?id=78398. Review URL: https://chromiumcodereview.appspot.com/9416087 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123255 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/base/video_frame.cc10
-rw-r--r--media/base/video_frame.h5
-rw-r--r--media/filters/gpu_video_decoder.cc7
-rw-r--r--media/filters/gpu_video_decoder.h6
4 files changed, 24 insertions, 4 deletions
diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc
index 294edb5..fc97736 100644
--- a/media/base/video_frame.cc
+++ b/media/base/video_frame.cc
@@ -61,6 +61,7 @@ bool VideoFrame::IsValidConfig(
// static
scoped_refptr<VideoFrame> VideoFrame::WrapNativeTexture(
uint32 texture_id,
+ uint32 texture_target,
size_t width,
size_t height,
base::TimeDelta timestamp,
@@ -69,6 +70,7 @@ scoped_refptr<VideoFrame> VideoFrame::WrapNativeTexture(
scoped_refptr<VideoFrame> frame(
new VideoFrame(NATIVE_TEXTURE, width, height, timestamp, duration));
frame->texture_id_ = texture_id;
+ frame->texture_target_ = texture_target;
frame->texture_no_longer_needed_ = no_longer_needed;
return frame;
}
@@ -150,7 +152,8 @@ VideoFrame::VideoFrame(VideoFrame::Format format,
: format_(format),
width_(width),
height_(height),
- texture_id_(0) {
+ texture_id_(0),
+ texture_target_(0) {
SetTimestamp(timestamp);
SetDuration(duration);
memset(&strides_, 0, sizeof(strides_));
@@ -260,6 +263,11 @@ uint32 VideoFrame::texture_id() const {
return texture_id_;
}
+uint32 VideoFrame::texture_target() const {
+ DCHECK_EQ(format_, NATIVE_TEXTURE);
+ return texture_target_;
+}
+
bool VideoFrame::IsEndOfStream() const {
return format_ == VideoFrame::EMPTY;
}
diff --git a/media/base/video_frame.h b/media/base/video_frame.h
index a95dd459..f65bf23 100644
--- a/media/base/video_frame.h
+++ b/media/base/video_frame.h
@@ -62,6 +62,7 @@ class MEDIA_EXPORT VideoFrame : public StreamSample {
// frame is destroyed |no_longer_needed.Run()| will be called.
static scoped_refptr<VideoFrame> WrapNativeTexture(
uint32 texture_id,
+ uint32 texture_target,
size_t width,
size_t height,
base::TimeDelta timestamp,
@@ -99,6 +100,9 @@ class MEDIA_EXPORT VideoFrame : public StreamSample {
// call if this is a NATIVE_TEXTURE frame.
uint32 texture_id() const;
+ // Returns the texture target. Only valid for NATIVE_TEXTURE frames.
+ uint32 texture_target() const;
+
// StreamSample interface.
virtual bool IsEndOfStream() const OVERRIDE;
@@ -136,6 +140,7 @@ class MEDIA_EXPORT VideoFrame : public StreamSample {
// Native texture ID, if this is a NATIVE_TEXTURE frame.
uint32 texture_id_;
+ uint32 texture_target_;
base::Closure texture_no_longer_needed_;
DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame);
diff --git a/media/filters/gpu_video_decoder.cc b/media/filters/gpu_video_decoder.cc
index c839d04..4616295 100644
--- a/media/filters/gpu_video_decoder.cc
+++ b/media/filters/gpu_video_decoder.cc
@@ -48,6 +48,7 @@ GpuVideoDecoder::GpuVideoDecoder(
factories_(factories),
state_(kNormal),
demuxer_read_in_progress_(false),
+ decoder_texture_target_(0),
next_picture_buffer_id_(0),
next_bitstream_buffer_id_(0),
shutting_down_(false) {
@@ -326,7 +327,8 @@ void GpuVideoDecoder::ProvidePictureBuffers(uint32 count,
}
std::vector<uint32> texture_ids;
- if (!factories_->CreateTextures(count, size, &texture_ids)) {
+ if (!factories_->CreateTextures(
+ count, size, &texture_ids, &decoder_texture_target_)) {
NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE);
return;
}
@@ -382,8 +384,9 @@ void GpuVideoDecoder::PictureReady(const media::Picture& picture) {
base::TimeDelta duration;
GetBufferTimeData(picture.bitstream_buffer_id(), &timestamp, &duration);
+ DCHECK(decoder_texture_target_);
scoped_refptr<VideoFrame> frame(VideoFrame::WrapNativeTexture(
- pb.texture_id(), pb.size().width(),
+ pb.texture_id(), decoder_texture_target_, pb.size().width(),
pb.size().height(), timestamp, duration,
base::Bind(&GpuVideoDecoder::ReusePictureBuffer, this,
picture.picture_buffer_id())));
diff --git a/media/filters/gpu_video_decoder.h b/media/filters/gpu_video_decoder.h
index f325219..f17a4cc 100644
--- a/media/filters/gpu_video_decoder.h
+++ b/media/filters/gpu_video_decoder.h
@@ -40,7 +40,8 @@ class MEDIA_EXPORT GpuVideoDecoder
// Allocate & delete native textures.
virtual bool CreateTextures(int32 count, const gfx::Size& size,
- std::vector<uint32>* texture_ids) = 0;
+ std::vector<uint32>* texture_ids,
+ uint32* texture_target) = 0;
virtual void DeleteTexture(uint32 texture_id) = 0;
// Allocate & return a shared memory segment. Caller is responsible for
@@ -184,6 +185,9 @@ class MEDIA_EXPORT GpuVideoDecoder
std::map<int32, BufferPair> bitstream_buffers_in_decoder_;
std::map<int32, PictureBuffer> picture_buffers_in_decoder_;
+ // The texture target used for decoded pictures.
+ uint32 decoder_texture_target_;
+
struct BufferTimeData {
BufferTimeData(int32 bbid, base::TimeDelta ts, base::TimeDelta dur);
~BufferTimeData();