| Index: content/common/gpu/media/vaapi_video_encode_accelerator.cc
|
| diff --git a/content/common/gpu/media/vaapi_video_encode_accelerator.cc b/content/common/gpu/media/vaapi_video_encode_accelerator.cc
|
| index 3ea4f91d58882642f3c1f10e23458c0e54fadac7..90c21d8be03cd3eae4d415b1f641b1682e227119 100644
|
| --- a/content/common/gpu/media/vaapi_video_encode_accelerator.cc
|
| +++ b/content/common/gpu/media/vaapi_video_encode_accelerator.cc
|
| @@ -6,7 +6,6 @@
|
|
|
| #include "base/bind.h"
|
| #include "base/callback.h"
|
| -#include "base/message_loop/message_loop_proxy.h"
|
| #include "base/metrics/histogram.h"
|
| #include "base/numerics/safe_conversions.h"
|
| #include "content/common/gpu/media/h264_dpb.h"
|
| @@ -133,7 +132,7 @@ VaapiVideoEncodeAccelerator::VaapiVideoEncodeAccelerator()
|
| cpb_size_(0),
|
| encoding_parameters_changed_(false),
|
| encoder_thread_("VAVEAEncoderThread"),
|
| - child_message_loop_proxy_(base::MessageLoopProxy::current()),
|
| + child_task_runner_(base::ThreadTaskRunnerHandle::Get()),
|
| weak_this_ptr_factory_(this) {
|
| DVLOGF(4);
|
| weak_this_ = weak_this_ptr_factory_.GetWeakPtr();
|
| @@ -147,7 +146,7 @@ VaapiVideoEncodeAccelerator::VaapiVideoEncodeAccelerator()
|
|
|
| VaapiVideoEncodeAccelerator::~VaapiVideoEncodeAccelerator() {
|
| DVLOGF(4);
|
| - DCHECK(child_message_loop_proxy_->BelongsToCurrentThread());
|
| + DCHECK(child_task_runner_->BelongsToCurrentThread());
|
| DCHECK(!encoder_thread_.IsRunning());
|
| }
|
|
|
| @@ -157,7 +156,7 @@ bool VaapiVideoEncodeAccelerator::Initialize(
|
| media::VideoCodecProfile output_profile,
|
| uint32 initial_bitrate,
|
| Client* client) {
|
| - DCHECK(child_message_loop_proxy_->BelongsToCurrentThread());
|
| + DCHECK(child_task_runner_->BelongsToCurrentThread());
|
| DCHECK(!encoder_thread_.IsRunning());
|
| DCHECK_EQ(state_, kUninitialized);
|
|
|
| @@ -207,7 +206,7 @@ bool VaapiVideoEncodeAccelerator::Initialize(
|
| LOG(ERROR) << "Failed to start encoder thread";
|
| return false;
|
| }
|
| - encoder_thread_proxy_ = encoder_thread_.message_loop_proxy();
|
| + encoder_thread_proxy_ = encoder_thread_.task_runner();
|
|
|
| // Finish the remaining initialization on the encoder thread.
|
| encoder_thread_proxy_->PostTask(
|
| @@ -239,13 +238,10 @@ void VaapiVideoEncodeAccelerator::InitializeTask() {
|
| UpdatePPS();
|
| GeneratePackedPPS();
|
|
|
| - child_message_loop_proxy_->PostTask(
|
| + child_task_runner_->PostTask(
|
| FROM_HERE,
|
| - base::Bind(&Client::RequireBitstreamBuffers,
|
| - client_,
|
| - kNumInputBuffers,
|
| - coded_size_,
|
| - output_buffer_byte_size_));
|
| + base::Bind(&Client::RequireBitstreamBuffers, client_, kNumInputBuffers,
|
| + coded_size_, output_buffer_byte_size_));
|
|
|
| SetState(kEncoding);
|
| }
|
| @@ -556,12 +552,9 @@ void VaapiVideoEncodeAccelerator::TryToReturnBitstreamBuffer() {
|
| << (encode_job->keyframe ? "(keyframe)" : "")
|
| << " id: " << buffer->id << " size: " << data_size;
|
|
|
| - child_message_loop_proxy_->PostTask(FROM_HERE,
|
| - base::Bind(&Client::BitstreamBufferReady,
|
| - client_,
|
| - buffer->id,
|
| - data_size,
|
| - encode_job->keyframe));
|
| + child_task_runner_->PostTask(
|
| + FROM_HERE, base::Bind(&Client::BitstreamBufferReady, client_, buffer->id,
|
| + data_size, encode_job->keyframe));
|
| }
|
|
|
| void VaapiVideoEncodeAccelerator::Encode(
|
| @@ -569,7 +562,7 @@ void VaapiVideoEncodeAccelerator::Encode(
|
| bool force_keyframe) {
|
| DVLOGF(3) << "Frame timestamp: " << frame->timestamp().InMilliseconds()
|
| << " force_keyframe: " << force_keyframe;
|
| - DCHECK(child_message_loop_proxy_->BelongsToCurrentThread());
|
| + DCHECK(child_task_runner_->BelongsToCurrentThread());
|
|
|
| encoder_thread_proxy_->PostTask(
|
| FROM_HERE,
|
| @@ -663,7 +656,7 @@ void VaapiVideoEncodeAccelerator::EncodeFrameTask() {
|
| void VaapiVideoEncodeAccelerator::UseOutputBitstreamBuffer(
|
| const media::BitstreamBuffer& buffer) {
|
| DVLOGF(4) << "id: " << buffer.id();
|
| - DCHECK(child_message_loop_proxy_->BelongsToCurrentThread());
|
| + DCHECK(child_task_runner_->BelongsToCurrentThread());
|
|
|
| if (buffer.size() < output_buffer_byte_size_) {
|
| NOTIFY_ERROR(kInvalidArgumentError, "Provided bitstream buffer too small");
|
| @@ -700,7 +693,7 @@ void VaapiVideoEncodeAccelerator::RequestEncodingParametersChange(
|
| uint32 bitrate,
|
| uint32 framerate) {
|
| DVLOGF(2) << "bitrate: " << bitrate << " framerate: " << framerate;
|
| - DCHECK(child_message_loop_proxy_->BelongsToCurrentThread());
|
| + DCHECK(child_task_runner_->BelongsToCurrentThread());
|
|
|
| encoder_thread_proxy_->PostTask(
|
| FROM_HERE,
|
| @@ -752,7 +745,7 @@ void VaapiVideoEncodeAccelerator::RequestEncodingParametersChangeTask(
|
| }
|
|
|
| void VaapiVideoEncodeAccelerator::Destroy() {
|
| - DCHECK(child_message_loop_proxy_->BelongsToCurrentThread());
|
| + DCHECK(child_task_runner_->BelongsToCurrentThread());
|
|
|
| // Can't call client anymore after Destroy() returns.
|
| client_ptr_factory_.reset();
|
| @@ -1050,11 +1043,10 @@ void VaapiVideoEncodeAccelerator::SetState(State state) {
|
| }
|
|
|
| void VaapiVideoEncodeAccelerator::NotifyError(Error error) {
|
| - if (!child_message_loop_proxy_->BelongsToCurrentThread()) {
|
| - child_message_loop_proxy_->PostTask(
|
| - FROM_HERE,
|
| - base::Bind(
|
| - &VaapiVideoEncodeAccelerator::NotifyError, weak_this_, error));
|
| + if (!child_task_runner_->BelongsToCurrentThread()) {
|
| + child_task_runner_->PostTask(
|
| + FROM_HERE, base::Bind(&VaapiVideoEncodeAccelerator::NotifyError,
|
| + weak_this_, error));
|
| return;
|
| }
|
|
|
|
|