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 11 matching lines...) Expand all Loading... |
22 #include "base/debug/alias.h" | 22 #include "base/debug/alias.h" |
23 #include "base/file_version_info.h" | 23 #include "base/file_version_info.h" |
24 #include "base/files/file_path.h" | 24 #include "base/files/file_path.h" |
25 #include "base/logging.h" | 25 #include "base/logging.h" |
26 #include "base/memory/scoped_ptr.h" | 26 #include "base/memory/scoped_ptr.h" |
27 #include "base/memory/shared_memory.h" | 27 #include "base/memory/shared_memory.h" |
28 #include "base/message_loop/message_loop.h" | 28 #include "base/message_loop/message_loop.h" |
29 #include "base/path_service.h" | 29 #include "base/path_service.h" |
30 #include "base/trace_event/trace_event.h" | 30 #include "base/trace_event/trace_event.h" |
31 #include "base/win/windows_version.h" | 31 #include "base/win/windows_version.h" |
32 #include "media/base/win/mf_initializer.h" | |
33 #include "media/video/video_decode_accelerator.h" | 32 #include "media/video/video_decode_accelerator.h" |
34 #include "ui/gl/gl_bindings.h" | 33 #include "ui/gl/gl_bindings.h" |
35 #include "ui/gl/gl_context.h" | 34 #include "ui/gl/gl_context.h" |
36 #include "ui/gl/gl_surface_egl.h" | 35 #include "ui/gl/gl_surface_egl.h" |
37 #include "ui/gl/gl_switches.h" | 36 #include "ui/gl/gl_switches.h" |
38 | 37 |
39 namespace { | 38 namespace { |
40 | 39 |
41 // Path is appended on to the PROGRAM_FILES base path. | 40 // Path is appended on to the PROGRAM_FILES base path. |
42 const wchar_t kVPXDecoderDLLPath[] = L"Intel\\Media SDK\\"; | 41 const wchar_t kVPXDecoderDLLPath[] = L"Intel\\Media SDK\\"; |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 RETURN_AND_NOTIFY_ON_FAILURE( | 591 RETURN_AND_NOTIFY_ON_FAILURE( |
593 gfx::g_driver_egl.ext.b_EGL_ANGLE_surface_d3d_texture_2d_share_handle, | 592 gfx::g_driver_egl.ext.b_EGL_ANGLE_surface_d3d_texture_2d_share_handle, |
594 "EGL_ANGLE_surface_d3d_texture_2d_share_handle unavailable", | 593 "EGL_ANGLE_surface_d3d_texture_2d_share_handle unavailable", |
595 PLATFORM_FAILURE, | 594 PLATFORM_FAILURE, |
596 false); | 595 false); |
597 | 596 |
598 State state = GetState(); | 597 State state = GetState(); |
599 RETURN_AND_NOTIFY_ON_FAILURE((state == kUninitialized), | 598 RETURN_AND_NOTIFY_ON_FAILURE((state == kUninitialized), |
600 "Initialize: invalid state: " << state, ILLEGAL_STATE, false); | 599 "Initialize: invalid state: " << state, ILLEGAL_STATE, false); |
601 | 600 |
602 media::InitializeMediaFoundation(); | 601 HRESULT hr = MFStartup(MF_VERSION, MFSTARTUP_FULL); |
| 602 RETURN_AND_NOTIFY_ON_HR_FAILURE(hr, "MFStartup failed.", PLATFORM_FAILURE, |
| 603 false); |
603 | 604 |
604 RETURN_AND_NOTIFY_ON_FAILURE(InitDecoder(profile), | 605 RETURN_AND_NOTIFY_ON_FAILURE(InitDecoder(profile), |
605 "Failed to initialize decoder", PLATFORM_FAILURE, false); | 606 "Failed to initialize decoder", PLATFORM_FAILURE, false); |
606 | 607 |
607 RETURN_AND_NOTIFY_ON_FAILURE(GetStreamsInfoAndBufferReqs(), | 608 RETURN_AND_NOTIFY_ON_FAILURE(GetStreamsInfoAndBufferReqs(), |
608 "Failed to get input/output stream info.", PLATFORM_FAILURE, false); | 609 "Failed to get input/output stream info.", PLATFORM_FAILURE, false); |
609 | 610 |
610 RETURN_AND_NOTIFY_ON_FAILURE( | 611 RETURN_AND_NOTIFY_ON_FAILURE( |
611 SendMFTMessage(MFT_MESSAGE_NOTIFY_BEGIN_STREAMING, 0), | 612 SendMFTMessage(MFT_MESSAGE_NOTIFY_BEGIN_STREAMING, 0), |
612 "Send MFT_MESSAGE_NOTIFY_BEGIN_STREAMING notification failed", | 613 "Send MFT_MESSAGE_NOTIFY_BEGIN_STREAMING notification failed", |
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1439 d3d11_device_manager_.Release(); | 1440 d3d11_device_manager_.Release(); |
1440 d3d11_query_.Release(); | 1441 d3d11_query_.Release(); |
1441 dx11_video_format_converter_media_type_needs_init_ = true; | 1442 dx11_video_format_converter_media_type_needs_init_ = true; |
1442 } else { | 1443 } else { |
1443 d3d9_.Release(); | 1444 d3d9_.Release(); |
1444 d3d9_device_ex_.Release(); | 1445 d3d9_device_ex_.Release(); |
1445 device_manager_.Release(); | 1446 device_manager_.Release(); |
1446 query_.Release(); | 1447 query_.Release(); |
1447 } | 1448 } |
1448 | 1449 |
| 1450 MFShutdown(); |
1449 SetState(kUninitialized); | 1451 SetState(kUninitialized); |
1450 } | 1452 } |
1451 | 1453 |
1452 void DXVAVideoDecodeAccelerator::NotifyInputBufferRead(int input_buffer_id) { | 1454 void DXVAVideoDecodeAccelerator::NotifyInputBufferRead(int input_buffer_id) { |
1453 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); | 1455 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); |
1454 if (client_) | 1456 if (client_) |
1455 client_->NotifyEndOfBitstreamBuffer(input_buffer_id); | 1457 client_->NotifyEndOfBitstreamBuffer(input_buffer_id); |
1456 } | 1458 } |
1457 | 1459 |
1458 void DXVAVideoDecodeAccelerator::NotifyFlushDone() { | 1460 void DXVAVideoDecodeAccelerator::NotifyFlushDone() { |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2187 D3DSURFACE_DESC surface_desc; | 2189 D3DSURFACE_DESC surface_desc; |
2188 hr = surface->GetDesc(&surface_desc); | 2190 hr = surface->GetDesc(&surface_desc); |
2189 RETURN_ON_HR_FAILURE(hr, "Failed to get surface description", false); | 2191 RETURN_ON_HR_FAILURE(hr, "Failed to get surface description", false); |
2190 *width = surface_desc.Width; | 2192 *width = surface_desc.Width; |
2191 *height = surface_desc.Height; | 2193 *height = surface_desc.Height; |
2192 } | 2194 } |
2193 return true; | 2195 return true; |
2194 } | 2196 } |
2195 | 2197 |
2196 } // namespace content | 2198 } // namespace content |
OLD | NEW |