| Index: remoting/protocol/audio_writer.cc
|
| diff --git a/remoting/protocol/protobuf_video_writer.cc b/remoting/protocol/audio_writer.cc
|
| similarity index 62%
|
| copy from remoting/protocol/protobuf_video_writer.cc
|
| copy to remoting/protocol/audio_writer.cc
|
| index a0ca271d21ec3383ee2f2698a7c892fcce8dca2b..dc8a939e587078dc89e9f90bda6ec2a26931a189 100644
|
| --- a/remoting/protocol/protobuf_video_writer.cc
|
| +++ b/remoting/protocol/audio_writer.cc
|
| @@ -2,37 +2,38 @@
|
| // 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/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/session_config.h"
|
| #include "remoting/protocol/util.h"
|
|
|
| namespace remoting {
|
| namespace protocol {
|
|
|
| -ProtobufVideoWriter::ProtobufVideoWriter()
|
| +AudioWriter::AudioWriter()
|
| : session_(NULL) {
|
| }
|
|
|
| -ProtobufVideoWriter::~ProtobufVideoWriter() {
|
| +AudioWriter::~AudioWriter() {
|
| Close();
|
| }
|
|
|
| -void ProtobufVideoWriter::Init(protocol::Session* session,
|
| +void AudioWriter::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(&AudioWriter::OnChannelReady, base::Unretained(this)));
|
| }
|
|
|
| -void ProtobufVideoWriter::OnChannelReady(scoped_ptr<net::StreamSocket> socket) {
|
| +void AudioWriter::OnChannelReady(scoped_ptr<net::StreamSocket> socket) {
|
| if (!socket.get()) {
|
| initialized_callback_.Run(false);
|
| return;
|
| @@ -47,26 +48,28 @@ void ProtobufVideoWriter::OnChannelReady(scoped_ptr<net::StreamSocket> socket) {
|
| initialized_callback_.Run(true);
|
| }
|
|
|
| -void ProtobufVideoWriter::Close() {
|
| +void AudioWriter::Close() {
|
| buffered_writer_.Close();
|
| channel_.reset();
|
| if (session_) {
|
| - session_->CancelChannelCreation(kVideoChannelName);
|
| + session_->CancelChannelCreation(kAudioChannelName);
|
| session_ = NULL;
|
| }
|
| }
|
|
|
| -bool ProtobufVideoWriter::is_connected() {
|
| +bool AudioWriter::is_connected() {
|
| return channel_.get() != NULL;
|
| }
|
|
|
| -void ProtobufVideoWriter::ProcessVideoPacket(scoped_ptr<VideoPacket> packet,
|
| +void AudioWriter::ProcessAudioPacket(scoped_ptr<AudioPacket> packet,
|
| const base::Closure& done) {
|
| buffered_writer_.Write(SerializeAndFrameMessage(*packet), done);
|
| }
|
|
|
| -int ProtobufVideoWriter::GetPendingPackets() {
|
| - return buffered_writer_.GetBufferChunks();
|
| +// static
|
| +AudioWriter* AudioWriter::Create(const SessionConfig& config) {
|
| + // TODO(kxing): Support different session configurations.
|
| + return new AudioWriter();
|
| }
|
|
|
| } // namespace protocol
|
|
|