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

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

Issue 1057013002: Make sure RenderingHelper doesn't allocate a window of size 0x0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix-vda-tests
Patch Set: . Created 5 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 XStoreName(display, window_, "VideoDecodeAcceleratorTest"); 233 XStoreName(display, window_, "VideoDecodeAcceleratorTest");
234 XSelectInput(display, window_, ExposureMask); 234 XSelectInput(display, window_, ExposureMask);
235 XMapWindow(display, window_); 235 XMapWindow(display, window_);
236 #elif defined(USE_OZONE) 236 #elif defined(USE_OZONE)
237 base::MessageLoop::ScopedNestableTaskAllower nest_loop( 237 base::MessageLoop::ScopedNestableTaskAllower nest_loop(
238 base::MessageLoop::current()); 238 base::MessageLoop::current());
239 base::RunLoop wait_window_resize; 239 base::RunLoop wait_window_resize;
240 240
241 platform_window_delegate_.reset(new RenderingHelper::StubOzoneDelegate()); 241 platform_window_delegate_.reset(new RenderingHelper::StubOzoneDelegate());
242 window_ = platform_window_delegate_->accelerated_widget(); 242 window_ = platform_window_delegate_->accelerated_widget();
243 gfx::Size window_size(800, 600);
243 #if defined(OS_CHROMEOS) 244 #if defined(OS_CHROMEOS)
244 // We hold onto the main loop here to wait for the DisplayController 245 // We hold onto the main loop here to wait for the DisplayController
245 // to give us the size of the display so we can create a window of 246 // to give us the size of the display so we can create a window of
246 // the same size. 247 // the same size.
247 base::RunLoop wait_display_setup; 248 base::RunLoop wait_display_setup;
248 DisplayConfiguratorObserver display_setup_observer(&wait_display_setup); 249 DisplayConfiguratorObserver display_setup_observer(&wait_display_setup);
249 display_configurator_.reset(new ui::DisplayConfigurator()); 250 display_configurator_.reset(new ui::DisplayConfigurator());
250 display_configurator_->SetDelegateForTesting(0); 251 display_configurator_->SetDelegateForTesting(0);
251 display_configurator_->AddObserver(&display_setup_observer); 252 display_configurator_->AddObserver(&display_setup_observer);
252 display_configurator_->Init(true); 253 display_configurator_->Init(true);
253 display_configurator_->ForceInitialConfigure(0); 254 display_configurator_->ForceInitialConfigure(0);
254 // Make sure all the display configuration is applied. 255 // Make sure all the display configuration is applied.
255 wait_display_setup.Run(); 256 wait_display_setup.Run();
256 display_configurator_->RemoveObserver(&display_setup_observer); 257 display_configurator_->RemoveObserver(&display_setup_observer);
257 258
259 gfx::Size framebuffer_size = display_configurator_->framebuffer_size();
260 if (!framebuffer_size.IsEmpty())
261 window_size = framebuffer_size;
262 #endif
258 platform_window_delegate_->platform_window()->SetBounds( 263 platform_window_delegate_->platform_window()->SetBounds(
259 gfx::Rect(display_configurator_->framebuffer_size())); 264 gfx::Rect(window_size));
260 #else
261 platform_window_delegate_->platform_window()->SetBounds(gfx::Rect(800, 600));
262 #endif
263 265
264 // On Ozone/DRI, platform windows are associated with the physical 266 // On Ozone/DRI, platform windows are associated with the physical
265 // outputs. Association is achieved by matching the bounds of the 267 // outputs. Association is achieved by matching the bounds of the
266 // window with the origin & modeset of the display output. Until a 268 // window with the origin & modeset of the display output. Until a
267 // window is associated with a display output, we cannot get vsync 269 // window is associated with a display output, we cannot get vsync
268 // events, because there is no hardware to get events from. Here we 270 // events, because there is no hardware to get events from. Here we
269 // wait for the window to resized and therefore associated with 271 // wait for the window to resized and therefore associated with
270 // display output to be sure that we will get such events. 272 // display output to be sure that we will get such events.
271 wait_window_resize.RunUntilIdle(); 273 wait_window_resize.RunUntilIdle();
272 #else 274 #else
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 // When the rendering falls behind, drops frames. 848 // When the rendering falls behind, drops frames.
847 while (scheduled_render_time_ < target) { 849 while (scheduled_render_time_ < target) {
848 scheduled_render_time_ += frame_duration_; 850 scheduled_render_time_ += frame_duration_;
849 DropOneFrameForAllVideos(); 851 DropOneFrameForAllVideos();
850 } 852 }
851 853
852 message_loop_->PostDelayedTask( 854 message_loop_->PostDelayedTask(
853 FROM_HERE, render_task_.callback(), target - now); 855 FROM_HERE, render_task_.callback(), target - now);
854 } 856 }
855 } // namespace content 857 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698