Chromium Code Reviews| 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/dxva_video_decode_accelerator.h" | 5 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #if !defined(OS_WIN) | 7 #if !defined(OS_WIN) |
| 8 #error This file should only be built on Windows. | 8 #error This file should only be built on Windows. |
| 9 #endif // !defined(OS_WIN) | 9 #endif // !defined(OS_WIN) |
| 10 | 10 |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 625 weak_this_factory_(this) { | 625 weak_this_factory_(this) { |
| 626 weak_ptr_ = weak_this_factory_.GetWeakPtr(); | 626 weak_ptr_ = weak_this_factory_.GetWeakPtr(); |
| 627 memset(&input_stream_info_, 0, sizeof(input_stream_info_)); | 627 memset(&input_stream_info_, 0, sizeof(input_stream_info_)); |
| 628 memset(&output_stream_info_, 0, sizeof(output_stream_info_)); | 628 memset(&output_stream_info_, 0, sizeof(output_stream_info_)); |
| 629 } | 629 } |
| 630 | 630 |
| 631 DXVAVideoDecodeAccelerator::~DXVAVideoDecodeAccelerator() { | 631 DXVAVideoDecodeAccelerator::~DXVAVideoDecodeAccelerator() { |
| 632 client_ = NULL; | 632 client_ = NULL; |
| 633 } | 633 } |
| 634 | 634 |
| 635 bool DXVAVideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile, | 635 bool DXVAVideoDecodeAccelerator::Initialize(const StreamParameters& params, |
| 636 Client* client) { | 636 Client* client) { |
| 637 if (params.is_encrypted) { | |
| 638 DLOG(ERROR) << "Encrypted streams are not supported for this VDA"; | |
|
xhwang
2015/12/02 06:48:18
Here and below, how about
NOTREACHED() << "Encryp
Tima Vaisburd
2015/12/02 22:56:58
Done.
| |
| 639 return false; | |
| 640 } | |
| 641 | |
| 637 client_ = client; | 642 client_ = client; |
| 638 | 643 |
| 639 main_thread_task_runner_ = base::MessageLoop::current()->task_runner(); | 644 main_thread_task_runner_ = base::MessageLoop::current()->task_runner(); |
| 640 | 645 |
| 641 bool profile_supported = false; | 646 bool profile_supported = false; |
| 642 for (const auto& supported_profile : kSupportedProfiles) { | 647 for (const auto& supported_profile : kSupportedProfiles) { |
| 643 if (profile == supported_profile) { | 648 if (params.profile == supported_profile) { |
| 644 profile_supported = true; | 649 profile_supported = true; |
| 645 break; | 650 break; |
| 646 } | 651 } |
| 647 } | 652 } |
| 648 if (!profile_supported) { | 653 if (!profile_supported) { |
| 649 RETURN_AND_NOTIFY_ON_FAILURE(false, | 654 RETURN_AND_NOTIFY_ON_FAILURE(false, |
| 650 "Unsupported h.264, vp8, or vp9 profile", PLATFORM_FAILURE, false); | 655 "Unsupported h.264, vp8, or vp9 profile", PLATFORM_FAILURE, false); |
| 651 } | 656 } |
| 652 | 657 |
| 653 // Not all versions of Windows 7 and later include Media Foundation DLLs. | 658 // Not all versions of Windows 7 and later include Media Foundation DLLs. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 685 "EGL_ANGLE_surface_d3d_texture_2d_share_handle unavailable", | 690 "EGL_ANGLE_surface_d3d_texture_2d_share_handle unavailable", |
| 686 PLATFORM_FAILURE, | 691 PLATFORM_FAILURE, |
| 687 false); | 692 false); |
| 688 | 693 |
| 689 State state = GetState(); | 694 State state = GetState(); |
| 690 RETURN_AND_NOTIFY_ON_FAILURE((state == kUninitialized), | 695 RETURN_AND_NOTIFY_ON_FAILURE((state == kUninitialized), |
| 691 "Initialize: invalid state: " << state, ILLEGAL_STATE, false); | 696 "Initialize: invalid state: " << state, ILLEGAL_STATE, false); |
| 692 | 697 |
| 693 media::InitializeMediaFoundation(); | 698 media::InitializeMediaFoundation(); |
| 694 | 699 |
| 695 RETURN_AND_NOTIFY_ON_FAILURE(InitDecoder(profile), | 700 RETURN_AND_NOTIFY_ON_FAILURE(InitDecoder(params.profile), |
| 696 "Failed to initialize decoder", PLATFORM_FAILURE, false); | 701 "Failed to initialize decoder", PLATFORM_FAILURE, false); |
| 697 | 702 |
| 698 RETURN_AND_NOTIFY_ON_FAILURE(GetStreamsInfoAndBufferReqs(), | 703 RETURN_AND_NOTIFY_ON_FAILURE(GetStreamsInfoAndBufferReqs(), |
| 699 "Failed to get input/output stream info.", PLATFORM_FAILURE, false); | 704 "Failed to get input/output stream info.", PLATFORM_FAILURE, false); |
| 700 | 705 |
| 701 RETURN_AND_NOTIFY_ON_FAILURE( | 706 RETURN_AND_NOTIFY_ON_FAILURE( |
| 702 SendMFTMessage(MFT_MESSAGE_NOTIFY_BEGIN_STREAMING, 0), | 707 SendMFTMessage(MFT_MESSAGE_NOTIFY_BEGIN_STREAMING, 0), |
| 703 "Send MFT_MESSAGE_NOTIFY_BEGIN_STREAMING notification failed", | 708 "Send MFT_MESSAGE_NOTIFY_BEGIN_STREAMING notification failed", |
| 704 PLATFORM_FAILURE, false); | 709 PLATFORM_FAILURE, false); |
| 705 | 710 |
| (...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2284 D3DSURFACE_DESC surface_desc; | 2289 D3DSURFACE_DESC surface_desc; |
| 2285 hr = surface->GetDesc(&surface_desc); | 2290 hr = surface->GetDesc(&surface_desc); |
| 2286 RETURN_ON_HR_FAILURE(hr, "Failed to get surface description", false); | 2291 RETURN_ON_HR_FAILURE(hr, "Failed to get surface description", false); |
| 2287 *width = surface_desc.Width; | 2292 *width = surface_desc.Width; |
| 2288 *height = surface_desc.Height; | 2293 *height = surface_desc.Height; |
| 2289 } | 2294 } |
| 2290 return true; | 2295 return true; |
| 2291 } | 2296 } |
| 2292 | 2297 |
| 2293 } // namespace content | 2298 } // namespace content |
| OLD | NEW |