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

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

Issue 10024072: Cull unnecessary media::VideoFrame::Formats from the enum. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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
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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 iter.next(); 73 iter.next();
74 EncodeRect(rect, iter.done()); 74 EncodeRect(rect, iter.done());
75 } 75 }
76 76
77 capture_data_ = NULL; 77 capture_data_ = NULL;
78 callback_.Reset(); 78 callback_.Reset();
79 } 79 }
80 80
81 void EncoderRowBased::EncodeRect(const SkIRect& rect, bool last) { 81 void EncoderRowBased::EncodeRect(const SkIRect& rect, bool last) {
82 CHECK(capture_data_->data_planes().data[0]); 82 CHECK(capture_data_->data_planes().data[0]);
83 CHECK_EQ(capture_data_->pixel_format(), media::VideoFrame::RGB32);
83 const int strides = capture_data_->data_planes().strides[0]; 84 const int strides = capture_data_->data_planes().strides[0];
84 const int bytes_per_pixel = GetBytesPerPixel(capture_data_->pixel_format()); 85 const int bytes_per_pixel = 4;
scherkus (not reviewing) 2012/04/10 21:32:31 doesn't VideoFrame offer this info?
Ami GONE FROM CHROMIUM 2012/04/10 22:01:07 Only as row_bytes(0)/width(), and I didn't think t
scherkus (not reviewing) 2012/04/10 22:05:39 that's what I thought :\ SGTM
85 const int row_size = bytes_per_pixel * rect.width(); 86 const int row_size = bytes_per_pixel * rect.width();
86 87
87 compressor_->Reset(); 88 compressor_->Reset();
88 89
89 scoped_ptr<VideoPacket> packet(new VideoPacket()); 90 scoped_ptr<VideoPacket> packet(new VideoPacket());
90 PrepareUpdateStart(rect, packet.get()); 91 PrepareUpdateStart(rect, packet.get());
91 const uint8* in = capture_data_->data_planes().data[0] + 92 const uint8* in = capture_data_->data_planes().data[0] +
92 rect.fTop * strides + rect.fLeft * bytes_per_pixel; 93 rect.fTop * strides + rect.fLeft * bytes_per_pixel;
93 // TODO(hclam): Fill in the sequence number. 94 // TODO(hclam): Fill in the sequence number.
94 uint8* out = GetOutputBuffer(packet.get(), packet_size_); 95 uint8* out = GetOutputBuffer(packet.get(), packet_size_);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 } 163 }
163 164
164 uint8* EncoderRowBased::GetOutputBuffer(VideoPacket* packet, size_t size) { 165 uint8* EncoderRowBased::GetOutputBuffer(VideoPacket* packet, size_t size) {
165 packet->mutable_data()->resize(size); 166 packet->mutable_data()->resize(size);
166 // TODO(ajwong): Is there a better way to do this at all??? 167 // TODO(ajwong): Is there a better way to do this at all???
167 return const_cast<uint8*>(reinterpret_cast<const uint8*>( 168 return const_cast<uint8*>(reinterpret_cast<const uint8*>(
168 packet->mutable_data()->data())); 169 packet->mutable_data()->data()));
169 } 170 }
170 171
171 } // namespace remoting 172 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698