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 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 #endif | 104 #endif |
| 105 | 105 |
| 106 // MF_XVP_PLAYBACK_MODE | 106 // MF_XVP_PLAYBACK_MODE |
| 107 // Data type: UINT32 (treat as BOOL) | 107 // Data type: UINT32 (treat as BOOL) |
| 108 // If this attribute is TRUE, the video processor will run in playback mode | 108 // 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 | 109 // where it allows callers to allocate output samples and allows last frame |
| 110 // regeneration (repaint). | 110 // regeneration (repaint). |
| 111 DEFINE_GUID(MF_XVP_PLAYBACK_MODE, 0x3c5d293f, 0xad67, 0x4e29, 0xaf, 0x12, | 111 DEFINE_GUID(MF_XVP_PLAYBACK_MODE, 0x3c5d293f, 0xad67, 0x4e29, 0xaf, 0x12, |
| 112 0xcf, 0x3e, 0x23, 0x8a, 0xcc, 0xe9); | 112 0xcf, 0x3e, 0x23, 0x8a, 0xcc, 0xe9); |
| 113 | 113 |
| 114 // Defines the GUID for the Intel H264 DXVA device. | |
| 115 static const GUID DXVA2_Intel_ModeH264_E = { | |
| 116 0x604F8E68, 0x4951, 0x4c54,{ 0x88, 0xFE, 0xAB, 0xD2, 0x5C, 0x15, 0xB3, 0xD6} | |
| 117 }; | |
| 118 | |
| 114 // Provides scoped access to the underlying buffer in an IMFMediaBuffer | 119 // Provides scoped access to the underlying buffer in an IMFMediaBuffer |
| 115 // instance. | 120 // instance. |
| 116 class MediaBufferScopedPointer { | 121 class MediaBufferScopedPointer { |
| 117 public: | 122 public: |
| 118 MediaBufferScopedPointer(IMFMediaBuffer* media_buffer) | 123 MediaBufferScopedPointer(IMFMediaBuffer* media_buffer) |
| 119 : media_buffer_(media_buffer), | 124 : media_buffer_(media_buffer), |
| 120 buffer_(nullptr), | 125 buffer_(nullptr), |
| 121 max_length_(0), | 126 max_length_(0), |
| 122 current_length_(0) { | 127 current_length_(0) { |
| 123 HRESULT hr = media_buffer_->Lock(&buffer_, &max_length_, ¤t_length_); | 128 HRESULT hr = media_buffer_->Lock(&buffer_, &max_length_, ¤t_length_); |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 310 return hr; | 315 return hr; |
| 311 } | 316 } |
| 312 | 317 |
| 313 // Helper function to query the ANGLE device object. The template argument T | 318 // Helper function to query the ANGLE device object. The template argument T |
| 314 // identifies the device interface being queried. IDirect3DDevice9Ex for d3d9 | 319 // identifies the device interface being queried. IDirect3DDevice9Ex for d3d9 |
| 315 // and ID3D11Device for dx11. | 320 // and ID3D11Device for dx11. |
| 316 template<class T> | 321 template<class T> |
| 317 base::win::ScopedComPtr<T> QueryDeviceObjectFromANGLE(int object_type) { | 322 base::win::ScopedComPtr<T> QueryDeviceObjectFromANGLE(int object_type) { |
| 318 base::win::ScopedComPtr<T> device_object; | 323 base::win::ScopedComPtr<T> device_object; |
| 319 | 324 |
| 325 TRACE_EVENT0("gpu", "QueryDeviceObjectFromANGLE. GetHardwareDisplay"); | |
| 326 | |
| 320 EGLDisplay egl_display = gfx::GLSurfaceEGL::GetHardwareDisplay(); | 327 EGLDisplay egl_display = gfx::GLSurfaceEGL::GetHardwareDisplay(); |
| 321 intptr_t egl_device = 0; | 328 intptr_t egl_device = 0; |
| 322 intptr_t device = 0; | 329 intptr_t device = 0; |
| 323 | 330 |
| 324 RETURN_ON_FAILURE( | 331 RETURN_ON_FAILURE( |
| 325 gfx::GLSurfaceEGL::HasEGLExtension("EGL_EXT_device_query"), | 332 gfx::GLSurfaceEGL::HasEGLExtension("EGL_EXT_device_query"), |
| 326 "EGL_EXT_device_query missing", | 333 "EGL_EXT_device_query missing", |
| 327 device_object); | 334 device_object); |
| 328 | 335 |
| 336 TRACE_EVENT0("gpu", "QueryDeviceObjectFromANGLE. eglGetProcAddress"); | |
| 337 | |
| 329 PFNEGLQUERYDISPLAYATTRIBEXTPROC QueryDisplayAttribEXT = | 338 PFNEGLQUERYDISPLAYATTRIBEXTPROC QueryDisplayAttribEXT = |
| 330 reinterpret_cast<PFNEGLQUERYDISPLAYATTRIBEXTPROC>(eglGetProcAddress( | 339 reinterpret_cast<PFNEGLQUERYDISPLAYATTRIBEXTPROC>(eglGetProcAddress( |
| 331 "eglQueryDisplayAttribEXT")); | 340 "eglQueryDisplayAttribEXT")); |
| 332 | 341 |
| 333 RETURN_ON_FAILURE( | 342 RETURN_ON_FAILURE( |
| 334 QueryDisplayAttribEXT, | 343 QueryDisplayAttribEXT, |
| 335 "Failed to get the eglQueryDisplayAttribEXT function from ANGLE", | 344 "Failed to get the eglQueryDisplayAttribEXT function from ANGLE", |
| 336 device_object); | 345 device_object); |
| 337 | 346 |
| 347 TRACE_EVENT0("gpu", "QueryDeviceObjectFromANGLE. eglGetProcAddress"); | |
| 348 | |
| 338 PFNEGLQUERYDEVICEATTRIBEXTPROC QueryDeviceAttribEXT = | 349 PFNEGLQUERYDEVICEATTRIBEXTPROC QueryDeviceAttribEXT = |
| 339 reinterpret_cast<PFNEGLQUERYDEVICEATTRIBEXTPROC>(eglGetProcAddress( | 350 reinterpret_cast<PFNEGLQUERYDEVICEATTRIBEXTPROC>(eglGetProcAddress( |
| 340 "eglQueryDeviceAttribEXT")); | 351 "eglQueryDeviceAttribEXT")); |
| 341 | 352 |
| 342 RETURN_ON_FAILURE( | 353 RETURN_ON_FAILURE( |
| 343 QueryDeviceAttribEXT, | 354 QueryDeviceAttribEXT, |
| 344 "Failed to get the eglQueryDeviceAttribEXT function from ANGLE", | 355 "Failed to get the eglQueryDeviceAttribEXT function from ANGLE", |
| 345 device_object); | 356 device_object); |
| 346 | 357 |
| 358 TRACE_EVENT0("gpu", "QueryDeviceObjectFromANGLE. QueryDisplayAttribEXT"); | |
| 359 | |
| 347 RETURN_ON_FAILURE( | 360 RETURN_ON_FAILURE( |
| 348 QueryDisplayAttribEXT(egl_display, EGL_DEVICE_EXT, &egl_device), | 361 QueryDisplayAttribEXT(egl_display, EGL_DEVICE_EXT, &egl_device), |
| 349 "The eglQueryDisplayAttribEXT function failed to get the EGL device", | 362 "The eglQueryDisplayAttribEXT function failed to get the EGL device", |
| 350 device_object); | 363 device_object); |
| 351 | 364 |
| 352 RETURN_ON_FAILURE( | 365 RETURN_ON_FAILURE( |
| 353 egl_device, | 366 egl_device, |
| 354 "Failed to get the EGL device", | 367 "Failed to get the EGL device", |
| 355 device_object); | 368 device_object); |
| 356 | 369 |
| 370 TRACE_EVENT0("gpu", "QueryDeviceObjectFromANGLE. QueryDisplayAttribEXT"); | |
| 371 | |
| 357 RETURN_ON_FAILURE( | 372 RETURN_ON_FAILURE( |
| 358 QueryDeviceAttribEXT( | 373 QueryDeviceAttribEXT( |
| 359 reinterpret_cast<EGLDeviceEXT>(egl_device), object_type, &device), | 374 reinterpret_cast<EGLDeviceEXT>(egl_device), object_type, &device), |
| 360 "The eglQueryDeviceAttribEXT function failed to get the device", | 375 "The eglQueryDeviceAttribEXT function failed to get the device", |
| 361 device_object); | 376 device_object); |
| 362 | 377 |
| 363 RETURN_ON_FAILURE(device, "Failed to get the ANGLE device", device_object); | 378 RETURN_ON_FAILURE(device, "Failed to get the ANGLE device", device_object); |
| 364 | 379 |
| 380 TRACE_EVENT0("gpu", "QueryDeviceObjectFromANGLE. Device object assignment"); | |
| 365 device_object = reinterpret_cast<T*>(device); | 381 device_object = reinterpret_cast<T*>(device); |
| 366 return device_object; | 382 return device_object; |
| 367 } | 383 } |
| 368 | 384 |
| 369 H264ConfigChangeDetector::H264ConfigChangeDetector() | 385 H264ConfigChangeDetector::H264ConfigChangeDetector() |
| 370 : last_sps_id_(0), | 386 : last_sps_id_(0), |
| 371 last_pps_id_(0), | 387 last_pps_id_(0), |
| 372 config_changed_(false), | 388 config_changed_(false), |
| 373 pending_config_changed_(false) { | 389 pending_config_changed_(false) { |
| 374 } | 390 } |
| (...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1334 return false; | 1350 return false; |
| 1335 } | 1351 } |
| 1336 | 1352 |
| 1337 GLenum DXVAVideoDecodeAccelerator::GetSurfaceInternalFormat() const { | 1353 GLenum DXVAVideoDecodeAccelerator::GetSurfaceInternalFormat() const { |
| 1338 return GL_BGRA_EXT; | 1354 return GL_BGRA_EXT; |
| 1339 } | 1355 } |
| 1340 | 1356 |
| 1341 // static | 1357 // static |
| 1342 media::VideoDecodeAccelerator::SupportedProfiles | 1358 media::VideoDecodeAccelerator::SupportedProfiles |
| 1343 DXVAVideoDecodeAccelerator::GetSupportedProfiles() { | 1359 DXVAVideoDecodeAccelerator::GetSupportedProfiles() { |
| 1360 TRACE_EVENT0("gpu,startup", | |
| 1361 "DXVAVideoDecodeAccelerator::GetSupportedProfiles"); | |
| 1362 | |
| 1344 // TODO(henryhsu): Need to ensure the profiles are actually supported. | 1363 // TODO(henryhsu): Need to ensure the profiles are actually supported. |
| 1345 SupportedProfiles profiles; | 1364 SupportedProfiles profiles; |
| 1346 for (const auto& supported_profile : kSupportedProfiles) { | 1365 for (const auto& supported_profile : kSupportedProfiles) { |
| 1366 std::pair<int, int> min_resolution = GetMinResolution(supported_profile); | |
| 1367 std::pair<int, int> max_resolution = GetMaxResolution(supported_profile); | |
| 1368 | |
| 1347 SupportedProfile profile; | 1369 SupportedProfile profile; |
| 1348 profile.profile = supported_profile; | 1370 profile.profile = supported_profile; |
| 1349 // Windows Media Foundation H.264 decoding does not support decoding videos | 1371 profile.min_resolution.SetSize(min_resolution.first, min_resolution.second); |
| 1350 // with any dimension smaller than 48 pixels: | 1372 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); | 1373 profiles.push_back(profile); |
| 1356 } | 1374 } |
| 1357 return profiles; | 1375 return profiles; |
| 1358 } | 1376 } |
| 1359 | 1377 |
| 1360 // static | 1378 // static |
| 1361 void DXVAVideoDecodeAccelerator::PreSandboxInitialization() { | 1379 void DXVAVideoDecodeAccelerator::PreSandboxInitialization() { |
| 1362 ::LoadLibrary(L"MFPlat.dll"); | 1380 ::LoadLibrary(L"MFPlat.dll"); |
| 1363 ::LoadLibrary(L"msmpeg2vdec.dll"); | 1381 ::LoadLibrary(L"msmpeg2vdec.dll"); |
| 1364 ::LoadLibrary(L"mf.dll"); | 1382 ::LoadLibrary(L"mf.dll"); |
| 1365 ::LoadLibrary(L"dxva2.dll"); | 1383 ::LoadLibrary(L"dxva2.dll"); |
| 1366 | 1384 |
| 1367 if (base::win::GetVersion() > base::win::VERSION_WIN7) { | 1385 if (base::win::GetVersion() > base::win::VERSION_WIN7) { |
| 1368 LoadLibrary(L"msvproc.dll"); | 1386 LoadLibrary(L"msvproc.dll"); |
| 1369 } else { | 1387 } else { |
| 1370 #if defined(ENABLE_DX11_FOR_WIN7) | 1388 #if defined(ENABLE_DX11_FOR_WIN7) |
| 1371 LoadLibrary(L"mshtmlmedia.dll"); | 1389 LoadLibrary(L"mshtmlmedia.dll"); |
| 1372 #endif | 1390 #endif |
| 1373 } | 1391 } |
| 1374 } | 1392 } |
| 1375 | 1393 |
| 1394 // static | |
| 1395 std::pair<int, int> DXVAVideoDecodeAccelerator::GetMinResolution( | |
| 1396 media::VideoCodecProfile profile) { | |
| 1397 TRACE_EVENT0("gpu,startup", | |
| 1398 "DXVAVideoDecodeAccelerator::GetMinResolution"); | |
| 1399 std::pair<int, int> min_resolution; | |
| 1400 if (profile >= media::H264PROFILE_BASELINE && | |
| 1401 profile <= media::H264PROFILE_HIGH) { | |
| 1402 // Windows Media Foundation H.264 decoding does not support decoding videos | |
| 1403 // with any dimension smaller than 48 pixels: | |
| 1404 // http://msdn.microsoft.com/en-us/library/windows/desktop/dd797815 | |
| 1405 min_resolution = std::make_pair(48, 48); | |
| 1406 } else { | |
| 1407 // TODO(ananta) | |
| 1408 // Detect this properly for VP8/VP9 profiles. | |
| 1409 min_resolution = std::make_pair(16, 16); | |
| 1410 } | |
| 1411 return min_resolution; | |
| 1412 } | |
| 1413 | |
| 1414 // static | |
| 1415 std::pair<int, int> DXVAVideoDecodeAccelerator::GetMaxResolution( | |
| 1416 const media::VideoCodecProfile profile) { | |
| 1417 TRACE_EVENT0("gpu,startup", | |
| 1418 "DXVAVideoDecodeAccelerator::GetMaxResolution"); | |
| 1419 std::pair<int, int> max_resolution; | |
| 1420 if (profile >= media::H264PROFILE_BASELINE && | |
| 1421 profile <= media::H264PROFILE_HIGH) { | |
| 1422 max_resolution = GetMaxH264Resolution(); | |
| 1423 } else { | |
| 1424 // TODO(ananta) | |
| 1425 // Detect this properly for VP8/VP9 profiles. | |
| 1426 max_resolution = std::make_pair(4096, 2160); | |
| 1427 } | |
| 1428 return max_resolution; | |
| 1429 } | |
| 1430 | |
| 1431 std::pair<int, int> DXVAVideoDecodeAccelerator::GetMaxH264Resolution() { | |
| 1432 TRACE_EVENT0("gpu,startup", | |
| 1433 "DXVAVideoDecodeAccelerator::GetMaxH264Resolution"); | |
| 1434 // The H.264 resolution detection operation is expensive. This static flag | |
| 1435 // allows us to run the detection once. | |
| 1436 static bool resolution_detected = false; | |
| 1437 // Use 1088 to account for 16x16 macroblocks. | |
| 1438 static std::pair<int, int> max_resolution = std::make_pair(1920, 1088); | |
| 1439 if (resolution_detected) | |
| 1440 return max_resolution; | |
| 1441 | |
| 1442 resolution_detected = true; | |
| 1443 | |
| 1444 // On Windows 7 the maximum resolution supported by media foundation is | |
| 1445 // 1920 x 1088. | |
| 1446 if (base::win::GetVersion() == base::win::VERSION_WIN7) | |
| 1447 return max_resolution; | |
| 1448 | |
| 1449 // To detect if a driver supports the desired resolutions, we try and create | |
| 1450 // a DXVA decoder instance for that resolution and profile. If that succeeds | |
| 1451 // we assume that the driver supports H/W H.264 decoding for that resolution. | |
| 1452 HRESULT hr = E_FAIL; | |
| 1453 | |
| 1454 TRACE_EVENT0("gpu,startup", | |
| 1455 "GetMaxH264Resolution. QueryDeviceObjectFromANGLE"); | |
| 1456 | |
| 1457 base::win::ScopedComPtr<ID3D11Device> device = | |
| 1458 QueryDeviceObjectFromANGLE<ID3D11Device>(EGL_D3D11_DEVICE_ANGLE); | |
| 1459 if (!device.get()) | |
| 1460 return max_resolution; | |
| 1461 | |
| 1462 base::win::ScopedComPtr<ID3D11VideoDevice> video_device; | |
| 1463 hr = device.QueryInterface(IID_ID3D11VideoDevice, | |
| 1464 video_device.ReceiveVoid()); | |
| 1465 if (FAILED(hr)) { | |
| 1466 CHECK(false); | |
|
sandersd (OOO until July 31)
2016/04/01 21:02:54
This does not seem like a good plan in GPU startup
ananta
2016/04/01 21:12:44
Removed the CHECK here and below
| |
| 1467 return max_resolution; | |
| 1468 } | |
| 1469 | |
| 1470 TRACE_EVENT0("gpu,startup", "GetMaxH264Resolution. H.264 guid search begin"); | |
| 1471 | |
| 1472 // Enumerate supported video profiles and look for the H264 profile. | |
| 1473 GUID decoder_guid = {}; | |
| 1474 bool found = false; | |
| 1475 UINT profile_count = video_device->GetVideoDecoderProfileCount(); | |
| 1476 for (UINT profile_idx = 0; profile_idx < profile_count; profile_idx++) { | |
| 1477 GUID profile_id = {}; | |
| 1478 hr = video_device->GetVideoDecoderProfile(profile_idx, &profile_id); | |
| 1479 if (SUCCEEDED(hr) && | |
| 1480 (profile_id == DXVA2_ModeH264_E || | |
| 1481 profile_id == DXVA2_Intel_ModeH264_E)) { | |
| 1482 decoder_guid = profile_id; | |
| 1483 found = true; | |
| 1484 break; | |
| 1485 } | |
| 1486 } | |
| 1487 | |
| 1488 TRACE_EVENT0("gpu,startup", "GetMaxH264Resolution. H.264 guid search end"); | |
| 1489 | |
| 1490 if (!found) { | |
| 1491 CHECK(false); | |
| 1492 return max_resolution; | |
| 1493 } | |
| 1494 | |
| 1495 // We look for the following resolutions in the driver. | |
| 1496 // TODO(ananta) | |
| 1497 // Look into whether this list needs to be expanded. | |
| 1498 static std::pair<int, int> resolution_array[] = { | |
| 1499 // Use 1088 to account for 16x16 macroblocks. | |
| 1500 std::make_pair(1920, 1088), | |
| 1501 std::make_pair(2560, 1440), | |
| 1502 std::make_pair(3840, 2160), | |
| 1503 std::make_pair(4096, 2160), | |
| 1504 std::make_pair(4096, 2304), | |
| 1505 }; | |
| 1506 | |
| 1507 TRACE_EVENT0("gpu,startup", "GetMaxH264Resolution. Resolution search begin"); | |
| 1508 | |
| 1509 for (size_t res_idx = 0; res_idx < arraysize(resolution_array); | |
| 1510 res_idx++) { | |
| 1511 D3D11_VIDEO_DECODER_DESC desc = {}; | |
| 1512 desc.Guid = decoder_guid; | |
| 1513 desc.SampleWidth = resolution_array[res_idx].first; | |
| 1514 desc.SampleHeight = resolution_array[res_idx].second; | |
| 1515 desc.OutputFormat = DXGI_FORMAT_NV12; | |
| 1516 UINT config_count = 0; | |
| 1517 hr = video_device->GetVideoDecoderConfigCount(&desc, &config_count); | |
| 1518 if (FAILED(hr) || config_count == 0) | |
| 1519 return max_resolution; | |
| 1520 | |
| 1521 D3D11_VIDEO_DECODER_CONFIG config = {}; | |
| 1522 hr = video_device->GetVideoDecoderConfig(&desc, 0, &config); | |
| 1523 if (FAILED(hr)) | |
| 1524 return max_resolution; | |
| 1525 | |
| 1526 base::win::ScopedComPtr<ID3D11VideoDecoder> video_decoder; | |
| 1527 hr = video_device->CreateVideoDecoder(&desc, &config, | |
| 1528 video_decoder.Receive()); | |
| 1529 if (!video_decoder.get()) | |
| 1530 return max_resolution; | |
| 1531 | |
| 1532 max_resolution = resolution_array[res_idx]; | |
| 1533 } | |
| 1534 return max_resolution; | |
| 1535 } | |
| 1536 | |
| 1376 bool DXVAVideoDecodeAccelerator::InitDecoder(media::VideoCodecProfile profile) { | 1537 bool DXVAVideoDecodeAccelerator::InitDecoder(media::VideoCodecProfile profile) { |
| 1377 HMODULE decoder_dll = NULL; | 1538 HMODULE decoder_dll = NULL; |
| 1378 | 1539 |
| 1379 CLSID clsid = {}; | 1540 CLSID clsid = {}; |
| 1380 | 1541 |
| 1381 // Profile must fall within the valid range for one of the supported codecs. | 1542 // Profile must fall within the valid range for one of the supported codecs. |
| 1382 if (profile >= media::H264PROFILE_MIN && profile <= media::H264PROFILE_MAX) { | 1543 if (profile >= media::H264PROFILE_MIN && profile <= media::H264PROFILE_MAX) { |
| 1383 // We mimic the steps CoCreateInstance uses to instantiate the object. This | 1544 // 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 | 1545 // 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 | 1546 // 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; | 1891 OutputBuffers::iterator index; |
| 1731 | 1892 |
| 1732 for (index = output_picture_buffers_.begin(); | 1893 for (index = output_picture_buffers_.begin(); |
| 1733 index != output_picture_buffers_.end() && | 1894 index != output_picture_buffers_.end() && |
| 1734 OutputSamplesPresent(); | 1895 OutputSamplesPresent(); |
| 1735 ++index) { | 1896 ++index) { |
| 1736 if (index->second->available()) { | 1897 if (index->second->available()) { |
| 1737 PendingSampleInfo* pending_sample = NULL; | 1898 PendingSampleInfo* pending_sample = NULL; |
| 1738 { | 1899 { |
| 1739 base::AutoLock lock(decoder_lock_); | 1900 base::AutoLock lock(decoder_lock_); |
| 1740 | |
| 1741 PendingSampleInfo& sample_info = pending_output_samples_.front(); | 1901 PendingSampleInfo& sample_info = pending_output_samples_.front(); |
| 1742 if (sample_info.picture_buffer_id != -1) | 1902 if (sample_info.picture_buffer_id != -1) |
| 1743 continue; | 1903 continue; |
| 1744 pending_sample = &sample_info; | 1904 pending_sample = &sample_info; |
| 1745 } | 1905 } |
| 1746 | 1906 |
| 1747 int width = 0; | 1907 int width = 0; |
| 1748 int height = 0; | 1908 int height = 0; |
| 1749 if (!GetVideoFrameDimensions(pending_sample->output_sample.get(), | 1909 if (!GetVideoFrameDimensions(pending_sample->output_sample.get(), |
| 1750 &width, &height)) { | 1910 &width, &height)) { |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2656 DismissStaleBuffers(true); | 2816 DismissStaleBuffers(true); |
| 2657 Invalidate(); | 2817 Invalidate(); |
| 2658 Initialize(config_, client_); | 2818 Initialize(config_, client_); |
| 2659 decoder_thread_task_runner_->PostTask( | 2819 decoder_thread_task_runner_->PostTask( |
| 2660 FROM_HERE, | 2820 FROM_HERE, |
| 2661 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, | 2821 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, |
| 2662 base::Unretained(this))); | 2822 base::Unretained(this))); |
| 2663 } | 2823 } |
| 2664 | 2824 |
| 2665 } // namespace content | 2825 } // namespace content |
| OLD | NEW |