| 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" |
| 11 #include "remoting/base/util.h" | 11 #include "remoting/base/util.h" |
| 12 #include "remoting/proto/video.pb.h" | 12 #include "remoting/proto/video.pb.h" |
| 13 #include "ui/gfx/rect.h" | |
| 14 | 13 |
| 15 namespace remoting { | 14 namespace remoting { |
| 16 | 15 |
| 17 static const int kPacketSize = 1024 * 1024; | 16 static const int kPacketSize = 1024 * 1024; |
| 18 | 17 |
| 19 EncoderRowBased* EncoderRowBased::CreateZlibEncoder() { | 18 EncoderRowBased* EncoderRowBased::CreateZlibEncoder() { |
| 20 return new EncoderRowBased(new CompressorZlib(), | 19 return new EncoderRowBased(new CompressorZlib(), |
| 21 VideoPacketFormat::ENCODING_ZLIB); | 20 VideoPacketFormat::ENCODING_ZLIB); |
| 22 } | 21 } |
| 23 | 22 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 35 EncoderRowBased* EncoderRowBased::CreateVerbatimEncoder(int packet_size) { | 34 EncoderRowBased* EncoderRowBased::CreateVerbatimEncoder(int packet_size) { |
| 36 return new EncoderRowBased(new CompressorVerbatim(), | 35 return new EncoderRowBased(new CompressorVerbatim(), |
| 37 VideoPacketFormat::ENCODING_VERBATIM, | 36 VideoPacketFormat::ENCODING_VERBATIM, |
| 38 packet_size); | 37 packet_size); |
| 39 } | 38 } |
| 40 | 39 |
| 41 EncoderRowBased::EncoderRowBased(Compressor* compressor, | 40 EncoderRowBased::EncoderRowBased(Compressor* compressor, |
| 42 VideoPacketFormat::Encoding encoding) | 41 VideoPacketFormat::Encoding encoding) |
| 43 : encoding_(encoding), | 42 : encoding_(encoding), |
| 44 compressor_(compressor), | 43 compressor_(compressor), |
| 45 screen_size_(0, 0), | 44 screen_size_(SkISize::Make(0,0)), |
| 46 packet_size_(kPacketSize) { | 45 packet_size_(kPacketSize) { |
| 47 } | 46 } |
| 48 | 47 |
| 49 EncoderRowBased::EncoderRowBased(Compressor* compressor, | 48 EncoderRowBased::EncoderRowBased(Compressor* compressor, |
| 50 VideoPacketFormat::Encoding encoding, | 49 VideoPacketFormat::Encoding encoding, |
| 51 int packet_size) | 50 int packet_size) |
| 52 : encoding_(encoding), | 51 : encoding_(encoding), |
| 53 compressor_(compressor), | 52 compressor_(compressor), |
| 54 screen_size_(0, 0), | 53 screen_size_(SkISize::Make(0,0)), |
| 55 packet_size_(packet_size) { | 54 packet_size_(packet_size) { |
| 56 } | 55 } |
| 57 | 56 |
| 58 EncoderRowBased::~EncoderRowBased() {} | 57 EncoderRowBased::~EncoderRowBased() {} |
| 59 | 58 |
| 60 void EncoderRowBased::Encode(scoped_refptr<CaptureData> capture_data, | 59 void EncoderRowBased::Encode(scoped_refptr<CaptureData> capture_data, |
| 61 bool key_frame, | 60 bool key_frame, |
| 62 DataAvailableCallback* data_available_callback) { | 61 DataAvailableCallback* data_available_callback) { |
| 63 CHECK(capture_data->pixel_format() == media::VideoFrame::RGB32) | 62 CHECK(capture_data->pixel_format() == media::VideoFrame::RGB32) |
| 64 << "RowBased Encoder only works with RGB32. Got " | 63 << "RowBased Encoder only works with RGB32. Got " |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 163 |
| 165 uint8* EncoderRowBased::GetOutputBuffer(VideoPacket* packet, size_t size) { | 164 uint8* EncoderRowBased::GetOutputBuffer(VideoPacket* packet, size_t size) { |
| 166 packet->mutable_data()->resize(size); | 165 packet->mutable_data()->resize(size); |
| 167 // TODO(ajwong): Is there a better way to do this at all??? | 166 // TODO(ajwong): Is there a better way to do this at all??? |
| 168 return const_cast<uint8*>(reinterpret_cast<const uint8*>( | 167 return const_cast<uint8*>(reinterpret_cast<const uint8*>( |
| 169 packet->mutable_data()->data())); | 168 packet->mutable_data()->data())); |
| 170 } | 169 } |
| 171 | 170 |
| 172 | 171 |
| 173 } // namespace remoting | 172 } // namespace remoting |
| OLD | NEW |