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

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

Issue 1824723003: [chromecast] Pass media task runner to VideoPlaneController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: fixed android build Created 4 years, 9 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 | « chromecast/graphics/cast_screen.cc ('k') | chromecast/media/base/video_plane_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 18 matching lines...) Expand all
29 // media thread with SetGeometry calls (which are expensive on many 29 // media thread with SetGeometry calls (which are expensive on many
30 // platforms). 30 // platforms).
31 // The class collects/caches the data it needs before it can start operating. 31 // The class collects/caches the data it needs before it can start operating.
32 // This means SetGeometry, SetDeviceResolution, and SetGraphicsPlaneResolution 32 // This means SetGeometry, SetDeviceResolution, and SetGraphicsPlaneResolution
33 // need to be called at least once in any order before the class starts making 33 // need to be called at least once in any order before the class starts making
34 // calls to VideoPlane::SetGeometry. All calls to these methods beforehand just 34 // calls to VideoPlane::SetGeometry. All calls to these methods beforehand just
35 // set/update the cached parameters. 35 // set/update the cached parameters.
36 // All calls to public methods should be from the same thread. 36 // All calls to public methods should be from the same thread.
37 class VideoPlaneController { 37 class VideoPlaneController {
38 public: 38 public:
39 static VideoPlaneController* GetInstance(); 39 explicit VideoPlaneController(
40 40 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner);
41 ~VideoPlaneController();
41 // Sets the video plane geometry (forwards to VideoPlane::SetGeometry) 42 // Sets the video plane geometry (forwards to VideoPlane::SetGeometry)
42 // in *graphics plane coordinates*. 43 // in *graphics plane coordinates*.
43 // * This should be called on UI thread (hopping to media thread is handled 44 // * This should be called on UI thread (hopping to media thread is handled
44 // internally). 45 // internally).
45 // If there is no change to video plane parameters from the last call to this 46 // If there is no change to video plane parameters from the last call to this
46 // method, it is a no-op. 47 // method, it is a no-op.
47 void SetGeometry(const RectF& display_rect, VideoPlane::Transform transform); 48 void SetGeometry(const RectF& display_rect, VideoPlane::Transform transform);
48 49
49 // Sets physical screen resolution. This must be called at least once when 50 // Sets physical screen resolution. This must be called at least once when
50 // the final output resolution (HDMI signal or panel resolution) is known, 51 // the final output resolution (HDMI signal or panel resolution) is known,
(...skipping 19 matching lines...) Expand all
70 // Makes class active again. Also resets the video plane by posting a call to 71 // 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 // VideoPlane::SetGeometry with most recent resolution and geometry parameters
72 // (assuming they are all set). Safe to call multiple times. 73 // (assuming they are all set). Safe to call multiple times.
73 void Resume(); 74 void Resume();
74 bool is_paused() const; 75 bool is_paused() const;
75 76
76 private: 77 private:
77 class RateLimitedSetVideoPlaneGeometry; 78 class RateLimitedSetVideoPlaneGeometry;
78 friend struct base::DefaultSingletonTraits<VideoPlaneController>; 79 friend struct base::DefaultSingletonTraits<VideoPlaneController>;
79 80
80 VideoPlaneController();
81 ~VideoPlaneController();
82
83 // Check if HaveDataForSetGeometry. If not, this method is a no-op. Otherwise 81 // Check if HaveDataForSetGeometry. If not, this method is a no-op. Otherwise
84 // it scales the display rect from graphics to device resolution coordinates. 82 // it scales the display rect from graphics to device resolution coordinates.
85 // Then posts task to media thread for VideoPlane::SetGeometry. 83 // Then posts task to media thread for VideoPlane::SetGeometry.
86 void MaybeRunSetGeometry(); 84 void MaybeRunSetGeometry();
87 // Checks if all data has been collected to make calls to 85 // Checks if all data has been collected to make calls to
88 // VideoPlane::SetGeometry. 86 // VideoPlane::SetGeometry.
89 bool HaveDataForSetGeometry() const; 87 bool HaveDataForSetGeometry() const;
90 88
91 bool is_paused_; 89 bool is_paused_;
92 90
(...skipping 14 matching lines...) Expand all
107 105
108 base::ThreadChecker thread_checker_; 106 base::ThreadChecker thread_checker_;
109 107
110 DISALLOW_COPY_AND_ASSIGN(VideoPlaneController); 108 DISALLOW_COPY_AND_ASSIGN(VideoPlaneController);
111 }; 109 };
112 110
113 } // namespace media 111 } // namespace media
114 } // namespace chromecast 112 } // namespace chromecast
115 113
116 #endif // CHROMECAST_MEDIA_VIDEO_PLANE_CONTROLLER_H_ 114 #endif // CHROMECAST_MEDIA_VIDEO_PLANE_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chromecast/graphics/cast_screen.cc ('k') | chromecast/media/base/video_plane_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698