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

Side by Side Diff: content/common/gpu/media/exynos_video_decode_accelerator.cc

Issue 24762003: Set the texture to cleared in VideoDecodeAccelerator::PictureReady. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <dlfcn.h> 5 #include <dlfcn.h>
6 #include <errno.h> 6 #include <errno.h>
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <linux/videodev2.h> 8 #include <linux/videodev2.h>
9 #include <poll.h> 9 #include <poll.h>
10 #include <sys/eventfd.h> 10 #include <sys/eventfd.h>
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 188
189 ExynosVideoDecodeAccelerator::GscInputRecord::~GscInputRecord() { 189 ExynosVideoDecodeAccelerator::GscInputRecord::~GscInputRecord() {
190 } 190 }
191 191
192 ExynosVideoDecodeAccelerator::GscOutputRecord::GscOutputRecord() 192 ExynosVideoDecodeAccelerator::GscOutputRecord::GscOutputRecord()
193 : at_device(false), 193 : at_device(false),
194 at_client(false), 194 at_client(false),
195 fd(-1), 195 fd(-1),
196 egl_image(EGL_NO_IMAGE_KHR), 196 egl_image(EGL_NO_IMAGE_KHR),
197 egl_sync(EGL_NO_SYNC_KHR), 197 egl_sync(EGL_NO_SYNC_KHR),
198 picture_id(-1) { 198 picture_id(-1),
199 cleared(false) {
199 } 200 }
200 201
201 ExynosVideoDecodeAccelerator::GscOutputRecord::~GscOutputRecord() { 202 ExynosVideoDecodeAccelerator::GscOutputRecord::~GscOutputRecord() {
202 } 203 }
203 204
204 ExynosVideoDecodeAccelerator::ExynosVideoDecodeAccelerator( 205 ExynosVideoDecodeAccelerator::ExynosVideoDecodeAccelerator(
205 EGLDisplay egl_display, 206 EGLDisplay egl_display,
206 EGLContext egl_context, 207 EGLContext egl_context,
207 Client* client, 208 Client* client,
208 const base::WeakPtr<Client>& io_client, 209 const base::WeakPtr<Client>& io_client,
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 } 1046 }
1046 1047
1047 DCHECK_EQ(pic_buffers->picture_buffers.size(), gsc_output_buffer_map_.size()); 1048 DCHECK_EQ(pic_buffers->picture_buffers.size(), gsc_output_buffer_map_.size());
1048 for (size_t i = 0; i < gsc_output_buffer_map_.size(); ++i) { 1049 for (size_t i = 0; i < gsc_output_buffer_map_.size(); ++i) {
1049 // We should be blank right now. 1050 // We should be blank right now.
1050 GscOutputRecord& output_record = gsc_output_buffer_map_[i]; 1051 GscOutputRecord& output_record = gsc_output_buffer_map_[i];
1051 DCHECK_EQ(output_record.fd, -1); 1052 DCHECK_EQ(output_record.fd, -1);
1052 DCHECK_EQ(output_record.egl_image, EGL_NO_IMAGE_KHR); 1053 DCHECK_EQ(output_record.egl_image, EGL_NO_IMAGE_KHR);
1053 DCHECK_EQ(output_record.egl_sync, EGL_NO_SYNC_KHR); 1054 DCHECK_EQ(output_record.egl_sync, EGL_NO_SYNC_KHR);
1054 DCHECK_EQ(output_record.picture_id, -1); 1055 DCHECK_EQ(output_record.picture_id, -1);
1056 DCHECK_EQ(output_record.cleared, false);
1055 PictureBufferArrayRef::PictureBufferRef& buffer = 1057 PictureBufferArrayRef::PictureBufferRef& buffer =
1056 pic_buffers->picture_buffers[i]; 1058 pic_buffers->picture_buffers[i];
1057 output_record.fd = buffer.egl_image_fd; 1059 output_record.fd = buffer.egl_image_fd;
1058 output_record.egl_image = buffer.egl_image; 1060 output_record.egl_image = buffer.egl_image;
1059 output_record.picture_id = buffer.client_id; 1061 output_record.picture_id = buffer.client_id;
1060 1062
1061 // Take ownership of the EGLImage and fd. 1063 // Take ownership of the EGLImage and fd.
1062 buffer.egl_image = EGL_NO_IMAGE_KHR; 1064 buffer.egl_image = EGL_NO_IMAGE_KHR;
1063 buffer.egl_image_fd = -1; 1065 buffer.egl_image_fd = -1;
1064 // And add this buffer to the free list. 1066 // And add this buffer to the free list.
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
1408 } 1410 }
1409 GscOutputRecord& output_record = gsc_output_buffer_map_[dqbuf.index]; 1411 GscOutputRecord& output_record = gsc_output_buffer_map_[dqbuf.index];
1410 DCHECK(output_record.at_device); 1412 DCHECK(output_record.at_device);
1411 DCHECK(!output_record.at_client); 1413 DCHECK(!output_record.at_client);
1412 DCHECK_EQ(output_record.egl_sync, EGL_NO_SYNC_KHR); 1414 DCHECK_EQ(output_record.egl_sync, EGL_NO_SYNC_KHR);
1413 output_record.at_device = false; 1415 output_record.at_device = false;
1414 output_record.at_client = true; 1416 output_record.at_client = true;
1415 gsc_output_buffer_queued_count_--; 1417 gsc_output_buffer_queued_count_--;
1416 DVLOG(3) << "DequeueGsc(): returning input_id=" << dqbuf.timestamp.tv_sec 1418 DVLOG(3) << "DequeueGsc(): returning input_id=" << dqbuf.timestamp.tv_sec
1417 << " as picture_id=" << output_record.picture_id; 1419 << " as picture_id=" << output_record.picture_id;
1418 io_message_loop_proxy_->PostTask(FROM_HERE, base::Bind( 1420 // If the picture is not cleared, post it to the child thread because it has
1421 // to be cleared in the child thread. Otherwise posting it to IO thread to
1422 // reduce latency.
piman 2013/09/26 16:50:01 So, if the main (child) thread is busy, this can m
wuchengli 2013/09/26 17:02:48 It's not OK. I cannot think of a solution now... I
wuchengli 2013/09/30 16:11:21 The code is updated to handle the case you mention
1423 scoped_refptr<base::MessageLoopProxy> message_loop_proxy;
1424 if (output_record.cleared) {
1425 message_loop_proxy = io_message_loop_proxy_;
1426 } else {
1427 message_loop_proxy = child_message_loop_proxy_;
1428 output_record.cleared = true;
1429 }
1430 message_loop_proxy->PostTask(FROM_HERE, base::Bind(
1419 &Client::PictureReady, io_client_, media::Picture( 1431 &Client::PictureReady, io_client_, media::Picture(
1420 output_record.picture_id, dqbuf.timestamp.tv_sec))); 1432 output_record.picture_id, dqbuf.timestamp.tv_sec)));
1421 decoder_frames_at_client_++; 1433 decoder_frames_at_client_++;
1422 } 1434 }
1423 1435
1424 NotifyFlushDoneIfNeeded(); 1436 NotifyFlushDoneIfNeeded();
1425 } 1437 }
1426 1438
1427 bool ExynosVideoDecodeAccelerator::EnqueueMfcInputRecord() { 1439 bool ExynosVideoDecodeAccelerator::EnqueueMfcInputRecord() {
1428 DVLOG(3) << "EnqueueMfcInputRecord()"; 1440 DVLOG(3) << "EnqueueMfcInputRecord()";
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after
2444 DestroyGscOutputBuffers(); 2456 DestroyGscOutputBuffers();
2445 DestroyMfcOutputBuffers(); 2457 DestroyMfcOutputBuffers();
2446 2458
2447 // Finish resolution change on decoder thread. 2459 // Finish resolution change on decoder thread.
2448 decoder_thread_.message_loop()->PostTask(FROM_HERE, base::Bind( 2460 decoder_thread_.message_loop()->PostTask(FROM_HERE, base::Bind(
2449 &ExynosVideoDecodeAccelerator::FinishResolutionChange, 2461 &ExynosVideoDecodeAccelerator::FinishResolutionChange,
2450 base::Unretained(this))); 2462 base::Unretained(this)));
2451 } 2463 }
2452 2464
2453 } // namespace content 2465 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698