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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 | 577 |
578 RETURN_AND_NOTIFY_ON_HR_FAILURE(sample->SetSampleTime(bitstream_buffer.id()), | 578 RETURN_AND_NOTIFY_ON_HR_FAILURE(sample->SetSampleTime(bitstream_buffer.id()), |
579 "Failed to associate input buffer id with sample", PLATFORM_FAILURE,); | 579 "Failed to associate input buffer id with sample", PLATFORM_FAILURE,); |
580 | 580 |
581 if (!inputs_before_decode_) { | 581 if (!inputs_before_decode_) { |
582 TRACE_EVENT_BEGIN_ETW("DXVAVideoDecodeAccelerator.Decoding", this, ""); | 582 TRACE_EVENT_BEGIN_ETW("DXVAVideoDecodeAccelerator.Decoding", this, ""); |
583 } | 583 } |
584 inputs_before_decode_++; | 584 inputs_before_decode_++; |
585 | 585 |
586 HRESULT hr = decoder_->ProcessInput(0, sample, 0); | 586 HRESULT hr = decoder_->ProcessInput(0, sample, 0); |
| 587 // As per msdn if the decoder returns MF_E_NOTACCEPTING then it means that it |
| 588 // has enough data to produce an output sample. In this case the recommended |
| 589 // options are to |
| 590 // 1. Generate new output by calling IMFTransform::ProcessOutput |
| 591 // 2. Flush the input data |
| 592 // We implement the first option, i.e to retrieve the output sample and then |
| 593 // process the input again. Failure in either of these steps is treated as a |
| 594 // decoder failure. |
| 595 if (hr == MF_E_NOTACCEPTING) { |
| 596 DoDecode(); |
| 597 RETURN_AND_NOTIFY_ON_FAILURE((state_ == kStopped || state_ == kNormal), |
| 598 "Failed to process output. Unexpected decoder state: " << state_, |
| 599 PLATFORM_FAILURE,); |
| 600 hr = decoder_->ProcessInput(0, sample, 0); |
| 601 } |
587 RETURN_AND_NOTIFY_ON_HR_FAILURE(hr, "Failed to process input sample", | 602 RETURN_AND_NOTIFY_ON_HR_FAILURE(hr, "Failed to process input sample", |
588 PLATFORM_FAILURE,); | 603 PLATFORM_FAILURE,); |
589 | 604 |
590 state_ = kEosDrain; | 605 state_ = kEosDrain; |
591 | 606 |
592 DoDecode(); | 607 DoDecode(); |
593 | 608 |
594 RETURN_AND_NOTIFY_ON_FAILURE((state_ == kStopped || state_ == kNormal), | 609 RETURN_AND_NOTIFY_ON_FAILURE((state_ == kStopped || state_ == kNormal), |
595 "Failed to process output. Unexpected decoder state: " << state_, | 610 "Failed to process output. Unexpected decoder state: " << state_, |
596 ILLEGAL_STATE,); | 611 ILLEGAL_STATE,); |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 GL_TEXTURE_2D); | 1071 GL_TEXTURE_2D); |
1057 } | 1072 } |
1058 } | 1073 } |
1059 | 1074 |
1060 void DXVAVideoDecodeAccelerator::NotifyPictureReady( | 1075 void DXVAVideoDecodeAccelerator::NotifyPictureReady( |
1061 const media::Picture& picture) { | 1076 const media::Picture& picture) { |
1062 // This task could execute after the decoder has been torn down. | 1077 // This task could execute after the decoder has been torn down. |
1063 if (state_ != kUninitialized && client_) | 1078 if (state_ != kUninitialized && client_) |
1064 client_->PictureReady(picture); | 1079 client_->PictureReady(picture); |
1065 } | 1080 } |
OLD | NEW |