Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1240)

Unified Diff: media/gpu/fake_video_decode_accelerator.cc

Issue 1882373004: Migrate content/common/gpu/media code to media/gpu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix several more bot-identified build issues Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 f8111623d0581a4f34191b0c73a4c9e3fc449731..4859b7e8503d392c252e55fd44e528fb48e4bf19 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>
@@ -18,15 +18,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,
@@ -38,8 +38,7 @@ FakeVideoDecodeAccelerator::FakeVideoDecodeAccelerator(
flushing_(false),
weak_this_factory_(this) {}
-FakeVideoDecodeAccelerator::~FakeVideoDecodeAccelerator() {
-}
+FakeVideoDecodeAccelerator::~FakeVideoDecodeAccelerator() {}
bool FakeVideoDecodeAccelerator::Initialize(const Config& config,
Client* client) {
@@ -84,20 +83,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";
@@ -108,14 +105,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);
@@ -176,11 +167,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);
@@ -191,4 +179,4 @@ void FakeVideoDecodeAccelerator::DoPictureReady() {
}
}
-} // namespace content
+} // namespace media

Powered by Google App Engine
This is Rietveld 408576698