| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 211 |
| 212 private: | 212 private: |
| 213 base::win::ScopedComPtr<IMFMediaBuffer> media_buffer_; | 213 base::win::ScopedComPtr<IMFMediaBuffer> media_buffer_; |
| 214 uint8_t* buffer_; | 214 uint8_t* buffer_; |
| 215 DWORD max_length_; | 215 DWORD max_length_; |
| 216 DWORD current_length_; | 216 DWORD current_length_; |
| 217 | 217 |
| 218 DISALLOW_COPY_AND_ASSIGN(MediaBufferScopedPointer); | 218 DISALLOW_COPY_AND_ASSIGN(MediaBufferScopedPointer); |
| 219 }; | 219 }; |
| 220 | 220 |
| 221 void LogDXVAError(int line) { |
| 222 LOG(ERROR) << "Error in dxva_video_decode_accelerator_win.cc on line " |
| 223 << line; |
| 224 } |
| 225 |
| 221 } // namespace | 226 } // namespace |
| 222 | 227 |
| 223 namespace media { | 228 namespace media { |
| 224 | 229 |
| 225 static const VideoCodecProfile kSupportedProfiles[] = { | 230 static const VideoCodecProfile kSupportedProfiles[] = { |
| 226 H264PROFILE_BASELINE, H264PROFILE_MAIN, H264PROFILE_HIGH, | 231 H264PROFILE_BASELINE, H264PROFILE_MAIN, H264PROFILE_HIGH, |
| 227 VP8PROFILE_ANY, VP9PROFILE_PROFILE0, VP9PROFILE_PROFILE1, | 232 VP8PROFILE_ANY, VP9PROFILE_PROFILE0, VP9PROFILE_PROFILE1, |
| 228 VP9PROFILE_PROFILE2, VP9PROFILE_PROFILE3}; | 233 VP9PROFILE_PROFILE2, VP9PROFILE_PROFILE3}; |
| 229 | 234 |
| 230 CreateDXGIDeviceManager | 235 CreateDXGIDeviceManager |
| 231 DXVAVideoDecodeAccelerator::create_dxgi_device_manager_ = NULL; | 236 DXVAVideoDecodeAccelerator::create_dxgi_device_manager_ = NULL; |
| 232 | 237 |
| 233 #define RETURN_ON_FAILURE(result, log, ret) \ | 238 #define RETURN_ON_FAILURE(result, log, ret) \ |
| 234 do { \ | 239 do { \ |
| 235 if (!(result)) { \ | 240 if (!(result)) { \ |
| 236 DLOG(ERROR) << log; \ | 241 DLOG(ERROR) << log; \ |
| 242 LogDXVAError(__LINE__); \ |
| 237 return ret; \ | 243 return ret; \ |
| 238 } \ | 244 } \ |
| 239 } while (0) | 245 } while (0) |
| 240 | 246 |
| 241 #define RETURN_ON_HR_FAILURE(result, log, ret) \ | 247 #define RETURN_ON_HR_FAILURE(result, log, ret) \ |
| 242 RETURN_ON_FAILURE(SUCCEEDED(result), \ | 248 RETURN_ON_FAILURE(SUCCEEDED(result), \ |
| 243 log << ", HRESULT: 0x" << std::hex << result, ret); | 249 log << ", HRESULT: 0x" << std::hex << result, ret); |
| 244 | 250 |
| 245 #define RETURN_AND_NOTIFY_ON_FAILURE(result, log, error_code, ret) \ | 251 #define RETURN_AND_NOTIFY_ON_FAILURE(result, log, error_code, ret) \ |
| 246 do { \ | 252 do { \ |
| 247 if (!(result)) { \ | 253 if (!(result)) { \ |
| 248 DVLOG(1) << log; \ | 254 DVLOG(1) << log; \ |
| 255 LogDXVAError(__LINE__); \ |
| 249 StopOnError(error_code); \ | 256 StopOnError(error_code); \ |
| 250 return ret; \ | 257 return ret; \ |
| 251 } \ | 258 } \ |
| 252 } while (0) | 259 } while (0) |
| 253 | 260 |
| 254 #define RETURN_AND_NOTIFY_ON_HR_FAILURE(result, log, error_code, ret) \ | 261 #define RETURN_AND_NOTIFY_ON_HR_FAILURE(result, log, error_code, ret) \ |
| 255 RETURN_AND_NOTIFY_ON_FAILURE(SUCCEEDED(result), \ | 262 RETURN_AND_NOTIFY_ON_FAILURE(SUCCEEDED(result), \ |
| 256 log << ", HRESULT: 0x" << std::hex << result, \ | 263 log << ", HRESULT: 0x" << std::hex << result, \ |
| 257 error_code, ret); | 264 error_code, ret); |
| 258 | 265 |
| (...skipping 2503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2762 SetState(kConfigChange); | 2769 SetState(kConfigChange); |
| 2763 Invalidate(); | 2770 Invalidate(); |
| 2764 Initialize(config_, client_); | 2771 Initialize(config_, client_); |
| 2765 decoder_thread_task_runner_->PostTask( | 2772 decoder_thread_task_runner_->PostTask( |
| 2766 FROM_HERE, | 2773 FROM_HERE, |
| 2767 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, | 2774 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, |
| 2768 base::Unretained(this))); | 2775 base::Unretained(this))); |
| 2769 } | 2776 } |
| 2770 | 2777 |
| 2771 } // namespace media | 2778 } // namespace media |
| OLD | NEW |