 Chromium Code Reviews
 Chromium Code Reviews Issue 1531543002:
  [Chromecast] Adding pause/resume operations to VideoPlaneController.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1531543002:
  [Chromecast] Adding pause/resume operations to VideoPlaneController.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| OLD | NEW | 
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CHROMECAST_MEDIA_VIDEO_PLANE_CONTROLLER_H_ | 5 #ifndef CHROMECAST_MEDIA_VIDEO_PLANE_CONTROLLER_H_ | 
| 6 #define CHROMECAST_MEDIA_VIDEO_PLANE_CONTROLLER_H_ | 6 #define CHROMECAST_MEDIA_VIDEO_PLANE_CONTROLLER_H_ | 
| 7 | 7 | 
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" | 
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" | 
| 10 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" | 
| (...skipping 26 matching lines...) Expand all Loading... | |
| 37 public: | 37 public: | 
| 38 static VideoPlaneController* GetInstance(); | 38 static VideoPlaneController* GetInstance(); | 
| 39 | 39 | 
| 40 // Sets the video plane geometry (forwards to VideoPlane::SetGeometry) | 40 // Sets the video plane geometry (forwards to VideoPlane::SetGeometry) | 
| 41 // in *graphics plane coordinates*. | 41 // in *graphics plane coordinates*. | 
| 42 // * This should be called on UI thread (hopping to media thread is handled | 42 // * This should be called on UI thread (hopping to media thread is handled | 
| 43 // internally). | 43 // internally). | 
| 44 // If there is no change to video plane parameters from the last call to this | 44 // If there is no change to video plane parameters from the last call to this | 
| 45 // method, it is a no-op. | 45 // method, it is a no-op. | 
| 46 void SetGeometry(const RectF& display_rect, VideoPlane::Transform transform); | 46 void SetGeometry(const RectF& display_rect, VideoPlane::Transform transform); | 
| 47 // Posts call to VideoPlane::SetGeometry with most recent resolution and | |
| 48 // geometry parameters (assuming they are all set). Use to reset video plane. | |
| 49 void ResetGeometry(); | |
| 
halliwell
2015/12/28 22:22:31
nit: blank line before comment.
I don't quite lik
 
esum
2016/01/11 16:28:57
Method no longer needed since resetting the video
 | |
