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 "media/gpu/rendering_helper.h" | 5 #include "media/gpu/rendering_helper.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 render_as_thumbnails_ = params.render_as_thumbnails; | 343 render_as_thumbnails_ = params.render_as_thumbnails; |
344 task_runner_ = base::ThreadTaskRunnerHandle::Get(); | 344 task_runner_ = base::ThreadTaskRunnerHandle::Get(); |
345 | 345 |
346 gl_surface_ = gl::init::CreateViewGLSurface(window_); | 346 gl_surface_ = gl::init::CreateViewGLSurface(window_); |
347 #if defined(USE_OZONE) | 347 #if defined(USE_OZONE) |
348 gl_surface_->Resize(platform_window_delegate_->GetSize(), 1.f, true); | 348 gl_surface_->Resize(platform_window_delegate_->GetSize(), 1.f, true); |
349 #endif // defined(USE_OZONE) | 349 #endif // defined(USE_OZONE) |
350 screen_size_ = gl_surface_->GetSize(); | 350 screen_size_ = gl_surface_->GetSize(); |
351 | 351 |
352 gl_context_ = gl::init::CreateGLContext(nullptr, gl_surface_.get(), | 352 gl_context_ = gl::init::CreateGLContext(nullptr, gl_surface_.get(), |
353 gl::PreferIntegratedGpu); | 353 gl::GLContextAttribs()); |
354 CHECK(gl_context_->MakeCurrent(gl_surface_.get())); | 354 CHECK(gl_context_->MakeCurrent(gl_surface_.get())); |
355 | 355 |
356 CHECK_GT(params.window_sizes.size(), 0U); | 356 CHECK_GT(params.window_sizes.size(), 0U); |
357 videos_.resize(params.window_sizes.size()); | 357 videos_.resize(params.window_sizes.size()); |
358 LayoutRenderingAreas(params.window_sizes); | 358 LayoutRenderingAreas(params.window_sizes); |
359 | 359 |
360 if (render_as_thumbnails_) { | 360 if (render_as_thumbnails_) { |
361 CHECK_EQ(videos_.size(), 1U); | 361 CHECK_EQ(videos_.size(), 1U); |
362 | 362 |
363 GLint max_texture_size; | 363 GLint max_texture_size; |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 // When the rendering falls behind, drops frames. | 884 // When the rendering falls behind, drops frames. |
885 while (scheduled_render_time_ < target) { | 885 while (scheduled_render_time_ < target) { |
886 scheduled_render_time_ += frame_duration_; | 886 scheduled_render_time_ += frame_duration_; |
887 DropOneFrameForAllVideos(); | 887 DropOneFrameForAllVideos(); |
888 } | 888 } |
889 | 889 |
890 task_runner_->PostDelayedTask(FROM_HERE, render_task_.callback(), | 890 task_runner_->PostDelayedTask(FROM_HERE, render_task_.callback(), |
891 target - now); | 891 target - now); |
892 } | 892 } |
893 } // namespace media | 893 } // namespace media |
OLD | NEW |