summaryrefslogtreecommitdiffstats
path: root/remoting/protocol/protobuf_video_reader.cc
blob: 02e06f8368b21cd07a4008acb3670f598a6e9a89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "remoting/protocol/protobuf_video_reader.h"

#include "base/task.h"
#include "remoting/proto/video.pb.h"
#include "remoting/protocol/session.h"

namespace remoting {
namespace protocol {

ProtobufVideoReader::ProtobufVideoReader(VideoPacketFormat::Encoding encoding)
    : encoding_(encoding) {
}

ProtobufVideoReader::~ProtobufVideoReader() { }

void ProtobufVideoReader::Init(protocol::Session* session,
                               VideoStub* video_stub) {
  reader_.Init(
      session->video_channel(),
      NewCallback(this, &ProtobufVideoReader::OnNewData));
  video_stub_ = video_stub;
}

void ProtobufVideoReader::OnNewData(VideoPacket* packet) {
  video_stub_->ProcessVideoPacket(packet, new DeleteTask<VideoPacket>(packet));
}

}  // namespace protocol
}  // namespace remoting