Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: media/gpu/dxva_video_decode_accelerator_win.cc

Issue 2792383003: Rename ScopedComPtr::Release() to ScopedComPtr::Reset() (Closed)
Patch Set: Fix New Callers Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1960 matching lines...) Expand 10 before | Expand all | Expand 10 after
1971 if (GetState() == kUninitialized) 1971 if (GetState() == kUninitialized)
1972 return; 1972 return;
1973 1973
1974 // Best effort to make the GL context current. 1974 // Best effort to make the GL context current.
1975 make_context_current_cb_.Run(); 1975 make_context_current_cb_.Run();
1976 1976
1977 StopDecoderThread(); 1977 StopDecoderThread();
1978 weak_this_factory_.InvalidateWeakPtrs(); 1978 weak_this_factory_.InvalidateWeakPtrs();
1979 weak_ptr_ = weak_this_factory_.GetWeakPtr(); 1979 weak_ptr_ = weak_this_factory_.GetWeakPtr();
1980 pending_output_samples_.clear(); 1980 pending_output_samples_.clear();
1981 decoder_.Release(); 1981 decoder_.Reset();
1982 config_change_detector_.reset(); 1982 config_change_detector_.reset();
1983 1983
1984 // If we are processing a config change, then leave the d3d9/d3d11 objects 1984 // If we are processing a config change, then leave the d3d9/d3d11 objects
1985 // along with the output picture buffers intact as they can be reused. The 1985 // along with the output picture buffers intact as they can be reused. The
1986 // output picture buffers may need to be recreated in case the video 1986 // output picture buffers may need to be recreated in case the video
1987 // resolution changes. We already handle that in the 1987 // resolution changes. We already handle that in the
1988 // HandleResolutionChanged() function. 1988 // HandleResolutionChanged() function.
1989 if (GetState() != kConfigChange) { 1989 if (GetState() != kConfigChange) {
1990 output_picture_buffers_.clear(); 1990 output_picture_buffers_.clear();
1991 stale_output_picture_buffers_.clear(); 1991 stale_output_picture_buffers_.clear();
1992 // We want to continue processing pending input after detecting a config 1992 // We want to continue processing pending input after detecting a config
1993 // change. 1993 // change.
1994 pending_input_buffers_.clear(); 1994 pending_input_buffers_.clear();
1995 pictures_requested_ = false; 1995 pictures_requested_ = false;
1996 if (use_dx11_) { 1996 if (use_dx11_) {
1997 d3d11_processor_.Release(); 1997 d3d11_processor_.Reset();
1998 enumerator_.Release(); 1998 enumerator_.Reset();
1999 video_context_.Release(); 1999 video_context_.Reset();
2000 video_device_.Release(); 2000 video_device_.Reset();
2001 d3d11_device_context_.Release(); 2001 d3d11_device_context_.Reset();
2002 d3d11_device_.Release(); 2002 d3d11_device_.Reset();
2003 d3d11_device_manager_.Release(); 2003 d3d11_device_manager_.Reset();
2004 d3d11_query_.Release(); 2004 d3d11_query_.Reset();
2005 multi_threaded_.Release(); 2005 multi_threaded_.Reset();
2006 processor_width_ = processor_height_ = 0; 2006 processor_width_ = processor_height_ = 0;
2007 } else { 2007 } else {
2008 d3d9_.Release(); 2008 d3d9_.Reset();
2009 d3d9_device_ex_.Release(); 2009 d3d9_device_ex_.Reset();
2010 device_manager_.Release(); 2010 device_manager_.Reset();
2011 query_.Release(); 2011 query_.Reset();
2012 } 2012 }
2013 } 2013 }
2014 sent_drain_message_ = false; 2014 sent_drain_message_ = false;
2015 SetState(kUninitialized); 2015 SetState(kUninitialized);
2016 } 2016 }
2017 2017
2018 void DXVAVideoDecodeAccelerator::StopDecoderThread() { 2018 void DXVAVideoDecodeAccelerator::StopDecoderThread() {
2019 // Try to determine what, if any exception last happened before a hang. See 2019 // Try to determine what, if any exception last happened before a hang. See
2020 // http://crbug.com/613701 2020 // http://crbug.com/613701
2021 DWORD last_exception_code = g_last_exception_code; 2021 DWORD last_exception_code = g_last_exception_code;
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
2774 FROM_HERE, base::Bind(&DXVAVideoDecodeAccelerator::CopySurfaceComplete, 2774 FROM_HERE, base::Bind(&DXVAVideoDecodeAccelerator::CopySurfaceComplete,
2775 weak_ptr_, src_surface, dest_surface, 2775 weak_ptr_, src_surface, dest_surface,
2776 picture_buffer_id, input_buffer_id)); 2776 picture_buffer_id, input_buffer_id));
2777 } 2777 }
2778 2778
2779 bool DXVAVideoDecodeAccelerator::InitializeID3D11VideoProcessor( 2779 bool DXVAVideoDecodeAccelerator::InitializeID3D11VideoProcessor(
2780 int width, 2780 int width,
2781 int height, 2781 int height,
2782 const gfx::ColorSpace& color_space) { 2782 const gfx::ColorSpace& color_space) {
2783 if (width < processor_width_ || height != processor_height_) { 2783 if (width < processor_width_ || height != processor_height_) {
2784 d3d11_processor_.Release(); 2784 d3d11_processor_.Reset();
2785 enumerator_.Release(); 2785 enumerator_.Reset();
2786 processor_width_ = 0; 2786 processor_width_ = 0;
2787 processor_height_ = 0; 2787 processor_height_ = 0;
2788 2788
2789 D3D11_VIDEO_PROCESSOR_CONTENT_DESC desc; 2789 D3D11_VIDEO_PROCESSOR_CONTENT_DESC desc;
2790 desc.InputFrameFormat = D3D11_VIDEO_FRAME_FORMAT_PROGRESSIVE; 2790 desc.InputFrameFormat = D3D11_VIDEO_FRAME_FORMAT_PROGRESSIVE;
2791 desc.InputFrameRate.Numerator = 60; 2791 desc.InputFrameRate.Numerator = 60;
2792 desc.InputFrameRate.Denominator = 1; 2792 desc.InputFrameRate.Denominator = 1;
2793 desc.InputWidth = width; 2793 desc.InputWidth = width;
2794 desc.InputHeight = height; 2794 desc.InputHeight = height;
2795 desc.OutputFrameRate.Numerator = 60; 2795 desc.OutputFrameRate.Numerator = 60;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2943 if (out_subtype == output_type) { 2943 if (out_subtype == output_type) {
2944 if (width && height) { 2944 if (width && height) {
2945 hr = MFSetAttributeSize(media_type.get(), MF_MT_FRAME_SIZE, width, 2945 hr = MFSetAttributeSize(media_type.get(), MF_MT_FRAME_SIZE, width,
2946 height); 2946 height);
2947 RETURN_ON_HR_FAILURE(hr, "Failed to set media type attributes", false); 2947 RETURN_ON_HR_FAILURE(hr, "Failed to set media type attributes", false);
2948 } 2948 }
2949 hr = transform->SetOutputType(0, media_type.get(), 0); // No flags 2949 hr = transform->SetOutputType(0, media_type.get(), 0); // No flags
2950 RETURN_ON_HR_FAILURE(hr, "Failed to set output type", false); 2950 RETURN_ON_HR_FAILURE(hr, "Failed to set output type", false);
2951 return true; 2951 return true;
2952 } 2952 }
2953 media_type.Release(); 2953 media_type.Reset();
2954 } 2954 }
2955 return false; 2955 return false;
2956 } 2956 }
2957 2957
2958 HRESULT DXVAVideoDecodeAccelerator::CheckConfigChanged(IMFSample* sample, 2958 HRESULT DXVAVideoDecodeAccelerator::CheckConfigChanged(IMFSample* sample,
2959 bool* config_changed) { 2959 bool* config_changed) {
2960 if (codec_ != kCodecH264) 2960 if (codec_ != kCodecH264)
2961 return S_FALSE; 2961 return S_FALSE;
2962 2962
2963 base::win::ScopedComPtr<IMFMediaBuffer> buffer; 2963 base::win::ScopedComPtr<IMFMediaBuffer> buffer;
(...skipping 22 matching lines...) Expand all
2986 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, 2986 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers,
2987 base::Unretained(this))); 2987 base::Unretained(this)));
2988 } 2988 }
2989 2989
2990 uint32_t DXVAVideoDecodeAccelerator::GetTextureTarget() const { 2990 uint32_t DXVAVideoDecodeAccelerator::GetTextureTarget() const {
2991 bool provide_nv12_textures = share_nv12_textures_ || copy_nv12_textures_; 2991 bool provide_nv12_textures = share_nv12_textures_ || copy_nv12_textures_;
2992 return provide_nv12_textures ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D; 2992 return provide_nv12_textures ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D;
2993 } 2993 }
2994 2994
2995 } // namespace media 2995 } // namespace media
OLDNEW
« no previous file with comments | « media/gpu/dxva_picture_buffer_win.cc ('k') | media/gpu/media_foundation_video_encode_accelerator_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698