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

Unified Diff: content/common/gpu/media/rendering_helper.h

Issue 294663006: vda_unittest - Move the fps control from ThrottleVDAClient to RenderingHelper. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address review comments Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: content/common/gpu/media/rendering_helper.h
diff --git a/content/common/gpu/media/rendering_helper.h b/content/common/gpu/media/rendering_helper.h
index 36b4924adb13ab2dfe8a1dc453cd56ebf959268b..11b380f254fdf52442d34ceb3cb356e2ea4be681 100644
--- a/content/common/gpu/media/rendering_helper.h
+++ b/content/common/gpu/media/rendering_helper.h
@@ -9,7 +9,10 @@
#include <vector>
#include "base/basictypes.h"
-#include "ui/gfx/size.h"
+#include "base/time/time.h"
+#include "base/timer/timer.h"
+#include "ui/gfx/geometry/rect.h"
+#include "ui/gfx/geometry/size.h"
#include "ui/gl/gl_bindings.h"
namespace base {
@@ -27,31 +30,23 @@ typedef EGLContext NativeContextType;
namespace content {
-struct RenderingHelperParams {
- RenderingHelperParams();
- ~RenderingHelperParams();
-
- bool suppress_swap_to_display;
- int num_windows;
- // Dimensions of window(s) created for displaying frames. In the
- // case of thumbnail rendering, these won't match the frame dimensions.
- std::vector<gfx::Size> window_dimensions;
- // Dimensions of video frame texture(s).
- std::vector<gfx::Size> frame_dimensions;
- // Whether the frames are rendered as scaled thumbnails within a
- // larger FBO that is in turn rendered to the window.
- bool render_as_thumbnails;
- // The size of the FBO containing all visible thumbnails.
- gfx::Size thumbnails_page_size;
- // The size of each thumbnail within the FBO.
- gfx::Size thumbnail_size;
-};
+struct RenderingHelperParams;
// Creates and draws textures used by the video decoder.
// This class is not thread safe and thus all the methods of this class
// (except for ctor/dtor) ensure they're being run on a single thread.
class RenderingHelper {
public:
+ // Interface for the content provider of the RenderingHelper.
+ class Client {
+ public:
+ // Callback to tell client to render the content.
+ virtual void RenderContent(RenderingHelper* helper) = 0;
+
+ protected:
+ virtual ~Client() {}
+ };
+
RenderingHelper();
~RenderingHelper();
@@ -69,7 +64,12 @@ class RenderingHelper {
uint32* texture_id,
base::WaitableEvent* done);
- // Render |texture_id| to the screen using target |texture_target|.
+ // Render thumbnail in the |texture_id| to the FBO buffer using target
+ // |texture_target|.
+ void RenderThumbnail(uint32 texture_target, uint32 texture_id);
+
+ // Render |texture_id| to the current view port of the screen using target
+ // |texture_target|.
void RenderTexture(uint32 texture_target, uint32 texture_id);
// Delete |texture_id|.
@@ -90,12 +90,9 @@ class RenderingHelper {
private:
void Clear();
- // Make window_id's surface current w/ the GL context, or release the context
- // if |window_id < 0|.
- void MakeCurrent(int window_id);
-
+ void RenderContent();
+ base::RepeatingTimer<RenderingHelper> render_timer_;
base::MessageLoop* message_loop_;
- std::vector<gfx::Size> window_dimensions_;
std::vector<gfx::Size> frame_dimensions_;
NativeContextType gl_context_;
@@ -103,18 +100,23 @@ class RenderingHelper {
#if defined(GL_VARIANT_EGL)
EGLDisplay gl_display_;
- std::vector<EGLSurface> gl_surfaces_;
+ EGLSurface gl_surface_;
#else
XVisualInfo* x_visual_;
#endif
#if defined(OS_WIN)
- std::vector<HWND> windows_;
+ HWND window_;
#else
Display* x_display_;
- std::vector<Window> x_windows_;
+ Window x_window_;
#endif
+ // The rendering area of each window on the screen.
+ std::vector<gfx::Rect> render_areas_;
+
+ std::vector<base::WeakPtr<Client> > clients_;
+
bool render_as_thumbnails_;
int frame_count_;
GLuint thumbnails_fbo_id_;
@@ -122,10 +124,32 @@ class RenderingHelper {
gfx::Size thumbnails_fbo_size_;
gfx::Size thumbnail_size_;
GLuint program_;
+ base::TimeDelta frame_duration_;
DISALLOW_COPY_AND_ASSIGN(RenderingHelper);
};
+struct RenderingHelperParams {
+ RenderingHelperParams();
+ ~RenderingHelperParams();
+ int rendering_fps;
+
+ std::vector<base::WeakPtr<RenderingHelper::Client> > clients;
+ int num_windows;
+
+ // Dimensions of window(s) created for displaying frames. In the
+ // case of thumbnail rendering, these won't match the frame dimensions.
+ std::vector<gfx::Size> window_dimensions;
+ // Dimensions of video frame texture(s).
+ std::vector<gfx::Size> frame_dimensions;
+ // Whether the frames are rendered as scaled thumbnails within a
+ // larger FBO that is in turn rendered to the window.
+ bool render_as_thumbnails;
+ // The size of the FBO containing all visible thumbnails.
+ gfx::Size thumbnails_page_size;
+ // The size of each thumbnail within the FBO.
+ gfx::Size thumbnail_size;
+};
} // namespace content
#endif // CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_

Powered by Google App Engine
This is Rietveld 408576698