summaryrefslogtreecommitdiffstats
path: root/remoting/client/rectangle_update_decoder.cc
diff options
context:
space:
mode:
Diffstat (limited to 'remoting/client/rectangle_update_decoder.cc')
-rw-r--r--remoting/client/rectangle_update_decoder.cc36
1 files changed, 17 insertions, 19 deletions
diff --git a/remoting/client/rectangle_update_decoder.cc b/remoting/client/rectangle_update_decoder.cc
index 9a77860..8471991 100644
--- a/remoting/client/rectangle_update_decoder.cc
+++ b/remoting/client/rectangle_update_decoder.cc
@@ -9,7 +9,6 @@
#include "media/base/callback.h"
#include "remoting/base/decoder.h"
#include "remoting/base/decoder_row_based.h"
-#include "remoting/base/decoder_vp8.h"
#include "remoting/base/tracer.h"
#include "remoting/base/util.h"
#include "remoting/client/frame_consumer.h"
@@ -47,7 +46,7 @@ RectangleUpdateDecoder::RectangleUpdateDecoder(MessageLoop* message_loop,
RectangleUpdateDecoder::~RectangleUpdateDecoder() {
}
-void RectangleUpdateDecoder::DecodePacket(const VideoPacket& packet,
+void RectangleUpdateDecoder::DecodePacket(const RectangleUpdatePacket& packet,
Task* done) {
if (message_loop_ != MessageLoop::current()) {
message_loop_->PostTask(
@@ -71,8 +70,8 @@ void RectangleUpdateDecoder::DecodePacket(const VideoPacket& packet,
&RectangleUpdateDecoder::ProcessPacketData,
packet, done_runner.release());
- if (packet.flags() | VideoPacket::FIRST_PACKET) {
- const VideoPacketFormat& format = packet.format();
+ if (packet.flags() | RectangleUpdatePacket::FIRST_PACKET) {
+ const RectangleFormat& format = packet.format();
InitializeDecoder(format, process_packet_data);
} else {
@@ -82,7 +81,8 @@ void RectangleUpdateDecoder::DecodePacket(const VideoPacket& packet,
}
void RectangleUpdateDecoder::ProcessPacketData(
- const VideoPacket& packet, Task* done) {
+ const RectangleUpdatePacket& packet,
+ Task* done) {
AutoTaskRunner done_runner(done);
if (!decoder_->IsReadyForData()) {
@@ -92,9 +92,9 @@ void RectangleUpdateDecoder::ProcessPacketData(
}
TraceContext::tracer()->PrintString("Executing Decode.");
- decoder_->DecodeBytes(packet.data());
+ decoder_->DecodeBytes(packet.encoded_rect());
- if (packet.flags() | VideoPacket::LAST_PACKET) {
+ if (packet.flags() | RectangleUpdatePacket::LAST_PACKET) {
decoder_->Reset();
UpdatedRects* rects = new UpdatedRects();
@@ -109,38 +109,39 @@ void RectangleUpdateDecoder::ProcessPacketData(
}
// static
-bool RectangleUpdateDecoder::IsValidPacket(const VideoPacket& packet) {
+bool RectangleUpdateDecoder::IsValidPacket(
+ const RectangleUpdatePacket& packet) {
if (!packet.IsInitialized()) {
LOG(WARNING) << "Protobuf consistency checks fail.";
return false;
}
// First packet must have a format.
- if (packet.flags() | VideoPacket::FIRST_PACKET) {
+ if (packet.flags() | RectangleUpdatePacket::FIRST_PACKET) {
if (!packet.has_format()) {
LOG(WARNING) << "First packet must have format.";
return false;
}
// TODO(ajwong): Verify that we don't need to whitelist encodings.
- const VideoPacketFormat& format = packet.format();
+ const RectangleFormat& format = packet.format();
if (!format.has_encoding() ||
- format.encoding() == VideoPacketFormat::ENCODING_INVALID) {
+ format.encoding() == EncodingInvalid) {
LOG(WARNING) << "Invalid encoding specified.";
return false;
}
}
// We shouldn't generate null packets.
- if (!packet.has_data()) {
- LOG(WARNING) << "Packet w/o data received.";
+ if (!packet.has_encoded_rect()) {
+ LOG(WARNING) << "Packet w/o an encoded rectangle received.";
return false;
}
return true;
}
-void RectangleUpdateDecoder::InitializeDecoder(const VideoPacketFormat& format,
+void RectangleUpdateDecoder::InitializeDecoder(const RectangleFormat& format,
Task* done) {
if (message_loop_ != MessageLoop::current()) {
message_loop_->PostTask(
@@ -191,15 +192,12 @@ void RectangleUpdateDecoder::InitializeDecoder(const VideoPacketFormat& format,
CHECK(decoder_->Encoding() == format.encoding());
} else {
// Initialize a new decoder based on this message encoding.
- if (format.encoding() == VideoPacketFormat::ENCODING_VERBATIM) {
+ if (format.encoding() == EncodingNone) {
TraceContext::tracer()->PrintString("Creating Verbatim decoder.");
decoder_.reset(DecoderRowBased::CreateVerbatimDecoder());
- } else if (format.encoding() == VideoPacketFormat::ENCODING_ZLIB) {
+ } else if (format.encoding() == EncodingZlib) {
TraceContext::tracer()->PrintString("Creating Zlib decoder");
decoder_.reset(DecoderRowBased::CreateZlibDecoder());
- } else if (format.encoding() == VideoPacketFormat::ENCODING_VP8) {
- TraceContext::tracer()->PrintString("Creating VP8 decoder");
- decoder_.reset(new DecoderVp8());
} else {
NOTREACHED() << "Invalid Encoding found: " << format.encoding();
}