Commit 89d1d57f authored by Ted Meyer's avatar Ted Meyer Committed by Commit Bot

Fix media::Status dcheck from D3d11VideoDecoder

Causal statuses are required to be non-ok-statuses, but the conditions
as written could allow a causal status to be generated from a successful
HRESULT. This breaks the conditions up, and moves one of the checks from
!SUCCEEDED() to FAILED() for consistency

Bug: 1120094
Change-Id: I47c2524c2ee5ae4984f1616fb26f02386bfbe6f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2369434
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#800720}
parent 8606649f
......@@ -222,11 +222,14 @@ D3D11VideoDecoder::CreateD3D11Decoder() {
UINT config_count = 0;
hr = video_device_->GetVideoDecoderConfigCount(
decoder_configurator_->DecoderDescriptor(), &config_count);
if (FAILED(hr) || config_count == 0) {
if (FAILED(hr)) {
return Status(StatusCode::kGetDecoderConfigCountFailed)
.AddCause(HresultToStatus(hr));
}
if (config_count == 0)
return Status(StatusCode::kGetDecoderConfigCountFailed);
D3D11_VIDEO_DECODER_CONFIG dec_config = {};
bool found = false;
......@@ -277,7 +280,11 @@ D3D11VideoDecoder::CreateD3D11Decoder() {
Microsoft::WRL::ComPtr<ID3D11VideoDecoder> video_decoder;
hr = video_device_->CreateVideoDecoder(
decoder_configurator_->DecoderDescriptor(), &dec_config, &video_decoder);
if (!video_decoder.Get() || FAILED(hr)) {
if (!video_decoder.Get())
return Status(StatusCode::kDecoderCreationFailed);
if (FAILED(hr)) {
return Status(StatusCode::kDecoderCreationFailed)
.AddCause(HresultToStatus(hr));
}
......@@ -368,7 +375,7 @@ void D3D11VideoDecoder::Initialize(const VideoDecoderConfig& config,
if (!base::FeatureList::IsEnabled(kD3D11VideoDecoderSkipMultithreaded)) {
ComD3D11Multithread multi_threaded;
hr = device_->QueryInterface(IID_PPV_ARGS(&multi_threaded));
if (!SUCCEEDED(hr)) {
if (FAILED(hr)) {
NotifyError(Status(StatusCode::kQueryID3D11MultithreadFailed)
.AddCause(HresultToStatus(hr)));
return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment