Commit 71020cea authored by Dale Curtis's avatar Dale Curtis Committed by Commit Bot

Don't abort PictureBuffer operations during Invalidate().

These operations should continue in all cases since dismissing,
requesting, or waiting on picture buffers should happen regardless
of whatever the decoder is currently doing.

R=liberato

Bug: 1111273
Change-Id: I7dc76ca22cca3f5f16c085a9cd9648275aa3e0c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2473342
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Auto-Submit: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarFrank Liberato <liberato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#817324}
parent 4957560c
......@@ -617,6 +617,7 @@ DXVAVideoDecodeAccelerator::DXVAVideoDecodeAccelerator(
processing_config_changed_(false),
use_empty_video_hdr_metadata_(workarounds.use_empty_video_hdr_metadata) {
weak_ptr_ = weak_this_factory_.GetWeakPtr();
pb_weak_ptr_ = pb_weak_this_factory_.GetWeakPtr();
memset(&input_stream_info_, 0, sizeof(input_stream_info_));
memset(&output_stream_info_, 0, sizeof(output_stream_info_));
use_color_info_ = base::FeatureList::IsEnabled(kVideoBlitColorAccuracy);
......@@ -1138,7 +1139,7 @@ void DXVAVideoDecodeAccelerator::ReusePictureBuffer(int32_t picture_buffer_id) {
FROM_HERE,
base::BindOnce(
&DXVAVideoDecodeAccelerator::DeferredDismissStaleBuffer,
weak_ptr_, picture_buffer_id));
pb_weak_ptr_, picture_buffer_id));
}
return;
}
......@@ -1198,7 +1199,7 @@ void DXVAVideoDecodeAccelerator::WaitForOutputBuffer(int32_t picture_buffer_id,
main_thread_task_runner_->PostDelayedTask(
FROM_HERE,
base::BindOnce(&DXVAVideoDecodeAccelerator::WaitForOutputBuffer,
weak_ptr_, picture_buffer_id, count + 1),
pb_weak_ptr_, picture_buffer_id, count + 1),
base::TimeDelta::FromMilliseconds(kFlushDecoderSurfaceTimeoutMs));
return;
}
......@@ -1847,7 +1848,7 @@ bool DXVAVideoDecodeAccelerator::ProcessOutputSample(
main_thread_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(&DXVAVideoDecodeAccelerator::RequestPictureBuffers,
weak_ptr_, width, height));
pb_weak_ptr_, width, height));
pictures_requested_ = true;
return true;
......@@ -2010,6 +2011,9 @@ void DXVAVideoDecodeAccelerator::Invalidate() {
// resolution changes. We already handle that in the
// HandleResolutionChanged() function.
if (GetState() != kConfigChange) {
pb_weak_this_factory_.InvalidateWeakPtrs();
pb_weak_ptr_ = pb_weak_this_factory_.GetWeakPtr();
output_picture_buffers_.clear();
stale_output_picture_buffers_.clear();
// We want to continue processing pending input after detecting a config
......@@ -2335,12 +2339,12 @@ void DXVAVideoDecodeAccelerator::HandleResolutionChanged(int width,
main_thread_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(&DXVAVideoDecodeAccelerator::DismissStaleBuffers,
weak_ptr_, false));
pb_weak_ptr_, false));
main_thread_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(&DXVAVideoDecodeAccelerator::RequestPictureBuffers,
weak_ptr_, width, height));
pb_weak_ptr_, width, height));
}
void DXVAVideoDecodeAccelerator::DismissStaleBuffers(bool force) {
......
......@@ -532,6 +532,7 @@ class MEDIA_GPU_EXPORT DXVAVideoDecodeAccelerator
// thread safety of reaching into this class from multiple threads to
// attain a WeakPtr.
base::WeakPtr<DXVAVideoDecodeAccelerator> weak_ptr_;
base::WeakPtr<DXVAVideoDecodeAccelerator> pb_weak_ptr_;
// Set to true if we are in the context of a Flush operation. Used to prevent
// multiple flush done notifications being sent out.
......@@ -613,6 +614,9 @@ class MEDIA_GPU_EXPORT DXVAVideoDecodeAccelerator
// WeakPtrFactory for posting tasks back to |this|.
base::WeakPtrFactory<DXVAVideoDecodeAccelerator> weak_this_factory_{this};
// WeakPtrFactory for posting picture buffer related tasks back to |this|.
base::WeakPtrFactory<DXVAVideoDecodeAccelerator> pb_weak_this_factory_{this};
// Function pointer for the MFCreateDXGIDeviceManager API.
static CreateDXGIDeviceManager create_dxgi_device_manager_;
......
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