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

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

Issue 10736046: Add DPI information to video packets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reviewer comments. Created 8 years, 5 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/capture_data.cc ('k') | remoting/base/encoder_vp8.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 flush, &consumed, &written); 117 flush, &consumed, &written);
118 row_pos += consumed; 118 row_pos += consumed;
119 filled += written; 119 filled += written;
120 120
121 // We have reached the end of stream. 121 // We have reached the end of stream.
122 if (!compress_again) { 122 if (!compress_again) {
123 packet->set_flags(packet->flags() | VideoPacket::LAST_PACKET); 123 packet->set_flags(packet->flags() | VideoPacket::LAST_PACKET);
124 packet->set_capture_time_ms(capture_data_->capture_time_ms()); 124 packet->set_capture_time_ms(capture_data_->capture_time_ms());
125 packet->set_client_sequence_number( 125 packet->set_client_sequence_number(
126 capture_data_->client_sequence_number()); 126 capture_data_->client_sequence_number());
127 SkIPoint dpi(capture_data_->dpi());
128 if (dpi.x())
129 packet->mutable_format()->set_x_dpi(dpi.x());
130 if (dpi.y())
131 packet->mutable_format()->set_y_dpi(dpi.y());
127 if (last) 132 if (last)
128 packet->set_flags(packet->flags() | VideoPacket::LAST_PARTITION); 133 packet->set_flags(packet->flags() | VideoPacket::LAST_PARTITION);
129 DCHECK(row_pos == row_size); 134 DCHECK(row_pos == row_size);
130 DCHECK(row_y == rect.height() - 1); 135 DCHECK(row_y == rect.height() - 1);
131 } 136 }
132 137
133 // If we have filled the message or we have reached the end of stream. 138 // If we have filled the message or we have reached the end of stream.
134 if (filled == packet_size_ || !compress_again) { 139 if (filled == packet_size_ || !compress_again) {
135 packet->mutable_data()->resize(filled); 140 packet->mutable_data()->resize(filled);
136 callback_.Run(packet.Pass()); 141 callback_.Run(packet.Pass());
(...skipping 26 matching lines...) Expand all
163 } 168 }
164 169
165 uint8* EncoderRowBased::GetOutputBuffer(VideoPacket* packet, size_t size) { 170 uint8* EncoderRowBased::GetOutputBuffer(VideoPacket* packet, size_t size) {
166 packet->mutable_data()->resize(size); 171 packet->mutable_data()->resize(size);
167 // TODO(ajwong): Is there a better way to do this at all??? 172 // TODO(ajwong): Is there a better way to do this at all???
168 return const_cast<uint8*>(reinterpret_cast<const uint8*>( 173 return const_cast<uint8*>(reinterpret_cast<const uint8*>(
169 packet->mutable_data()->data())); 174 packet->mutable_data()->data()));
170 } 175 }
171 176
172 } // namespace remoting 177 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/base/capture_data.cc ('k') | remoting/base/encoder_vp8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698