Allow shaped-desktop hosts to send shape only when it changes.
Previously hosts supplying a shaped desktop needed to attach the desktop
shape to every frame, wasting bandwidth since the shape changes
relatively infrequently.
This CL updates the VideoRenderer implementations to preserve the shape
(or lack of one) from the preceding frame if the VideoPacket does not
include the use_desktop_shape field.
Also simplifies FrameConsumerProxy to remove the need for ref-counting,
updates NULL->nullptr throughout remoting/codec/, and removes
unnecessary transparency logic from VideoDecoderVpx.
BUG=446288
Review URL: https://codereview.chromium.org/1236663002
Cr-Commit-Position: refs/heads/master@{#339212}
diff --git a/remoting/codec/video_decoder_vpx.h b/remoting/codec/video_decoder_vpx.h
index 9c969984..21a576a 100644
--- a/remoting/codec/video_decoder_vpx.h
+++ b/remoting/codec/video_decoder_vpx.h
@@ -12,6 +12,7 @@
#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_region.h"
+typedef const struct vpx_codec_iface vpx_codec_iface_t;
typedef struct vpx_image vpx_image_t;
namespace remoting {
@@ -25,7 +26,7 @@
~VideoDecoderVpx() override;
// VideoDecoder interface.
- void Initialize(const webrtc::DesktopSize& screen_size) override;
+ void Initialize(const webrtc::DesktopSize& source_size) override;
bool DecodePacket(const VideoPacket& packet) override;
void Invalidate(const webrtc::DesktopSize& view_size,
const webrtc::DesktopRegion& region) override;
@@ -37,29 +38,21 @@
const webrtc::DesktopRegion* GetImageShape() override;
private:
- explicit VideoDecoderVpx(ScopedVpxCodec codec);
+ explicit VideoDecoderVpx(vpx_codec_iface_t* codec);
- // Calculates the difference between the desktop shape regions in two
- // consecutive frames and updates |updated_region_| and |transparent_region_|
- // accordingly.
- void UpdateImageShapeRegion(webrtc::DesktopRegion* new_desktop_shape);
+ // Returns the dimensions of the most recent frame as a DesktopSize.
+ webrtc::DesktopSize image_size() const;
ScopedVpxCodec codec_;
- // Pointer to the last decoded image.
- vpx_image_t* last_image_;
+ // Pointer to the most recently decoded image.
+ vpx_image_t* image_;
- // The region updated that hasn't been copied to the screen yet.
+ // Area of the source that has changed since the last RenderFrame call.
webrtc::DesktopRegion updated_region_;
- // Output dimensions.
- webrtc::DesktopSize screen_size_;
-
- // The region occupied by the top level windows.
- webrtc::DesktopRegion desktop_shape_;
-
- // The region that should be make transparent.
- webrtc::DesktopRegion transparent_region_;
+ // The shape of the most-recent frame, if any.
+ scoped_ptr<webrtc::DesktopRegion> desktop_shape_;
DISALLOW_COPY_AND_ASSIGN(VideoDecoderVpx);
};