| OLD | NEW |
| 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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 } | 316 } |
| 317 | 317 |
| 318 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { | 318 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { |
| 319 if (filter_ && io_task_runner_->BelongsToCurrentThread()) | 319 if (filter_ && io_task_runner_->BelongsToCurrentThread()) |
| 320 return filter_->SendOnIOThread(message); | 320 return filter_->SendOnIOThread(message); |
| 321 DCHECK(child_task_runner_->BelongsToCurrentThread()); | 321 DCHECK(child_task_runner_->BelongsToCurrentThread()); |
| 322 return stub_->channel()->Send(message); | 322 return stub_->channel()->Send(message); |
| 323 } | 323 } |
| 324 | 324 |
| 325 void GpuVideoDecodeAccelerator::Initialize( | 325 void GpuVideoDecodeAccelerator::Initialize( |
| 326 const media::VideoCodecProfile profile, | 326 const media::VideoDecodeAccelerator::Config& config, |
| 327 IPC::Message* init_done_msg) { | 327 IPC::Message* init_done_msg) { |
| 328 DCHECK(!video_decode_accelerator_); | 328 DCHECK(!video_decode_accelerator_); |
| 329 | 329 |
| 330 if (!stub_->channel()->AddRoute(host_route_id_, this)) { | 330 if (!stub_->channel()->AddRoute(host_route_id_, this)) { |
| 331 DLOG(ERROR) << "Initialize(): failed to add route"; | 331 DLOG(ERROR) << "Initialize(): failed to add route"; |
| 332 SendCreateDecoderReply(init_done_msg, false); | 332 SendCreateDecoderReply(init_done_msg, false); |
| 333 } | 333 } |
| 334 | 334 |
| 335 #if !defined(OS_WIN) | 335 #if !defined(OS_WIN) |
| 336 // Ensure we will be able to get a GL context at all before initializing | 336 // Ensure we will be able to get a GL context at all before initializing |
| (...skipping 12 matching lines...) Expand all Loading... |
| 349 &GpuVideoDecodeAccelerator::CreateV4L2VDA, | 349 &GpuVideoDecodeAccelerator::CreateV4L2VDA, |
| 350 &GpuVideoDecodeAccelerator::CreateV4L2SliceVDA, | 350 &GpuVideoDecodeAccelerator::CreateV4L2SliceVDA, |
| 351 &GpuVideoDecodeAccelerator::CreateVaapiVDA, | 351 &GpuVideoDecodeAccelerator::CreateVaapiVDA, |
| 352 &GpuVideoDecodeAccelerator::CreateVTVDA, | 352 &GpuVideoDecodeAccelerator::CreateVTVDA, |
| 353 &GpuVideoDecodeAccelerator::CreateOzoneVDA, | 353 &GpuVideoDecodeAccelerator::CreateOzoneVDA, |
| 354 &GpuVideoDecodeAccelerator::CreateAndroidVDA}; | 354 &GpuVideoDecodeAccelerator::CreateAndroidVDA}; |
| 355 | 355 |
| 356 for (const auto& create_vda_function : create_vda_fps) { | 356 for (const auto& create_vda_function : create_vda_fps) { |
| 357 video_decode_accelerator_ = (this->*create_vda_function)(); | 357 video_decode_accelerator_ = (this->*create_vda_function)(); |
| 358 if (!video_decode_accelerator_ || | 358 if (!video_decode_accelerator_ || |
| 359 !video_decode_accelerator_->Initialize(profile, this)) | 359 !video_decode_accelerator_->Initialize(config, this)) |
| 360 continue; | 360 continue; |
| 361 | 361 |
| 362 if (video_decode_accelerator_->CanDecodeOnIOThread()) { | 362 if (video_decode_accelerator_->CanDecodeOnIOThread()) { |
| 363 filter_ = new MessageFilter(this, host_route_id_); | 363 filter_ = new MessageFilter(this, host_route_id_); |
| 364 stub_->channel()->AddFilter(filter_.get()); | 364 stub_->channel()->AddFilter(filter_.get()); |
| 365 } | 365 } |
| 366 SendCreateDecoderReply(init_done_msg, true); | 366 SendCreateDecoderReply(init_done_msg, true); |
| 367 return; | 367 return; |
| 368 } | 368 } |
| 369 video_decode_accelerator_.reset(); | 369 video_decode_accelerator_.reset(); |
| 370 LOG(ERROR) << "HW video decode not available for profile " << profile; | 370 LOG(ERROR) << "HW video decode not available for profile " << config.profile |
| 371 << (config.is_encrypted ? " with encryption" : ""); |
| 371 SendCreateDecoderReply(init_done_msg, false); | 372 SendCreateDecoderReply(init_done_msg, false); |
| 372 } | 373 } |
| 373 | 374 |
| 374 scoped_ptr<media::VideoDecodeAccelerator> | 375 scoped_ptr<media::VideoDecodeAccelerator> |
| 375 GpuVideoDecodeAccelerator::CreateDXVAVDA() { | 376 GpuVideoDecodeAccelerator::CreateDXVAVDA() { |
| 376 scoped_ptr<media::VideoDecodeAccelerator> decoder; | 377 scoped_ptr<media::VideoDecodeAccelerator> decoder; |
| 377 #if defined(OS_WIN) | 378 #if defined(OS_WIN) |
| 378 if (base::win::GetVersion() >= base::win::VERSION_WIN7) { | 379 if (base::win::GetVersion() >= base::win::VERSION_WIN7) { |
| 379 DVLOG(0) << "Initializing DXVA HW decoder for windows."; | 380 DVLOG(0) << "Initializing DXVA HW decoder for windows."; |
| 380 decoder.reset(new DXVAVideoDecodeAccelerator(make_context_current_, | 381 decoder.reset(new DXVAVideoDecodeAccelerator(make_context_current_, |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 uncleared_textures_.erase(it); | 639 uncleared_textures_.erase(it); |
| 639 } | 640 } |
| 640 | 641 |
| 641 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message, | 642 void GpuVideoDecodeAccelerator::SendCreateDecoderReply(IPC::Message* message, |
| 642 bool succeeded) { | 643 bool succeeded) { |
| 643 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded); | 644 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(message, succeeded); |
| 644 Send(message); | 645 Send(message); |
| 645 } | 646 } |
| 646 | 647 |
| 647 } // namespace content | 648 } // namespace content |
| OLD | NEW |