| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/common/gpu/media/rendering_helper.h" | 5 #include "content/common/gpu/media/rendering_helper.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <numeric> | 8 #include <numeric> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/callback_helpers.h" | 12 #include "base/callback_helpers.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/mac/scoped_nsautorelease_pool.h" | 14 #include "base/mac/scoped_nsautorelease_pool.h" |
| 15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 16 #include "base/strings/stringize_macros.h" | 16 #include "base/strings/stringize_macros.h" |
| 17 #include "base/synchronization/waitable_event.h" | 17 #include "base/synchronization/waitable_event.h" |
| 18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 19 #include "ui/gl/gl_context.h" | 19 #include "ui/gl/gl_context.h" |
| 20 #include "ui/gl/gl_implementation.h" | 20 #include "ui/gl/gl_implementation.h" |
| 21 #include "ui/gl/gl_surface.h" | 21 #include "ui/gl/gl_surface.h" |
| 22 #include "ui/gl/gl_surface_egl.h" | |
| 23 #include "ui/gl/gl_surface_glx.h" | |
| 24 | 22 |
| 25 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
| 26 #include <windows.h> | 24 #include <windows.h> |
| 27 #endif | 25 #endif |
| 28 | 26 |
| 29 #if defined(USE_X11) | 27 #if defined(USE_X11) |
| 30 #include "ui/gfx/x/x11_types.h" | 28 #include "ui/gfx/x/x11_types.h" |
| 29 #include "ui/gl/gl_surface_glx.h" |
| 30 #define GL_VARIANT_GLX 1 |
| 31 #else |
| 32 #include "ui/gl/gl_surface_egl.h" |
| 33 #define GL_VARIANT_EGL 1 |
| 31 #endif | 34 #endif |
| 32 | 35 |
| 33 #if !defined(OS_WIN) && defined(ARCH_CPU_X86_FAMILY) | 36 #if defined(USE_OZONE) |
| 34 #define GL_VARIANT_GLX 1 | 37 #include "ui/ozone/public/ozone_platform.h" |
| 35 #else | 38 #include "ui/ozone/public/ui_thread_gpu.h" |
| 36 #define GL_VARIANT_EGL 1 | 39 #include "ui/platform_window/platform_window.h" |
| 40 #include "ui/platform_window/platform_window_delegate.h" |
| 37 #endif | 41 #endif |
| 38 | 42 |
| 39 // Helper for Shader creation. | 43 // Helper for Shader creation. |
| 40 static void CreateShader(GLuint program, | 44 static void CreateShader(GLuint program, |
| 41 GLenum type, | 45 GLenum type, |
| 42 const char* source, | 46 const char* source, |
| 43 int size) { | 47 int size) { |
| 44 GLuint shader = glCreateShader(type); | 48 GLuint shader = glCreateShader(type); |
| 45 glShaderSource(shader, 1, &source, &size); | 49 glShaderSource(shader, 1, &source, &size); |
| 46 glCompileShader(shader); | 50 glCompileShader(shader); |
| 47 int result = GL_FALSE; | 51 int result = GL_FALSE; |
| 48 glGetShaderiv(shader, GL_COMPILE_STATUS, &result); | 52 glGetShaderiv(shader, GL_COMPILE_STATUS, &result); |
| 49 if (!result) { | 53 if (!result) { |
| 50 char log[4096]; | 54 char log[4096]; |
| 51 glGetShaderInfoLog(shader, arraysize(log), NULL, log); | 55 glGetShaderInfoLog(shader, arraysize(log), NULL, log); |
| 52 LOG(FATAL) << log; | 56 LOG(FATAL) << log; |
| 53 } | 57 } |
| 54 glAttachShader(program, shader); | 58 glAttachShader(program, shader); |
| 55 glDeleteShader(shader); | 59 glDeleteShader(shader); |
| 56 CHECK_EQ(static_cast<int>(glGetError()), GL_NO_ERROR); | 60 CHECK_EQ(static_cast<int>(glGetError()), GL_NO_ERROR); |
| 57 } | 61 } |
| 58 | 62 |
| 59 namespace content { | 63 namespace content { |
| 60 | 64 |
| 65 #if defined(USE_OZONE) |
| 66 |
| 67 class RenderingHelper::StubOzoneDelegate : public ui::PlatformWindowDelegate { |
| 68 public: |
| 69 StubOzoneDelegate() : widget_(gfx::kNullAcceleratedWidget) { |
| 70 platform_window_ = ui::OzonePlatform::GetInstance()->CreatePlatformWindow( |
| 71 this, gfx::Rect()); |
| 72 } |
| 73 virtual ~StubOzoneDelegate() {} |
| 74 |
| 75 virtual void OnBoundsChanged(const gfx::Rect& new_bounds) override {} |
| 76 |
| 77 virtual void OnDamageRect(const gfx::Rect& damaged_region) override {} |
| 78 |
| 79 virtual void DispatchEvent(ui::Event* event) override {} |
| 80 |
| 81 virtual void OnCloseRequest() override {} |
| 82 virtual void OnClosed() override {} |
| 83 |
| 84 virtual void OnWindowStateChanged( |
| 85 ui::PlatformWindowState new_state) override {}; |
| 86 |
| 87 virtual void OnLostCapture() override {}; |
| 88 |
| 89 virtual void OnAcceleratedWidgetAvailable( |
| 90 gfx::AcceleratedWidget widget) override { |
| 91 widget_ = widget; |
| 92 }; |
| 93 |
| 94 virtual void OnActivationChanged(bool active) override {}; |
| 95 |
| 96 gfx::AcceleratedWidget GetAcceleratedWidget() const { return widget_; } |
| 97 |
| 98 gfx::Size GetSize() { return platform_window_->GetBounds().size(); } |
| 99 |
| 100 private: |
| 101 scoped_ptr<ui::PlatformWindow> platform_window_; |
| 102 gfx::AcceleratedWidget widget_; |
| 103 }; |
| 104 |
| 105 #endif // defined(USE_OZONE) |
| 106 |
| 61 RenderingHelperParams::RenderingHelperParams() | 107 RenderingHelperParams::RenderingHelperParams() |
| 62 : rendering_fps(0), warm_up_iterations(0), render_as_thumbnails(false) { | 108 : rendering_fps(0), warm_up_iterations(0), render_as_thumbnails(false) { |
| 63 } | 109 } |
| 64 | 110 |
| 65 RenderingHelperParams::~RenderingHelperParams() {} | 111 RenderingHelperParams::~RenderingHelperParams() {} |
| 66 | 112 |
| 67 VideoFrameTexture::VideoFrameTexture(uint32 texture_target, | 113 VideoFrameTexture::VideoFrameTexture(uint32 texture_target, |
| 68 uint32 texture_id, | 114 uint32 texture_id, |
| 69 const base::Closure& no_longer_needed_cb) | 115 const base::Closure& no_longer_needed_cb) |
| 70 : texture_target_(texture_target), | 116 : texture_target_(texture_target), |
| (...skipping 15 matching lines...) Expand all Loading... |
| 86 | 132 |
| 87 // static | 133 // static |
| 88 bool RenderingHelper::InitializeOneOff() { | 134 bool RenderingHelper::InitializeOneOff() { |
| 89 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 135 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| 90 #if GL_VARIANT_GLX | 136 #if GL_VARIANT_GLX |
| 91 cmd_line->AppendSwitchASCII(switches::kUseGL, | 137 cmd_line->AppendSwitchASCII(switches::kUseGL, |
| 92 gfx::kGLImplementationDesktopName); | 138 gfx::kGLImplementationDesktopName); |
| 93 #else | 139 #else |
| 94 cmd_line->AppendSwitchASCII(switches::kUseGL, gfx::kGLImplementationEGLName); | 140 cmd_line->AppendSwitchASCII(switches::kUseGL, gfx::kGLImplementationEGLName); |
| 95 #endif | 141 #endif |
| 142 |
| 143 #if defined(USE_OZONE) |
| 144 static ui::UiThreadGpu ui_thread_gpu; |
| 145 ui::OzonePlatform::InitializeForUI(); |
| 146 return gfx::GLSurface::InitializeOneOff() && ui_thread_gpu.Initialize(); |
| 147 #else |
| 96 return gfx::GLSurface::InitializeOneOff(); | 148 return gfx::GLSurface::InitializeOneOff(); |
| 149 #endif |
| 97 } | 150 } |
| 98 | 151 |
| 99 RenderingHelper::RenderingHelper() { | 152 RenderingHelper::RenderingHelper() { |
| 100 window_ = gfx::kNullAcceleratedWidget; | 153 window_ = gfx::kNullAcceleratedWidget; |
| 101 Clear(); | 154 Clear(); |
| 102 } | 155 } |
| 103 | 156 |
| 104 RenderingHelper::~RenderingHelper() { | 157 RenderingHelper::~RenderingHelper() { |
| 105 CHECK_EQ(videos_.size(), 0U) << "Must call UnInitialize before dtor."; | 158 CHECK_EQ(videos_.size(), 0U) << "Must call UnInitialize before dtor."; |
| 106 Clear(); | 159 Clear(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 120 base::Bind(&RenderingHelper::RenderContent, base::Unretained(this))); | 173 base::Bind(&RenderingHelper::RenderContent, base::Unretained(this))); |
| 121 | 174 |
| 122 frame_duration_ = params.rendering_fps > 0 | 175 frame_duration_ = params.rendering_fps > 0 |
| 123 ? base::TimeDelta::FromSeconds(1) / params.rendering_fps | 176 ? base::TimeDelta::FromSeconds(1) / params.rendering_fps |
| 124 : base::TimeDelta(); | 177 : base::TimeDelta(); |
| 125 | 178 |
| 126 render_as_thumbnails_ = params.render_as_thumbnails; | 179 render_as_thumbnails_ = params.render_as_thumbnails; |
| 127 message_loop_ = base::MessageLoop::current(); | 180 message_loop_ = base::MessageLoop::current(); |
| 128 | 181 |
| 129 #if defined(OS_WIN) | 182 #if defined(OS_WIN) |
| 130 screen_size_ = | |
| 131 gfx::Size(GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); | |
| 132 window_ = CreateWindowEx(0, | 183 window_ = CreateWindowEx(0, |
| 133 L"Static", | 184 L"Static", |
| 134 L"VideoDecodeAcceleratorTest", | 185 L"VideoDecodeAcceleratorTest", |
| 135 WS_OVERLAPPEDWINDOW | WS_VISIBLE, | 186 WS_OVERLAPPEDWINDOW | WS_VISIBLE, |
| 136 0, | 187 0, |
| 137 0, | 188 0, |
| 138 screen_size_.width(), | 189 GetSystemMetrics(SM_CXSCREEN), |
| 139 screen_size_.height(), | 190 GetSystemMetrics(SM_CYSCREEN), |
| 140 NULL, | 191 NULL, |
| 141 NULL, | 192 NULL, |
| 142 NULL, | 193 NULL, |
| 143 NULL); | 194 NULL); |
| 144 #elif defined(USE_X11) | 195 #elif defined(USE_X11) |
| 145 Display* display = gfx::GetXDisplay(); | 196 Display* display = gfx::GetXDisplay(); |
| 146 Screen* screen = DefaultScreenOfDisplay(display); | 197 Screen* screen = DefaultScreenOfDisplay(display); |
| 147 screen_size_ = gfx::Size(XWidthOfScreen(screen), XHeightOfScreen(screen)); | |
| 148 | 198 |
| 149 CHECK(display); | 199 CHECK(display); |
| 150 | 200 |
| 151 XSetWindowAttributes window_attributes; | 201 XSetWindowAttributes window_attributes; |
| 152 memset(&window_attributes, 0, sizeof(window_attributes)); | 202 memset(&window_attributes, 0, sizeof(window_attributes)); |
| 153 window_attributes.background_pixel = | 203 window_attributes.background_pixel = |
| 154 BlackPixel(display, DefaultScreen(display)); | 204 BlackPixel(display, DefaultScreen(display)); |
| 155 window_attributes.override_redirect = true; | 205 window_attributes.override_redirect = true; |
| 156 int depth = DefaultDepth(display, DefaultScreen(display)); | 206 int depth = DefaultDepth(display, DefaultScreen(display)); |
| 157 | 207 |
| 158 window_ = XCreateWindow(display, | 208 window_ = XCreateWindow(display, |
| 159 DefaultRootWindow(display), | 209 DefaultRootWindow(display), |
| 160 0, | 210 0, |
| 161 0, | 211 0, |
| 162 screen_size_.width(), | 212 XWidthOfScreen(screen), |
| 163 screen_size_.height(), | 213 XHeightOfScreen(screen), |
| 164 0 /* border width */, | 214 0 /* border width */, |
| 165 depth, | 215 depth, |
| 166 CopyFromParent /* class */, | 216 CopyFromParent /* class */, |
| 167 CopyFromParent /* visual */, | 217 CopyFromParent /* visual */, |
| 168 (CWBackPixel | CWOverrideRedirect), | 218 (CWBackPixel | CWOverrideRedirect), |
| 169 &window_attributes); | 219 &window_attributes); |
| 170 XStoreName(display, window_, "VideoDecodeAcceleratorTest"); | 220 XStoreName(display, window_, "VideoDecodeAcceleratorTest"); |
| 171 XSelectInput(display, window_, ExposureMask); | 221 XSelectInput(display, window_, ExposureMask); |
| 172 XMapWindow(display, window_); | 222 XMapWindow(display, window_); |
| 223 #elif defined(USE_OZONE) |
| 224 platform_window_delegate_.reset(new RenderingHelper::StubOzoneDelegate()); |
| 225 window_ = platform_window_delegate_->GetAcceleratedWidget(); |
| 173 #else | 226 #else |
| 174 #error unknown platform | 227 #error unknown platform |
| 175 #endif | 228 #endif |
| 176 CHECK(window_ != gfx::kNullAcceleratedWidget); | 229 CHECK(window_ != gfx::kNullAcceleratedWidget); |
| 177 | 230 |
| 178 gl_surface_ = gfx::GLSurface::CreateViewGLSurface(window_); | 231 gl_surface_ = gfx::GLSurface::CreateViewGLSurface(window_); |
| 232 screen_size_ = gl_surface_->GetSize(); |
| 233 |
| 179 gl_context_ = gfx::GLContext::CreateGLContext( | 234 gl_context_ = gfx::GLContext::CreateGLContext( |
| 180 NULL, gl_surface_.get(), gfx::PreferIntegratedGpu); | 235 NULL, gl_surface_.get(), gfx::PreferIntegratedGpu); |
| 181 gl_context_->MakeCurrent(gl_surface_.get()); | 236 CHECK(gl_context_->MakeCurrent(gl_surface_.get())); |
| 182 | 237 |
| 183 CHECK_GT(params.window_sizes.size(), 0U); | 238 CHECK_GT(params.window_sizes.size(), 0U); |
| 184 videos_.resize(params.window_sizes.size()); | 239 videos_.resize(params.window_sizes.size()); |
| 185 LayoutRenderingAreas(params.window_sizes); | 240 LayoutRenderingAreas(params.window_sizes); |
| 186 | 241 |
| 187 if (render_as_thumbnails_) { | 242 if (render_as_thumbnails_) { |
| 188 CHECK_EQ(videos_.size(), 1U); | 243 CHECK_EQ(videos_.size(), 1U); |
| 189 | 244 |
| 190 GLint max_texture_size; | 245 GLint max_texture_size; |
| 191 glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size); | 246 glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 if (tex_external != -1) { | 352 if (tex_external != -1) { |
| 298 glUniform1i(tex_external, 1); | 353 glUniform1i(tex_external, 1); |
| 299 } | 354 } |
| 300 int pos_location = glGetAttribLocation(program_, "in_pos"); | 355 int pos_location = glGetAttribLocation(program_, "in_pos"); |
| 301 glEnableVertexAttribArray(pos_location); | 356 glEnableVertexAttribArray(pos_location); |
| 302 glVertexAttribPointer(pos_location, 2, GL_FLOAT, GL_FALSE, 0, kVertices); | 357 glVertexAttribPointer(pos_location, 2, GL_FLOAT, GL_FALSE, 0, kVertices); |
| 303 int tc_location = glGetAttribLocation(program_, "in_tc"); | 358 int tc_location = glGetAttribLocation(program_, "in_tc"); |
| 304 glEnableVertexAttribArray(tc_location); | 359 glEnableVertexAttribArray(tc_location); |
| 305 glVertexAttribPointer(tc_location, 2, GL_FLOAT, GL_FALSE, 0, kTextureCoords); | 360 glVertexAttribPointer(tc_location, 2, GL_FLOAT, GL_FALSE, 0, kTextureCoords); |
| 306 | 361 |
| 307 if (frame_duration_ != base::TimeDelta()) | 362 if (frame_duration_ == base::TimeDelta()) |
| 308 WarmUpRendering(params.warm_up_iterations); | 363 done->Signal(); |
| 364 else { |
| 365 int warm_up_iterations = params.warm_up_iterations; |
| 366 #if defined(USE_OZONE) |
| 367 // On Ozone the VSyncProvider can't provide a vsync_internal until |
| 368 // we render at least a frame, so we warm up with at least one |
| 369 // frame. |
| 370 // On top of this, we want to make sure all the buffers backing |
| 371 // the GL surface are cleared, otherwise we can see the previous |
| 372 // test's last frames, so we set warm up iterations to 2, to clear |
| 373 // the front and back buffers. |
| 374 warm_up_iterations = std::max(2, warm_up_iterations); |
| 375 #endif |
| 376 if (warm_up_iterations > 0) |
| 377 WarmUpRendering(warm_up_iterations); |
| 309 | 378 |
| 310 // It's safe to use Unretained here since |rendering_thread_| will be stopped | 379 // It's safe to use Unretained here since |rendering_thread_| will |
| 311 // in VideoDecodeAcceleratorTest.TearDown(), while the |rendering_helper_| is | 380 // be stopped in VideoDecodeAcceleratorTest.TearDown(), while the |
| 312 // a member of that class. (See video_decode_accelerator_unittest.cc.) | 381 // |rendering_helper_| is a member of that class. (See |
| 313 gl_surface_->GetVSyncProvider()->GetVSyncParameters(base::Bind( | 382 // video_decode_accelerator_unittest.cc.) |
| 314 &RenderingHelper::UpdateVSyncParameters, base::Unretained(this), done)); | 383 gl_surface_->GetVSyncProvider()->GetVSyncParameters(base::Bind( |
| 384 &RenderingHelper::UpdateVSyncParameters, base::Unretained(this), done)); |
| 385 } |
| 315 } | 386 } |
| 316 | 387 |
| 317 // The rendering for the first few frames is slow (e.g., 100ms on Peach Pit). | 388 // The rendering for the first few frames is slow (e.g., 100ms on Peach Pit). |
| 318 // This affects the numbers measured in the performance test. We try to render | 389 // This affects the numbers measured in the performance test. We try to render |
| 319 // several frames here to warm up the rendering. | 390 // several frames here to warm up the rendering. |
| 320 void RenderingHelper::WarmUpRendering(int warm_up_iterations) { | 391 void RenderingHelper::WarmUpRendering(int warm_up_iterations) { |
| 321 unsigned int texture_id; | 392 unsigned int texture_id; |
| 322 scoped_ptr<GLubyte[]> emptyData(new GLubyte[screen_size_.GetArea() * 2]); | 393 scoped_ptr<GLubyte[]> emptyData(new GLubyte[screen_size_.GetArea() * 2]()); |
| 323 glGenTextures(1, &texture_id); | 394 glGenTextures(1, &texture_id); |
| 324 glBindTexture(GL_TEXTURE_2D, texture_id); | 395 glBindTexture(GL_TEXTURE_2D, texture_id); |
| 325 glTexImage2D(GL_TEXTURE_2D, | 396 glTexImage2D(GL_TEXTURE_2D, |
| 326 0, | 397 0, |
| 327 GL_RGB, | 398 GL_RGB, |
| 328 screen_size_.width(), | 399 screen_size_.width(), |
| 329 screen_size_.height(), | 400 screen_size_.height(), |
| 330 0, | 401 0, |
| 331 GL_RGB, | 402 GL_RGB, |
| 332 GL_UNSIGNED_SHORT_5_6_5, | 403 GL_UNSIGNED_SHORT_5_6_5, |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 glBindTexture(texture_target, 0); | 527 glBindTexture(texture_target, 0); |
| 457 CHECK_EQ(static_cast<int>(glGetError()), GL_NO_ERROR); | 528 CHECK_EQ(static_cast<int>(glGetError()), GL_NO_ERROR); |
| 458 } | 529 } |
| 459 | 530 |
| 460 void RenderingHelper::DeleteTexture(uint32 texture_id) { | 531 void RenderingHelper::DeleteTexture(uint32 texture_id) { |
| 461 CHECK_EQ(base::MessageLoop::current(), message_loop_); | 532 CHECK_EQ(base::MessageLoop::current(), message_loop_); |
| 462 glDeleteTextures(1, &texture_id); | 533 glDeleteTextures(1, &texture_id); |
| 463 CHECK_EQ(static_cast<int>(glGetError()), GL_NO_ERROR); | 534 CHECK_EQ(static_cast<int>(glGetError()), GL_NO_ERROR); |
| 464 } | 535 } |
| 465 | 536 |
| 466 void* RenderingHelper::GetGLContext() { | 537 scoped_refptr<gfx::GLContext> RenderingHelper::GetGLContext() { |
| 538 return gl_context_; |
| 539 } |
| 540 |
| 541 void* RenderingHelper::GetGLContextHandle() { |
| 467 return gl_context_->GetHandle(); | 542 return gl_context_->GetHandle(); |
| 468 } | 543 } |
| 469 | 544 |
| 470 void* RenderingHelper::GetGLDisplay() { | 545 void* RenderingHelper::GetGLDisplay() { |
| 471 return gl_surface_->GetDisplay(); | 546 return gl_surface_->GetDisplay(); |
| 472 } | 547 } |
| 473 | 548 |
| 474 void RenderingHelper::Clear() { | 549 void RenderingHelper::Clear() { |
| 475 videos_.clear(); | 550 videos_.clear(); |
| 476 message_loop_ = NULL; | 551 message_loop_ = NULL; |
| 477 gl_context_ = NULL; | 552 gl_context_ = NULL; |
| 478 gl_surface_ = NULL; | 553 gl_surface_ = NULL; |
| 479 | 554 |
| 480 render_as_thumbnails_ = false; | 555 render_as_thumbnails_ = false; |
| 481 frame_count_ = 0; | 556 frame_count_ = 0; |
| 482 thumbnails_fbo_id_ = 0; | 557 thumbnails_fbo_id_ = 0; |
| 483 thumbnails_texture_id_ = 0; | 558 thumbnails_texture_id_ = 0; |
| 484 | 559 |
| 485 #if defined(OS_WIN) | 560 #if defined(OS_WIN) |
| 486 if (window_) | 561 if (window_) |
| 487 DestroyWindow(window_); | 562 DestroyWindow(window_); |
| 488 #else | 563 #elif defined(USE_X11) |
| 489 // Destroy resources acquired in Initialize, in reverse-acquisition order. | 564 // Destroy resources acquired in Initialize, in reverse-acquisition order. |
| 490 if (window_) { | 565 if (window_) { |
| 491 CHECK(XUnmapWindow(gfx::GetXDisplay(), window_)); | 566 CHECK(XUnmapWindow(gfx::GetXDisplay(), window_)); |
| 492 CHECK(XDestroyWindow(gfx::GetXDisplay(), window_)); | 567 CHECK(XDestroyWindow(gfx::GetXDisplay(), window_)); |
| 493 } | 568 } |
| 494 #endif | 569 #endif |
| 495 window_ = gfx::kNullAcceleratedWidget; | 570 window_ = gfx::kNullAcceleratedWidget; |
| 496 } | 571 } |
| 497 | 572 |
| 498 void RenderingHelper::GetThumbnailsAsRGB(std::vector<unsigned char>* rgb, | 573 void RenderingHelper::GetThumbnailsAsRGB(std::vector<unsigned char>* rgb, |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 // When the rendering falls behind, drops frames. | 752 // When the rendering falls behind, drops frames. |
| 678 while (scheduled_render_time_ < target) { | 753 while (scheduled_render_time_ < target) { |
| 679 scheduled_render_time_ += frame_duration_; | 754 scheduled_render_time_ += frame_duration_; |
| 680 DropOneFrameForAllVideos(); | 755 DropOneFrameForAllVideos(); |
| 681 } | 756 } |
| 682 | 757 |
| 683 message_loop_->PostDelayedTask( | 758 message_loop_->PostDelayedTask( |
| 684 FROM_HERE, render_task_.callback(), target - now); | 759 FROM_HERE, render_task_.callback(), target - now); |
| 685 } | 760 } |
| 686 } // namespace content | 761 } // namespace content |
| OLD | NEW |