| 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 2112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2123 RETURN_AND_NOTIFY_ON_FAILURE(SendMFTMessage(MFT_MESSAGE_COMMAND_DRAIN, 0), | 2123 RETURN_AND_NOTIFY_ON_FAILURE(SendMFTMessage(MFT_MESSAGE_COMMAND_DRAIN, 0), |
| 2124 "Failed to send drain message", | 2124 "Failed to send drain message", |
| 2125 PLATFORM_FAILURE, ); | 2125 PLATFORM_FAILURE, ); |
| 2126 sent_drain_message_ = true; | 2126 sent_drain_message_ = true; |
| 2127 } | 2127 } |
| 2128 } | 2128 } |
| 2129 | 2129 |
| 2130 // Attempt to retrieve an output frame from the decoder. If we have one, | 2130 // Attempt to retrieve an output frame from the decoder. If we have one, |
| 2131 // return and proceed when the output frame is processed. If we don't have a | 2131 // return and proceed when the output frame is processed. If we don't have a |
| 2132 // frame then we are done. | 2132 // frame then we are done. |
| 2133 DoDecode(config_change_detector_->current_color_space()); | 2133 gfx::ColorSpace color_space = config_change_detector_->current_color_space(); |
| 2134 if (!color_space.IsValid()) |
| 2135 color_space = config_.color_space; |
| 2136 DoDecode(color_space); |
| 2134 if (OutputSamplesPresent()) | 2137 if (OutputSamplesPresent()) |
| 2135 return; | 2138 return; |
| 2136 | 2139 |
| 2137 if (!processing_config_changed_) { | 2140 if (!processing_config_changed_) { |
| 2138 SetState(kFlushing); | 2141 SetState(kFlushing); |
| 2139 | 2142 |
| 2140 main_thread_task_runner_->PostTask( | 2143 main_thread_task_runner_->PostTask( |
| 2141 FROM_HERE, | 2144 FROM_HERE, |
| 2142 base::Bind(&DXVAVideoDecodeAccelerator::NotifyFlushDone, weak_ptr_)); | 2145 base::Bind(&DXVAVideoDecodeAccelerator::NotifyFlushDone, weak_ptr_)); |
| 2143 } else { | 2146 } else { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2173 | 2176 |
| 2174 processing_config_changed_ = config_changed; | 2177 processing_config_changed_ = config_changed; |
| 2175 | 2178 |
| 2176 if (config_changed) { | 2179 if (config_changed) { |
| 2177 pending_input_buffers_.push_back(sample); | 2180 pending_input_buffers_.push_back(sample); |
| 2178 FlushInternal(); | 2181 FlushInternal(); |
| 2179 return; | 2182 return; |
| 2180 } | 2183 } |
| 2181 | 2184 |
| 2182 gfx::ColorSpace color_space = config_change_detector_->current_color_space(); | 2185 gfx::ColorSpace color_space = config_change_detector_->current_color_space(); |
| 2186 if (!color_space.IsValid()) |
| 2187 color_space = config_.color_space; |
| 2183 | 2188 |
| 2184 if (!inputs_before_decode_) { | 2189 if (!inputs_before_decode_) { |
| 2185 TRACE_EVENT_ASYNC_BEGIN0("gpu", "DXVAVideoDecodeAccelerator.Decoding", | 2190 TRACE_EVENT_ASYNC_BEGIN0("gpu", "DXVAVideoDecodeAccelerator.Decoding", |
| 2186 this); | 2191 this); |
| 2187 } | 2192 } |
| 2188 inputs_before_decode_++; | 2193 inputs_before_decode_++; |
| 2189 { | 2194 { |
| 2190 ScopedExceptionCatcher catcher(using_ms_vp9_mft_); | 2195 ScopedExceptionCatcher catcher(using_ms_vp9_mft_); |
| 2191 hr = decoder_->ProcessInput(0, sample.get(), 0); | 2196 hr = decoder_->ProcessInput(0, sample.get(), 0); |
| 2192 } | 2197 } |
| (...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2898 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, | 2903 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, |
| 2899 base::Unretained(this))); | 2904 base::Unretained(this))); |
| 2900 } | 2905 } |
| 2901 | 2906 |
| 2902 uint32_t DXVAVideoDecodeAccelerator::GetTextureTarget() const { | 2907 uint32_t DXVAVideoDecodeAccelerator::GetTextureTarget() const { |
| 2903 bool provide_nv12_textures = share_nv12_textures_ || copy_nv12_textures_; | 2908 bool provide_nv12_textures = share_nv12_textures_ || copy_nv12_textures_; |
| 2904 return provide_nv12_textures ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D; | 2909 return provide_nv12_textures ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D; |
| 2905 } | 2910 } |
| 2906 | 2911 |
| 2907 } // namespace media | 2912 } // namespace media |
| OLD | NEW |