| Index: content/common/gpu/media/video_decode_accelerator_unittest.cc
|
| diff --git a/content/common/gpu/media/video_decode_accelerator_unittest.cc b/content/common/gpu/media/video_decode_accelerator_unittest.cc
|
| index d3b80906e9e6d3cc30b895b96a0e3eb3fd7b7dbd..0c27b1cc7f52be49100c30e743a9d359bfce7aa6 100644
|
| --- a/content/common/gpu/media/video_decode_accelerator_unittest.cc
|
| +++ b/content/common/gpu/media/video_decode_accelerator_unittest.cc
|
| @@ -203,16 +203,12 @@
|
| // A helper class used to manage the lifetime of a Texture.
|
| class TextureRef : public base::RefCounted<TextureRef> {
|
| public:
|
| - TextureRef(uint32 texture_id, const base::Closure& no_longer_needed_cb)
|
| - : texture_id_(texture_id), no_longer_needed_cb_(no_longer_needed_cb) {}
|
| -
|
| - int32 texture_id() const { return texture_id_; }
|
| + TextureRef(const base::Closure& no_longer_needed_cb)
|
| + : no_longer_needed_cb_(no_longer_needed_cb) {}
|
|
|
| private:
|
| friend class base::RefCounted<TextureRef>;
|
| ~TextureRef();
|
| -
|
| - uint32 texture_id_;
|
| base::Closure no_longer_needed_cb_;
|
| };
|
|
|
| @@ -362,8 +358,6 @@
|
| // CS_RESET_State.
|
| TextureRefMap pending_textures_;
|
|
|
| - int32 next_picture_buffer_id_;
|
| -
|
| DISALLOW_IMPLICIT_CONSTRUCTORS(GLRenderingVDAClient);
|
| };
|
|
|
| @@ -404,8 +398,7 @@
|
| suppress_rendering_(suppress_rendering),
|
| delay_reuse_after_frame_num_(delay_reuse_after_frame_num),
|
| decode_calls_per_second_(decode_calls_per_second),
|
| - render_as_thumbnails_(render_as_thumbnails),
|
| - next_picture_buffer_id_(1) {
|
| + render_as_thumbnails_(render_as_thumbnails) {
|
| CHECK_GT(num_in_flight_decodes, 0);
|
| CHECK_GT(num_play_throughs, 0);
|
| // |num_in_flight_decodes_| is unsupported if |decode_calls_per_second_| > 0.
|
| @@ -442,7 +435,7 @@
|
| scoped_ptr<media::VideoDecodeAccelerator> decoder;
|
| #if defined(OS_CHROMEOS) && (defined(ARCH_CPU_ARMEL) || \
|
| (defined(USE_OZONE) && defined(USE_V4L2_CODEC)))
|
| - scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder);
|
| + scoped_ptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder);
|
| if (device.get()) {
|
| base::WeakPtr<VideoDecodeAccelerator::Client> weak_client = AsWeakPtr();
|
| decoder.reset(new V4L2VideoDecodeAccelerator(
|
| @@ -450,7 +443,7 @@
|
| static_cast<EGLContext>(rendering_helper_->GetGLContextHandle()),
|
| weak_client,
|
| base::Bind(&DoNothingReturnTrue),
|
| - device,
|
| + device.Pass(),
|
| base::MessageLoopProxy::current()));
|
| }
|
| #endif
|
| @@ -512,18 +505,16 @@
|
| texture_target_, &texture_id, dimensions, &done);
|
| done.Wait();
|
|
|
| - int32 picture_buffer_id = next_picture_buffer_id_++;
|
| - CHECK(active_textures_
|
| - .insert(std::make_pair(
|
| - picture_buffer_id,
|
| - new TextureRef(texture_id,
|
| - base::Bind(&RenderingHelper::DeleteTexture,
|
| + // Use the texture_id as the picture's id.
|
| + int32 id = static_cast<int32>(texture_id);
|
| + CHECK(
|
| + active_textures_.insert(std::make_pair(
|
| + id, new TextureRef(base::Bind(
|
| + &RenderingHelper::DeleteTexture,
|
| base::Unretained(rendering_helper_),
|
| - texture_id))))
|
| - .second);
|
| -
|
| - buffers.push_back(
|
| - media::PictureBuffer(picture_buffer_id, dimensions, texture_id));
|
| + texture_id)))).second);
|
| +
|
| + buffers.push_back(media::PictureBuffer(id, dimensions, texture_id));
|
| }
|
| decoder_->AssignPictureBuffers(buffers);
|
| }
|
| @@ -569,7 +560,8 @@
|
| ASSERT_NE(active_textures_.end(), texture_it);
|
|
|
| scoped_refptr<VideoFrameTexture> video_frame = new VideoFrameTexture(
|
| - texture_target_, texture_it->second->texture_id(),
|
| + texture_target_,
|
| + static_cast<uint32>(texture_it->first), // the texture id
|
| base::Bind(&GLRenderingVDAClient::ReturnPicture, AsWeakPtr(),
|
| picture.picture_buffer_id()));
|
| ASSERT_TRUE(pending_textures_.insert(*texture_it).second);
|
|
|