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

Side by Side Diff: remoting/base/decoder_zlib.cc

Issue 3141036: Revert 57112 - Rename (Host|Client)Message to Chromoting(Host|Client)Message.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « remoting/base/decoder_zlib.h ('k') | remoting/base/encoder.h » ('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/base/decoder_zlib.h" 5 #include "remoting/base/decoder_zlib.h"
6 6
7 #include "remoting/base/decompressor_zlib.h" 7 #include "remoting/base/decompressor_zlib.h"
8 #include "remoting/base/protocol_util.h" 8 #include "remoting/base/protocol_util.h"
9 9
10 namespace remoting { 10 namespace remoting {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 partial_decode_done_.reset(partial_decode_done); 42 partial_decode_done_.reset(partial_decode_done);
43 decode_done_.reset(decode_done); 43 decode_done_.reset(decode_done);
44 updated_rects_ = updated_rects; 44 updated_rects_ = updated_rects;
45 frame_ = frame; 45 frame_ = frame;
46 46
47 // Create the decompressor. 47 // Create the decompressor.
48 decompressor_.reset(new DecompressorZlib()); 48 decompressor_.reset(new DecompressorZlib());
49 return true; 49 return true;
50 } 50 }
51 51
52 bool DecoderZlib::PartialDecode(ChromotingHostMessage* message) { 52 bool DecoderZlib::PartialDecode(HostMessage* message) {
53 scoped_ptr<ChromotingHostMessage> msg_deleter(message); 53 scoped_ptr<HostMessage> msg_deleter(message);
54 DCHECK(message->has_update_stream_packet()); 54 DCHECK(message->has_update_stream_packet());
55 55
56 bool ret = true; 56 bool ret = true;
57 if (message->update_stream_packet().has_begin_rect()) 57 if (message->update_stream_packet().has_begin_rect())
58 ret = HandleBeginRect(message); 58 ret = HandleBeginRect(message);
59 if (ret && message->update_stream_packet().has_rect_data()) 59 if (ret && message->update_stream_packet().has_rect_data())
60 ret = HandleRectData(message); 60 ret = HandleRectData(message);
61 if (ret && message->update_stream_packet().has_end_rect()) 61 if (ret && message->update_stream_packet().has_end_rect())
62 ret = HandleEndRect(message); 62 ret = HandleEndRect(message);
63 return ret; 63 return ret;
64 } 64 }
65 65
66 void DecoderZlib::EndDecode() { 66 void DecoderZlib::EndDecode() {
67 DCHECK_EQ(kWaitingForBeginRect, state_); 67 DCHECK_EQ(kWaitingForBeginRect, state_);
68 decode_done_->Run(); 68 decode_done_->Run();
69 69
70 partial_decode_done_.reset(); 70 partial_decode_done_.reset();
71 decode_done_.reset(); 71 decode_done_.reset();
72 updated_rects_ = NULL; 72 updated_rects_ = NULL;
73 frame_ = NULL; 73 frame_ = NULL;
74 decompressor_.reset(); 74 decompressor_.reset();
75 } 75 }
76 76
77 bool DecoderZlib::HandleBeginRect(ChromotingHostMessage* message) { 77 bool DecoderZlib::HandleBeginRect(HostMessage* message) {
78 DCHECK_EQ(kWaitingForBeginRect, state_); 78 DCHECK_EQ(kWaitingForBeginRect, state_);
79 state_ = kWaitingForRectData; 79 state_ = kWaitingForRectData;
80 80
81 rect_width_ = message->update_stream_packet().begin_rect().width(); 81 rect_width_ = message->update_stream_packet().begin_rect().width();
82 rect_height_ = message->update_stream_packet().begin_rect().height(); 82 rect_height_ = message->update_stream_packet().begin_rect().height();
83 rect_x_ = message->update_stream_packet().begin_rect().x(); 83 rect_x_ = message->update_stream_packet().begin_rect().x();
84 rect_y_ = message->update_stream_packet().begin_rect().y(); 84 rect_y_ = message->update_stream_packet().begin_rect().y();
85 85
86 PixelFormat pixel_format = 86 PixelFormat pixel_format =
87 message->update_stream_packet().begin_rect().pixel_format(); 87 message->update_stream_packet().begin_rect().pixel_format();
88 88
89 if (static_cast<PixelFormat>(frame_->format()) != pixel_format) { 89 if (static_cast<PixelFormat>(frame_->format()) != pixel_format) {
90 NOTREACHED() << "Pixel format of message doesn't match the video frame. " 90 NOTREACHED() << "Pixel format of message doesn't match the video frame. "
91 "Expected vs received = " 91 "Expected vs received = "
92 << frame_->format() << " vs " << pixel_format 92 << frame_->format() << " vs " << pixel_format
93 << " Color space conversion required."; 93 << " Color space conversion required.";
94 return false; 94 return false;
95 } 95 }
96 96
97 bytes_per_pixel_ = GetBytesPerPixel(pixel_format); 97 bytes_per_pixel_ = GetBytesPerPixel(pixel_format);
98 row_pos_ = 0; 98 row_pos_ = 0;
99 row_y_ = 0; 99 row_y_ = 0;
100 return true; 100 return true;
101 } 101 }
102 102
103 bool DecoderZlib::HandleRectData(ChromotingHostMessage* message) { 103 bool DecoderZlib::HandleRectData(HostMessage* message) {
104 DCHECK_EQ(kWaitingForRectData, state_); 104 DCHECK_EQ(kWaitingForRectData, state_);
105 DCHECK_EQ(0, 105 DCHECK_EQ(0,
106 message->update_stream_packet().rect_data().sequence_number()); 106 message->update_stream_packet().rect_data().sequence_number());
107 107
108 const uint8* in = 108 const uint8* in =
109 (const uint8*)message->update_stream_packet().rect_data().data().data(); 109 (const uint8*)message->update_stream_packet().rect_data().data().data();
110 const int in_size = 110 const int in_size =
111 message->update_stream_packet().rect_data().data().size(); 111 message->update_stream_packet().rect_data().data().size();
112 const int row_size = rect_width_ * bytes_per_pixel_; 112 const int row_size = rect_width_ * bytes_per_pixel_;
113 int stride = frame_->stride(media::VideoFrame::kRGBPlane); 113 int stride = frame_->stride(media::VideoFrame::kRGBPlane);
(...skipping 24 matching lines...) Expand all
138 // If this row is completely filled then move onto the next row. 138 // If this row is completely filled then move onto the next row.
139 if (row_pos_ == row_size) { 139 if (row_pos_ == row_size) {
140 ++row_y_; 140 ++row_y_;
141 row_pos_ = 0; 141 row_pos_ = 0;
142 out += stride; 142 out += stride;
143 } 143 }
144 } 144 }
145 return true; 145 return true;
146 } 146 }
147 147
148 bool DecoderZlib::HandleEndRect(ChromotingHostMessage* message) { 148 bool DecoderZlib::HandleEndRect(HostMessage* message) {
149 DCHECK_EQ(kWaitingForRectData, state_); 149 DCHECK_EQ(kWaitingForRectData, state_);
150 state_ = kWaitingForBeginRect; 150 state_ = kWaitingForBeginRect;
151 151
152 updated_rects_->clear(); 152 updated_rects_->clear();
153 updated_rects_->push_back(gfx::Rect(rect_x_, rect_y_, 153 updated_rects_->push_back(gfx::Rect(rect_x_, rect_y_,
154 rect_width_, rect_height_)); 154 rect_width_, rect_height_));
155 partial_decode_done_->Run(); 155 partial_decode_done_->Run();
156 return true; 156 return true;
157 } 157 }
158 158
159 } // namespace remoting 159 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/base/decoder_zlib.h ('k') | remoting/base/encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698