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

Unified Diff: media/gpu/v4l2_video_decode_accelerator.cc

Issue 2335573002: V4L2VideoDecodeAccelerator: destroy buffers in decoder thread. (Closed)
Patch Set: V4L2VideoDecodeAccelerator: destroy buffers in decoder thread. Created 4 years, 3 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 | « 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 b4a4ff0cc3fe90f40e18e4b40e2f60c75510674a..57f798ddb8aa6d50257caf59e804e611194eccd8 100644
--- a/media/gpu/v4l2_video_decode_accelerator.cc
+++ b/media/gpu/v4l2_video_decode_accelerator.cc
@@ -186,9 +186,6 @@ V4L2VideoDecodeAccelerator::~V4L2VideoDecodeAccelerator() {
DCHECK(!decoder_thread_.IsRunning());
DCHECK(!device_poll_thread_.IsRunning());
- DestroyInputBuffers();
- DestroyOutputBuffers();
-
// These maps have members that should be manually destroyed, e.g. file
// descriptors, mmap() segments, etc.
DCHECK(input_buffer_map_.empty());
@@ -1576,6 +1573,9 @@ void V4L2VideoDecodeAccelerator::DestroyTask() {
// Set our state to kError. Just in case.
decoder_state_ = kError;
+
+ DestroyInputBuffers();
+ DestroyOutputBuffers();
}
bool V4L2VideoDecodeAccelerator::StartDevicePoll() {
@@ -1689,12 +1689,13 @@ void V4L2VideoDecodeAccelerator::StartResolutionChange() {
if (image_processor_)
image_processor_.release()->Destroy();
- // Post a task to clean up buffers on child thread. This will also ensure
- // that we won't accept ReusePictureBuffer() anymore after that.
- child_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&V4L2VideoDecodeAccelerator::ResolutionChangeDestroyBuffers,
- weak_this_));
+ if (!DestroyOutputBuffers()) {
+ LOGF(ERROR) << "Failed destroying output buffers.";
+ NOTIFY_ERROR(PLATFORM_FAILURE);
+ return;
+ }
+
+ FinishResolutionChange();
}
void V4L2VideoDecodeAccelerator::FinishResolutionChange() {
@@ -2124,7 +2125,7 @@ bool V4L2VideoDecodeAccelerator::CreateOutputBuffers() {
void V4L2VideoDecodeAccelerator::DestroyInputBuffers() {
DVLOGF(3);
- DCHECK(child_task_runner_->BelongsToCurrentThread());
+ DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread());
DCHECK(!input_streamon_);
for (size_t i = 0; i < input_buffer_map_.size(); ++i) {
@@ -2147,7 +2148,7 @@ void V4L2VideoDecodeAccelerator::DestroyInputBuffers() {
bool V4L2VideoDecodeAccelerator::DestroyOutputBuffers() {
DVLOGF(3);
- DCHECK(child_task_runner_->BelongsToCurrentThread());
+ DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread());
DCHECK(!output_streamon_);
bool success = true;
@@ -2155,11 +2156,10 @@ bool V4L2VideoDecodeAccelerator::DestroyOutputBuffers() {
OutputRecord& output_record = output_buffer_map_[i];
if (output_record.egl_image != EGL_NO_IMAGE_KHR) {
- if (egl_image_device_->DestroyEGLImage(
- egl_display_, output_record.egl_image) != EGL_TRUE) {
- DVLOGF(1) << "DestroyEGLImage failed.";
- success = false;
- }
+ child_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(base::IgnoreResult(&V4L2Device::DestroyEGLImage), device_,
kcwu 2016/09/12 10:59:48 Add log if destroy failed at least.
wuchengli 2016/09/12 11:15:36 V4L2SVDA has three base::IgnoreResult(&V4L2Device:
+ egl_display_, output_record.egl_image));
}
if (output_record.egl_sync != EGL_NO_SYNC_KHR) {
@@ -2196,22 +2196,6 @@ bool V4L2VideoDecodeAccelerator::DestroyOutputBuffers() {
return success;
}
-void V4L2VideoDecodeAccelerator::ResolutionChangeDestroyBuffers() {
- DCHECK(child_task_runner_->BelongsToCurrentThread());
- DVLOGF(3);
-
- if (!DestroyOutputBuffers()) {
- LOGF(ERROR) << "Failed destroying output buffers.";
- NOTIFY_ERROR(PLATFORM_FAILURE);
- return;
- }
-
- // Finish resolution change on decoder thread.
- decoder_thread_.task_runner()->PostTask(
- FROM_HERE, base::Bind(&V4L2VideoDecodeAccelerator::FinishResolutionChange,
- base::Unretained(this)));
-}
-
void V4L2VideoDecodeAccelerator::SendPictureReady() {
DVLOGF(3);
DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread());
« 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