| Index: content/common/gpu/media/vaapi_video_decode_accelerator.cc
|
| diff --git a/content/common/gpu/media/vaapi_video_decode_accelerator.cc b/content/common/gpu/media/vaapi_video_decode_accelerator.cc
|
| index 73471d64eaf2256738fa353ea67fc7d87a54d4d6..79860d5b60dc1190c7046da266eddec104a5c922 100644
|
| --- a/content/common/gpu/media/vaapi_video_decode_accelerator.cc
|
| +++ b/content/common/gpu/media/vaapi_video_decode_accelerator.cc
|
| @@ -57,7 +57,7 @@ void VaapiVideoDecodeAccelerator::NotifyError(Error error) {
|
| DVLOG(1) << "Notifying of error " << error;
|
| if (client_) {
|
| client_->NotifyError(error);
|
| - client_ptr_factory_.InvalidateWeakPtrs();
|
| + client_ptr_factory_.reset();
|
| }
|
| }
|
|
|
| @@ -237,7 +237,6 @@ VaapiVideoDecodeAccelerator::TFPPicture*
|
|
|
| VaapiVideoDecodeAccelerator::VaapiVideoDecodeAccelerator(
|
| Display* x_display,
|
| - Client* client,
|
| const base::Callback<bool(void)>& make_context_current)
|
| : x_display_(x_display),
|
| make_context_current_(make_context_current),
|
| @@ -248,15 +247,12 @@ VaapiVideoDecodeAccelerator::VaapiVideoDecodeAccelerator(
|
| weak_this_(base::AsWeakPtr(this)),
|
| va_surface_release_cb_(media::BindToCurrentLoop(base::Bind(
|
| &VaapiVideoDecodeAccelerator::RecycleVASurfaceID, weak_this_))),
|
| - client_ptr_factory_(client),
|
| - client_(client_ptr_factory_.GetWeakPtr()),
|
| decoder_thread_("VaapiDecoderThread"),
|
| num_frames_at_client_(0),
|
| num_stream_bufs_at_decoder_(0),
|
| finish_flush_pending_(false),
|
| awaiting_va_surfaces_recycle_(false),
|
| requested_num_pics_(0) {
|
| - DCHECK(client);
|
| }
|
|
|
| VaapiVideoDecodeAccelerator::~VaapiVideoDecodeAccelerator() {
|
| @@ -292,10 +288,13 @@ bool VaapiVideoDecodeAccelerator::InitializeFBConfig() {
|
| return true;
|
| }
|
|
|
| -bool VaapiVideoDecodeAccelerator::Initialize(
|
| - media::VideoCodecProfile profile) {
|
| +bool VaapiVideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile,
|
| + Client* client) {
|
| DCHECK_EQ(message_loop_, base::MessageLoop::current());
|
|
|
| + client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client));
|
| + client_ = client_ptr_factory_->GetWeakPtr();
|
| +
|
| base::AutoLock auto_lock(lock_);
|
| DCHECK_EQ(state_, kUninitialized);
|
| DVLOG(2) << "Initializing VAVDA, profile: " << profile;
|
| @@ -904,7 +903,7 @@ void VaapiVideoDecodeAccelerator::Cleanup() {
|
| base::AutoLock auto_lock(lock_);
|
| state_ = kDestroying;
|
|
|
| - client_ptr_factory_.InvalidateWeakPtrs();
|
| + client_ptr_factory_.reset();
|
|
|
| {
|
| base::AutoUnlock auto_unlock(lock_);
|
|
|