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/encoder_row_based.h" | 5 #include "remoting/base/encoder_row_based.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "remoting/base/capture_data.h" | 8 #include "remoting/base/capture_data.h" |
9 #include "remoting/base/compressor_verbatim.h" | 9 #include "remoting/base/compressor_verbatim.h" |
10 #include "remoting/base/compressor_zlib.h" | 10 #include "remoting/base/compressor_zlib.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 compress_again = compressor_->Process(in + row_pos, row_size - row_pos, | 111 compress_again = compressor_->Process(in + row_pos, row_size - row_pos, |
112 out + filled, packet_size_ - filled, | 112 out + filled, packet_size_ - filled, |
113 flush, &consumed, &written); | 113 flush, &consumed, &written); |
114 row_pos += consumed; | 114 row_pos += consumed; |
115 filled += written; | 115 filled += written; |
116 | 116 |
117 // We have reached the end of stream. | 117 // We have reached the end of stream. |
118 if (!compress_again) { | 118 if (!compress_again) { |
119 packet->set_flags(packet->flags() | VideoPacket::LAST_PACKET); | 119 packet->set_flags(packet->flags() | VideoPacket::LAST_PACKET); |
120 packet->set_capture_time_ms(capture_data_->capture_time_ms()); | 120 packet->set_capture_time_ms(capture_data_->capture_time_ms()); |
| 121 packet->set_client_sequence_number( |
| 122 capture_data_->client_sequence_number()); |
121 if (last) | 123 if (last) |
122 packet->set_flags(packet->flags() | VideoPacket::LAST_PARTITION); | 124 packet->set_flags(packet->flags() | VideoPacket::LAST_PARTITION); |
123 DCHECK(row_pos == row_size); | 125 DCHECK(row_pos == row_size); |
124 DCHECK(row_y == rect.height() - 1); | 126 DCHECK(row_y == rect.height() - 1); |
125 } | 127 } |
126 | 128 |
127 // If we have filled the message or we have reached the end of stream. | 129 // If we have filled the message or we have reached the end of stream. |
128 if (filled == packet_size_ || !compress_again) { | 130 if (filled == packet_size_ || !compress_again) { |
129 packet->mutable_data()->resize(filled); | 131 packet->mutable_data()->resize(filled); |
130 callback_->Run(packet); | 132 callback_->Run(packet); |
(...skipping 28 matching lines...) Expand all Loading... |
159 | 161 |
160 uint8* EncoderRowBased::GetOutputBuffer(VideoPacket* packet, size_t size) { | 162 uint8* EncoderRowBased::GetOutputBuffer(VideoPacket* packet, size_t size) { |
161 packet->mutable_data()->resize(size); | 163 packet->mutable_data()->resize(size); |
162 // TODO(ajwong): Is there a better way to do this at all??? | 164 // TODO(ajwong): Is there a better way to do this at all??? |
163 return const_cast<uint8*>(reinterpret_cast<const uint8*>( | 165 return const_cast<uint8*>(reinterpret_cast<const uint8*>( |
164 packet->mutable_data()->data())); | 166 packet->mutable_data()->data())); |
165 } | 167 } |
166 | 168 |
167 | 169 |
168 } // namespace remoting | 170 } // namespace remoting |
OLD | NEW |