OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 24 matching lines...) Expand all Loading... |
35 EncoderRowBased* EncoderRowBased::CreateVerbatimEncoder(int packet_size) { | 35 EncoderRowBased* EncoderRowBased::CreateVerbatimEncoder(int packet_size) { |
36 return new EncoderRowBased(new CompressorVerbatim(), | 36 return new EncoderRowBased(new CompressorVerbatim(), |
37 VideoPacketFormat::ENCODING_VERBATIM, | 37 VideoPacketFormat::ENCODING_VERBATIM, |
38 packet_size); | 38 packet_size); |
39 } | 39 } |
40 | 40 |
41 EncoderRowBased::EncoderRowBased(Compressor* compressor, | 41 EncoderRowBased::EncoderRowBased(Compressor* compressor, |
42 VideoPacketFormat::Encoding encoding) | 42 VideoPacketFormat::Encoding encoding) |
43 : encoding_(encoding), | 43 : encoding_(encoding), |
44 compressor_(compressor), | 44 compressor_(compressor), |
45 screen_size_(0, 0), | 45 screen_size_(SkISize::Make(0,0)), |
46 packet_size_(kPacketSize) { | 46 packet_size_(kPacketSize) { |
47 } | 47 } |
48 | 48 |
49 EncoderRowBased::EncoderRowBased(Compressor* compressor, | 49 EncoderRowBased::EncoderRowBased(Compressor* compressor, |
50 VideoPacketFormat::Encoding encoding, | 50 VideoPacketFormat::Encoding encoding, |
51 int packet_size) | 51 int packet_size) |
52 : encoding_(encoding), | 52 : encoding_(encoding), |
53 compressor_(compressor), | 53 compressor_(compressor), |
54 screen_size_(0, 0), | 54 screen_size_(SkISize::Make(0,0)), |
55 packet_size_(packet_size) { | 55 packet_size_(packet_size) { |
56 } | 56 } |
57 | 57 |
58 EncoderRowBased::~EncoderRowBased() {} | 58 EncoderRowBased::~EncoderRowBased() {} |
59 | 59 |
60 void EncoderRowBased::Encode(scoped_refptr<CaptureData> capture_data, | 60 void EncoderRowBased::Encode(scoped_refptr<CaptureData> capture_data, |
61 bool key_frame, | 61 bool key_frame, |
62 DataAvailableCallback* data_available_callback) { | 62 DataAvailableCallback* data_available_callback) { |
63 CHECK(capture_data->pixel_format() == media::VideoFrame::RGB32) | 63 CHECK(capture_data->pixel_format() == media::VideoFrame::RGB32) |
64 << "RowBased Encoder only works with RGB32. Got " | 64 << "RowBased Encoder only works with RGB32. Got " |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 164 |
165 uint8* EncoderRowBased::GetOutputBuffer(VideoPacket* packet, size_t size) { | 165 uint8* EncoderRowBased::GetOutputBuffer(VideoPacket* packet, size_t size) { |
166 packet->mutable_data()->resize(size); | 166 packet->mutable_data()->resize(size); |
167 // 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??? |
168 return const_cast<uint8*>(reinterpret_cast<const uint8*>( | 168 return const_cast<uint8*>(reinterpret_cast<const uint8*>( |
169 packet->mutable_data()->data())); | 169 packet->mutable_data()->data())); |
170 } | 170 } |
171 | 171 |
172 | 172 |
173 } // namespace remoting | 173 } // namespace remoting |
OLD | NEW |