| 47 | 50 | 
| 48 // Sets physical screen resolution. This must be called at least once when | 51 // Sets physical screen resolution. This must be called at least once when | 
| 49 // the final output resolution (HDMI signal or panel resolution) is known, | 52 // the final output resolution (HDMI signal or panel resolution) is known, | 
| 50 // then later when it changes. If there is no change to the device resolution | 53 // then later when it changes. If there is no change to the device resolution | 
| 51 // from the last call to this method, it is a no-op. | 54 // from the last call to this method, it is a no-op. | 
| 52 void SetDeviceResolution(const Size& resolution); | 55 void SetDeviceResolution(const Size& resolution); | 
| 53 | 56 | 
| 54 // Sets graphics hardware plane resolution. This must be called at least once | 57 // Sets graphics hardware plane resolution. This must be called at least once | 
| 55 // when the hardware graphics plane resolution (same resolution as | 58 // when the hardware graphics plane resolution (same resolution as | 
| 56 // gfx::Screen) is known, then later when it changes. If there is no change to | 59 // gfx::Screen) is known, then later when it changes. If there is no change to | 
| 57 // the graphics plane resolution from the last call to this method, it is a | 60 // the graphics plane resolution from the last call to this method, it is a | 
| 58 // no-op. | 61 // no-op. | 
| 59 void SetGraphicsPlaneResolution(const Size& resolution); | 62 void SetGraphicsPlaneResolution(const Size& resolution); | 
| 60 | 63 | 
| 64 // After Pause is called, no further calls to VideoPlane::SetGeometry will be | |
| 65 // made except for any pending calls already scheduled on the media thread. | |
| 66 // The Set methods will however update cached parameters that will take | |
| 67 // effect once the class is resumed. Safe to call multiple times. | |
| 68 void Pause(); | |
| 69 // Makes class active again. Safe to call multiple times. | |
| 70 void Resume(); | |
| 71 bool is_paused() const; | |
| 72 | |
| 61 private: | 73 private: | 
| 62 class RateLimitedSetVideoPlaneGeometry; | 74 class RateLimitedSetVideoPlaneGeometry; | 
| 63 friend struct base::DefaultSingletonTraits<VideoPlaneController>; | 75 friend struct base::DefaultSingletonTraits<VideoPlaneController>; | 
| 64 | 76 | 
| 65 VideoPlaneController(); | 77 VideoPlaneController(); | 
| 66 ~VideoPlaneController(); | 78 ~VideoPlaneController(); | 
| 67 | 79 | 
| 68 // Check if HaveDataForSetGeometry. If not, this method is a no-op. Otherwise | 80 // Check if HaveDataForSetGeometry. If not, this method is a no-op. Otherwise | 
| 69 // it scales the display rect from graphics to device resolution coordinates. | 81 // it scales the display rect from graphics to device resolution coordinates. | 
| 70 // Then posts task to media thread for VideoPlane::SetGeometry. | 82 // Then posts task to media thread for VideoPlane::SetGeometry. | 
| 71 void MaybeRunSetGeometry(); | 83 void MaybeRunSetGeometry(); | 
| 72 // Checks if all data has been collected to make calls to | 84 // Checks if all data has been collected to make calls to | 
| 73 // VideoPlane::SetGeometry. | 85 // VideoPlane::SetGeometry. | 
| 74 bool HaveDataForSetGeometry() const; | 86 bool HaveDataForSetGeometry() const; | 
| 75 | 87 | 
| 88 bool is_paused_; | |
| 89 | |
| 76 // Current resolutions | 90 // Current resolutions | 
| 77 bool have_output_res_; | 91 bool have_output_res_; | 
| 78 bool have_graphics_res_; | 92 bool have_graphics_res_; | 
| 79 Size output_res_; | 93 Size output_res_; | 
| 80 Size graphics_res_; | 94 Size graphics_res_; | 
| 81 | 95 | 
| 82 // Saved video plane parameters (in graphics plane coordinates) | 96 // Saved video plane parameters (in graphics plane coordinates) | 
| 83 // for use when screen resolution changes. | 97 // for use when screen resolution changes. | 
| 84 bool have_video_plane_geometry_; | 98 bool have_video_plane_geometry_; | 
| 85 RectF video_plane_display_rect_; | 99 RectF video_plane_display_rect_; | 
| 86 VideoPlane::Transform video_plane_transform_; | 100 VideoPlane::Transform video_plane_transform_; | 
| 87 | 101 | 
| 88 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; | 102 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; | 
| 89 scoped_refptr<RateLimitedSetVideoPlaneGeometry> video_plane_wrapper_; | 103 scoped_refptr<RateLimitedSetVideoPlaneGeometry> video_plane_wrapper_; | 
| 90 | 104 | 
| 91 base::ThreadChecker thread_checker_; | 105 base::ThreadChecker thread_checker_; | 
| 92 | 106 | 
| 93 DISALLOW_COPY_AND_ASSIGN(VideoPlaneController); | 107 DISALLOW_COPY_AND_ASSIGN(VideoPlaneController); | 
| 94 }; | 108 }; | 
| 95 | 109 | 
| 96 } // namespace media | 110 } // namespace media | 
| 97 } // namespace chromecast | 111 } // namespace chromecast | 
| 98 | 112 | 
| 99 #endif // CHROMECAST_MEDIA_VIDEO_PLANE_CONTROLLER_H_ | 113 #endif // CHROMECAST_MEDIA_VIDEO_PLANE_CONTROLLER_H_ | 
| OLD | NEW |