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

Side by Side Diff: remoting/client/rectangle_update_decoder.cc

Issue 3305001: Move decoder into separate thread, clean up API layering, and redo update protocl (Closed)
Patch Set: Fix compile error. Created 10 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/rectangle_update_decoder.h ('k') | remoting/client/x11_client.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "media/base/callback.h" 9 #include "media/base/callback.h"
10 #include "remoting/base/decoder.h" 10 #include "remoting/base/decoder.h"
11 #include "remoting/base/decoder_verbatim.h" 11 #include "remoting/base/decoder_row_based.h"
12 #include "remoting/base/decoder_zlib.h"
13 #include "remoting/base/protocol/chromotocol.pb.h" 12 #include "remoting/base/protocol/chromotocol.pb.h"
13 #include "remoting/base/protocol_util.h"
14 #include "remoting/base/tracer.h" 14 #include "remoting/base/tracer.h"
15 #include "remoting/client/frame_consumer.h" 15 #include "remoting/client/frame_consumer.h"
16 16
17 using media::AutoTaskRunner; 17 using media::AutoTaskRunner;
18 18
19 namespace remoting { 19 namespace remoting {
20 20
21 namespace { 21 namespace {
22 22
23 class PartialFrameCleanup : public Task { 23 class PartialFrameCleanup : public Task {
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 // 188 //
189 // For now though, assume that only one encoding is used throughout. 189 // For now though, assume that only one encoding is used throughout.
190 // 190 //
191 // Note, this may be as simple as just deleting the current decoder. 191 // Note, this may be as simple as just deleting the current decoder.
192 // However, we need to verify the flushing semantics of the decoder first. 192 // However, we need to verify the flushing semantics of the decoder first.
193 CHECK(decoder_->Encoding() == format.encoding()); 193 CHECK(decoder_->Encoding() == format.encoding());
194 } else { 194 } else {
195 // Initialize a new decoder based on this message encoding. 195 // Initialize a new decoder based on this message encoding.
196 if (format.encoding() == EncodingNone) { 196 if (format.encoding() == EncodingNone) {
197 TraceContext::tracer()->PrintString("Creating Verbatim decoder."); 197 TraceContext::tracer()->PrintString("Creating Verbatim decoder.");
198 decoder_.reset(new DecoderVerbatim()); 198 decoder_.reset(DecoderRowBased::CreateVerbatimDecoder());
199 } else if (format.encoding() == EncodingZlib) { 199 } else if (format.encoding() == EncodingZlib) {
200 TraceContext::tracer()->PrintString("Creating Zlib decoder"); 200 TraceContext::tracer()->PrintString("Creating Zlib decoder");
201 decoder_.reset(new DecoderZlib()); 201 decoder_.reset(DecoderRowBased::CreateZlibDecoder());
202 } else { 202 } else {
203 NOTREACHED() << "Invalid Encoding found: " << format.encoding(); 203 NOTREACHED() << "Invalid Encoding found: " << format.encoding();
204 } 204 }
205 } 205 }
206 206
207 // TODO(ajwong): This can happen in the face of corrupt input data. Figure 207 // TODO(ajwong): This can happen in the face of corrupt input data. Figure
208 // out the right behavior and make this more resilient. 208 // out the right behavior and make this more resilient.
209 CHECK(updated_rects_.empty()); 209 CHECK(updated_rects_.empty());
210 210
211 gfx::Rect rectangle_size(format.x(), format.y(), 211 gfx::Rect rectangle_size(format.x(), format.y(),
212 format.width(), format.height()); 212 format.width(), format.height());
213 updated_rects_.push_back(rectangle_size); 213 updated_rects_.push_back(rectangle_size);
214 decoder_->Initialize(frame_, rectangle_size); 214 decoder_->Initialize(frame_, rectangle_size,
215 GetBytesPerPixel(format.pixel_format()));
215 TraceContext::tracer()->PrintString("Decoder is Initialized"); 216 TraceContext::tracer()->PrintString("Decoder is Initialized");
216 } 217 }
217 218
218 } // namespace remoting 219 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/rectangle_update_decoder.h ('k') | remoting/client/x11_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698