summaryrefslogtreecommitdiffstats
path: root/remoting/client/rectangle_update_decoder.cc
diff options
context:
space:
mode:
authorwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-01 23:48:37 +0000
committerwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-01 23:48:37 +0000
commit4f5be2341a05dca1cf590d3d33562b8ca8911e37 (patch)
treec4544a70fa8d06a399322f75937c5895442bcd01 /remoting/client/rectangle_update_decoder.cc
parent1a8eee7c96b33276484f9679b5f4bf7c7b063cf0 (diff)
downloadchromium_src-4f5be2341a05dca1cf590d3d33562b8ca8911e37.zip
chromium_src-4f5be2341a05dca1cf590d3d33562b8ca8911e37.tar.gz
chromium_src-4f5be2341a05dca1cf590d3d33562b8ca8911e37.tar.bz2
Remove support for the initial-resolution tag in session descriptions.
TEST=Unit-tests & manual interoperability testing with older versions. Review URL: http://codereview.chromium.org/9021044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116083 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/client/rectangle_update_decoder.cc')
-rw-r--r--remoting/client/rectangle_update_decoder.cc51
1 files changed, 22 insertions, 29 deletions
diff --git a/remoting/client/rectangle_update_decoder.cc b/remoting/client/rectangle_update_decoder.cc
index 8b7ca9e..7c20438 100644
--- a/remoting/client/rectangle_update_decoder.cc
+++ b/remoting/client/rectangle_update_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -23,19 +23,15 @@ RectangleUpdateDecoder::RectangleUpdateDecoder(MessageLoop* message_loop,
FrameConsumer* consumer)
: message_loop_(message_loop),
consumer_(consumer),
- initial_screen_size_(SkISize::Make(0, 0)),
+ screen_size_(SkISize::Make(0, 0)),
clip_rect_(SkIRect::MakeEmpty()),
- frame_is_new_(false),
- frame_is_consuming_(false) {
+ decoder_needs_reset_(false) {
}
RectangleUpdateDecoder::~RectangleUpdateDecoder() {
}
void RectangleUpdateDecoder::Initialize(const SessionConfig& config) {
- initial_screen_size_ = SkISize::Make(config.initial_resolution().width,
- config.initial_resolution().height);
-
// Initialize decoder based on the selected codec.
ChannelConfig::Codec codec = config.video_config().codec;
if (codec == ChannelConfig::CODEC_VERBATIM) {
@@ -70,36 +66,35 @@ void RectangleUpdateDecoder::AllocateFrame(const VideoPacket* packet,
}
base::ScopedClosureRunner done_runner(done);
- // Find the required frame size.
- bool has_screen_size = packet->format().has_screen_width() &&
- packet->format().has_screen_height();
- SkISize screen_size(SkISize::Make(packet->format().screen_width(),
- packet->format().screen_height()));
- if (!has_screen_size)
- screen_size = initial_screen_size_;
-
- // Find the current frame size.
- int width = 0;
- int height = 0;
- if (frame_) {
- width = static_cast<int>(frame_->width());
- height = static_cast<int>(frame_->height());
+ // If the packet includes a screen size, store it.
+ if (packet->format().has_screen_width() &&
+ packet->format().has_screen_height()) {
+ screen_size_.set(packet->format().screen_width(),
+ packet->format().screen_height());
+ }
+
+ // If we've never seen a screen size, ignore the packet.
+ if (screen_size_.isZero()) {
+ return;
}
- SkISize frame_size(SkISize::Make(width, height));
+ // Ensure the output frame is the right size.
+ SkISize frame_size = SkISize::Make(0, 0);
+ if (frame_)
+ frame_size.set(frame_->width(), frame_->height());
// Allocate a new frame, if necessary.
- if ((!frame_) || (has_screen_size && (screen_size != frame_size))) {
+ if ((!frame_) || (screen_size_ != frame_size)) {
if (frame_) {
consumer_->ReleaseFrame(frame_);
frame_ = NULL;
}
consumer_->AllocateFrame(
- media::VideoFrame::RGB32, screen_size, &frame_,
+ media::VideoFrame::RGB32, screen_size_, &frame_,
base::Bind(&RectangleUpdateDecoder::ProcessPacketData,
this, packet, done_runner.Release()));
- frame_is_new_ = true;
+ decoder_needs_reset_ = true;
return;
}
ProcessPacketData(packet, done_runner.Release());
@@ -115,10 +110,10 @@ void RectangleUpdateDecoder::ProcessPacketData(
}
base::ScopedClosureRunner done_runner(done);
- if (frame_is_new_) {
+ if (decoder_needs_reset_) {
decoder_->Reset();
decoder_->Initialize(frame_);
- frame_is_new_ = false;
+ decoder_needs_reset_ = false;
}
if (!decoder_->IsReadyForData()) {
@@ -205,7 +200,6 @@ void RectangleUpdateDecoder::SubmitToConsumer() {
RectVector* dirty_rects = new RectVector();
decoder_->GetUpdatedRects(dirty_rects);
- frame_is_consuming_ = true;
consumer_->OnPartialFrameOutput(frame_, dirty_rects, base::Bind(
&RectangleUpdateDecoder::OnFrameConsumed, this, dirty_rects));
}
@@ -231,7 +225,6 @@ void RectangleUpdateDecoder::OnFrameConsumed(RectVector* rects) {
delete rects;
- frame_is_consuming_ = false;
DoRefresh();
}