Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: content/common/gpu/media/dxva_video_decode_accelerator.cc

Issue 1149203002: Extract re-usable InitializeMediaFoundation() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix linkage of InitializeMediaFoundation() in GN builds Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | media/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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"
32 #include "media/video/video_decode_accelerator.h" 33 #include "media/video/video_decode_accelerator.h"
33 #include "ui/gl/gl_bindings.h" 34 #include "ui/gl/gl_bindings.h"
34 #include "ui/gl/gl_context.h" 35 #include "ui/gl/gl_context.h"
35 #include "ui/gl/gl_surface_egl.h" 36 #include "ui/gl/gl_surface_egl.h"
36 #include "ui/gl/gl_switches.h" 37 #include "ui/gl/gl_switches.h"
37 38
38 namespace { 39 namespace {
39 40
40 // Path is appended on to the PROGRAM_FILES base path. 41 // Path is appended on to the PROGRAM_FILES base path.
41 const wchar_t kVPXDecoderDLLPath[] = L"Intel\\Media SDK\\"; 42 const wchar_t kVPXDecoderDLLPath[] = L"Intel\\Media SDK\\";
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 RETURN_AND_NOTIFY_ON_FAILURE( 592 RETURN_AND_NOTIFY_ON_FAILURE(
592 gfx::g_driver_egl.ext.b_EGL_ANGLE_surface_d3d_texture_2d_share_handle, 593 gfx::g_driver_egl.ext.b_EGL_ANGLE_surface_d3d_texture_2d_share_handle,
593 "EGL_ANGLE_surface_d3d_texture_2d_share_handle unavailable", 594 "EGL_ANGLE_surface_d3d_texture_2d_share_handle unavailable",
594 PLATFORM_FAILURE, 595 PLATFORM_FAILURE,
595 false); 596 false);
596 597
597 State state = GetState(); 598 State state = GetState();
598 RETURN_AND_NOTIFY_ON_FAILURE((state == kUninitialized), 599 RETURN_AND_NOTIFY_ON_FAILURE((state == kUninitialized),
599 "Initialize: invalid state: " << state, ILLEGAL_STATE, false); 600 "Initialize: invalid state: " << state, ILLEGAL_STATE, false);
600 601
601 HRESULT hr = MFStartup(MF_VERSION, MFSTARTUP_FULL); 602 media::InitializeMediaFoundation();
602 RETURN_AND_NOTIFY_ON_HR_FAILURE(hr, "MFStartup failed.", PLATFORM_FAILURE,
603 false);
604 603
605 RETURN_AND_NOTIFY_ON_FAILURE(InitDecoder(profile), 604 RETURN_AND_NOTIFY_ON_FAILURE(InitDecoder(profile),
606 "Failed to initialize decoder", PLATFORM_FAILURE, false); 605 "Failed to initialize decoder", PLATFORM_FAILURE, false);
607 606
608 RETURN_AND_NOTIFY_ON_FAILURE(GetStreamsInfoAndBufferReqs(), 607 RETURN_AND_NOTIFY_ON_FAILURE(GetStreamsInfoAndBufferReqs(),
609 "Failed to get input/output stream info.", PLATFORM_FAILURE, false); 608 "Failed to get input/output stream info.", PLATFORM_FAILURE, false);
610 609
611 RETURN_AND_NOTIFY_ON_FAILURE( 610 RETURN_AND_NOTIFY_ON_FAILURE(
612 SendMFTMessage(MFT_MESSAGE_NOTIFY_BEGIN_STREAMING, 0), 611 SendMFTMessage(MFT_MESSAGE_NOTIFY_BEGIN_STREAMING, 0),
613 "Send MFT_MESSAGE_NOTIFY_BEGIN_STREAMING notification failed", 612 "Send MFT_MESSAGE_NOTIFY_BEGIN_STREAMING notification failed",
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after
1440 d3d11_device_manager_.Release(); 1439 d3d11_device_manager_.Release();
1441 d3d11_query_.Release(); 1440 d3d11_query_.Release();
1442 dx11_video_format_converter_media_type_needs_init_ = true; 1441 dx11_video_format_converter_media_type_needs_init_ = true;
1443 } else { 1442 } else {
1444 d3d9_.Release(); 1443 d3d9_.Release();
1445 d3d9_device_ex_.Release(); 1444 d3d9_device_ex_.Release();
1446 device_manager_.Release(); 1445 device_manager_.Release();
1447 query_.Release(); 1446 query_.Release();
1448 } 1447 }
1449 1448
1450 MFShutdown();
1451 SetState(kUninitialized); 1449 SetState(kUninitialized);
1452 } 1450 }
1453 1451
1454 void DXVAVideoDecodeAccelerator::NotifyInputBufferRead(int input_buffer_id) { 1452 void DXVAVideoDecodeAccelerator::NotifyInputBufferRead(int input_buffer_id) {
1455 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); 1453 DCHECK(main_thread_task_runner_->BelongsToCurrentThread());
1456 if (client_) 1454 if (client_)
1457 client_->NotifyEndOfBitstreamBuffer(input_buffer_id); 1455 client_->NotifyEndOfBitstreamBuffer(input_buffer_id);
1458 } 1456 }
1459 1457
1460 void DXVAVideoDecodeAccelerator::NotifyFlushDone() { 1458 void DXVAVideoDecodeAccelerator::NotifyFlushDone() {
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
2189 D3DSURFACE_DESC surface_desc; 2187 D3DSURFACE_DESC surface_desc;
2190 hr = surface->GetDesc(&surface_desc); 2188 hr = surface->GetDesc(&surface_desc);
2191 RETURN_ON_HR_FAILURE(hr, "Failed to get surface description", false); 2189 RETURN_ON_HR_FAILURE(hr, "Failed to get surface description", false);
2192 *width = surface_desc.Width; 2190 *width = surface_desc.Width;
2193 *height = surface_desc.Height; 2191 *height = surface_desc.Height;
2194 } 2192 }
2195 return true; 2193 return true;
2196 } 2194 }
2197 2195
2198 } // namespace content 2196 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | media/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698