| 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 |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 | 332 |
| 333 frame_duration_ = params.rendering_fps > 0 | 333 frame_duration_ = params.rendering_fps > 0 |
| 334 ? base::TimeDelta::FromSeconds(1) / params.rendering_fps | 334 ? base::TimeDelta::FromSeconds(1) / params.rendering_fps |
| 335 : base::TimeDelta(); | 335 : base::TimeDelta(); |
| 336 | 336 |
| 337 render_as_thumbnails_ = params.render_as_thumbnails; | 337 render_as_thumbnails_ = params.render_as_thumbnails; |
| 338 message_loop_ = base::MessageLoop::current(); | 338 message_loop_ = base::MessageLoop::current(); |
| 339 | 339 |
| 340 gl_surface_ = gfx::GLSurface::CreateViewGLSurface(window_); | 340 gl_surface_ = gfx::GLSurface::CreateViewGLSurface(window_); |
| 341 #if defined(USE_OZONE) | 341 #if defined(USE_OZONE) |
| 342 gl_surface_->Resize(platform_window_delegate_->GetSize()); | 342 gl_surface_->Resize(platform_window_delegate_->GetSize(), 1.f); |
| 343 #endif // defined(USE_OZONE) | 343 #endif // defined(USE_OZONE) |
| 344 screen_size_ = gl_surface_->GetSize(); | 344 screen_size_ = gl_surface_->GetSize(); |
| 345 | 345 |
| 346 gl_context_ = gfx::GLContext::CreateGLContext( | 346 gl_context_ = gfx::GLContext::CreateGLContext( |
| 347 NULL, gl_surface_.get(), gfx::PreferIntegratedGpu); | 347 NULL, gl_surface_.get(), gfx::PreferIntegratedGpu); |
| 348 CHECK(gl_context_->MakeCurrent(gl_surface_.get())); | 348 CHECK(gl_context_->MakeCurrent(gl_surface_.get())); |
| 349 | 349 |
| 350 CHECK_GT(params.window_sizes.size(), 0U); | 350 CHECK_GT(params.window_sizes.size(), 0U); |
| 351 videos_.resize(params.window_sizes.size()); | 351 videos_.resize(params.window_sizes.size()); |
| 352 LayoutRenderingAreas(params.window_sizes); | 352 LayoutRenderingAreas(params.window_sizes); |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 // When the rendering falls behind, drops frames. | 881 // When the rendering falls behind, drops frames. |
| 882 while (scheduled_render_time_ < target) { | 882 while (scheduled_render_time_ < target) { |
| 883 scheduled_render_time_ += frame_duration_; | 883 scheduled_render_time_ += frame_duration_; |
| 884 DropOneFrameForAllVideos(); | 884 DropOneFrameForAllVideos(); |
| 885 } | 885 } |
| 886 | 886 |
| 887 message_loop_->PostDelayedTask( | 887 message_loop_->PostDelayedTask( |
| 888 FROM_HERE, render_task_.callback(), target - now); | 888 FROM_HERE, render_task_.callback(), target - now); |
| 889 } | 889 } |
| 890 } // namespace content | 890 } // namespace content |
| OLD | NEW |