Index: media/gpu/avda_codec_allocator.cc |
diff --git a/media/gpu/avda_codec_allocator.cc b/media/gpu/avda_codec_allocator.cc |
index bbf96156ea4d85280e8bba9b69dbbd319f80b7c0..b249e0f3e0af9f371e309b2994c5db9cc33f7883 100644 |
--- a/media/gpu/avda_codec_allocator.cc |
+++ b/media/gpu/avda_codec_allocator.cc |
@@ -137,7 +137,7 @@ scoped_refptr<base::SingleThreadTaskRunner> AVDACodecAllocator::TaskRunnerFor( |
return threads_[task_type]->thread.task_runner(); |
} |
-bool AVDACodecAllocator::AllocateSurface(AVDACodecAllocatorClient* client, |
+bool AVDACodecAllocator::AllocateSurface(AVDASurfaceAllocatorClient* client, |
int surface_id) { |
DVLOG(1) << __func__ << ": " << surface_id; |
DCHECK(thread_checker_.CalledOnValidThread()); |
@@ -160,7 +160,7 @@ bool AVDACodecAllocator::AllocateSurface(AVDACodecAllocatorClient* client, |
return false; |
} |
-void AVDACodecAllocator::DeallocateSurface(AVDACodecAllocatorClient* client, |
+void AVDACodecAllocator::DeallocateSurface(AVDASurfaceAllocatorClient* client, |
int surface_id) { |
DCHECK(thread_checker_.CalledOnValidThread()); |
if (surface_id == SurfaceManager::kNoSurfaceID || |
@@ -248,7 +248,7 @@ std::unique_ptr<VideoCodecBridge> AVDACodecAllocator::CreateMediaCodecSync( |
std::unique_ptr<VideoCodecBridge> codec(VideoCodecBridge::CreateDecoder( |
codec_config->codec, codec_config->needs_protected_surface, |
codec_config->initial_expected_coded_size, |
- codec_config->surface.j_surface().obj(), media_crypto, codec_config->csd0, |
+ codec_config->j_surface().obj(), media_crypto, codec_config->csd0, |
codec_config->csd1, true, require_software_codec)); |
return codec; |
@@ -257,11 +257,15 @@ std::unique_ptr<VideoCodecBridge> AVDACodecAllocator::CreateMediaCodecSync( |
void AVDACodecAllocator::CreateMediaCodecAsync( |
base::WeakPtr<AVDACodecAllocatorClient> client, |
scoped_refptr<CodecConfig> codec_config) { |
+ // We pass |codec_config| back to OnCodecConfigured in case it's the last |
+ // reference to it. It might have an overlay that must be dropped on the |
+ // right thread. |
base::PostTaskAndReplyWithResult( |
TaskRunnerFor(codec_config->task_type).get(), FROM_HERE, |
base::Bind(&AVDACodecAllocator::CreateMediaCodecSync, |
base::Unretained(this), codec_config), |
- base::Bind(&AVDACodecAllocatorClient::OnCodecConfigured, client)); |
+ base::Bind(&AVDACodecAllocatorClient::OnCodecConfigured, client, |
+ codec_config)); |
} |
void AVDACodecAllocator::ReleaseMediaCodec( |