Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1045)

Unified Diff: media/filters/gpu_video_decoder.cc

Issue 65803002: Replace MessageLoopProxy with SingleThreadTaskRunner for media/filters/ + associated code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/filters/gpu_video_decoder.h ('k') | media/filters/mock_gpu_video_accelerator_factories.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/gpu_video_decoder.cc
diff --git a/media/filters/gpu_video_decoder.cc b/media/filters/gpu_video_decoder.cc
index 6f2fe93c0ab098535001b1b52ec417e421ee7980..fcddcfc77f96560c1637a301aa28ba92a7f83df9 100644
--- a/media/filters/gpu_video_decoder.cc
+++ b/media/filters/gpu_video_decoder.cc
@@ -57,7 +57,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),
@@ -71,10 +71,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().
@@ -87,7 +87,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;
}
@@ -101,7 +101,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())
@@ -141,7 +141,7 @@ static void ReportGpuVideoDecoderInitializeStatusToUMAAndRunCB(
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());
@@ -201,7 +201,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());
@@ -211,7 +211,7 @@ void GpuVideoDecoder::DestroyPictureBuffers(PictureBufferMap* buffers) {
}
void GpuVideoDecoder::DestroyVDA() {
- DCHECK(gvd_loop_proxy_->BelongsToCurrentThread());
+ DCHECK(gvd_task_runner_->BelongsToCurrentThread());
if (vda_)
vda_.release()->Destroy();
@@ -223,7 +223,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());
@@ -332,17 +332,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
next_picture_buffer_id_ == 0 || // Decode() will ProvidePictureBuffers().
available_pictures_ > 0 || !ready_video_frames_.empty();
@@ -357,7 +357,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;
@@ -394,7 +394,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()) {
@@ -423,7 +423,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());
@@ -470,7 +470,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.
@@ -493,7 +493,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;
@@ -522,7 +522,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);
@@ -538,13 +538,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);
@@ -564,7 +564,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) {
@@ -585,7 +585,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::CreateEOSFrame());
@@ -593,7 +593,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
@@ -608,7 +608,7 @@ void GpuVideoDecoder::NotifyResetDone() {
}
void GpuVideoDecoder::NotifyError(media::VideoDecodeAccelerator::Error error) {
- DCHECK(gvd_loop_proxy_->BelongsToCurrentThread());
+ DCHECK(gvd_task_runner_->BelongsToCurrentThread());
if (!vda_)
return;
« no previous file with comments | « media/filters/gpu_video_decoder.h ('k') | media/filters/mock_gpu_video_accelerator_factories.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698