| 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 "media/gpu/dxva_video_decode_accelerator_win.h" | 5 #include "media/gpu/dxva_video_decode_accelerator_win.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #if !defined(OS_WIN) | 9 #if !defined(OS_WIN) |
| 10 #error This file should only be built on Windows. | 10 #error This file should only be built on Windows. |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 egl_config_(NULL), | 494 egl_config_(NULL), |
| 495 state_(kUninitialized), | 495 state_(kUninitialized), |
| 496 pictures_requested_(false), | 496 pictures_requested_(false), |
| 497 inputs_before_decode_(0), | 497 inputs_before_decode_(0), |
| 498 sent_drain_message_(false), | 498 sent_drain_message_(false), |
| 499 get_gl_context_cb_(get_gl_context_cb), | 499 get_gl_context_cb_(get_gl_context_cb), |
| 500 make_context_current_cb_(make_context_current_cb), | 500 make_context_current_cb_(make_context_current_cb), |
| 501 codec_(kUnknownVideoCodec), | 501 codec_(kUnknownVideoCodec), |
| 502 decoder_thread_("DXVAVideoDecoderThread"), | 502 decoder_thread_("DXVAVideoDecoderThread"), |
| 503 pending_flush_(false), | 503 pending_flush_(false), |
| 504 enable_low_latency_(gpu_preferences.enable_low_latency_dxva), |
| 504 share_nv12_textures_(gpu_preferences.enable_zero_copy_dxgi_video && | 505 share_nv12_textures_(gpu_preferences.enable_zero_copy_dxgi_video && |
| 505 !workarounds.disable_dxgi_zero_copy_video), | 506 !workarounds.disable_dxgi_zero_copy_video), |
| 506 copy_nv12_textures_(gpu_preferences.enable_nv12_dxgi_video && | 507 copy_nv12_textures_(gpu_preferences.enable_nv12_dxgi_video && |
| 507 !workarounds.disable_nv12_dxgi_video), | 508 !workarounds.disable_nv12_dxgi_video), |
| 508 use_dx11_(false), | 509 use_dx11_(false), |
| 509 use_keyed_mutex_(false), | 510 use_keyed_mutex_(false), |
| 510 dx11_video_format_converter_media_type_needs_init_(true), | 511 dx11_video_format_converter_media_type_needs_init_(true), |
| 511 using_angle_device_(false), | 512 using_angle_device_(false), |
| 512 enable_accelerated_vpx_decode_( | 513 enable_accelerated_vpx_decode_( |
| 513 gpu_preferences.enable_accelerated_vpx_decode), | 514 gpu_preferences.enable_accelerated_vpx_decode), |
| (...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1447 | 1448 |
| 1448 UINT32 dxva = 0; | 1449 UINT32 dxva = 0; |
| 1449 hr = attributes->GetUINT32(MF_SA_D3D_AWARE, &dxva); | 1450 hr = attributes->GetUINT32(MF_SA_D3D_AWARE, &dxva); |
| 1450 RETURN_ON_HR_FAILURE(hr, "Failed to check if decoder supports DXVA", false); | 1451 RETURN_ON_HR_FAILURE(hr, "Failed to check if decoder supports DXVA", false); |
| 1451 | 1452 |
| 1452 if (codec_ == kCodecH264) { | 1453 if (codec_ == kCodecH264) { |
| 1453 hr = attributes->SetUINT32(CODECAPI_AVDecVideoAcceleration_H264, TRUE); | 1454 hr = attributes->SetUINT32(CODECAPI_AVDecVideoAcceleration_H264, TRUE); |
| 1454 RETURN_ON_HR_FAILURE(hr, "Failed to enable DXVA H/W decoding", false); | 1455 RETURN_ON_HR_FAILURE(hr, "Failed to enable DXVA H/W decoding", false); |
| 1455 } | 1456 } |
| 1456 | 1457 |
| 1457 hr = attributes->SetUINT32(CODECAPI_AVLowLatencyMode, TRUE); | 1458 if (enable_low_latency_) { |
| 1458 if (SUCCEEDED(hr)) { | 1459 hr = attributes->SetUINT32(CODECAPI_AVLowLatencyMode, TRUE); |
| 1459 DVLOG(1) << "Successfully set Low latency mode on decoder."; | 1460 if (SUCCEEDED(hr)) { |
| 1460 } else { | 1461 DVLOG(1) << "Successfully set Low latency mode on decoder."; |
| 1461 DVLOG(1) << "Failed to set Low latency mode on decoder. Error: " << hr; | 1462 } else { |
| 1463 DVLOG(1) << "Failed to set Low latency mode on decoder. Error: " << hr; |
| 1464 } |
| 1462 } | 1465 } |
| 1463 | 1466 |
| 1464 auto* gl_context = get_gl_context_cb_.Run(); | 1467 auto* gl_context = get_gl_context_cb_.Run(); |
| 1465 RETURN_ON_FAILURE(gl_context, "Couldn't get GL context", false); | 1468 RETURN_ON_FAILURE(gl_context, "Couldn't get GL context", false); |
| 1466 | 1469 |
| 1467 // The decoder should use DX11 iff | 1470 // The decoder should use DX11 iff |
| 1468 // 1. The underlying H/W decoder supports it. | 1471 // 1. The underlying H/W decoder supports it. |
| 1469 // 2. We have a pointer to the MFCreateDXGIDeviceManager function needed for | 1472 // 2. We have a pointer to the MFCreateDXGIDeviceManager function needed for |
| 1470 // this. This should always be true for Windows 8+. | 1473 // this. This should always be true for Windows 8+. |
| 1471 // 3. ANGLE is using DX11. | 1474 // 3. ANGLE is using DX11. |
| (...skipping 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2709 SetState(kConfigChange); | 2712 SetState(kConfigChange); |
| 2710 Invalidate(); | 2713 Invalidate(); |
| 2711 Initialize(config_, client_); | 2714 Initialize(config_, client_); |
| 2712 decoder_thread_task_runner_->PostTask( | 2715 decoder_thread_task_runner_->PostTask( |
| 2713 FROM_HERE, | 2716 FROM_HERE, |
| 2714 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, | 2717 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, |
| 2715 base::Unretained(this))); | 2718 base::Unretained(this))); |
| 2716 } | 2719 } |
| 2717 | 2720 |
| 2718 } // namespace media | 2721 } // namespace media |
| OLD | NEW |