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 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1384 void DXVAVideoDecodeAccelerator::Invalidate() { | 1384 void DXVAVideoDecodeAccelerator::Invalidate() { |
1385 if (GetState() == kUninitialized) | 1385 if (GetState() == kUninitialized) |
1386 return; | 1386 return; |
1387 decoder_thread_.Stop(); | 1387 decoder_thread_.Stop(); |
1388 weak_this_factory_.InvalidateWeakPtrs(); | 1388 weak_this_factory_.InvalidateWeakPtrs(); |
1389 output_picture_buffers_.clear(); | 1389 output_picture_buffers_.clear(); |
1390 stale_output_picture_buffers_.clear(); | 1390 stale_output_picture_buffers_.clear(); |
1391 pending_output_samples_.clear(); | 1391 pending_output_samples_.clear(); |
1392 pending_input_buffers_.clear(); | 1392 pending_input_buffers_.clear(); |
1393 decoder_.Release(); | 1393 decoder_.Release(); |
1394 if (video_format_converter_mft_.get()) { | 1394 |
1395 video_format_converter_mft_->ProcessMessage( | 1395 if (use_dx11_) { |
1396 MFT_MESSAGE_NOTIFY_END_STREAMING, 0); | 1396 if (video_format_converter_mft_.get()) { |
1397 video_format_converter_mft_.Release(); | 1397 video_format_converter_mft_->ProcessMessage( |
| 1398 MFT_MESSAGE_NOTIFY_END_STREAMING, 0); |
| 1399 video_format_converter_mft_.Release(); |
| 1400 } |
| 1401 d3d11_device_context_.Release(); |
| 1402 d3d11_device_.Release(); |
| 1403 d3d11_device_manager_.Release(); |
| 1404 d3d11_query_.Release(); |
| 1405 dx11_video_format_converter_media_type_needs_init_ = true; |
| 1406 } else { |
| 1407 d3d9_.Release(); |
| 1408 d3d9_device_ex_.Release(); |
| 1409 device_manager_.Release(); |
| 1410 query_.Release(); |
1398 } | 1411 } |
| 1412 |
1399 MFShutdown(); | 1413 MFShutdown(); |
1400 dx11_video_format_converter_media_type_needs_init_ = true; | |
1401 SetState(kUninitialized); | 1414 SetState(kUninitialized); |
1402 } | 1415 } |
1403 | 1416 |
1404 void DXVAVideoDecodeAccelerator::NotifyInputBufferRead(int input_buffer_id) { | 1417 void DXVAVideoDecodeAccelerator::NotifyInputBufferRead(int input_buffer_id) { |
1405 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); | 1418 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); |
1406 if (client_) | 1419 if (client_) |
1407 client_->NotifyEndOfBitstreamBuffer(input_buffer_id); | 1420 client_->NotifyEndOfBitstreamBuffer(input_buffer_id); |
1408 } | 1421 } |
1409 | 1422 |
1410 void DXVAVideoDecodeAccelerator::NotifyFlushDone() { | 1423 void DXVAVideoDecodeAccelerator::NotifyFlushDone() { |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2139 D3DSURFACE_DESC surface_desc; | 2152 D3DSURFACE_DESC surface_desc; |
2140 hr = surface->GetDesc(&surface_desc); | 2153 hr = surface->GetDesc(&surface_desc); |
2141 RETURN_ON_HR_FAILURE(hr, "Failed to get surface description", false); | 2154 RETURN_ON_HR_FAILURE(hr, "Failed to get surface description", false); |
2142 *width = surface_desc.Width; | 2155 *width = surface_desc.Width; |
2143 *height = surface_desc.Height; | 2156 *height = surface_desc.Height; |
2144 } | 2157 } |
2145 return true; | 2158 return true; |
2146 } | 2159 } |
2147 | 2160 |
2148 } // namespace content | 2161 } // namespace content |
OLD | NEW |