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

Unified Diff: chromecast/media/cma/filters/hole_frame_factory.cc

Issue 1372393007: [Chromecast] Upgrade to new CMA backend API (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Address alokp@ comments Created 5 years, 2 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: chromecast/media/cma/filters/hole_frame_factory.cc
diff --git a/chromecast/media/cma/filters/hole_frame_factory.cc b/chromecast/media/cma/filters/hole_frame_factory.cc
deleted file mode 100644
index 4d4b33380b0408dc7cdb70bc6a7ac05bfc534528..0000000000000000000000000000000000000000
--- a/chromecast/media/cma/filters/hole_frame_factory.cc
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chromecast/media/cma/filters/hole_frame_factory.h"
-
-#include "base/bind.h"
-#include "base/location.h"
-#include "gpu/GLES2/gl2extchromium.h"
-#include "gpu/command_buffer/client/gles2_interface.h"
-#include "media/base/video_frame.h"
-#include "media/renderers/gpu_video_accelerator_factories.h"
-
-namespace chromecast {
-namespace media {
-
-HoleFrameFactory::HoleFrameFactory(
- const scoped_refptr<::media::GpuVideoAcceleratorFactories>& gpu_factories)
- : gpu_factories_(gpu_factories),
- texture_(0),
- image_id_(0),
- sync_point_(0) {
- if (gpu_factories_) {
- gpu::gles2::GLES2Interface* gl = gpu_factories_->GetGLES2Interface();
- CHECK(gl);
-
- gl->GenTextures(1, &texture_);
- gl->BindTexture(GL_TEXTURE_2D, texture_);
- image_id_ = gl->CreateGpuMemoryBufferImageCHROMIUM(1, 1, GL_RGBA,
- GL_SCANOUT_CHROMIUM);
- gl->BindTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id_);
-
- gl->GenMailboxCHROMIUM(mailbox_.name);
- gl->ProduceTextureDirectCHROMIUM(texture_, GL_TEXTURE_2D, mailbox_.name);
-
- sync_point_ = gl->InsertSyncPointCHROMIUM();
- }
-}
-
-HoleFrameFactory::~HoleFrameFactory() {
- if (texture_) {
- gpu::gles2::GLES2Interface* gl = gpu_factories_->GetGLES2Interface();
- gl->BindTexture(GL_TEXTURE_2D, texture_);
- gl->ReleaseTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id_);
- gl->DeleteTextures(1, &texture_);
- gl->DestroyImageCHROMIUM(image_id_);
- }
-}
-
-scoped_refptr<::media::VideoFrame> HoleFrameFactory::CreateHoleFrame(
- const gfx::Size& size) {
- if (texture_) {
- scoped_refptr<::media::VideoFrame> frame =
- ::media::VideoFrame::WrapNativeTexture(
- ::media::PIXEL_FORMAT_XRGB,
- gpu::MailboxHolder(mailbox_, GL_TEXTURE_2D, sync_point_),
- ::media::VideoFrame::ReleaseMailboxCB(),
- size, // coded_size
- gfx::Rect(size), // visible rect
- size, // natural size
- base::TimeDelta()); // timestamp
- frame->metadata()->SetBoolean(::media::VideoFrameMetadata::ALLOW_OVERLAY,
- true);
- return frame;
- } else {
- // This case is needed for audio-only devices.
- return ::media::VideoFrame::CreateBlackFrame(gfx::Size(1, 1));
- }
-}
-
-} // namespace media
-} // namespace chromecast

Powered by Google App Engine
This is Rietveld 408576698