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

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

Issue 462413004: rendering_helper - Refactoring - remove the Client interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address review comments Created 6 years, 4 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 a2dfb1bbf492690104ee2f183aa076ccfc60a3a3..16a7ec8809c549c8d0fbc4f36b35996244e0ca1d 100644
--- a/content/common/gpu/media/rendering_helper.h
+++ b/content/common/gpu/media/rendering_helper.h
@@ -5,6 +5,7 @@
#ifndef CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_
#define CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_
+#include <deque>
#include <map>
#include <vector>
@@ -24,25 +25,50 @@ class WaitableEvent;
namespace content {
-struct RenderingHelperParams;
+class VideoFrame : public base::RefCounted<VideoFrame> {
+ public:
+ uint32 texture_id() const { return texture_id_; }
+ uint32 texture_target() const { return texture_target_; }
+
+ VideoFrame(uint32 texture_target,
+ uint32 texture_id,
+ const base::Closure& no_longer_needed_cb);
+ ~VideoFrame();
+
+ private:
+ uint32 texture_target_;
+ uint32 texture_id_;
+ base::Closure no_longer_needed_cb_;
+};
+
+struct RenderingHelperParams {
+ RenderingHelperParams();
+ ~RenderingHelperParams();
+
+ // The rendering FPS.
+ int rendering_fps;
+
+ // The desired size of each window. We play each stream in its own window
+ // on the screen.
+ std::vector<gfx::Size> window_sizes;
+
+ // The members below are only used for the thumbnail mode where all frames
+ // are rendered in sequence onto one FBO for comparison/verification purposes.
+
+ // 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;
+};
// 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;
-
- // Callback to get the desired window size of the client.
- virtual const gfx::Size& GetWindowSize() = 0;
-
- protected:
- virtual ~Client() {}
- };
RenderingHelper();
~RenderingHelper();
@@ -67,9 +93,11 @@ class RenderingHelper {
// |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);
+ // Queues the VideoFrame for rendering.
+ void QueueVideoFrame(size_t window_id, scoped_refptr<VideoFrame> video_frame);
+
+ // Drops all the pending video frames of the specified window.
+ void DropPendingFrames(size_t window_id);
// Delete |texture_id|.
void DeleteTexture(uint32 texture_id);
@@ -87,11 +115,29 @@ class RenderingHelper {
base::WaitableEvent* done);
private:
+ struct RenderedVideo {
+ // The rect on the screen where the video will be rendered.
+ gfx::Rect render_area;
+
+ // Ture if the last (and the only one) frame in pending_frames has
Pawel Osciak 2014/08/15 05:45:16 s/Ture/True/ Also, I think you want to say not th
Owen Lin 2014/08/18 09:03:08 I have changed the documentation. But I am confuse
Pawel Osciak 2014/08/20 10:26:26 Right, it was actually me who was confused. Please
+ // been rendered.
+ bool last_frame_rendered;
+
+ // The video frames pending for rendering.
+ std::deque<scoped_refptr<VideoFrame> > pending_frames;
Pawel Osciak 2014/08/15 05:45:16 Oh I forgot to comment on this last time, you don'
Owen Lin 2014/08/18 09:03:08 Done. Thanks. I got a feeling that deque is more e
+
+ RenderedVideo() : last_frame_rendered(false) {}
+ };
+
void Clear();
void RenderContent();
- void LayoutRenderingAreas();
+ void LayoutRenderingAreas(const std::vector<gfx::Size>& window_sizes);
+
+ // Render |texture_id| to the current view port of the screen using target
+ // |texture_target|.
+ void RenderTexture(uint32 texture_target, uint32 texture_id);
// Timer to trigger the RenderContent() repeatly.
scoped_ptr<base::RepeatingTimer<RenderingHelper> > render_timer_;
@@ -104,10 +150,7 @@ class RenderingHelper {
gfx::Size screen_size_;
- // The rendering area of each window on the screen.
- std::vector<gfx::Rect> render_areas_;
-
- std::vector<base::WeakPtr<Client> > clients_;
+ std::vector<RenderedVideo> videos_;
bool render_as_thumbnails_;
int frame_count_;
@@ -121,24 +164,6 @@ class RenderingHelper {
DISALLOW_COPY_AND_ASSIGN(RenderingHelper);
};
-struct RenderingHelperParams {
- RenderingHelperParams();
- ~RenderingHelperParams();
-
- // The rendering FPS.
- int rendering_fps;
-
- // The clients who provide the content for rendering.
- std::vector<base::WeakPtr<RenderingHelper::Client> > clients;
-
- // 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_
« no previous file with comments | « no previous file | content/common/gpu/media/rendering_helper.cc » ('j') | content/common/gpu/media/rendering_helper.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698