| Index: remoting/protocol/audio_reader.cc
|
| diff --git a/remoting/protocol/protobuf_video_reader.cc b/remoting/protocol/audio_reader.cc
|
| similarity index 50%
|
| copy from remoting/protocol/protobuf_video_reader.cc
|
| copy to remoting/protocol/audio_reader.cc
|
| index 827a63f49262bd74ea55e66f200f0d38dbfd0fb2..31e34e426363d25689c8a572d090b14b24d220ca 100644
|
| --- a/remoting/protocol/protobuf_video_reader.cc
|
| +++ b/remoting/protocol/audio_reader.cc
|
| @@ -2,45 +2,45 @@
|
| // 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 "remoting/protocol/audio_reader.h"
|
|
|
| #include "base/bind.h"
|
| #include "net/socket/stream_socket.h"
|
| #include "remoting/base/constants.h"
|
| -#include "remoting/proto/video.pb.h"
|
| #include "remoting/protocol/session.h"
|
| +#include "remoting/protocol/session_config.h"
|
|
|
| namespace remoting {
|
| namespace protocol {
|
|
|
| -ProtobufVideoReader::ProtobufVideoReader(VideoPacketFormat::Encoding encoding)
|
| +AudioReader::AudioReader(AudioPacket::Encoding encoding)
|
| : session_(NULL),
|
| encoding_(encoding),
|
| - video_stub_(NULL) {
|
| + audio_stub_(NULL) {
|
| }
|
|
|
| -ProtobufVideoReader::~ProtobufVideoReader() {
|
| +AudioReader::~AudioReader() {
|
| if (session_)
|
| - session_->CancelChannelCreation(kVideoChannelName);
|
| + session_->CancelChannelCreation(kAudioChannelName);
|
| }
|
|
|
| -void ProtobufVideoReader::Init(protocol::Session* session,
|
| - VideoStub* video_stub,
|
| +void AudioReader::Init(protocol::Session* session,
|
| + AudioStub* audio_stub,
|
| const InitializedCallback& callback) {
|
| session_ = session;
|
| initialized_callback_ = callback;
|
| - video_stub_ = video_stub;
|
| + audio_stub_ = audio_stub;
|
|
|
| session_->CreateStreamChannel(
|
| - kVideoChannelName,
|
| - base::Bind(&ProtobufVideoReader::OnChannelReady, base::Unretained(this)));
|
| + kAudioChannelName,
|
| + base::Bind(&AudioReader::OnChannelReady, base::Unretained(this)));
|
| }
|
|
|
| -bool ProtobufVideoReader::is_connected() {
|
| +bool AudioReader::is_connected() {
|
| return channel_.get() != NULL;
|
| }
|
|
|
| -void ProtobufVideoReader::OnChannelReady(scoped_ptr<net::StreamSocket> socket) {
|
| +void AudioReader::OnChannelReady(scoped_ptr<net::StreamSocket> socket) {
|
| if (!socket.get()) {
|
| initialized_callback_.Run(false);
|
| return;
|
| @@ -48,14 +48,20 @@ void ProtobufVideoReader::OnChannelReady(scoped_ptr<net::StreamSocket> socket) {
|
|
|
| DCHECK(!channel_.get());
|
| channel_ = socket.Pass();
|
| - reader_.Init(channel_.get(), base::Bind(&ProtobufVideoReader::OnNewData,
|
| + reader_.Init(channel_.get(), base::Bind(&AudioReader::OnNewData,
|
| base::Unretained(this)));
|
| initialized_callback_.Run(true);
|
| }
|
|
|
| -void ProtobufVideoReader::OnNewData(scoped_ptr<VideoPacket> packet,
|
| +void AudioReader::OnNewData(scoped_ptr<AudioPacket> packet,
|
| const base::Closure& done_task) {
|
| - video_stub_->ProcessVideoPacket(packet.Pass(), done_task);
|
| + audio_stub_->ProcessAudioPacket(packet.Pass(), done_task);
|
| +}
|
| +
|
| +// static
|
| +AudioReader* AudioReader::Create(const SessionConfig& config) {
|
| + // TODO(kxing): Support different session configurations.
|
| + return new AudioReader(AudioPacket::ENCODING_RAW);
|
| }
|
|
|
| } // namespace protocol
|
|
|