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_win.h" | 5 #include "content/common/gpu/media/dxva_video_decode_accelerator_win.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 |
| 11 #include <codecapi.h> | 11 #include <codecapi.h> |
| 12 #include <dxgi1_2.h> | 12 #include <dxgi1_2.h> |
| 13 #include <ks.h> | 13 #include <ks.h> |
| 14 #include <mfapi.h> | 14 #include <mfapi.h> |
| 15 #include <mferror.h> | 15 #include <mferror.h> |
| 16 #include <ntverp.h> | 16 #include <ntverp.h> |
| 17 #include <stddef.h> | 17 #include <stddef.h> |
| 18 #include <string.h> | 18 #include <string.h> |
| 19 #include <wmcodecdsp.h> | 19 #include <wmcodecdsp.h> |
| 20 | 20 |
| 21 #include "base/base_paths_win.h" | 21 #include "base/base_paths_win.h" |
| 22 #include "base/bind.h" | 22 #include "base/bind.h" |
| 23 #include "base/callback.h" | 23 #include "base/callback.h" |
| 24 #include "base/command_line.h" | |
| 24 #include "base/debug/alias.h" | 25 #include "base/debug/alias.h" |
| 25 #include "base/file_version_info.h" | 26 #include "base/file_version_info.h" |
| 26 #include "base/files/file_path.h" | 27 #include "base/files/file_path.h" |
| 27 #include "base/logging.h" | 28 #include "base/logging.h" |
| 28 #include "base/macros.h" | 29 #include "base/macros.h" |
| 29 #include "base/memory/scoped_ptr.h" | 30 #include "base/memory/scoped_ptr.h" |
| 30 #include "base/memory/shared_memory.h" | 31 #include "base/memory/shared_memory.h" |
| 31 #include "base/message_loop/message_loop.h" | 32 #include "base/message_loop/message_loop.h" |
| 32 #include "base/path_service.h" | 33 #include "base/path_service.h" |
| 33 #include "base/trace_event/trace_event.h" | 34 #include "base/trace_event/trace_event.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 #endif | 105 #endif |
| 105 | 106 |
| 106 // MF_XVP_PLAYBACK_MODE | 107 // MF_XVP_PLAYBACK_MODE |
| 107 // Data type: UINT32 (treat as BOOL) | 108 // Data type: UINT32 (treat as BOOL) |
| 108 // If this attribute is TRUE, the video processor will run in playback mode | 109 // If this attribute is TRUE, the video processor will run in playback mode |
| 109 // where it allows callers to allocate output samples and allows last frame | 110 // where it allows callers to allocate output samples and allows last frame |
| 110 // regeneration (repaint). | 111 // regeneration (repaint). |
| 111 DEFINE_GUID(MF_XVP_PLAYBACK_MODE, 0x3c5d293f, 0xad67, 0x4e29, 0xaf, 0x12, | 112 DEFINE_GUID(MF_XVP_PLAYBACK_MODE, 0x3c5d293f, 0xad67, 0x4e29, 0xaf, 0x12, |
| 112 0xcf, 0x3e, 0x23, 0x8a, 0xcc, 0xe9); | 113 0xcf, 0x3e, 0x23, 0x8a, 0xcc, 0xe9); |
| 113 | 114 |
| 115 // Defines the GUID for the Intel H264 DXVA device. | |
| 116 static const GUID DXVA2_Intel_ModeH264_E = { | |
| 117 0x604F8E68, 0x4951, 0x4c54,{ 0x88, 0xFE, 0xAB, 0xD2, 0x5C, 0x15, 0xB3, 0xD6} | |
| 118 }; | |
| 119 | |
| 114 // Provides scoped access to the underlying buffer in an IMFMediaBuffer | 120 // Provides scoped access to the underlying buffer in an IMFMediaBuffer |
| 115 // instance. | 121 // instance. |
| 116 class MediaBufferScopedPointer { | 122 class MediaBufferScopedPointer { |
| 117 public: | 123 public: |
| 118 MediaBufferScopedPointer(IMFMediaBuffer* media_buffer) | 124 MediaBufferScopedPointer(IMFMediaBuffer* media_buffer) |
| 119 : media_buffer_(media_buffer), | 125 : media_buffer_(media_buffer), |
| 120 buffer_(nullptr), | 126 buffer_(nullptr), |
| 121 max_length_(0), | 127 max_length_(0), |
| 122 current_length_(0) { | 128 current_length_(0) { |
| 123 HRESULT hr = media_buffer_->Lock(&buffer_, &max_length_, ¤t_length_); | 129 HRESULT hr = media_buffer_->Lock(&buffer_, &max_length_, ¤t_length_); |
| (...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1000 hr = query_->Issue(D3DISSUE_END); | 1006 hr = query_->Issue(D3DISSUE_END); |
| 1001 RETURN_ON_HR_FAILURE(hr, "Failed to issue END test query", false); | 1007 RETURN_ON_HR_FAILURE(hr, "Failed to issue END test query", false); |
| 1002 return true; | 1008 return true; |
| 1003 } | 1009 } |
| 1004 | 1010 |
| 1005 bool DXVAVideoDecodeAccelerator::CreateDX11DevManager() { | 1011 bool DXVAVideoDecodeAccelerator::CreateDX11DevManager() { |
| 1006 HRESULT hr = create_dxgi_device_manager_(&dx11_dev_manager_reset_token_, | 1012 HRESULT hr = create_dxgi_device_manager_(&dx11_dev_manager_reset_token_, |
| 1007 d3d11_device_manager_.Receive()); | 1013 d3d11_device_manager_.Receive()); |
| 1008 RETURN_ON_HR_FAILURE(hr, "MFCreateDXGIDeviceManager failed", false); | 1014 RETURN_ON_HR_FAILURE(hr, "MFCreateDXGIDeviceManager failed", false); |
| 1009 | 1015 |
| 1010 // This array defines the set of DirectX hardware feature levels we support. | 1016 hr = CreateD3D11DeviceHelper(d3d11_device_.Receive(), |
| 1011 // The ordering MUST be preserved. All applications are assumed to support | 1017 d3d11_device_context_.Receive()); |
| 1012 // 9.1 unless otherwise stated by the application. | 1018 RETURN_ON_HR_FAILURE(hr, "Failed to create D3D11 device", false) |
| 1013 D3D_FEATURE_LEVEL feature_levels[] = { | |
| 1014 D3D_FEATURE_LEVEL_11_1, | |
| 1015 D3D_FEATURE_LEVEL_11_0, | |
| 1016 D3D_FEATURE_LEVEL_10_1, | |
| 1017 D3D_FEATURE_LEVEL_10_0, | |
| 1018 D3D_FEATURE_LEVEL_9_3, | |
| 1019 D3D_FEATURE_LEVEL_9_2, | |
| 1020 D3D_FEATURE_LEVEL_9_1 | |
| 1021 }; | |
| 1022 | |
| 1023 UINT flags = D3D11_CREATE_DEVICE_VIDEO_SUPPORT; | |
| 1024 | |
| 1025 #if defined _DEBUG | |
| 1026 flags |= D3D11_CREATE_DEVICE_DEBUG; | |
| 1027 #endif | |
| 1028 | |
| 1029 D3D_FEATURE_LEVEL feature_level_out = D3D_FEATURE_LEVEL_11_0; | |
| 1030 hr = D3D11CreateDevice(NULL, | |
| 1031 D3D_DRIVER_TYPE_HARDWARE, | |
| 1032 NULL, | |
| 1033 flags, | |
| 1034 feature_levels, | |
| 1035 arraysize(feature_levels), | |
| 1036 D3D11_SDK_VERSION, | |
| 1037 d3d11_device_.Receive(), | |
| 1038 &feature_level_out, | |
| 1039 d3d11_device_context_.Receive()); | |
| 1040 RETURN_ON_HR_FAILURE(hr, "Failed to create DX11 device", false); | |
| 1041 | 1019 |
| 1042 // Enable multithreaded mode on the device. This ensures that accesses to | 1020 // Enable multithreaded mode on the device. This ensures that accesses to |
| 1043 // context are synchronized across threads. We have multiple threads | 1021 // context are synchronized across threads. We have multiple threads |
| 1044 // accessing the context, the media foundation decoder threads and the | 1022 // accessing the context, the media foundation decoder threads and the |
| 1045 // decoder thread via the video format conversion transform. | 1023 // decoder thread via the video format conversion transform. |
| 1046 hr = multi_threaded_.QueryFrom(d3d11_device_.get()); | 1024 hr = multi_threaded_.QueryFrom(d3d11_device_.get()); |
| 1047 RETURN_ON_HR_FAILURE(hr, "Failed to query ID3D10Multithread", false); | 1025 RETURN_ON_HR_FAILURE(hr, "Failed to query ID3D10Multithread", false); |
| 1048 multi_threaded_->SetMultithreadProtected(TRUE); | 1026 multi_threaded_->SetMultithreadProtected(TRUE); |
| 1049 | 1027 |
| 1050 hr = d3d11_device_manager_->ResetDevice(d3d11_device_.get(), | 1028 hr = d3d11_device_manager_->ResetDevice(d3d11_device_.get(), |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1337 GLenum DXVAVideoDecodeAccelerator::GetSurfaceInternalFormat() const { | 1315 GLenum DXVAVideoDecodeAccelerator::GetSurfaceInternalFormat() const { |
| 1338 return GL_BGRA_EXT; | 1316 return GL_BGRA_EXT; |
| 1339 } | 1317 } |
| 1340 | 1318 |
| 1341 // static | 1319 // static |
| 1342 media::VideoDecodeAccelerator::SupportedProfiles | 1320 media::VideoDecodeAccelerator::SupportedProfiles |
| 1343 DXVAVideoDecodeAccelerator::GetSupportedProfiles() { | 1321 DXVAVideoDecodeAccelerator::GetSupportedProfiles() { |
| 1344 // TODO(henryhsu): Need to ensure the profiles are actually supported. | 1322 // TODO(henryhsu): Need to ensure the profiles are actually supported. |
| 1345 SupportedProfiles profiles; | 1323 SupportedProfiles profiles; |
| 1346 for (const auto& supported_profile : kSupportedProfiles) { | 1324 for (const auto& supported_profile : kSupportedProfiles) { |
| 1325 std::pair<int, int> min_resolution = GetMinResolution(supported_profile); | |
|
sandersd (OOO until July 31)
2016/04/01 01:38:52
Please measure how much time this adds to browser
ananta
2016/04/01 03:28:16
I added TRACE_EVENT calls around this callstack to
| |
| 1326 std::pair<int, int> max_resolution = GetMaxResolution(supported_profile); | |
| 1327 | |
| 1347 SupportedProfile profile; | 1328 SupportedProfile profile; |
| 1348 profile.profile = supported_profile; | 1329 profile.profile = supported_profile; |
| 1349 // Windows Media Foundation H.264 decoding does not support decoding videos | 1330 profile.min_resolution.SetSize(min_resolution.first, min_resolution.second); |
| 1350 // with any dimension smaller than 48 pixels: | 1331 profile.max_resolution.SetSize(max_resolution.first, max_resolution.second); |
| 1351 // http://msdn.microsoft.com/en-us/library/windows/desktop/dd797815 | |
| 1352 profile.min_resolution.SetSize(48, 48); | |
| 1353 // Use 1088 to account for 16x16 macroblocks. | |
| 1354 profile.max_resolution.SetSize(1920, 1088); | |
| 1355 profiles.push_back(profile); | 1332 profiles.push_back(profile); |
| 1356 } | 1333 } |
| 1357 return profiles; | 1334 return profiles; |
| 1358 } | 1335 } |
| 1359 | 1336 |
| 1360 // static | 1337 // static |
| 1361 void DXVAVideoDecodeAccelerator::PreSandboxInitialization() { | 1338 void DXVAVideoDecodeAccelerator::PreSandboxInitialization() { |
| 1362 ::LoadLibrary(L"MFPlat.dll"); | 1339 ::LoadLibrary(L"MFPlat.dll"); |
| 1363 ::LoadLibrary(L"msmpeg2vdec.dll"); | 1340 ::LoadLibrary(L"msmpeg2vdec.dll"); |
| 1364 ::LoadLibrary(L"mf.dll"); | 1341 ::LoadLibrary(L"mf.dll"); |
| 1365 ::LoadLibrary(L"dxva2.dll"); | 1342 ::LoadLibrary(L"dxva2.dll"); |
| 1366 | 1343 |
| 1367 if (base::win::GetVersion() > base::win::VERSION_WIN7) { | 1344 if (base::win::GetVersion() > base::win::VERSION_WIN7) { |
| 1368 LoadLibrary(L"msvproc.dll"); | 1345 LoadLibrary(L"msvproc.dll"); |
| 1369 } else { | 1346 } else { |
| 1370 #if defined(ENABLE_DX11_FOR_WIN7) | 1347 #if defined(ENABLE_DX11_FOR_WIN7) |
| 1371 LoadLibrary(L"mshtmlmedia.dll"); | 1348 LoadLibrary(L"mshtmlmedia.dll"); |
| 1372 #endif | 1349 #endif |
| 1373 } | 1350 } |
| 1374 } | 1351 } |
| 1375 | 1352 |
| 1353 // static | |
| 1354 std::pair<int, int> DXVAVideoDecodeAccelerator::GetMinResolution( | |
| 1355 media::VideoCodecProfile profile) { | |
| 1356 std::pair<int, int> min_resolution; | |
| 1357 if (profile >= media::H264PROFILE_BASELINE && | |
| 1358 profile <= media::H264PROFILE_HIGH) { | |
| 1359 // Windows Media Foundation H.264 decoding does not support decoding videos | |
| 1360 // with any dimension smaller than 48 pixels: | |
| 1361 // http://msdn.microsoft.com/en-us/library/windows/desktop/dd797815 | |
| 1362 min_resolution = std::make_pair(48, 48); | |
| 1363 } else { | |
| 1364 // TODO(ananta) | |
| 1365 // Detect this properly for VP8/VP9 profiles. | |
| 1366 min_resolution = std::make_pair(16, 16); | |
| 1367 } | |
| 1368 return min_resolution; | |
| 1369 } | |
| 1370 | |
| 1371 // static | |
| 1372 std::pair<int, int> DXVAVideoDecodeAccelerator::GetMaxResolution( | |
| 1373 const media::VideoCodecProfile profile) { | |
| 1374 std::pair<int, int> max_resolution; | |
| 1375 if (profile >= media::H264PROFILE_BASELINE && | |
| 1376 profile <= media::H264PROFILE_HIGH) { | |
| 1377 max_resolution = GetMaxH264Resolution(); | |
| 1378 } | |
| 1379 else { | |
| 1380 // TODO(ananta) | |
| 1381 // Detect this properly for VP8/VP9 profiles. | |
| 1382 max_resolution = std::make_pair(4096, 2160); | |
| 1383 } | |
| 1384 return max_resolution; | |
| 1385 } | |
| 1386 | |
| 1387 std::pair<int, int> DXVAVideoDecodeAccelerator::GetMaxH264Resolution() { | |
| 1388 // The H.264 resolution detection operation is expensive. This static flag | |
| 1389 // allows us to run the detection once. | |
| 1390 static bool resolution_detected = false; | |
| 1391 // Use 1088 to account for 16x16 macroblocks. | |
| 1392 static std::pair<int, int> max_resolution = std::make_pair(1920, 1088); | |
| 1393 if (resolution_detected) | |
| 1394 return max_resolution; | |
| 1395 | |
| 1396 resolution_detected = true; | |
| 1397 | |
| 1398 // On Windows 7 the maximum resolution supported by media foundation is | |
| 1399 // 1920 x 1088. On Windows 8+ if we are running with D3D11 disabled, we | |
| 1400 // fallback to the above resolution. | |
| 1401 if (base::win::GetVersion() == base::win::VERSION_WIN7 || | |
| 1402 base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 1403 switches::kDisableD3D11)) { | |
|
jbauman
2016/04/01 01:23:49
Probably don't need to check the command-line swit
ananta
2016/04/01 01:37:06
Done.
| |
| 1404 return max_resolution; | |
| 1405 } | |
| 1406 | |
| 1407 // To detect if a driver supports the desired resolutions, we try and create | |
| 1408 // a DXVA decoder instance for that resolution and profile. If that succeeds | |
| 1409 // we assume that the driver supports H/W H.264 decoding for that resolution. | |
| 1410 HRESULT hr = E_FAIL; | |
| 1411 | |
| 1412 base::win::ScopedComPtr<ID3D11Device> device = | |
| 1413 QueryDeviceObjectFromANGLE<ID3D11Device>(EGL_D3D11_DEVICE_ANGLE); | |
| 1414 if (!device.get()) { | |
| 1415 hr = CreateD3D11DeviceHelper(device.Receive(), nullptr); | |
|
jbauman
2016/04/01 01:23:49
I don't think we should bother trying to create ou
ananta
2016/04/01 01:37:06
Done.
| |
| 1416 if (FAILED(hr)) { | |
| 1417 CHECK(false); | |
| 1418 return max_resolution; | |
| 1419 } | |
| 1420 } | |
| 1421 | |
| 1422 base::win::ScopedComPtr<ID3D11VideoDevice> video_device; | |
| 1423 hr = device.QueryInterface(IID_ID3D11VideoDevice, | |
| 1424 video_device.ReceiveVoid()); | |
| 1425 if (FAILED(hr)) { | |
| 1426 CHECK(false); | |
| 1427 return max_resolution; | |
| 1428 } | |
| 1429 | |
| 1430 // Enumerate supported video profiles and look for the H264 profile. | |
| 1431 GUID decoder_guid = {}; | |
| 1432 bool found = false; | |
| 1433 UINT profile_count = video_device->GetVideoDecoderProfileCount(); | |
| 1434 for (UINT profile_idx = 0; profile_idx < profile_count; profile_idx++) { | |
| 1435 GUID profile_id = {}; | |
| 1436 hr = video_device->GetVideoDecoderProfile(profile_idx, &profile_id); | |
| 1437 if (SUCCEEDED(hr) && | |
| 1438 (profile_id == DXVA2_ModeH264_E || | |
| 1439 profile_id == DXVA2_Intel_ModeH264_E)) { | |
| 1440 decoder_guid = profile_id; | |
| 1441 found = true; | |
| 1442 break; | |
| 1443 } | |
| 1444 } | |
| 1445 | |
| 1446 if (!found) { | |
| 1447 CHECK(false); | |
| 1448 return max_resolution; | |
| 1449 } | |
| 1450 | |
| 1451 // We look for the following resolutions in the driver. | |
| 1452 // TODO(ananta) | |
| 1453 // Look into whether this list needs to be expanded. | |
| 1454 static std::pair<int, int> resolution_array[] = { | |
| 1455 // Use 1088 to account for 16x16 macroblocks. | |
| 1456 std::make_pair(1920, 1088), | |
| 1457 std::make_pair(2560, 1440), | |
| 1458 std::make_pair(3840, 2160), | |
| 1459 std::make_pair(4096, 2160), | |
| 1460 std::make_pair(4096, 2304), | |
| 1461 }; | |
| 1462 | |
| 1463 for (size_t res_idx = 0; res_idx < arraysize(resolution_array); | |
| 1464 res_idx++) { | |
| 1465 D3D11_VIDEO_DECODER_DESC desc = {}; | |
| 1466 desc.Guid = decoder_guid; | |
| 1467 desc.SampleWidth = resolution_array[res_idx].first; | |
| 1468 desc.SampleHeight = resolution_array[res_idx].second; | |
| 1469 desc.OutputFormat = DXGI_FORMAT_NV12; | |
| 1470 UINT config_count = 0; | |
| 1471 hr = video_device->GetVideoDecoderConfigCount(&desc, &config_count); | |
| 1472 if (FAILED(hr) || config_count == 0) | |
| 1473 return max_resolution; | |
| 1474 | |
| 1475 for (UINT config_idx = 0; config_idx < config_count; config_idx++) { | |
| 1476 D3D11_VIDEO_DECODER_CONFIG config = {}; | |
| 1477 hr = video_device->GetVideoDecoderConfig(&desc, config_idx, &config); | |
| 1478 if (FAILED(hr)) | |
| 1479 return max_resolution; | |
| 1480 base::win::ScopedComPtr<ID3D11VideoDecoder> video_decoder; | |
| 1481 hr = video_device->CreateVideoDecoder(&desc, &config, | |
| 1482 video_decoder.Receive()); | |
| 1483 if (!video_decoder.get()) | |
| 1484 return max_resolution; | |
| 1485 max_resolution = resolution_array[res_idx]; | |
| 1486 } | |
| 1487 } | |
| 1488 return max_resolution; | |
| 1489 } | |
| 1490 | |
| 1491 // static | |
| 1492 HRESULT DXVAVideoDecodeAccelerator::CreateD3D11DeviceHelper( | |
| 1493 ID3D11Device** device, | |
| 1494 ID3D11DeviceContext** context) { | |
| 1495 if (!device) | |
| 1496 return E_INVALIDARG; | |
| 1497 // This array defines the set of DirectX hardware feature levels we support. | |
| 1498 // The ordering MUST be preserved. All applications are assumed to support | |
| 1499 // 9.1 unless otherwise stated by the application. | |
| 1500 D3D_FEATURE_LEVEL feature_levels[] = { | |
| 1501 D3D_FEATURE_LEVEL_11_1, | |
| 1502 D3D_FEATURE_LEVEL_11_0, | |
| 1503 D3D_FEATURE_LEVEL_10_1, | |
| 1504 D3D_FEATURE_LEVEL_10_0, | |
| 1505 D3D_FEATURE_LEVEL_9_3, | |
| 1506 D3D_FEATURE_LEVEL_9_2, | |
| 1507 D3D_FEATURE_LEVEL_9_1 | |
| 1508 }; | |
| 1509 | |
| 1510 UINT flags = D3D11_CREATE_DEVICE_VIDEO_SUPPORT; | |
| 1511 | |
| 1512 #if defined _DEBUG | |
| 1513 flags |= D3D11_CREATE_DEVICE_DEBUG; | |
| 1514 #endif | |
| 1515 | |
| 1516 D3D_FEATURE_LEVEL feature_level_out = D3D_FEATURE_LEVEL_11_0; | |
| 1517 HRESULT hr = D3D11CreateDevice(NULL, | |
| 1518 D3D_DRIVER_TYPE_HARDWARE, | |
| 1519 NULL, | |
| 1520 flags, | |
| 1521 feature_levels, | |
| 1522 arraysize(feature_levels), | |
| 1523 D3D11_SDK_VERSION, | |
| 1524 device, | |
| 1525 &feature_level_out, | |
| 1526 context); | |
| 1527 return hr; | |
| 1528 } | |
| 1529 | |
| 1376 bool DXVAVideoDecodeAccelerator::InitDecoder(media::VideoCodecProfile profile) { | 1530 bool DXVAVideoDecodeAccelerator::InitDecoder(media::VideoCodecProfile profile) { |
| 1377 HMODULE decoder_dll = NULL; | 1531 HMODULE decoder_dll = NULL; |
| 1378 | 1532 |
| 1379 CLSID clsid = {}; | 1533 CLSID clsid = {}; |
| 1380 | 1534 |
| 1381 // Profile must fall within the valid range for one of the supported codecs. | 1535 // Profile must fall within the valid range for one of the supported codecs. |
| 1382 if (profile >= media::H264PROFILE_MIN && profile <= media::H264PROFILE_MAX) { | 1536 if (profile >= media::H264PROFILE_MIN && profile <= media::H264PROFILE_MAX) { |
| 1383 // We mimic the steps CoCreateInstance uses to instantiate the object. This | 1537 // We mimic the steps CoCreateInstance uses to instantiate the object. This |
| 1384 // was previously done because it failed inside the sandbox, and now is done | 1538 // was previously done because it failed inside the sandbox, and now is done |
| 1385 // as a more minimal approach to avoid other side-effects CCI might have (as | 1539 // as a more minimal approach to avoid other side-effects CCI might have (as |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1730 OutputBuffers::iterator index; | 1884 OutputBuffers::iterator index; |
| 1731 | 1885 |
| 1732 for (index = output_picture_buffers_.begin(); | 1886 for (index = output_picture_buffers_.begin(); |
| 1733 index != output_picture_buffers_.end() && | 1887 index != output_picture_buffers_.end() && |
| 1734 OutputSamplesPresent(); | 1888 OutputSamplesPresent(); |
| 1735 ++index) { | 1889 ++index) { |
| 1736 if (index->second->available()) { | 1890 if (index->second->available()) { |
| 1737 PendingSampleInfo* pending_sample = NULL; | 1891 PendingSampleInfo* pending_sample = NULL; |
| 1738 { | 1892 { |
| 1739 base::AutoLock lock(decoder_lock_); | 1893 base::AutoLock lock(decoder_lock_); |
| 1740 | |
| 1741 PendingSampleInfo& sample_info = pending_output_samples_.front(); | 1894 PendingSampleInfo& sample_info = pending_output_samples_.front(); |
| 1742 if (sample_info.picture_buffer_id != -1) | 1895 if (sample_info.picture_buffer_id != -1) |
| 1743 continue; | 1896 continue; |
| 1744 pending_sample = &sample_info; | 1897 pending_sample = &sample_info; |
| 1745 } | 1898 } |
| 1746 | 1899 |
| 1747 int width = 0; | 1900 int width = 0; |
| 1748 int height = 0; | 1901 int height = 0; |
| 1749 if (!GetVideoFrameDimensions(pending_sample->output_sample.get(), | 1902 if (!GetVideoFrameDimensions(pending_sample->output_sample.get(), |
| 1750 &width, &height)) { | 1903 &width, &height)) { |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2656 DismissStaleBuffers(true); | 2809 DismissStaleBuffers(true); |
| 2657 Invalidate(); | 2810 Invalidate(); |
| 2658 Initialize(config_, client_); | 2811 Initialize(config_, client_); |
| 2659 decoder_thread_task_runner_->PostTask( | 2812 decoder_thread_task_runner_->PostTask( |
| 2660 FROM_HERE, | 2813 FROM_HERE, |
| 2661 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, | 2814 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, |
| 2662 base::Unretained(this))); | 2815 base::Unretained(this))); |
| 2663 } | 2816 } |
| 2664 | 2817 |
| 2665 } // namespace content | 2818 } // namespace content |
| OLD | NEW |