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

Side by Side Diff: content/common/gpu/media/gpu_video_decode_accelerator.cc

Issue 1490333005: Don't require VDAs to return all PictureBuffers at once. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moved flags into VDA::Capabilities. Created 5 years 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" 5 #include "content/common/gpu/media/gpu_video_decode_accelerator.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 28 matching lines...) Expand all
39 #include "content/common/gpu/media/v4l2_slice_video_decode_accelerator.h" 39 #include "content/common/gpu/media/v4l2_slice_video_decode_accelerator.h"
40 #include "content/common/gpu/media/v4l2_video_decode_accelerator.h" 40 #include "content/common/gpu/media/v4l2_video_decode_accelerator.h"
41 #endif 41 #endif
42 #if defined(ARCH_CPU_X86_FAMILY) 42 #if defined(ARCH_CPU_X86_FAMILY)
43 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" 43 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h"
44 #include "ui/gl/gl_implementation.h" 44 #include "ui/gl/gl_implementation.h"
45 #endif 45 #endif
46 #elif defined(USE_OZONE) 46 #elif defined(USE_OZONE)
47 #include "media/ozone/media_ozone_platform.h" 47 #include "media/ozone/media_ozone_platform.h"
48 #elif defined(OS_ANDROID) 48 #elif defined(OS_ANDROID)
49 #include "content/common/gpu/media/android_copying_backing_strategy.h"
50 #include "content/common/gpu/media/android_deferred_rendering_backing_strategy.h "
51 #include "content/common/gpu/media/android_video_decode_accelerator.h" 49 #include "content/common/gpu/media/android_video_decode_accelerator.h"
52 #endif 50 #endif
53 51
54 #include "ui/gfx/geometry/size.h" 52 #include "ui/gfx/geometry/size.h"
55 53
56 namespace content { 54 namespace content {
57 55
58 static bool MakeDecoderContextCurrent( 56 static bool MakeDecoderContextCurrent(
59 const base::WeakPtr<GpuCommandBufferStub> stub) { 57 const base::WeakPtr<GpuCommandBufferStub> stub) {
60 if (!stub) { 58 if (!stub) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 base::Bind(&MakeDecoderContextCurrent, stub_->AsWeakPtr()); 143 base::Bind(&MakeDecoderContextCurrent, stub_->AsWeakPtr());
146 } 144 }
147 145
148 GpuVideoDecodeAccelerator::~GpuVideoDecodeAccelerator() { 146 GpuVideoDecodeAccelerator::~GpuVideoDecodeAccelerator() {
149 // This class can only be self-deleted from OnWillDestroyStub(), which means 147 // This class can only be self-deleted from OnWillDestroyStub(), which means
150 // the VDA has already been destroyed in there. 148 // the VDA has already been destroyed in there.
151 DCHECK(!video_decode_accelerator_); 149 DCHECK(!video_decode_accelerator_);
152 } 150 }
153 151
154 // static 152 // static
155 gpu::VideoDecodeAcceleratorSupportedProfiles 153 gpu::VideoDecodeAcceleratorCapabilities
156 GpuVideoDecodeAccelerator::GetSupportedProfiles() { 154 GpuVideoDecodeAccelerator::GetCapabilities() {
157 media::VideoDecodeAccelerator::SupportedProfiles profiles; 155 media::VideoDecodeAccelerator::Capabilities capabilities;
156 media::VideoDecodeAccelerator::SupportedProfiles& profiles =
157 capabilities.supported_profiles;
158 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); 158 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
159 if (cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) 159 if (cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode))
160 return gpu::VideoDecodeAcceleratorSupportedProfiles(); 160 return gpu::VideoDecodeAcceleratorCapabilities();
161 161
162 // Query supported profiles for each VDA. The order of querying VDAs should 162 // Query supported profiles for each VDA. The order of querying VDAs should
163 // be the same as the order of initializing VDAs. Then the returned profile 163 // be the same as the order of initializing VDAs. Then the returned profile
164 // can be initialized by corresponding VDA successfully. 164 // can be initialized by corresponding VDA successfully.
165 #if defined(OS_WIN) 165 #if defined(OS_WIN)
166 profiles = DXVAVideoDecodeAccelerator::GetSupportedProfiles(); 166 profiles = DXVAVideoDecodeAccelerator::GetSupportedProfiles();
167 #elif defined(OS_CHROMEOS) 167 #elif defined(OS_CHROMEOS)
168 media::VideoDecodeAccelerator::SupportedProfiles vda_profiles; 168 media::VideoDecodeAccelerator::SupportedProfiles vda_profiles;
169 #if defined(USE_V4L2_CODEC) 169 #if defined(USE_V4L2_CODEC)
170 vda_profiles = V4L2VideoDecodeAccelerator::GetSupportedProfiles(); 170 vda_profiles = V4L2VideoDecodeAccelerator::GetSupportedProfiles();
171 GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles(vda_profiles, &profiles); 171 GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles(vda_profiles, &profiles);
172 vda_profiles = V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles(); 172 vda_profiles = V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles();
173 GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles(vda_profiles, &profiles); 173 GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles(vda_profiles, &profiles);
174 #endif 174 #endif
175 #if defined(ARCH_CPU_X86_FAMILY) 175 #if defined(ARCH_CPU_X86_FAMILY)
176 vda_profiles = VaapiVideoDecodeAccelerator::GetSupportedProfiles(); 176 vda_profiles = VaapiVideoDecodeAccelerator::GetSupportedProfiles();
177 GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles(vda_profiles, &profiles); 177 GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles(vda_profiles, &profiles);
178 #endif 178 #endif
179 #elif defined(OS_MACOSX) 179 #elif defined(OS_MACOSX)
180 profiles = VTVideoDecodeAccelerator::GetSupportedProfiles(); 180 profiles = VTVideoDecodeAccelerator::GetSupportedProfiles();
181 #elif defined(OS_ANDROID) 181 #elif defined(OS_ANDROID)
182 profiles = AndroidVideoDecodeAccelerator::GetSupportedProfiles(); 182 capabilities = AndroidVideoDecodeAccelerator::GetCapabilities();
183 #endif 183 #endif
184 return GpuVideoAcceleratorUtil::ConvertMediaToGpuDecodeProfiles(profiles); 184 return GpuVideoAcceleratorUtil::ConvertMediaToGpuDecodeCapabilities(
185 capabilities);
185 } 186 }
186 187
187 bool GpuVideoDecodeAccelerator::OnMessageReceived(const IPC::Message& msg) { 188 bool GpuVideoDecodeAccelerator::OnMessageReceived(const IPC::Message& msg) {
188 if (!video_decode_accelerator_) 189 if (!video_decode_accelerator_)
189 return false; 190 return false;
190 191
191 bool handled = true; 192 bool handled = true;
192 IPC_BEGIN_MESSAGE_MAP(GpuVideoDecodeAccelerator, msg) 193 IPC_BEGIN_MESSAGE_MAP(GpuVideoDecodeAccelerator, msg)
193 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderMsg_SetCdm, OnSetCdm) 194 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderMsg_SetCdm, OnSetCdm)
194 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderMsg_Decode, OnDecode) 195 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderMsg_Decode, OnDecode)
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 media::MediaOzonePlatform::GetInstance(); 466 media::MediaOzonePlatform::GetInstance();
466 decoder.reset(platform->CreateVideoDecodeAccelerator(make_context_current_)); 467 decoder.reset(platform->CreateVideoDecodeAccelerator(make_context_current_));
467 #endif 468 #endif
468 return decoder.Pass(); 469 return decoder.Pass();
469 } 470 }
470 471
471 scoped_ptr<media::VideoDecodeAccelerator> 472 scoped_ptr<media::VideoDecodeAccelerator>
472 GpuVideoDecodeAccelerator::CreateAndroidVDA() { 473 GpuVideoDecodeAccelerator::CreateAndroidVDA() {
473 scoped_ptr<media::VideoDecodeAccelerator> decoder; 474 scoped_ptr<media::VideoDecodeAccelerator> decoder;
474 #if defined(OS_ANDROID) 475 #if defined(OS_ANDROID)
475 decoder.reset(new AndroidVideoDecodeAccelerator( 476 decoder.reset(new AndroidVideoDecodeAccelerator(stub_->decoder()->AsWeakPtr(),
476 stub_->decoder()->AsWeakPtr(), make_context_current_, 477 make_context_current_));
477 make_scoped_ptr(
478 #if defined(ENABLE_MEDIA_PIPELINE_ON_ANDROID)
479 new AndroidDeferredRenderingBackingStrategy()
480 #else
481 new AndroidCopyingBackingStrategy()
482 #endif
483 )));
484 #endif 478 #endif
485 return decoder.Pass(); 479 return decoder.Pass();
486 } 480 }
487 481
488 void GpuVideoDecodeAccelerator::OnSetCdm(int cdm_id) { 482 void GpuVideoDecodeAccelerator::OnSetCdm(int cdm_id) {
489 DCHECK(video_decode_accelerator_); 483 DCHECK(video_decode_accelerator_);
490 video_decode_accelerator_->SetCdm(cdm_id); 484 video_decode_accelerator_->SetCdm(cdm_id);
491 } 485 }
492 486
493 // Runs on IO thread if video_decode_accelerator_->CanDecodeOnIOThread() is 487 // Runs on IO thread if video_decode_accelerator_->CanDecodeOnIOThread() is
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 uncleared_textures_.erase(it); 632 uncleared_textures_.erase(it);
639 } 633 }
640 634
641 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message, 635 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message,
642 bool succeeded) { 636 bool succeeded) {
643 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded); 637 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded);
644 Send(message); 638 Send(message);
645 } 639 }
646 640
647 } // namespace content 641 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698