Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(497)

Unified Diff: remoting/protocol/audio_writer.cc

Issue 10535153: Added files for audio writers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Small cleanup Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/audio_writer.h ('k') | remoting/remoting.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « remoting/protocol/audio_writer.h ('k') | remoting/remoting.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698