Index: media/filters/gpu_video_decoder.cc |
diff --git a/media/filters/gpu_video_decoder.cc b/media/filters/gpu_video_decoder.cc |
index 44ccf35ec1e4c81af67d2c7ffaac89196df5ed05..7f3e0a37d002481e9e1971efff5c2b64d8b5ea8a 100644 |
--- a/media/filters/gpu_video_decoder.cc |
+++ b/media/filters/gpu_video_decoder.cc |
@@ -56,7 +56,7 @@ GpuVideoDecoder::GpuVideoDecoder( |
const scoped_refptr<GpuVideoAcceleratorFactories>& factories, |
const scoped_refptr<MediaLog>& media_log) |
: needs_bitstream_conversion_(false), |
- gvd_loop_proxy_(factories->GetMessageLoop()), |
+ gvd_task_runner_(factories->GetTaskRunner()), |
weak_factory_(this), |
factories_(factories), |
state_(kNormal), |
@@ -70,10 +70,10 @@ GpuVideoDecoder::GpuVideoDecoder( |
void GpuVideoDecoder::Reset(const base::Closure& closure) { |
DVLOG(3) << "Reset()"; |
- DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); |
+ DCHECK(gvd_task_runner_->BelongsToCurrentThread()); |
if (state_ == kDrainingDecoder && !factories_->IsAborted()) { |
- gvd_loop_proxy_->PostTask(FROM_HERE, base::Bind( |
+ gvd_task_runner_->PostTask(FROM_HERE, base::Bind( |
&GpuVideoDecoder::Reset, weak_this_, closure)); |
// NOTE: if we're deferring Reset() until a Flush() completes, return |
// queued pictures to the VDA so they can be used to finish that Flush(). |
@@ -86,7 +86,7 @@ void GpuVideoDecoder::Reset(const base::Closure& closure) { |
ready_video_frames_.clear(); |
if (!vda_) { |
- gvd_loop_proxy_->PostTask(FROM_HERE, closure); |
+ gvd_task_runner_->PostTask(FROM_HERE, closure); |
return; |
} |
@@ -100,7 +100,7 @@ void GpuVideoDecoder::Reset(const base::Closure& closure) { |
} |
void GpuVideoDecoder::Stop(const base::Closure& closure) { |
- DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); |
+ DCHECK(gvd_task_runner_->BelongsToCurrentThread()); |
if (vda_) |
DestroyVDA(); |
if (!pending_decode_cb_.is_null()) |
@@ -129,7 +129,7 @@ static bool IsCodedSizeSupported(const gfx::Size& coded_size) { |
void GpuVideoDecoder::Initialize(const VideoDecoderConfig& config, |
const PipelineStatusCB& orig_status_cb) { |
DVLOG(3) << "Initialize()"; |
- DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); |
+ DCHECK(gvd_task_runner_->BelongsToCurrentThread()); |
DCHECK(config.IsValidConfig()); |
DCHECK(!config.is_encrypted()); |
@@ -189,7 +189,7 @@ void GpuVideoDecoder::Initialize(const VideoDecoderConfig& config, |
} |
void GpuVideoDecoder::DestroyPictureBuffers(PictureBufferMap* buffers) { |
- DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); |
+ DCHECK(gvd_task_runner_->BelongsToCurrentThread()); |
for (PictureBufferMap::iterator it = buffers->begin(); it != buffers->end(); |
++it) { |
factories_->DeleteTexture(it->second.texture_id()); |
@@ -199,7 +199,7 @@ void GpuVideoDecoder::DestroyPictureBuffers(PictureBufferMap* buffers) { |
} |
void GpuVideoDecoder::DestroyVDA() { |
- DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); |
+ DCHECK(gvd_task_runner_->BelongsToCurrentThread()); |
if (vda_) |
vda_.release()->Destroy(); |
@@ -211,7 +211,7 @@ void GpuVideoDecoder::DestroyVDA() { |
void GpuVideoDecoder::Decode(const scoped_refptr<DecoderBuffer>& buffer, |
const DecodeCB& decode_cb) { |
- DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); |
+ DCHECK(gvd_task_runner_->BelongsToCurrentThread()); |
DCHECK(pending_reset_cb_.is_null()); |
DCHECK(pending_decode_cb_.is_null()); |
@@ -320,17 +320,17 @@ void GpuVideoDecoder::GetBufferData(int32 id, base::TimeDelta* timestamp, |
} |
bool GpuVideoDecoder::HasAlpha() const { |
- DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); |
+ DCHECK(gvd_task_runner_->BelongsToCurrentThread()); |
return true; |
} |
bool GpuVideoDecoder::NeedsBitstreamConversion() const { |
- DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); |
+ DCHECK(gvd_task_runner_->BelongsToCurrentThread()); |
return needs_bitstream_conversion_; |
} |
bool GpuVideoDecoder::CanReadWithoutStalling() const { |
- DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); |
+ DCHECK(gvd_task_runner_->BelongsToCurrentThread()); |
return available_pictures_ > 0 || !ready_video_frames_.empty(); |
} |
@@ -343,7 +343,7 @@ void GpuVideoDecoder::ProvidePictureBuffers(uint32 count, |
uint32 texture_target) { |
DVLOG(3) << "ProvidePictureBuffers(" << count << ", " |
<< size.width() << "x" << size.height() << ")"; |
- DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); |
+ DCHECK(gvd_task_runner_->BelongsToCurrentThread()); |
std::vector<uint32> texture_ids; |
std::vector<gpu::Mailbox> texture_mailboxes; |
@@ -380,7 +380,7 @@ void GpuVideoDecoder::ProvidePictureBuffers(uint32 count, |
void GpuVideoDecoder::DismissPictureBuffer(int32 id) { |
DVLOG(3) << "DismissPictureBuffer(" << id << ")"; |
- DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); |
+ DCHECK(gvd_task_runner_->BelongsToCurrentThread()); |
PictureBufferMap::iterator it = assigned_picture_buffers_.find(id); |
if (it == assigned_picture_buffers_.end()) { |
@@ -409,7 +409,7 @@ void GpuVideoDecoder::DismissPictureBuffer(int32 id) { |
void GpuVideoDecoder::PictureReady(const media::Picture& picture) { |
DVLOG(3) << "PictureReady()"; |
- DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); |
+ DCHECK(gvd_task_runner_->BelongsToCurrentThread()); |
PictureBufferMap::iterator it = |
assigned_picture_buffers_.find(picture.picture_buffer_id()); |
@@ -456,7 +456,7 @@ void GpuVideoDecoder::PictureReady(const media::Picture& picture) { |
void GpuVideoDecoder::EnqueueFrameAndTriggerFrameDelivery( |
const scoped_refptr<VideoFrame>& frame) { |
- DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); |
+ DCHECK(gvd_task_runner_->BelongsToCurrentThread()); |
// During a pending vda->Reset(), we don't accumulate frames. Drop it on the |
// floor and return. |
@@ -479,7 +479,7 @@ void GpuVideoDecoder::EnqueueFrameAndTriggerFrameDelivery( |
void GpuVideoDecoder::ReusePictureBuffer(int64 picture_buffer_id, |
uint32 sync_point) { |
DVLOG(3) << "ReusePictureBuffer(" << picture_buffer_id << ")"; |
- DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); |
+ DCHECK(gvd_task_runner_->BelongsToCurrentThread()); |
if (!vda_) |
return; |
@@ -508,7 +508,7 @@ void GpuVideoDecoder::ReusePictureBuffer(int64 picture_buffer_id, |
} |
GpuVideoDecoder::SHMBuffer* GpuVideoDecoder::GetSHM(size_t min_size) { |
- DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); |
+ DCHECK(gvd_task_runner_->BelongsToCurrentThread()); |
if (available_shm_segments_.empty() || |
available_shm_segments_.back()->size < min_size) { |
size_t size_to_allocate = std::max(min_size, kSharedMemorySegmentBytes); |
@@ -524,13 +524,13 @@ GpuVideoDecoder::SHMBuffer* GpuVideoDecoder::GetSHM(size_t min_size) { |
} |
void GpuVideoDecoder::PutSHM(SHMBuffer* shm_buffer) { |
- DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); |
+ DCHECK(gvd_task_runner_->BelongsToCurrentThread()); |
available_shm_segments_.push_back(shm_buffer); |
} |
void GpuVideoDecoder::NotifyEndOfBitstreamBuffer(int32 id) { |
DVLOG(3) << "NotifyEndOfBitstreamBuffer(" << id << ")"; |
- DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); |
+ DCHECK(gvd_task_runner_->BelongsToCurrentThread()); |
std::map<int32, BufferPair>::iterator it = |
bitstream_buffers_in_decoder_.find(id); |
@@ -550,7 +550,7 @@ void GpuVideoDecoder::NotifyEndOfBitstreamBuffer(int32 id) { |
} |
GpuVideoDecoder::~GpuVideoDecoder() { |
- DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); |
+ DCHECK(gvd_task_runner_->BelongsToCurrentThread()); |
DCHECK(!vda_.get()); // Stop should have been already called. |
DCHECK(pending_decode_cb_.is_null()); |
for (size_t i = 0; i < available_shm_segments_.size(); ++i) { |
@@ -571,7 +571,7 @@ GpuVideoDecoder::~GpuVideoDecoder() { |
void GpuVideoDecoder::NotifyFlushDone() { |
DVLOG(3) << "NotifyFlushDone()"; |
- DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); |
+ DCHECK(gvd_task_runner_->BelongsToCurrentThread()); |
DCHECK_EQ(state_, kDrainingDecoder); |
state_ = kDecoderDrained; |
EnqueueFrameAndTriggerFrameDelivery(VideoFrame::CreateEmptyFrame()); |
@@ -579,7 +579,7 @@ void GpuVideoDecoder::NotifyFlushDone() { |
void GpuVideoDecoder::NotifyResetDone() { |
DVLOG(3) << "NotifyResetDone()"; |
- DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); |
+ DCHECK(gvd_task_runner_->BelongsToCurrentThread()); |
DCHECK(ready_video_frames_.empty()); |
// This needs to happen after the Reset() on vda_ is done to ensure pictures |
@@ -594,7 +594,7 @@ void GpuVideoDecoder::NotifyResetDone() { |
} |
void GpuVideoDecoder::NotifyError(media::VideoDecodeAccelerator::Error error) { |
- DCHECK(gvd_loop_proxy_->BelongsToCurrentThread()); |
+ DCHECK(gvd_task_runner_->BelongsToCurrentThread()); |
if (!vda_) |
return; |