| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_ | 5 #ifndef MEDIA_GPU_RENDERING_HELPER_H_ |
| 6 #define CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_ | 6 #define MEDIA_GPU_RENDERING_HELPER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <memory> | 12 #include <memory> |
| 13 #include <queue> | 13 #include <queue> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/cancelable_callback.h" | 16 #include "base/cancelable_callback.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 19 #include "build/build_config.h" | 19 #include "build/build_config.h" |
| 20 #include "ui/gfx/geometry/rect.h" | 20 #include "ui/gfx/geometry/rect.h" |
| 21 #include "ui/gfx/geometry/size.h" | 21 #include "ui/gfx/geometry/size.h" |
| 22 #include "ui/gl/gl_bindings.h" | 22 #include "ui/gl/gl_bindings.h" |
| 23 #include "ui/gl/gl_context.h" | 23 #include "ui/gl/gl_context.h" |
| 24 #include "ui/gl/gl_surface.h" | 24 #include "ui/gl/gl_surface.h" |
| 25 | 25 |
| 26 namespace base { | 26 namespace base { |
| 27 class MessageLoop; | 27 class MessageLoop; |
| 28 class WaitableEvent; | 28 class WaitableEvent; |
| 29 } | 29 } |
| 30 | 30 |
| 31 namespace ui { | 31 namespace ui { |
| 32 class DisplayConfigurator; | 32 class DisplayConfigurator; |
| 33 } | 33 } |
| 34 | 34 |
| 35 namespace content { | 35 namespace media { |
| 36 | 36 |
| 37 class VideoFrameTexture : public base::RefCounted<VideoFrameTexture> { | 37 class VideoFrameTexture : public base::RefCounted<VideoFrameTexture> { |
| 38 public: | 38 public: |
| 39 uint32_t texture_id() const { return texture_id_; } | 39 uint32_t texture_id() const { return texture_id_; } |
| 40 uint32_t texture_target() const { return texture_target_; } | 40 uint32_t texture_target() const { return texture_target_; } |
| 41 | 41 |
| 42 VideoFrameTexture(uint32_t texture_target, | 42 VideoFrameTexture(uint32_t texture_target, |
| 43 uint32_t texture_id, | 43 uint32_t texture_id, |
| 44 const base::Closure& no_longer_needed_cb); | 44 const base::Closure& no_longer_needed_cb); |
| 45 | 45 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 gfx::Size thumbnails_page_size; | 79 gfx::Size thumbnails_page_size; |
| 80 // The size of each thumbnail within the FBO. | 80 // The size of each thumbnail within the FBO. |
| 81 gfx::Size thumbnail_size; | 81 gfx::Size thumbnail_size; |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 // Creates and draws textures used by the video decoder. | 84 // Creates and draws textures used by the video decoder. |
| 85 // This class is not thread safe and thus all the methods of this class | 85 // This class is not thread safe and thus all the methods of this class |
| 86 // (except for ctor/dtor) ensure they're being run on a single thread. | 86 // (except for ctor/dtor) ensure they're being run on a single thread. |
| 87 class RenderingHelper { | 87 class RenderingHelper { |
| 88 public: | 88 public: |
| 89 | |
| 90 RenderingHelper(); | 89 RenderingHelper(); |
| 91 ~RenderingHelper(); | 90 ~RenderingHelper(); |
| 92 | 91 |
| 93 // Initialize GL. This method must be called on the rendering | 92 // Initialize GL. This method must be called on the rendering |
| 94 // thread. | 93 // thread. |
| 95 static void InitializeOneOff(base::WaitableEvent* done); | 94 static void InitializeOneOff(base::WaitableEvent* done); |
| 96 | 95 |
| 97 // Setup the platform window to display test results. This method | 96 // Setup the platform window to display test results. This method |
| 98 // must be called on the main thread. | 97 // must be called on the main thread. |
| 99 void Setup(); | 98 void Setup(); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 bool is_flushing; | 153 bool is_flushing; |
| 155 | 154 |
| 156 // The number of frames need to be dropped to catch up the rendering. We | 155 // The number of frames need to be dropped to catch up the rendering. We |
| 157 // always keep the last remaining frame in pending_frames even after it | 156 // always keep the last remaining frame in pending_frames even after it |
| 158 // has been rendered, so that we have something to display if the client | 157 // has been rendered, so that we have something to display if the client |
| 159 // is falling behind on providing us with new frames during timer-driven | 158 // is falling behind on providing us with new frames during timer-driven |
| 160 // playback. | 159 // playback. |
| 161 int frames_to_drop; | 160 int frames_to_drop; |
| 162 | 161 |
| 163 // The video frames pending for rendering. | 162 // The video frames pending for rendering. |
| 164 std::queue<scoped_refptr<VideoFrameTexture> > pending_frames; | 163 std::queue<scoped_refptr<VideoFrameTexture>> pending_frames; |
| 165 | 164 |
| 166 RenderedVideo(); | 165 RenderedVideo(); |
| 167 RenderedVideo(const RenderedVideo& other); | 166 RenderedVideo(const RenderedVideo& other); |
| 168 ~RenderedVideo(); | 167 ~RenderedVideo(); |
| 169 }; | 168 }; |
| 170 | 169 |
| 171 void Clear(); | 170 void Clear(); |
| 172 | 171 |
| 173 void RenderContent(); | 172 void RenderContent(); |
| 174 | 173 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 GLuint program_; | 217 GLuint program_; |
| 219 base::TimeDelta frame_duration_; | 218 base::TimeDelta frame_duration_; |
| 220 base::TimeTicks scheduled_render_time_; | 219 base::TimeTicks scheduled_render_time_; |
| 221 base::CancelableClosure render_task_; | 220 base::CancelableClosure render_task_; |
| 222 base::TimeTicks vsync_timebase_; | 221 base::TimeTicks vsync_timebase_; |
| 223 base::TimeDelta vsync_interval_; | 222 base::TimeDelta vsync_interval_; |
| 224 | 223 |
| 225 DISALLOW_COPY_AND_ASSIGN(RenderingHelper); | 224 DISALLOW_COPY_AND_ASSIGN(RenderingHelper); |
| 226 }; | 225 }; |
| 227 | 226 |
| 228 } // namespace content | 227 } // namespace media |
| 229 | 228 |
| 230 #endif // CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_ | 229 #endif // MEDIA_GPU_RENDERING_HELPER_H_ |
| OLD | NEW |