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

Unified Diff: media/gpu/v4l2_video_encode_accelerator.cc

Issue 2076423004: Remove calls to MessageLoop::current() in media. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months 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
Index: media/gpu/v4l2_video_encode_accelerator.cc
diff --git a/media/gpu/v4l2_video_encode_accelerator.cc b/media/gpu/v4l2_video_encode_accelerator.cc
index 19db6d94dd2aa5b20fa380642ca1ccfdfb2772dc..481c27741f67a432b51892e1cff95f5213ca70e7 100644
--- a/media/gpu/v4l2_video_encode_accelerator.cc
+++ b/media/gpu/v4l2_video_encode_accelerator.cc
@@ -18,6 +18,7 @@
#include "base/command_line.h"
#include "base/macros.h"
#include "base/numerics/safe_conversions.h"
+#include "base/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/trace_event.h"
#include "media/base/bind_to_current_loop.h"
@@ -405,7 +406,7 @@ void V4L2VideoEncodeAccelerator::EncodeTask(
const scoped_refptr<VideoFrame>& frame,
bool force_keyframe) {
DVLOG(3) << "EncodeTask(): force_keyframe=" << force_keyframe;
- DCHECK_EQ(encoder_thread_.message_loop(), base::MessageLoop::current());
+ DCHECK(encoder_thread_.task_runner()->BelongsToCurrentThread());
DCHECK_NE(encoder_state_, kUninitialized);
if (encoder_state_ == kError) {
@@ -448,7 +449,7 @@ void V4L2VideoEncodeAccelerator::EncodeTask(
void V4L2VideoEncodeAccelerator::UseOutputBitstreamBufferTask(
std::unique_ptr<BitstreamBufferRef> buffer_ref) {
DVLOG(3) << "UseOutputBitstreamBufferTask(): id=" << buffer_ref->id;
- DCHECK_EQ(encoder_thread_.message_loop(), base::MessageLoop::current());
+ DCHECK(encoder_thread_.task_runner()->BelongsToCurrentThread());
encoder_output_queue_.push_back(
linked_ptr<BitstreamBufferRef>(buffer_ref.release()));
@@ -479,7 +480,7 @@ void V4L2VideoEncodeAccelerator::DestroyTask() {
void V4L2VideoEncodeAccelerator::ServiceDeviceTask() {
DVLOG(3) << "ServiceDeviceTask()";
- DCHECK_EQ(encoder_thread_.message_loop(), base::MessageLoop::current());
+ DCHECK(encoder_thread_.task_runner()->BelongsToCurrentThread());
DCHECK_NE(encoder_state_, kUninitialized);
DCHECK_NE(encoder_state_, kInitialized);
@@ -523,7 +524,7 @@ void V4L2VideoEncodeAccelerator::ServiceDeviceTask() {
}
void V4L2VideoEncodeAccelerator::Enqueue() {
- DCHECK_EQ(encoder_thread_.message_loop(), base::MessageLoop::current());
+ DCHECK(encoder_thread_.task_runner()->BelongsToCurrentThread());
DVLOG(3) << "Enqueue() "
<< "free_input_buffers: " << free_input_buffers_.size()
@@ -571,7 +572,7 @@ void V4L2VideoEncodeAccelerator::Enqueue() {
void V4L2VideoEncodeAccelerator::Dequeue() {
DVLOG(3) << "Dequeue()";
- DCHECK_EQ(encoder_thread_.message_loop(), base::MessageLoop::current());
+ DCHECK(encoder_thread_.task_runner()->BelongsToCurrentThread());
// Dequeue completed input (VIDEO_OUTPUT) buffers, and recycle to the free
// list.
@@ -766,7 +767,7 @@ bool V4L2VideoEncodeAccelerator::EnqueueOutputRecord() {
bool V4L2VideoEncodeAccelerator::StartDevicePoll() {
DVLOG(3) << "StartDevicePoll()";
- DCHECK_EQ(encoder_thread_.message_loop(), base::MessageLoop::current());
+ DCHECK(encoder_thread_.task_runner()->BelongsToCurrentThread());
DCHECK(!device_poll_thread_.IsRunning());
// Start up the device poll thread and schedule its first DevicePollTask().
@@ -836,7 +837,7 @@ bool V4L2VideoEncodeAccelerator::StopDevicePoll() {
void V4L2VideoEncodeAccelerator::DevicePollTask(bool poll_device) {
DVLOG(3) << "DevicePollTask()";
- DCHECK_EQ(device_poll_thread_.message_loop(), base::MessageLoop::current());
+ DCHECK(device_poll_thread_.task_runner()->BelongsToCurrentThread());
bool event_pending;
if (!device_->Poll(poll_device, &event_pending)) {
@@ -891,7 +892,7 @@ void V4L2VideoEncodeAccelerator::RequestEncodingParametersChangeTask(
uint32_t framerate) {
DVLOG(3) << "RequestEncodingParametersChangeTask(): bitrate=" << bitrate
<< ", framerate=" << framerate;
- DCHECK_EQ(encoder_thread_.message_loop(), base::MessageLoop::current());
+ DCHECK(encoder_thread_.task_runner()->BelongsToCurrentThread());
if (bitrate < 1)
bitrate = 1;
@@ -1146,7 +1147,7 @@ bool V4L2VideoEncodeAccelerator::CreateInputBuffers() {
DVLOG(3) << "CreateInputBuffers()";
// This function runs on encoder_thread_ after output buffers have been
// provided by the client.
- DCHECK_EQ(encoder_thread_.message_loop(), base::MessageLoop::current());
+ DCHECK(encoder_thread_.task_runner()->BelongsToCurrentThread());
DCHECK(!input_streamon_);
struct v4l2_requestbuffers reqbufs;

Powered by Google App Engine
This is Rietveld 408576698