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

Side by Side Diff: remoting/client/plugin/pepper_view.h

Issue 23677011: Byte-swap the video frame pixels before passing them to Java. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Narrow the synchronization block Created 7 years, 2 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 | « remoting/client/plugin/chromoting_instance.cc ('k') | remoting/client/plugin/pepper_view.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 (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 // This class is an implementation of the ChromotingView for Pepper. It is 5 // This class is an implementation of the ChromotingView for Pepper. It is
6 // callable only on the Pepper thread. 6 // callable only on the Pepper thread.
7 7
8 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_VIEW_H_ 8 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_VIEW_H_
9 #define REMOTING_CLIENT_PLUGIN_PEPPER_VIEW_H_ 9 #define REMOTING_CLIENT_PLUGIN_PEPPER_VIEW_H_
10 10
(...skipping 17 matching lines...) Expand all
28 } // namespace webrtc 28 } // namespace webrtc
29 29
30 namespace remoting { 30 namespace remoting {
31 31
32 class ChromotingInstance; 32 class ChromotingInstance;
33 class ClientContext; 33 class ClientContext;
34 class FrameProducer; 34 class FrameProducer;
35 35
36 class PepperView : public FrameConsumer { 36 class PepperView : public FrameConsumer {
37 public: 37 public:
38 // Constructs a PepperView for the |instance|. The |instance|, |context| 38 // Constructs a PepperView for the |instance|. The |instance| and |context|
39 // and |producer| must outlive this class. 39 // must outlive this class.
40 PepperView(ChromotingInstance* instance, 40 PepperView(ChromotingInstance* instance, ClientContext* context);
41 ClientContext* context,
42 FrameProducer* producer);
43 virtual ~PepperView(); 41 virtual ~PepperView();
44 42
43 // Allocates buffers and passes them to the FrameProducer to render into until
44 // the maximum number of buffers are in-flight.
45 void Initialize(FrameProducer* producer);
46
45 // FrameConsumer implementation. 47 // FrameConsumer implementation.
46 virtual void ApplyBuffer(const webrtc::DesktopSize& view_size, 48 virtual void ApplyBuffer(const webrtc::DesktopSize& view_size,
47 const webrtc::DesktopRect& clip_area, 49 const webrtc::DesktopRect& clip_area,
48 webrtc::DesktopFrame* buffer, 50 webrtc::DesktopFrame* buffer,
49 const webrtc::DesktopRegion& region) OVERRIDE; 51 const webrtc::DesktopRegion& region) OVERRIDE;
50 virtual void ReturnBuffer(webrtc::DesktopFrame* buffer) OVERRIDE; 52 virtual void ReturnBuffer(webrtc::DesktopFrame* buffer) OVERRIDE;
51 virtual void SetSourceSize(const webrtc::DesktopSize& source_size, 53 virtual void SetSourceSize(const webrtc::DesktopSize& source_size,
52 const webrtc::DesktopVector& dpi) OVERRIDE; 54 const webrtc::DesktopVector& dpi) OVERRIDE;
55 virtual PixelFormat GetPixelFormat() OVERRIDE;
53 56
54 // Updates the PepperView's size & clipping area, taking into account the 57 // Updates the PepperView's size & clipping area, taking into account the
55 // DIP-to-device scale factor. 58 // DIP-to-device scale factor.
56 void SetView(const pp::View& view); 59 void SetView(const pp::View& view);
57 60
58 // Returns the dimensions of the most recently displayed frame, in pixels. 61 // Returns the dimensions of the most recently displayed frame, in pixels.
59 const webrtc::DesktopSize& get_source_size() const { 62 const webrtc::DesktopSize& get_source_size() const {
60 return source_size_; 63 return source_size_;
61 } 64 }
62 65
63 // Return the dimensions of the view in Density Independent Pixels (DIPs). 66 // Return the dimensions of the view in Density Independent Pixels (DIPs).
64 // Note that there may be multiple device pixels per DIP. 67 // Note that there may be multiple device pixels per DIP.
65 const webrtc::DesktopSize& get_view_size_dips() const { 68 const webrtc::DesktopSize& get_view_size_dips() const {
66 return dips_size_; 69 return dips_size_;
67 } 70 }
68 71
69 private: 72 private:
70 // Allocates a new frame buffer to supply to the FrameProducer to render into. 73 // Allocates a new frame buffer to supply to the FrameProducer to render into.
71 // Returns NULL if the maximum number of buffers has already been allocated. 74 // Returns NULL if the maximum number of buffers has already been allocated.
72 webrtc::DesktopFrame* AllocateBuffer(); 75 webrtc::DesktopFrame* AllocateBuffer();
73 76
74 // Frees a frame buffer previously allocated by AllocateBuffer. 77 // Frees a frame buffer previously allocated by AllocateBuffer.
75 void FreeBuffer(webrtc::DesktopFrame* buffer); 78 void FreeBuffer(webrtc::DesktopFrame* buffer);
76 79
77 // Allocates buffers and passes them to the FrameProducer to render into until
78 // the maximum number of buffers are in-flight.
79 void InitiateDrawing();
80
81 // Renders the parts of |buffer| identified by |region| to the view. If the 80 // Renders the parts of |buffer| identified by |region| to the view. If the
82 // clip area of the view has changed since the buffer was generated then 81 // clip area of the view has changed since the buffer was generated then
83 // FrameProducer is supplied the missed parts of |region|. The FrameProducer 82 // FrameProducer is supplied the missed parts of |region|. The FrameProducer
84 // will be supplied a new buffer when FlushBuffer() completes. 83 // will be supplied a new buffer when FlushBuffer() completes.
85 void FlushBuffer(const webrtc::DesktopRect& clip_area, 84 void FlushBuffer(const webrtc::DesktopRect& clip_area,
86 webrtc::DesktopFrame* buffer, 85 webrtc::DesktopFrame* buffer,
87 const webrtc::DesktopRegion& region); 86 const webrtc::DesktopRegion& region);
88 87
89 // Handles completion of FlushBuffer(), triggering a new buffer to be 88 // Handles completion of FlushBuffer(), triggering a new buffer to be
90 // returned to FrameProducer for rendering. 89 // returned to FrameProducer for rendering.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 bool frame_received_; 144 bool frame_received_;
146 145
147 pp::CompletionCallbackFactory<PepperView> callback_factory_; 146 pp::CompletionCallbackFactory<PepperView> callback_factory_;
148 147
149 DISALLOW_COPY_AND_ASSIGN(PepperView); 148 DISALLOW_COPY_AND_ASSIGN(PepperView);
150 }; 149 };
151 150
152 } // namespace remoting 151 } // namespace remoting
153 152
154 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_VIEW_H_ 153 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_VIEW_H_
OLDNEW
« no previous file with comments | « remoting/client/plugin/chromoting_instance.cc ('k') | remoting/client/plugin/pepper_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698