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

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: Rebase of Patch Set 8. 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.
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 // TODO(esum): Handle the case where there are pending calls already on the
67 // media thread. When this returns, the caller needs to know that absolutely
68 // no more SetGeometry calls will be made.
69 void Pause();
70 // Makes class active again. Also resets the video plane by posting a call to
71 // VideoPlane::SetGeometry with most recent resolution and geometry parameters
72 // (assuming they are all set). Safe to call multiple times.
73 void Resume();
74 bool is_paused() const;
75
62 private: 76 private:
63 class RateLimitedSetVideoPlaneGeometry; 77 class RateLimitedSetVideoPlaneGeometry;
64 friend struct base::DefaultSingletonTraits<VideoPlaneController>; 78 friend struct base::DefaultSingletonTraits<VideoPlaneController>;
65 79
66 VideoPlaneController(); 80 VideoPlaneController();
67 ~VideoPlaneController(); 81 ~VideoPlaneController();
68 82
69 // Check if HaveDataForSetGeometry. If not, this method is a no-op. Otherwise 83 // Check if HaveDataForSetGeometry. If not, this method is a no-op. Otherwise
70 // it scales the display rect from graphics to device resolution coordinates. 84 // it scales the display rect from graphics to device resolution coordinates.
71 // Then posts task to media thread for VideoPlane::SetGeometry. 85 // Then posts task to media thread for VideoPlane::SetGeometry.
72 void MaybeRunSetGeometry(); 86 void MaybeRunSetGeometry();
73 // Checks if all data has been collected to make calls to 87 // Checks if all data has been collected to make calls to
74 // VideoPlane::SetGeometry. 88 // VideoPlane::SetGeometry.
75 bool HaveDataForSetGeometry() const; 89 bool HaveDataForSetGeometry() const;
76 90
91 bool is_paused_;
92
77 // Current resolutions 93 // Current resolutions
78 bool have_output_res_; 94 bool have_output_res_;
79 bool have_graphics_res_; 95 bool have_graphics_res_;
80 Size output_res_; 96 Size output_res_;
81 Size graphics_res_; 97 Size graphics_res_;
82 98
83 // Saved video plane parameters (in graphics plane coordinates) 99 // Saved video plane parameters (in graphics plane coordinates)
84 // for use when screen resolution changes. 100 // for use when screen resolution changes.
85 bool have_video_plane_geometry_; 101 bool have_video_plane_geometry_;
86 RectF video_plane_display_rect_; 102 RectF video_plane_display_rect_;
87 VideoPlane::Transform video_plane_transform_; 103 VideoPlane::Transform video_plane_transform_;
88 104
89 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; 105 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_;
90 scoped_refptr<RateLimitedSetVideoPlaneGeometry> video_plane_wrapper_; 106 scoped_refptr<RateLimitedSetVideoPlaneGeometry> video_plane_wrapper_;
91 107
92 base::ThreadChecker thread_checker_; 108 base::ThreadChecker thread_checker_;
93 109
94 DISALLOW_COPY_AND_ASSIGN(VideoPlaneController); 110 DISALLOW_COPY_AND_ASSIGN(VideoPlaneController);
95 }; 111 };
96 112
97 } // namespace media 113 } // namespace media
98 } // namespace chromecast 114 } // namespace chromecast
99 115
100 #endif // CHROMECAST_MEDIA_VIDEO_PLANE_CONTROLLER_H_ 116 #endif // CHROMECAST_MEDIA_VIDEO_PLANE_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chromecast/browser/media/cma_media_pipeline_client.cc ('k') | chromecast/media/base/video_plane_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698