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

Unified Diff: media/filters/gpu_video_decoder.cc

Issue 1942123002: Plumb decoded video pixel format from GPU process to renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test on bots Created 4 years, 6 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
« no previous file with comments | « media/filters/gpu_video_decoder.h ('k') | media/gpu/android_video_decode_accelerator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/gpu_video_decoder.cc
diff --git a/media/filters/gpu_video_decoder.cc b/media/filters/gpu_video_decoder.cc
index abc5295708de55e995bc07b80904adbb5c8d5473..cffb93c869fb71d57c6aea99795562e943c81313 100644
--- a/media/filters/gpu_video_decoder.cc
+++ b/media/filters/gpu_video_decoder.cc
@@ -77,6 +77,7 @@ GpuVideoDecoder::GpuVideoDecoder(GpuVideoAcceleratorFactories* factories,
state_(kNormal),
request_surface_cb_(request_surface_cb),
decoder_texture_target_(0),
+ pixel_format_(PIXEL_FORMAT_UNKNOWN),
next_picture_buffer_id_(0),
next_bitstream_buffer_id_(0),
available_pictures_(0),
@@ -435,6 +436,7 @@ int GpuVideoDecoder::GetMaxDecodeRequests() const {
}
void GpuVideoDecoder::ProvidePictureBuffers(uint32_t count,
+ VideoPixelFormat format,
uint32_t textures_per_buffer,
const gfx::Size& size,
uint32_t texture_target) {
@@ -445,6 +447,19 @@ void GpuVideoDecoder::ProvidePictureBuffers(uint32_t count,
std::vector<uint32_t> texture_ids;
std::vector<gpu::Mailbox> texture_mailboxes;
decoder_texture_target_ = texture_target;
+
+ if (format == PIXEL_FORMAT_UNKNOWN) {
+ format = IsOpaque(config_.format()) ? PIXEL_FORMAT_XRGB : PIXEL_FORMAT_ARGB;
+ }
+
+ // TODO(jbauman): Move decoder_texture_target_ and pixel_format_ to the
+ // picture buffer. http://crbug.com/614789
+ if ((pixel_format_ != PIXEL_FORMAT_UNKNOWN) && (pixel_format_ != format)) {
+ NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE);
+ return;
+ }
+
+ pixel_format_ = format;
if (!factories_->CreateTextures(count * textures_per_buffer, size,
&texture_ids, &texture_mailboxes,
decoder_texture_target_)) {
@@ -549,12 +564,6 @@ void GpuVideoDecoder::PictureReady(const media::Picture& picture) {
DCHECK(decoder_texture_target_);
- VideoPixelFormat pixel_format = vda_->GetOutputFormat();
- if (pixel_format == PIXEL_FORMAT_UNKNOWN) {
- pixel_format =
- IsOpaque(config_.format()) ? PIXEL_FORMAT_XRGB : PIXEL_FORMAT_ARGB;
- }
-
gpu::MailboxHolder mailbox_holders[VideoFrame::kMaxPlanes];
for (size_t i = 0; i < pb.texture_ids().size(); ++i) {
mailbox_holders[i] = gpu::MailboxHolder(
@@ -562,7 +571,7 @@ void GpuVideoDecoder::PictureReady(const media::Picture& picture) {
}
scoped_refptr<VideoFrame> frame(VideoFrame::WrapNativeTextures(
- pixel_format, mailbox_holders,
+ pixel_format_, mailbox_holders,
base::Bind(&ReleaseMailboxTrampoline, factories_->GetTaskRunner(),
base::Bind(&GpuVideoDecoder::ReleaseMailbox,
weak_factory_.GetWeakPtr(), factories_,
« no previous file with comments | « media/filters/gpu_video_decoder.h ('k') | media/gpu/android_video_decode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698