OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "remoting/client/rectangle_update_decoder.h" | 5 #include "remoting/client/rectangle_update_decoder.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "remoting/base/decoder.h" | 10 #include "remoting/base/decoder.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 if (!decoder_->IsReadyForData()) { | 122 if (!decoder_->IsReadyForData()) { |
123 // TODO(ajwong): This whole thing should move into an invalid state. | 123 // TODO(ajwong): This whole thing should move into an invalid state. |
124 LOG(ERROR) << "Decoder is unable to process data. Dropping packet."; | 124 LOG(ERROR) << "Decoder is unable to process data. Dropping packet."; |
125 return; | 125 return; |
126 } | 126 } |
127 | 127 |
128 if (decoder_->DecodePacket(packet) == Decoder::DECODE_DONE) | 128 if (decoder_->DecodePacket(packet) == Decoder::DECODE_DONE) |
129 SubmitToConsumer(); | 129 SubmitToConsumer(); |
130 } | 130 } |
131 | 131 |
132 void RectangleUpdateDecoder::SetScaleRatios(double horizontal_ratio, | 132 void RectangleUpdateDecoder::SetOutputDimensions(const SkISize& size) { |
133 double vertical_ratio) { | |
134 if (message_loop_ != MessageLoop::current()) { | 133 if (message_loop_ != MessageLoop::current()) { |
135 message_loop_->PostTask( | 134 message_loop_->PostTask( |
136 FROM_HERE, base::Bind(&RectangleUpdateDecoder::SetScaleRatios, | 135 FROM_HERE, base::Bind(&RectangleUpdateDecoder::SetOutputDimensions, |
137 this, horizontal_ratio, vertical_ratio)); | 136 this, size)); |
138 return; | 137 return; |
139 } | 138 } |
140 | 139 |
141 // TODO(hclam): If the scale ratio has changed we should reallocate a | 140 // TODO(hclam): If the scale ratio has changed we should reallocate a |
142 // VideoFrame of different size. However if the scale ratio is always | 141 // VideoFrame of different size. However if the scale ratio is always |
143 // smaller than 1.0 we can use the same video frame. | 142 // smaller than 1.0 we can use the same video frame. |
144 decoder_->SetScaleRatios(horizontal_ratio, vertical_ratio); | 143 |
| 144 // TODO(wez): Because we're not using a scaling ratio, we do need to |
| 145 // reallocate the video frame here, and re-initialize the decoder. |
| 146 |
| 147 if (decoder_.get()) { |
| 148 decoder_->SetOutputDimensions(size); |
| 149 RefreshFullFrame(); |
| 150 } |
145 } | 151 } |
146 | 152 |
147 void RectangleUpdateDecoder::UpdateClipRect(const SkIRect& new_clip_rect) { | 153 void RectangleUpdateDecoder::UpdateClipRect(const SkIRect& new_clip_rect) { |
148 if (message_loop_ != MessageLoop::current()) { | 154 if (message_loop_ != MessageLoop::current()) { |
149 message_loop_->PostTask( | 155 message_loop_->PostTask( |
150 FROM_HERE, base::Bind(&RectangleUpdateDecoder::UpdateClipRect, | 156 FROM_HERE, base::Bind(&RectangleUpdateDecoder::UpdateClipRect, |
151 this, new_clip_rect)); | 157 this, new_clip_rect)); |
152 return; | 158 return; |
153 } | 159 } |
154 | 160 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 return; | 250 return; |
245 } | 251 } |
246 | 252 |
247 delete rects; | 253 delete rects; |
248 | 254 |
249 frame_is_consuming_ = false; | 255 frame_is_consuming_ = false; |
250 DoRefresh(); | 256 DoRefresh(); |
251 } | 257 } |
252 | 258 |
253 } // namespace remoting | 259 } // namespace remoting |
OLD | NEW |