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

Unified Diff: content/common/gpu/media/v4l2_video_decode_accelerator.cc

Issue 189993002: Start the VDA device poll thread in Initialize() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fed18955 offline discussion with posciak@ Created 6 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/media/v4l2_video_decode_accelerator.cc
diff --git a/content/common/gpu/media/v4l2_video_decode_accelerator.cc b/content/common/gpu/media/v4l2_video_decode_accelerator.cc
index 68baaa85c845c91dda916e544ddd9e15e27431a3..587da6bbc04ed5449ccadf7bf00f693f9273d3e4 100644
--- a/content/common/gpu/media/v4l2_video_decode_accelerator.cc
+++ b/content/common/gpu/media/v4l2_video_decode_accelerator.cc
@@ -288,6 +288,9 @@ bool V4L2VideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile,
return false;
}
+ if (!StartDevicePoll())
+ return false;
+
SetDecoderState(kInitialized);
child_message_loop_proxy_->PostTask(FROM_HERE, base::Bind(
@@ -709,7 +712,6 @@ bool V4L2VideoDecodeAccelerator::DecodeBufferInitial(
DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current());
DCHECK_NE(decoder_state_, kUninitialized);
DCHECK_NE(decoder_state_, kDecoding);
- DCHECK(!device_poll_thread_.IsRunning());
// Initial decode. We haven't been able to get output stream format info yet.
// Get it, and start decoding.
@@ -755,10 +757,6 @@ bool V4L2VideoDecodeAccelerator::DecodeBufferInitial(
*endpos = size;
}
- // StartDevicePoll will raise the error if there is one.
- if (!StartDevicePoll())
- return false;
-
decoder_state_ = kDecoding;
ScheduleDecodeBufferTaskIfNeeded();
return true;
@@ -885,8 +883,6 @@ void V4L2VideoDecodeAccelerator::ServiceDeviceTask(bool event_pending) {
DVLOG(3) << "ServiceDeviceTask()";
DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current());
DCHECK_NE(decoder_state_, kUninitialized);
- DCHECK_NE(decoder_state_, kInitialized);
- DCHECK_NE(decoder_state_, kAfterReset);
TRACE_EVENT0("Video Decoder", "V4L2VDA::ServiceDeviceTask");
if (decoder_state_ == kResetting) {
@@ -1353,6 +1349,9 @@ void V4L2VideoDecodeAccelerator::ResetDoneTask() {
return;
}
+ if (!StartDevicePoll())
+ return;
+
// We might have received a resolution change event while we were waiting
// for the reset to finish. The codec will not post another event if the
// resolution after reset remains the same as the one to which were just
@@ -1407,8 +1406,9 @@ void V4L2VideoDecodeAccelerator::DestroyTask() {
bool V4L2VideoDecodeAccelerator::StartDevicePoll() {
DVLOG(3) << "StartDevicePoll()";
- DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current());
DCHECK(!device_poll_thread_.IsRunning());
+ if (decoder_thread_.IsRunning())
+ DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current());
// Start up the device poll thread and schedule its first DevicePollTask().
if (!device_poll_thread_.Start()) {
@@ -1495,7 +1495,8 @@ bool V4L2VideoDecodeAccelerator::StopDevicePoll(bool keep_input_state) {
void V4L2VideoDecodeAccelerator::StartResolutionChangeIfNeeded() {
DCHECK_EQ(decoder_thread_.message_loop(), base::MessageLoop::current());
- DCHECK_EQ(decoder_state_, kDecoding);
+ DCHECK_NE(decoder_state_, kUninitialized);
+ DCHECK_NE(decoder_state_, kResetting);
if (!resolution_change_pending_)
return;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698