| 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 1977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1988 | 1988 |
| 1989 void DXVAVideoDecodeAccelerator::StopDecoderThread() { | 1989 void DXVAVideoDecodeAccelerator::StopDecoderThread() { |
| 1990 // Try to determine what, if any exception last happened before a hang. See | 1990 // Try to determine what, if any exception last happened before a hang. See |
| 1991 // http://crbug.com/613701 | 1991 // http://crbug.com/613701 |
| 1992 DWORD last_exception_code = g_last_exception_code; | 1992 DWORD last_exception_code = g_last_exception_code; |
| 1993 HRESULT last_unhandled_error = g_last_unhandled_error; | 1993 HRESULT last_unhandled_error = g_last_unhandled_error; |
| 1994 uint64_t last_exception_time = g_last_exception_time; | 1994 uint64_t last_exception_time = g_last_exception_time; |
| 1995 uint64_t last_process_output_time = g_last_process_output_time; | 1995 uint64_t last_process_output_time = g_last_process_output_time; |
| 1996 LARGE_INTEGER perf_frequency; | 1996 LARGE_INTEGER perf_frequency; |
| 1997 ::QueryPerformanceFrequency(&perf_frequency); | 1997 ::QueryPerformanceFrequency(&perf_frequency); |
| 1998 uint32_t output_array_size = output_array_size_; |
| 1999 size_t sample_count; |
| 2000 { |
| 2001 base::AutoLock lock(decoder_lock_); |
| 2002 sample_count = pending_output_samples_.size(); |
| 2003 } |
| 2004 |
| 1998 base::debug::Alias(&last_exception_code); | 2005 base::debug::Alias(&last_exception_code); |
| 1999 base::debug::Alias(&last_unhandled_error); | 2006 base::debug::Alias(&last_unhandled_error); |
| 2000 base::debug::Alias(&last_exception_time); | 2007 base::debug::Alias(&last_exception_time); |
| 2001 base::debug::Alias(&last_process_output_time); | 2008 base::debug::Alias(&last_process_output_time); |
| 2002 base::debug::Alias(&perf_frequency.QuadPart); | 2009 base::debug::Alias(&perf_frequency.QuadPart); |
| 2010 base::debug::Alias(&output_array_size); |
| 2011 base::debug::Alias(&sample_count); |
| 2003 decoder_thread_.Stop(); | 2012 decoder_thread_.Stop(); |
| 2004 } | 2013 } |
| 2005 | 2014 |
| 2006 void DXVAVideoDecodeAccelerator::NotifyInputBufferRead(int input_buffer_id) { | 2015 void DXVAVideoDecodeAccelerator::NotifyInputBufferRead(int input_buffer_id) { |
| 2007 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); | 2016 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); |
| 2008 if (client_) | 2017 if (client_) |
| 2009 client_->NotifyEndOfBitstreamBuffer(input_buffer_id); | 2018 client_->NotifyEndOfBitstreamBuffer(input_buffer_id); |
| 2010 } | 2019 } |
| 2011 | 2020 |
| 2012 void DXVAVideoDecodeAccelerator::NotifyFlushDone() { | 2021 void DXVAVideoDecodeAccelerator::NotifyFlushDone() { |
| (...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2831 false); | 2840 false); |
| 2832 hr = dxgi_buffer->GetResource( | 2841 hr = dxgi_buffer->GetResource( |
| 2833 __uuidof(ID3D11Texture2D), | 2842 __uuidof(ID3D11Texture2D), |
| 2834 reinterpret_cast<void**>(d3d11_texture.Receive())); | 2843 reinterpret_cast<void**>(d3d11_texture.Receive())); |
| 2835 RETURN_ON_HR_FAILURE(hr, "Failed to get D3D11Texture from output buffer", | 2844 RETURN_ON_HR_FAILURE(hr, "Failed to get D3D11Texture from output buffer", |
| 2836 false); | 2845 false); |
| 2837 D3D11_TEXTURE2D_DESC d3d11_texture_desc; | 2846 D3D11_TEXTURE2D_DESC d3d11_texture_desc; |
| 2838 d3d11_texture->GetDesc(&d3d11_texture_desc); | 2847 d3d11_texture->GetDesc(&d3d11_texture_desc); |
| 2839 *width = d3d11_texture_desc.Width; | 2848 *width = d3d11_texture_desc.Width; |
| 2840 *height = d3d11_texture_desc.Height; | 2849 *height = d3d11_texture_desc.Height; |
| 2850 output_array_size_ = d3d11_texture_desc.ArraySize; |
| 2841 } else { | 2851 } else { |
| 2842 base::win::ScopedComPtr<IDirect3DSurface9> surface; | 2852 base::win::ScopedComPtr<IDirect3DSurface9> surface; |
| 2843 hr = MFGetService(output_buffer.get(), MR_BUFFER_SERVICE, | 2853 hr = MFGetService(output_buffer.get(), MR_BUFFER_SERVICE, |
| 2844 IID_PPV_ARGS(surface.Receive())); | 2854 IID_PPV_ARGS(surface.Receive())); |
| 2845 RETURN_ON_HR_FAILURE(hr, "Failed to get D3D surface from output sample", | 2855 RETURN_ON_HR_FAILURE(hr, "Failed to get D3D surface from output sample", |
| 2846 false); | 2856 false); |
| 2847 D3DSURFACE_DESC surface_desc; | 2857 D3DSURFACE_DESC surface_desc; |
| 2848 hr = surface->GetDesc(&surface_desc); | 2858 hr = surface->GetDesc(&surface_desc); |
| 2849 RETURN_ON_HR_FAILURE(hr, "Failed to get surface description", false); | 2859 RETURN_ON_HR_FAILURE(hr, "Failed to get surface description", false); |
| 2850 *width = surface_desc.Width; | 2860 *width = surface_desc.Width; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2913 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, | 2923 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, |
| 2914 base::Unretained(this))); | 2924 base::Unretained(this))); |
| 2915 } | 2925 } |
| 2916 | 2926 |
| 2917 uint32_t DXVAVideoDecodeAccelerator::GetTextureTarget() const { | 2927 uint32_t DXVAVideoDecodeAccelerator::GetTextureTarget() const { |
| 2918 bool provide_nv12_textures = share_nv12_textures_ || copy_nv12_textures_; | 2928 bool provide_nv12_textures = share_nv12_textures_ || copy_nv12_textures_; |
| 2919 return provide_nv12_textures ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D; | 2929 return provide_nv12_textures ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D; |
| 2920 } | 2930 } |
| 2921 | 2931 |
| 2922 } // namespace media | 2932 } // namespace media |
| OLD | NEW |