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

Unified Diff: media/gpu/v4l2_video_decode_accelerator.cc

Issue 2530493003: V4L2VDA: do not allocate input buffers in GPU child thread. (Closed)
Patch Set: address Kuang-che's comments Created 4 years, 1 month 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/gpu/v4l2_video_decode_accelerator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/gpu/v4l2_video_decode_accelerator.cc
diff --git a/media/gpu/v4l2_video_decode_accelerator.cc b/media/gpu/v4l2_video_decode_accelerator.cc
index 1d5cf8ee6cb11d9b4e7222f4b08d7089e7f2b47e..401aa1d1a94519eea914428b092029e6f084ae77 100644
--- a/media/gpu/v4l2_video_decode_accelerator.cc
+++ b/media/gpu/v4l2_video_decode_accelerator.cc
@@ -274,21 +274,10 @@ bool V4L2VideoDecodeAccelerator::Initialize(const Config& config,
if (!SetupFormats())
return false;
- // Subscribe to the resolution change event.
- struct v4l2_event_subscription sub;
- memset(&sub, 0, sizeof(sub));
- sub.type = V4L2_EVENT_SOURCE_CHANGE;
- IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_SUBSCRIBE_EVENT, &sub);
-
if (video_profile_ >= H264PROFILE_MIN && video_profile_ <= H264PROFILE_MAX) {
decoder_h264_parser_.reset(new H264Parser());
}
- if (!CreateInputBuffers())
- return false;
-
- decoder_cmd_supported_ = IsDecoderCmdSupported();
-
if (!decoder_thread_.Start()) {
LOGF(ERROR) << "decoder thread failed to start";
return false;
@@ -297,15 +286,36 @@ bool V4L2VideoDecodeAccelerator::Initialize(const Config& config,
decoder_state_ = kInitialized;
output_mode_ = config.output_mode;
- // StartDevicePoll will NOTIFY_ERROR on failure, so IgnoreResult is fine here.
+ // InitializeTask will NOTIFY_ERROR on failure.
decoder_thread_.task_runner()->PostTask(
- FROM_HERE, base::Bind(base::IgnoreResult(
- &V4L2VideoDecodeAccelerator::StartDevicePoll),
+ FROM_HERE, base::Bind(&V4L2VideoDecodeAccelerator::InitializeTask,
base::Unretained(this)));
return true;
}
+void V4L2VideoDecodeAccelerator::InitializeTask() {
+ DVLOGF(3);
+ DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread());
+ DCHECK_EQ(decoder_state_, kUninitialized);
kcwu 2016/11/28 10:53:51 You added line 286, then this DCHECK will fail.
wuchengli 2016/11/28 12:58:16 Thanks for catching this.
+
+ // Subscribe to the resolution change event.
+ struct v4l2_event_subscription sub;
+ memset(&sub, 0, sizeof(sub));
+ sub.type = V4L2_EVENT_SOURCE_CHANGE;
+ IOCTL_OR_ERROR_RETURN(VIDIOC_SUBSCRIBE_EVENT, &sub);
+
+ if (!CreateInputBuffers()) {
+ NOTIFY_ERROR(PLATFORM_FAILURE);
+ return;
+ }
+
+ decoder_cmd_supported_ = IsDecoderCmdSupported();
+
+ if (!StartDevicePoll())
+ return;
+}
+
void V4L2VideoDecodeAccelerator::Decode(
const BitstreamBuffer& bitstream_buffer) {
DVLOGF(1) << "input_id=" << bitstream_buffer.id()
@@ -2129,6 +2139,7 @@ gfx::Size V4L2VideoDecodeAccelerator::GetVisibleSize(
bool V4L2VideoDecodeAccelerator::CreateInputBuffers() {
DVLOGF(3);
+ DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread());
// We always run this as we prepare to initialize.
DCHECK_EQ(decoder_state_, kUninitialized);
DCHECK(!input_streamon_);
« no previous file with comments | « media/gpu/v4l2_video_decode_accelerator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698