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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 hr = device_->CreateQuery(D3DQUERYTYPE_EVENT, query_.Receive()); | 406 hr = device_->CreateQuery(D3DQUERYTYPE_EVENT, query_.Receive()); |
407 RETURN_ON_HR_FAILURE(hr, "Failed to create D3D device query", false); | 407 RETURN_ON_HR_FAILURE(hr, "Failed to create D3D device query", false); |
408 // Ensure query_ API works (to avoid an infinite loop later in | 408 // Ensure query_ API works (to avoid an infinite loop later in |
409 // CopyOutputSampleDataToPictureBuffer). | 409 // CopyOutputSampleDataToPictureBuffer). |
410 hr = query_->Issue(D3DISSUE_END); | 410 hr = query_->Issue(D3DISSUE_END); |
411 RETURN_ON_HR_FAILURE(hr, "Failed to issue END test query", false); | 411 RETURN_ON_HR_FAILURE(hr, "Failed to issue END test query", false); |
412 return true; | 412 return true; |
413 } | 413 } |
414 | 414 |
415 DXVAVideoDecodeAccelerator::DXVAVideoDecodeAccelerator( | 415 DXVAVideoDecodeAccelerator::DXVAVideoDecodeAccelerator( |
416 media::VideoDecodeAccelerator::Client* client, | |
417 const base::Callback<bool(void)>& make_context_current) | 416 const base::Callback<bool(void)>& make_context_current) |
418 : client_(client), | 417 : client_(NULL), |
419 dev_manager_reset_token_(0), | 418 dev_manager_reset_token_(0), |
420 egl_config_(NULL), | 419 egl_config_(NULL), |
421 state_(kUninitialized), | 420 state_(kUninitialized), |
422 pictures_requested_(false), | 421 pictures_requested_(false), |
423 inputs_before_decode_(0), | 422 inputs_before_decode_(0), |
424 make_context_current_(make_context_current) { | 423 make_context_current_(make_context_current) { |
425 memset(&input_stream_info_, 0, sizeof(input_stream_info_)); | 424 memset(&input_stream_info_, 0, sizeof(input_stream_info_)); |
426 memset(&output_stream_info_, 0, sizeof(output_stream_info_)); | 425 memset(&output_stream_info_, 0, sizeof(output_stream_info_)); |
427 } | 426 } |
428 | 427 |
429 DXVAVideoDecodeAccelerator::~DXVAVideoDecodeAccelerator() { | 428 DXVAVideoDecodeAccelerator::~DXVAVideoDecodeAccelerator() { |
430 client_ = NULL; | 429 client_ = NULL; |
431 } | 430 } |
432 | 431 |
433 bool DXVAVideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile) { | 432 bool DXVAVideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile, |
| 433 Client* client) { |
434 DCHECK(CalledOnValidThread()); | 434 DCHECK(CalledOnValidThread()); |
435 | 435 |
| 436 client_ = client; |
| 437 |
436 // Not all versions of Windows 7 and later include Media Foundation DLLs. | 438 // Not all versions of Windows 7 and later include Media Foundation DLLs. |
437 // Instead of crashing while delay loading the DLL when calling MFStartup() | 439 // Instead of crashing while delay loading the DLL when calling MFStartup() |
438 // below, probe whether we can successfully load the DLL now. | 440 // below, probe whether we can successfully load the DLL now. |
439 // | 441 // |
440 // See http://crbug.com/339678 for details. | 442 // See http://crbug.com/339678 for details. |
441 HMODULE mfplat_dll = ::LoadLibrary(L"MFPlat.dll"); | 443 HMODULE mfplat_dll = ::LoadLibrary(L"MFPlat.dll"); |
442 RETURN_ON_FAILURE(mfplat_dll, "MFPlat.dll is required for decoding", false); | 444 RETURN_ON_FAILURE(mfplat_dll, "MFPlat.dll is required for decoding", false); |
443 | 445 |
444 // TODO(ananta) | 446 // TODO(ananta) |
445 // H264PROFILE_HIGH video decoding is janky at times. Needs more | 447 // H264PROFILE_HIGH video decoding is janky at times. Needs more |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1149 | 1151 |
1150 for (index = picture_buffers.begin(); | 1152 for (index = picture_buffers.begin(); |
1151 index != picture_buffers.end(); | 1153 index != picture_buffers.end(); |
1152 ++index) { | 1154 ++index) { |
1153 DVLOG(1) << "Dismissing picture id: " << index->second->id(); | 1155 DVLOG(1) << "Dismissing picture id: " << index->second->id(); |
1154 client_->DismissPictureBuffer(index->second->id()); | 1156 client_->DismissPictureBuffer(index->second->id()); |
1155 } | 1157 } |
1156 } | 1158 } |
1157 | 1159 |
1158 } // namespace content | 1160 } // namespace content |
OLD | NEW |