| Index: media/gpu/fake_video_decode_accelerator.cc
|
| diff --git a/content/common/gpu/media/fake_video_decode_accelerator.cc b/media/gpu/fake_video_decode_accelerator.cc
|
| similarity index 88%
|
| rename from content/common/gpu/media/fake_video_decode_accelerator.cc
|
| rename to media/gpu/fake_video_decode_accelerator.cc
|
| index cb594255b385d251f2a23f0585472cfafb4a416b..97b549064b1dcd27fe26d1f088eccfaef3d6a502 100644
|
| --- a/content/common/gpu/media/fake_video_decode_accelerator.cc
|
| +++ b/media/gpu/fake_video_decode_accelerator.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "content/common/gpu/media/fake_video_decode_accelerator.h"
|
| +#include "media/gpu/fake_video_decode_accelerator.h"
|
|
|
| #include <stddef.h>
|
| #include <string.h>
|
| @@ -20,15 +20,15 @@
|
| #include "ui/gl/gl_surface_egl.h"
|
| #include "ui/gl/gl_surface_glx.h"
|
|
|
| -namespace content {
|
| +namespace media {
|
|
|
| static const uint32_t kDefaultTextureTarget = GL_TEXTURE_2D;
|
| // Must be at least 2 since the rendering helper will switch between textures
|
| // and if there is only one, it will wait for the next one that will never come.
|
| // Must also be an even number as otherwise there won't be the same amount of
|
| // white and black frames.
|
| -static const unsigned int kNumBuffers = media::limits::kMaxVideoFrames +
|
| - (media::limits::kMaxVideoFrames & 1u);
|
| +static const unsigned int kNumBuffers =
|
| + media::limits::kMaxVideoFrames + (media::limits::kMaxVideoFrames & 1u);
|
|
|
| FakeVideoDecodeAccelerator::FakeVideoDecodeAccelerator(
|
| const gfx::Size& size,
|
| @@ -40,8 +40,7 @@ FakeVideoDecodeAccelerator::FakeVideoDecodeAccelerator(
|
| flushing_(false),
|
| weak_this_factory_(this) {}
|
|
|
| -FakeVideoDecodeAccelerator::~FakeVideoDecodeAccelerator() {
|
| -}
|
| +FakeVideoDecodeAccelerator::~FakeVideoDecodeAccelerator() {}
|
|
|
| bool FakeVideoDecodeAccelerator::Initialize(const Config& config,
|
| Client* client) {
|
| @@ -86,20 +85,18 @@ void FakeVideoDecodeAccelerator::Decode(
|
| void FakeVideoDecodeAccelerator::AssignPictureBuffers(
|
| const std::vector<media::PictureBuffer>& buffers) {
|
| DCHECK(buffers.size() == kNumBuffers);
|
| - DCHECK(!(buffers.size()%2));
|
| + DCHECK(!(buffers.size() % 2));
|
|
|
| // Save buffers and mark all buffers as ready for use.
|
| std::unique_ptr<uint8_t[]> white_data(
|
| new uint8_t[frame_buffer_size_.width() * frame_buffer_size_.height() *
|
| 4]);
|
| - memset(white_data.get(),
|
| - UINT8_MAX,
|
| + memset(white_data.get(), UINT8_MAX,
|
| frame_buffer_size_.width() * frame_buffer_size_.height() * 4);
|
| std::unique_ptr<uint8_t[]> black_data(
|
| new uint8_t[frame_buffer_size_.width() * frame_buffer_size_.height() *
|
| 4]);
|
| - memset(black_data.get(),
|
| - 0,
|
| + memset(black_data.get(), 0,
|
| frame_buffer_size_.width() * frame_buffer_size_.height() * 4);
|
| if (!make_context_current_cb_.Run()) {
|
| LOG(ERROR) << "ReusePictureBuffer(): could not make context current";
|
| @@ -110,14 +107,8 @@ void FakeVideoDecodeAccelerator::AssignPictureBuffers(
|
| glBindTexture(GL_TEXTURE_2D, buffers[index].texture_ids()[0]);
|
| // Every other frame white and the rest black.
|
| uint8_t* data = index % 2 ? white_data.get() : black_data.get();
|
| - glTexImage2D(GL_TEXTURE_2D,
|
| - 0,
|
| - GL_RGBA,
|
| - frame_buffer_size_.width(),
|
| - frame_buffer_size_.height(),
|
| - 0,
|
| - GL_RGBA,
|
| - GL_UNSIGNED_BYTE,
|
| + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, frame_buffer_size_.width(),
|
| + frame_buffer_size_.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE,
|
| data);
|
| glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
| glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
| @@ -178,11 +169,8 @@ void FakeVideoDecodeAccelerator::DoPictureReady() {
|
| int buffer_id = free_output_buffers_.front();
|
| free_output_buffers_.pop();
|
|
|
| - const media::Picture picture =
|
| - media::Picture(buffer_id,
|
| - bitstream_id,
|
| - gfx::Rect(frame_buffer_size_),
|
| - false);
|
| + const media::Picture picture = media::Picture(
|
| + buffer_id, bitstream_id, gfx::Rect(frame_buffer_size_), false);
|
| client_->PictureReady(picture);
|
| // Bitstream no longer needed.
|
| client_->NotifyEndOfBitstreamBuffer(bitstream_id);
|
| @@ -193,4 +181,4 @@ void FakeVideoDecodeAccelerator::DoPictureReady() {
|
| }
|
| }
|
|
|
| -} // namespace content
|
| +} // namespace media
|
|
|