| 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 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1276 return; | 1276 return; |
| 1277 } else if (hr == MF_E_TRANSFORM_NEED_MORE_INPUT) { | 1277 } else if (hr == MF_E_TRANSFORM_NEED_MORE_INPUT) { |
| 1278 // No more output from the decoder. Stop playback. | 1278 // No more output from the decoder. Stop playback. |
| 1279 SetState(kStopped); | 1279 SetState(kStopped); |
| 1280 return; | 1280 return; |
| 1281 } else { | 1281 } else { |
| 1282 NOTREACHED() << "Unhandled error in DoDecode()"; | 1282 NOTREACHED() << "Unhandled error in DoDecode()"; |
| 1283 return; | 1283 return; |
| 1284 } | 1284 } |
| 1285 } | 1285 } |
| 1286 TRACE_EVENT_END_ETW("DXVAVideoDecodeAccelerator.Decoding", this, ""); | 1286 TRACE_EVENT_ASYNC_END0("gpu", "DXVAVideoDecodeAccelerator.Decoding", this); |
| 1287 | 1287 |
| 1288 TRACE_COUNTER1("DXVA Decoding", "TotalPacketsBeforeDecode", | 1288 TRACE_COUNTER1("DXVA Decoding", "TotalPacketsBeforeDecode", |
| 1289 inputs_before_decode_); | 1289 inputs_before_decode_); |
| 1290 | 1290 |
| 1291 inputs_before_decode_ = 0; | 1291 inputs_before_decode_ = 0; |
| 1292 | 1292 |
| 1293 RETURN_AND_NOTIFY_ON_FAILURE(ProcessOutputSample(output_data_buffer.pSample), | 1293 RETURN_AND_NOTIFY_ON_FAILURE(ProcessOutputSample(output_data_buffer.pSample), |
| 1294 "Failed to process output sample.", PLATFORM_FAILURE,); | 1294 "Failed to process output sample.", PLATFORM_FAILURE,); |
| 1295 } | 1295 } |
| 1296 | 1296 |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1606 | 1606 |
| 1607 if (GetState() == kUninitialized) | 1607 if (GetState() == kUninitialized) |
| 1608 return; | 1608 return; |
| 1609 | 1609 |
| 1610 if (OutputSamplesPresent() || !pending_input_buffers_.empty()) { | 1610 if (OutputSamplesPresent() || !pending_input_buffers_.empty()) { |
| 1611 pending_input_buffers_.push_back(sample); | 1611 pending_input_buffers_.push_back(sample); |
| 1612 return; | 1612 return; |
| 1613 } | 1613 } |
| 1614 | 1614 |
| 1615 if (!inputs_before_decode_) { | 1615 if (!inputs_before_decode_) { |
| 1616 TRACE_EVENT_BEGIN_ETW("DXVAVideoDecodeAccelerator.Decoding", this, ""); | 1616 TRACE_EVENT_ASYNC_BEGIN0("gpu", "DXVAVideoDecodeAccelerator.Decoding", |
| 1617 this); |
| 1617 } | 1618 } |
| 1618 inputs_before_decode_++; | 1619 inputs_before_decode_++; |
| 1619 | 1620 |
| 1620 HRESULT hr = decoder_->ProcessInput(0, sample.get(), 0); | 1621 HRESULT hr = decoder_->ProcessInput(0, sample.get(), 0); |
| 1621 // As per msdn if the decoder returns MF_E_NOTACCEPTING then it means that it | 1622 // As per msdn if the decoder returns MF_E_NOTACCEPTING then it means that it |
| 1622 // has enough data to produce one or more output samples. In this case the | 1623 // has enough data to produce one or more output samples. In this case the |
| 1623 // recommended options are to | 1624 // recommended options are to |
| 1624 // 1. Generate new output by calling IMFTransform::ProcessOutput until it | 1625 // 1. Generate new output by calling IMFTransform::ProcessOutput until it |
| 1625 // returns MF_E_TRANSFORM_NEED_MORE_INPUT. | 1626 // returns MF_E_TRANSFORM_NEED_MORE_INPUT. |
| 1626 // 2. Flush the input data | 1627 // 2. Flush the input data |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2205 D3DSURFACE_DESC surface_desc; | 2206 D3DSURFACE_DESC surface_desc; |
| 2206 hr = surface->GetDesc(&surface_desc); | 2207 hr = surface->GetDesc(&surface_desc); |
| 2207 RETURN_ON_HR_FAILURE(hr, "Failed to get surface description", false); | 2208 RETURN_ON_HR_FAILURE(hr, "Failed to get surface description", false); |
| 2208 *width = surface_desc.Width; | 2209 *width = surface_desc.Width; |
| 2209 *height = surface_desc.Height; | 2210 *height = surface_desc.Height; |
| 2210 } | 2211 } |
| 2211 return true; | 2212 return true; |
| 2212 } | 2213 } |
| 2213 | 2214 |
| 2214 } // namespace content | 2215 } // namespace content |
| OLD | NEW |