OLD | NEW |
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_row_based.h" | 5 #include "remoting/base/decoder_row_based.h" |
6 | 6 |
7 #include "remoting/base/decompressor.h" | 7 #include "remoting/base/decompressor.h" |
8 #include "remoting/base/decompressor_zlib.h" | 8 #include "remoting/base/decompressor_zlib.h" |
9 #include "remoting/base/decompressor_verbatim.h" | 9 #include "remoting/base/decompressor_verbatim.h" |
10 #include "remoting/base/util.h" | 10 #include "remoting/base/util.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 row_pos_ += written; | 113 row_pos_ += written; |
114 | 114 |
115 // If this row is completely filled then move onto the next row. | 115 // If this row is completely filled then move onto the next row. |
116 if (row_pos_ == row_size) { | 116 if (row_pos_ == row_size) { |
117 ++row_y_; | 117 ++row_y_; |
118 row_pos_ = 0; | 118 row_pos_ = 0; |
119 out += stride; | 119 out += stride; |
120 } | 120 } |
121 } | 121 } |
122 | 122 |
123 if (state_ == kDone && row_y_ < clip_.height()) { | 123 if (state_ == kDone) { |
124 state_ = kError; | 124 if (row_y_ < clip_.height()) { |
125 LOG(WARNING) << "Received LAST_PACKET, but didn't get enough data."; | 125 state_ = kError; |
126 return DECODE_ERROR; | 126 return DECODE_ERROR; |
| 127 } |
| 128 |
| 129 decompressor_->Reset(); |
| 130 return DECODE_DONE; |
| 131 } else { |
| 132 return DECODE_IN_PROGRESS; |
127 } | 133 } |
128 | |
129 return state_ == kDone ? DECODE_DONE : DECODE_IN_PROGRESS; | |
130 } | 134 } |
131 | 135 |
132 void DecoderRowBased::UpdateStateForPacket(const VideoPacket* packet) { | 136 void DecoderRowBased::UpdateStateForPacket(const VideoPacket* packet) { |
133 if (state_ == kError) { | 137 if (state_ == kError) { |
134 return; | 138 return; |
135 } | 139 } |
136 | 140 |
137 if (packet->flags() & VideoPacket::FIRST_PACKET) { | 141 if (packet->flags() & VideoPacket::FIRST_PACKET) { |
138 if (state_ != kReady && state_ != kDone) { | 142 if (state_ != kReady && state_ != kDone) { |
139 state_ = kError; | 143 state_ = kError; |
(...skipping 29 matching lines...) Expand all Loading... |
169 | 173 |
170 void DecoderRowBased::GetUpdatedRects(UpdatedRects* rects) { | 174 void DecoderRowBased::GetUpdatedRects(UpdatedRects* rects) { |
171 rects->push_back(clip_); | 175 rects->push_back(clip_); |
172 } | 176 } |
173 | 177 |
174 VideoPacketFormat::Encoding DecoderRowBased::Encoding() { | 178 VideoPacketFormat::Encoding DecoderRowBased::Encoding() { |
175 return encoding_; | 179 return encoding_; |
176 } | 180 } |
177 | 181 |
178 } // namespace remoting | 182 } // namespace remoting |
OLD | NEW |