| Index: remoting/protocol/protobuf_audio_writer.cc
|
| diff --git a/remoting/protocol/protobuf_video_writer.cc b/remoting/protocol/protobuf_audio_writer.cc
|
| similarity index 61%
|
| copy from remoting/protocol/protobuf_video_writer.cc
|
| copy to remoting/protocol/protobuf_audio_writer.cc
|
| index a0ca271d21ec3383ee2f2698a7c892fcce8dca2b..a277a01a656bda8e22ba6b1f2f3ccff26fec58f4 100644
|
| --- a/remoting/protocol/protobuf_video_writer.cc
|
| +++ b/remoting/protocol/protobuf_audio_writer.cc
|
| @@ -2,37 +2,37 @@
|
| // 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_writer.h"
|
| +#include "remoting/protocol/protobuf_audio_writer.h"
|
|
|
| #include "base/bind.h"
|
| #include "net/socket/stream_socket.h"
|
| #include "remoting/base/constants.h"
|
| -#include "remoting/proto/video.pb.h"
|
| +#include "remoting/proto/audio.pb.h"
|
| #include "remoting/protocol/session.h"
|
| #include "remoting/protocol/util.h"
|
|
|
| namespace remoting {
|
| namespace protocol {
|
|
|
| -ProtobufVideoWriter::ProtobufVideoWriter()
|
| +ProtobufAudioWriter::ProtobufAudioWriter()
|
| : session_(NULL) {
|
| }
|
|
|
| -ProtobufVideoWriter::~ProtobufVideoWriter() {
|
| +ProtobufAudioWriter::~ProtobufAudioWriter() {
|
| Close();
|
| }
|
|
|
| -void ProtobufVideoWriter::Init(protocol::Session* session,
|
| +void ProtobufAudioWriter::Init(protocol::Session* session,
|
| const InitializedCallback& callback) {
|
| session_ = session;
|
| initialized_callback_ = callback;
|
|
|
| session_->CreateStreamChannel(
|
| - kVideoChannelName,
|
| - base::Bind(&ProtobufVideoWriter::OnChannelReady, base::Unretained(this)));
|
| + kAudioChannelName,
|
| + base::Bind(&ProtobufAudioWriter::OnChannelReady, base::Unretained(this)));
|
| }
|
|
|
| -void ProtobufVideoWriter::OnChannelReady(scoped_ptr<net::StreamSocket> socket) {
|
| +void ProtobufAudioWriter::OnChannelReady(scoped_ptr<net::StreamSocket> socket) {
|
| if (!socket.get()) {
|
| initialized_callback_.Run(false);
|
| return;
|
| @@ -40,34 +40,30 @@ void ProtobufVideoWriter::OnChannelReady(scoped_ptr<net::StreamSocket> socket) {
|
|
|
| DCHECK(!channel_.get());
|
| channel_ = socket.Pass();
|
| - // TODO(sergeyu): Provide WriteFailedCallback for the buffered writer.
|
| + // TODO(kxing): Provide WriteFailedCallback for the buffered writer.
|
| buffered_writer_.Init(
|
| channel_.get(), BufferedSocketWriter::WriteFailedCallback());
|
|
|
| initialized_callback_.Run(true);
|
| }
|
|
|
| -void ProtobufVideoWriter::Close() {
|
| +void ProtobufAudioWriter::Close() {
|
| buffered_writer_.Close();
|
| channel_.reset();
|
| if (session_) {
|
| - session_->CancelChannelCreation(kVideoChannelName);
|
| + session_->CancelChannelCreation(kAudioChannelName);
|
| session_ = NULL;
|
| }
|
| }
|
|
|
| -bool ProtobufVideoWriter::is_connected() {
|
| +bool ProtobufAudioWriter::is_connected() {
|
| return channel_.get() != NULL;
|
| }
|
|
|
| -void ProtobufVideoWriter::ProcessVideoPacket(scoped_ptr<VideoPacket> packet,
|
| +void ProtobufAudioWriter::ProcessAudioPacket(scoped_ptr<AudioPacket> packet,
|
| const base::Closure& done) {
|
| buffered_writer_.Write(SerializeAndFrameMessage(*packet), done);
|
| }
|
|
|
| -int ProtobufVideoWriter::GetPendingPackets() {
|
| - return buffered_writer_.GetBufferChunks();
|
| -}
|
| -
|
| } // namespace protocol
|
| } // namespace remoting
|
|
|