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

Side by Side Diff: chromecast/media/base/video_plane_controller.h

Issue 1531543002: [Chromecast] Adding pause/resume operations to VideoPlaneController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Just rebase of Patch Set 6. Created 4 years, 11 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
OLDNEW
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/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 // from the last call to this method, it is a no-op. 52 // from the last call to this method, it is a no-op.
53 void SetDeviceResolution(const Size& resolution); 53 void SetDeviceResolution(const Size& resolution);
54 54
55 // Sets graphics hardware plane resolution. This must be called at least once 55 // Sets graphics hardware plane resolution. This must be called at least once
56 // when the hardware graphics plane resolution (same resolution as 56 // when the hardware graphics plane resolution (same resolution as
57 // gfx::Screen) is known, then later when it changes. If there is no change to 57 // gfx::Screen) is known, then later when it changes. If there is no change to
58 // the graphics plane resolution from the last call to this method, it is a 58 // the graphics plane resolution from the last call to this method, it is a
59 // no-op. 59 // no-op.
60 void SetGraphicsPlaneResolution(const Size& resolution); 60 void SetGraphicsPlaneResolution(const Size& resolution);
61 61
62 // After Pause is called, no further calls to VideoPlane::SetGeometry will be
63 // made except for any pending calls already scheduled on the media thread.
halliwell 2016/01/12 03:25:07 Technically, doesn't this mean we're not implement
esum 2016/01/12 04:51:47 Ah, so I wasn't sure if this was worth the extra c
halliwell 2016/01/12 15:40:38 It is implementation-dependent, yes. I don't thin
esum 2016/01/15 23:02:28 Done.
64 // The Set methods will however update cached parameters that will take
65 // effect once the class is resumed. Safe to call multiple times.
66 void Pause();
67 // Makes class active again. Also resets the video plane by posting a call to
68 // VideoPlane::SetGeometry with most recent resolution and geometry parameters
69 // (assuming they are all set). Safe to call multiple times.
70 void Resume();
71 bool is_paused() const;
72
62 private: 73 private:
63 class RateLimitedSetVideoPlaneGeometry; 74 class RateLimitedSetVideoPlaneGeometry;
64 friend struct base::DefaultSingletonTraits<VideoPlaneController>; 75 friend struct base::DefaultSingletonTraits<VideoPlaneController>;
65 76
66 VideoPlaneController(); 77 VideoPlaneController();
67 ~VideoPlaneController(); 78 ~VideoPlaneController();
68 79
69 // 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
70 // it scales the display rect from graphics to device resolution coordinates. 81 // it scales the display rect from graphics to device resolution coordinates.
71 // Then posts task to media thread for VideoPlane::SetGeometry. 82 // Then posts task to media thread for VideoPlane::SetGeometry.
72 void MaybeRunSetGeometry(); 83 void MaybeRunSetGeometry();
73 // Checks if all data has been collected to make calls to 84 // Checks if all data has been collected to make calls to
74 // VideoPlane::SetGeometry. 85 // VideoPlane::SetGeometry.
75 bool HaveDataForSetGeometry() const; 86 bool HaveDataForSetGeometry() const;
76 87
88 bool is_paused_;
89
77 // Current resolutions 90 // Current resolutions
78 bool have_output_res_; 91 bool have_output_res_;
79 bool have_graphics_res_; 92 bool have_graphics_res_;
80 Size output_res_; 93 Size output_res_;
81 Size graphics_res_; 94 Size graphics_res_;
82 95
83 // Saved video plane parameters (in graphics plane coordinates) 96 // Saved video plane parameters (in graphics plane coordinates)
84 // for use when screen resolution changes. 97 // for use when screen resolution changes.
85 bool have_video_plane_geometry_; 98 bool have_video_plane_geometry_;
86 RectF video_plane_display_rect_; 99 RectF video_plane_display_rect_;
87 VideoPlane::Transform video_plane_transform_; 100 VideoPlane::Transform video_plane_transform_;
88 101
89 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; 102 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_;
90 scoped_refptr<RateLimitedSetVideoPlaneGeometry> video_plane_wrapper_; 103 scoped_refptr<RateLimitedSetVideoPlaneGeometry> video_plane_wrapper_;
91 104
92 base::ThreadChecker thread_checker_; 105 base::ThreadChecker thread_checker_;
93 106
94 DISALLOW_COPY_AND_ASSIGN(VideoPlaneController); 107 DISALLOW_COPY_AND_ASSIGN(VideoPlaneController);
95 }; 108 };
96 109
97 } // namespace media 110 } // namespace media
98 } // namespace chromecast 111 } // namespace chromecast
99 112
100 #endif // CHROMECAST_MEDIA_VIDEO_PLANE_CONTROLLER_H_ 113 #endif // CHROMECAST_MEDIA_VIDEO_PLANE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698