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 "media/gpu/dxva_video_decode_accelerator_win.h" | 5 #include "media/gpu/dxva_video_decode_accelerator_win.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #if !defined(OS_WIN) | 9 #if !defined(OS_WIN) |
| 10 #error This file should only be built on Windows. | 10 #error This file should only be built on Windows. |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 479 } | 479 } |
| 480 | 480 |
| 481 DXVAVideoDecodeAccelerator::PendingSampleInfo::PendingSampleInfo( | 481 DXVAVideoDecodeAccelerator::PendingSampleInfo::PendingSampleInfo( |
| 482 const PendingSampleInfo& other) = default; | 482 const PendingSampleInfo& other) = default; |
| 483 | 483 |
| 484 DXVAVideoDecodeAccelerator::PendingSampleInfo::~PendingSampleInfo() {} | 484 DXVAVideoDecodeAccelerator::PendingSampleInfo::~PendingSampleInfo() {} |
| 485 | 485 |
| 486 DXVAVideoDecodeAccelerator::DXVAVideoDecodeAccelerator( | 486 DXVAVideoDecodeAccelerator::DXVAVideoDecodeAccelerator( |
| 487 const GetGLContextCallback& get_gl_context_cb, | 487 const GetGLContextCallback& get_gl_context_cb, |
| 488 const MakeGLContextCurrentCallback& make_context_current_cb, | 488 const MakeGLContextCurrentCallback& make_context_current_cb, |
| 489 const BindGLImageCallback& bind_image_cb, | |
| 489 const gpu::GpuDriverBugWorkarounds& workarounds, | 490 const gpu::GpuDriverBugWorkarounds& workarounds, |
| 490 const gpu::GpuPreferences& gpu_preferences) | 491 const gpu::GpuPreferences& gpu_preferences) |
| 491 : client_(NULL), | 492 : client_(NULL), |
| 492 dev_manager_reset_token_(0), | 493 dev_manager_reset_token_(0), |
| 493 dx11_dev_manager_reset_token_(0), | 494 dx11_dev_manager_reset_token_(0), |
| 494 egl_config_(NULL), | 495 egl_config_(NULL), |
| 495 state_(kUninitialized), | 496 state_(kUninitialized), |
| 496 pictures_requested_(false), | 497 pictures_requested_(false), |
| 497 inputs_before_decode_(0), | 498 inputs_before_decode_(0), |
| 498 sent_drain_message_(false), | 499 sent_drain_message_(false), |
| 499 get_gl_context_cb_(get_gl_context_cb), | 500 get_gl_context_cb_(get_gl_context_cb), |
| 500 make_context_current_cb_(make_context_current_cb), | 501 make_context_current_cb_(make_context_current_cb), |
| 502 bind_image_cb_(bind_image_cb), | |
| 501 codec_(kUnknownVideoCodec), | 503 codec_(kUnknownVideoCodec), |
| 502 decoder_thread_("DXVAVideoDecoderThread"), | 504 decoder_thread_("DXVAVideoDecoderThread"), |
| 503 pending_flush_(false), | 505 pending_flush_(false), |
| 504 enable_low_latency_(gpu_preferences.enable_low_latency_dxva), | 506 enable_low_latency_(gpu_preferences.enable_low_latency_dxva), |
| 505 share_nv12_textures_(gpu_preferences.enable_zero_copy_dxgi_video && | 507 share_nv12_textures_(gpu_preferences.enable_zero_copy_dxgi_video && |
| 506 !workarounds.disable_dxgi_zero_copy_video), | 508 !workarounds.disable_dxgi_zero_copy_video), |
| 507 copy_nv12_textures_(gpu_preferences.enable_nv12_dxgi_video && | 509 copy_nv12_textures_(gpu_preferences.enable_nv12_dxgi_video && |
| 508 !workarounds.disable_nv12_dxgi_video), | 510 !workarounds.disable_nv12_dxgi_video), |
| 509 use_dx11_(false), | 511 use_dx11_(false), |
| 510 use_keyed_mutex_(false), | 512 use_keyed_mutex_(false), |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 873 "Failed to provide requested picture buffers. (Got " | 875 "Failed to provide requested picture buffers. (Got " |
| 874 << buffers.size() << ", requested " << kNumPictureBuffers << ")", | 876 << buffers.size() << ", requested " << kNumPictureBuffers << ")", |
| 875 INVALID_ARGUMENT, ); | 877 INVALID_ARGUMENT, ); |
| 876 | 878 |
| 877 RETURN_AND_NOTIFY_ON_FAILURE(make_context_current_cb_.Run(), | 879 RETURN_AND_NOTIFY_ON_FAILURE(make_context_current_cb_.Run(), |
| 878 "Failed to make context current", | 880 "Failed to make context current", |
| 879 PLATFORM_FAILURE, ); | 881 PLATFORM_FAILURE, ); |
| 880 // Copy the picture buffers provided by the client to the available list, | 882 // Copy the picture buffers provided by the client to the available list, |
| 881 // and mark these buffers as available for use. | 883 // and mark these buffers as available for use. |
| 882 for (size_t buffer_index = 0; buffer_index < buffers.size(); ++buffer_index) { | 884 for (size_t buffer_index = 0; buffer_index < buffers.size(); ++buffer_index) { |
| 885 RETURN_AND_NOTIFY_ON_FAILURE( | |
| 886 buffers[buffer_index].service_texture_ids().size() == | |
| 887 buffers[buffer_index].client_texture_ids().size(), | |
| 888 "Number of service and client ids do not match", PLATFORM_FAILURE, ); | |
|
sandersd (OOO until July 31)
2016/11/14 19:16:22
Is this still correct for the vda unittest? At one
| |
| 883 linked_ptr<DXVAPictureBuffer> picture_buffer = | 889 linked_ptr<DXVAPictureBuffer> picture_buffer = |
| 884 DXVAPictureBuffer::Create(*this, buffers[buffer_index], egl_config_); | 890 DXVAPictureBuffer::Create(*this, buffers[buffer_index], egl_config_); |
| 885 RETURN_AND_NOTIFY_ON_FAILURE(picture_buffer.get(), | 891 RETURN_AND_NOTIFY_ON_FAILURE(picture_buffer.get(), |
| 886 "Failed to allocate picture buffer", | 892 "Failed to allocate picture buffer", |
| 887 PLATFORM_FAILURE, ); | 893 PLATFORM_FAILURE, ); |
| 894 if (bind_image_cb_) { | |
| 895 for (size_t i = 0; i < buffers[buffer_index].client_texture_ids().size(); | |
| 896 i++) { | |
| 897 bind_image_cb_.Run(buffers[buffer_index].client_texture_ids()[i], | |
| 898 buffers[buffer_index].service_texture_ids()[i], | |
|
sandersd (OOO until July 31)
2016/11/14 19:16:22
The second parameter should be the texture target.
| |
| 899 picture_buffer->gl_image(), true); | |
| 900 } | |
| 901 } | |
| 888 | 902 |
| 889 bool inserted = | 903 bool inserted = |
| 890 output_picture_buffers_ | 904 output_picture_buffers_ |
| 891 .insert(std::make_pair(buffers[buffer_index].id(), picture_buffer)) | 905 .insert(std::make_pair(buffers[buffer_index].id(), picture_buffer)) |
| 892 .second; | 906 .second; |
| 893 DCHECK(inserted); | 907 DCHECK(inserted); |
| 894 } | 908 } |
| 895 | 909 |
| 896 ProcessPendingSamples(); | 910 ProcessPendingSamples(); |
| 897 if (pending_flush_ || processing_config_changed_) { | 911 if (pending_flush_ || processing_config_changed_) { |
| (...skipping 1845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2743 SetState(kConfigChange); | 2757 SetState(kConfigChange); |
| 2744 Invalidate(); | 2758 Invalidate(); |
| 2745 Initialize(config_, client_); | 2759 Initialize(config_, client_); |
| 2746 decoder_thread_task_runner_->PostTask( | 2760 decoder_thread_task_runner_->PostTask( |
| 2747 FROM_HERE, | 2761 FROM_HERE, |
| 2748 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, | 2762 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, |
| 2749 base::Unretained(this))); | 2763 base::Unretained(this))); |
| 2750 } | 2764 } |
| 2751 | 2765 |
| 2752 } // namespace media | 2766 } // namespace media |
| OLD | NEW |