diff options
author | jiesun@google.com <jiesun@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-09 16:00:32 +0000 |
---|---|---|
committer | jiesun@google.com <jiesun@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-09 16:00:32 +0000 |
commit | db9074beb04cd9129f7a1f58bd77c7596ba0f4d2 (patch) | |
tree | 392ef77f36075e6d95b7a690119d346e98bed349 /media/tools/player_x11/gles_video_renderer.cc | |
parent | a65bce4eea95ed4c31c75c726475410e2b245103 (diff) | |
download | chromium_src-db9074beb04cd9129f7a1f58bd77c7596ba0f4d2.zip chromium_src-db9074beb04cd9129f7a1f58bd77c7596ba0f4d2.tar.gz chromium_src-db9074beb04cd9129f7a1f58bd77c7596ba0f4d2.tar.bz2 |
change X/GL thread to message loop for injecting task
1. there are need to allocate buffer in this thread, requested by other threads. therefore it is natural to use message loop instead of infinite loop.
2. in the future, gpu command buffer consumer is running on it own thread and own the eglContext. we need to post buffer allocation there, therefore this change make player_x11 more resemble the real workflow in chrome.
TEST= glVideoRender on host machine.
glesVideoRender/x11VideoRender on arm netbook.
BUGS=None
Review URL: http://codereview.chromium.org/2724005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49255 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/tools/player_x11/gles_video_renderer.cc')
-rw-r--r-- | media/tools/player_x11/gles_video_renderer.cc | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/media/tools/player_x11/gles_video_renderer.cc b/media/tools/player_x11/gles_video_renderer.cc index f6cea9c..fab345a 100644 --- a/media/tools/player_x11/gles_video_renderer.cc +++ b/media/tools/player_x11/gles_video_renderer.cc @@ -23,10 +23,10 @@ GlesVideoRenderer::GlesVideoRenderer(Display* display, Window window) egl_destroy_image_khr_(NULL), display_(display), window_(window), - new_frame_(false), egl_display_(NULL), egl_surface_(NULL), - egl_context_(NULL) { + egl_context_(NULL), + glx_thread_message_loop_(NULL) { } GlesVideoRenderer::~GlesVideoRenderer() { @@ -149,22 +149,13 @@ bool GlesVideoRenderer::OnInitialize(media::VideoDecoder* decoder) { } void GlesVideoRenderer::OnFrameAvailable() { - AutoLock auto_lock(lock_); - new_frame_ = true; + if (glx_thread_message_loop()) { + glx_thread_message_loop()->PostTask(FROM_HERE, + NewRunnableMethod(this, &GlesVideoRenderer::Paint)); + } } void GlesVideoRenderer::Paint() { - // Use |new_frame_| to prevent overdraw since Paint() is called more - // often than needed. It is OK to lock only this flag and we don't - // want to lock the whole function because this method takes a long - // time to complete. - { - AutoLock auto_lock(lock_); - if (!new_frame_) - return; - new_frame_ = false; - } - // Initialize GLES here to avoid context switching. Some drivers doesn't // like switching context between threads. static bool initialized = false; |