summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--remoting/base/constants.cc4
-rw-r--r--remoting/base/constants.h5
-rw-r--r--remoting/protocol/buffered_socket_writer.h3
-rw-r--r--remoting/protocol/connection_to_client.cc25
-rw-r--r--remoting/protocol/connection_to_client.h5
-rw-r--r--remoting/protocol/connection_to_client_unittest.cc5
-rw-r--r--remoting/protocol/connection_to_host.cc23
-rw-r--r--remoting/protocol/connection_to_host.h5
-rw-r--r--remoting/protocol/fake_session.cc95
-rw-r--r--remoting/protocol/fake_session.h41
-rw-r--r--remoting/protocol/jingle_session.cc25
-rw-r--r--remoting/protocol/jingle_session.h4
-rw-r--r--remoting/protocol/jingle_session_unittest.cc172
-rw-r--r--remoting/protocol/protobuf_video_reader.cc28
-rw-r--r--remoting/protocol/protobuf_video_reader.h17
-rw-r--r--remoting/protocol/protobuf_video_writer.cc30
-rw-r--r--remoting/protocol/protobuf_video_writer.h17
-rw-r--r--remoting/protocol/rtp_video_reader.cc49
-rw-r--r--remoting/protocol/rtp_video_reader.h15
-rw-r--r--remoting/protocol/rtp_video_reader_unittest.cc9
-rw-r--r--remoting/protocol/rtp_video_writer.cc46
-rw-r--r--remoting/protocol/rtp_video_writer.h11
-rw-r--r--remoting/protocol/rtp_video_writer_unittest.cc12
-rw-r--r--remoting/protocol/session.h3
-rw-r--r--remoting/protocol/video_reader.h9
-rw-r--r--remoting/protocol/video_writer.h9
-rw-r--r--tools/valgrind/gtest_exclude/remoting_unittests.gtest-drmemory_win32.txt6
-rw-r--r--tools/valgrind/gtest_exclude/remoting_unittests.gtest-tsan.txt6
-rw-r--r--tools/valgrind/gtest_exclude/remoting_unittests.gtest-tsan_win32.txt6
29 files changed, 189 insertions, 496 deletions
diff --git a/remoting/base/constants.cc b/remoting/base/constants.cc
index 90ea755..219fe14 100644
--- a/remoting/base/constants.cc
+++ b/remoting/base/constants.cc
@@ -12,8 +12,4 @@ const char kChromotingTokenDefaultServiceName[] = "chromiumsync";
const char kChromotingXmlNamespace[] = "google:remoting";
-const char kVideoChannelName[] = "video";
-const char kVideoRtpChannelName[] = "videortp";
-const char kVideoRtcpChannelName[] = "videortpc";
-
} // namespace remoting
diff --git a/remoting/base/constants.h b/remoting/base/constants.h
index 6efa408..d464fa4 100644
--- a/remoting/base/constants.h
+++ b/remoting/base/constants.h
@@ -17,11 +17,6 @@ extern const char kChromotingTokenDefaultServiceName[];
// Namespace used for chromoting XMPP stanzas.
extern const char kChromotingXmlNamespace[];
-// Channel names.
-extern const char kVideoChannelName[];
-extern const char kVideoRtpChannelName[];
-extern const char kVideoRtcpChannelName[];
-
} // namespace remoting
#endif // REMOTING_BASE_CONSTANTS_H_
diff --git a/remoting/protocol/buffered_socket_writer.h b/remoting/protocol/buffered_socket_writer.h
index 3bb03d3..46a3a7e 100644
--- a/remoting/protocol/buffered_socket_writer.h
+++ b/remoting/protocol/buffered_socket_writer.h
@@ -41,8 +41,7 @@ class BufferedSocketWriterBase
// Initializes the writer. Must be called on the thread that will be used
// to access the socket in the future. |callback| will be called after each
- // failed write. Caller retains ownership of |socket|.
- // TODO(sergeyu): Change it so that it take ownership of |socket|.
+ // failed write.
void Init(net::Socket* socket, WriteFailedCallback* callback);
// Puts a new data chunk in the buffer. Returns false and doesn't enqueue
diff --git a/remoting/protocol/connection_to_client.cc b/remoting/protocol/connection_to_client.cc
index f61aded..f5cf592e 100644
--- a/remoting/protocol/connection_to_client.cc
+++ b/remoting/protocol/connection_to_client.cc
@@ -4,7 +4,6 @@
#include "remoting/protocol/connection_to_client.h"
-#include "base/bind.h"
#include "google/protobuf/message.h"
#include "net/base/io_buffer.h"
#include "remoting/protocol/client_control_sender.h"
@@ -97,18 +96,20 @@ void ConnectionToClient::OnSessionStateChange(protocol::Session::State state) {
client_control_sender_.reset(
new ClientControlSender(session_->control_channel()));
video_writer_.reset(VideoWriter::Create(session_->config()));
- video_writer_->Init(
- session_.get(), base::Bind(&ConnectionToClient::OnVideoInitialized,
- base::Unretained(this)));
+ video_writer_->Init(session_.get());
+
dispatcher_.reset(new HostMessageDispatcher());
dispatcher_->Initialize(this, host_stub_, input_stub_);
+
+ handler_->OnConnectionOpened(this);
break;
case protocol::Session::CLOSED:
CloseChannels();
handler_->OnConnectionClosed(this);
break;
case protocol::Session::FAILED:
- CloseOnError();
+ CloseChannels();
+ handler_->OnConnectionFailed(this);
break;
default:
// We shouldn't receive other states.
@@ -116,20 +117,6 @@ void ConnectionToClient::OnSessionStateChange(protocol::Session::State state) {
}
}
-void ConnectionToClient::OnVideoInitialized(bool successful) {
- if (!successful) {
- CloseOnError();
- return;
- }
-
- handler_->OnConnectionOpened(this);
-}
-
-void ConnectionToClient::CloseOnError() {
- CloseChannels();
- handler_->OnConnectionFailed(this);
-}
-
void ConnectionToClient::CloseChannels() {
if (video_writer_.get())
video_writer_->Close();
diff --git a/remoting/protocol/connection_to_client.h b/remoting/protocol/connection_to_client.h
index 9d7e25f..296ce63 100644
--- a/remoting/protocol/connection_to_client.h
+++ b/remoting/protocol/connection_to_client.h
@@ -90,11 +90,6 @@ class ConnectionToClient :
// Callback for protocol Session.
void OnSessionStateChange(Session::State state);
- // Callback for VideoReader::Init().
- void OnVideoInitialized(bool successful);
-
- void CloseOnError();
-
// Stops writing in the channels.
void CloseChannels();
diff --git a/remoting/protocol/connection_to_client_unittest.cc b/remoting/protocol/connection_to_client_unittest.cc
index 8a8e1e8..3609511 100644
--- a/remoting/protocol/connection_to_client_unittest.cc
+++ b/remoting/protocol/connection_to_client_unittest.cc
@@ -4,7 +4,6 @@
#include "base/message_loop.h"
#include "remoting/base/base_mock_objects.h"
-#include "remoting/base/constants.h"
#include "remoting/protocol/fake_session.h"
#include "remoting/protocol/connection_to_client.h"
#include "remoting/protocol/protocol_mock_objects.h"
@@ -61,9 +60,7 @@ TEST_F(ConnectionToClientTest, SendUpdateStream) {
// Verify that something has been written.
// TODO(sergeyu): Verify that the correct data has been written.
- ASSERT_TRUE(session_->GetStreamChannel(kVideoChannelName));
- EXPECT_GT(session_->GetStreamChannel(kVideoChannelName)->
- written_data().size(), 0u);
+ EXPECT_GT(session_->video_channel()->written_data().size(), 0u);
// And then close the connection to ConnectionToClient.
viewer_->Disconnect();
diff --git a/remoting/protocol/connection_to_host.cc b/remoting/protocol/connection_to_host.cc
index f00deed..26dca8b 100644
--- a/remoting/protocol/connection_to_host.cc
+++ b/remoting/protocol/connection_to_host.cc
@@ -176,7 +176,8 @@ void ConnectionToHost::OnSessionStateChange(
switch (state) {
case Session::FAILED:
state_ = STATE_FAILED;
- CloseOnError();
+ CloseChannels();
+ event_callback_->OnConnectionFailed(this);
break;
case Session::CLOSED:
@@ -189,10 +190,7 @@ void ConnectionToHost::OnSessionStateChange(
state_ = STATE_CONNECTED;
// Initialize reader and writer.
video_reader_.reset(VideoReader::Create(session_->config()));
- video_reader_->Init(
- session_.get(), video_stub_,
- base::Bind(&ConnectionToHost::OnVideoChannelInitialized,
- base::Unretained(this)));
+ video_reader_->Init(session_.get(), video_stub_);
host_control_sender_.reset(
new HostControlSender(session_->control_channel()));
dispatcher_->Initialize(session_.get(), client_stub_);
@@ -205,27 +203,12 @@ void ConnectionToHost::OnSessionStateChange(
}
}
-void ConnectionToHost::OnVideoChannelInitialized(bool successful) {
- if (!successful) {
- CloseOnError();
- return;
- }
-}
-
-void ConnectionToHost::CloseOnError() {
- state_ = STATE_FAILED;
- CloseChannels();
- event_callback_->OnConnectionFailed(this);
-}
-
void ConnectionToHost::CloseChannels() {
if (input_sender_.get())
input_sender_->Close();
if (host_control_sender_.get())
host_control_sender_->Close();
-
- video_reader_.reset();
}
void ConnectionToHost::OnClientAuthenticated() {
diff --git a/remoting/protocol/connection_to_host.h b/remoting/protocol/connection_to_host.h
index 65a4738..29bbb54 100644
--- a/remoting/protocol/connection_to_host.h
+++ b/remoting/protocol/connection_to_host.h
@@ -124,14 +124,9 @@ class ConnectionToHost : public SignalStrategy::StatusObserver,
// Callback for |session_|.
void OnSessionStateChange(Session::State state);
- // Callback for VideoReader::Init().
- void OnVideoChannelInitialized(bool successful);
-
// Callback for |video_reader_|.
void OnVideoPacket(VideoPacket* packet);
- void CloseOnError();
-
// Stops writing in the channels.
void CloseChannels();
diff --git a/remoting/protocol/fake_session.cc b/remoting/protocol/fake_session.cc
index a2496a7..b23dbb1 100644
--- a/remoting/protocol/fake_session.cc
+++ b/remoting/protocol/fake_session.cc
@@ -70,67 +70,6 @@ bool FakeSocket::SetSendBufferSize(int32 size) {
return false;
}
-int FakeSocket::Connect(net::CompletionCallback* callback) {
- return net::OK;
-}
-
-void FakeSocket::Disconnect() {
- NOTIMPLEMENTED();
-}
-
-bool FakeSocket::IsConnected() const {
- return true;
-}
-
-bool FakeSocket::IsConnectedAndIdle() const {
- NOTIMPLEMENTED();
- return false;
-}
-
-int FakeSocket::GetPeerAddress(
- net::AddressList* address) const {
- NOTIMPLEMENTED();
- return net::ERR_FAILED;
-}
-
-int FakeSocket::GetLocalAddress(
- net::IPEndPoint* address) const {
- NOTIMPLEMENTED();
- return net::ERR_FAILED;
-}
-
-const net::BoundNetLog& FakeSocket::NetLog() const {
- return net_log_;
-}
-
-void FakeSocket::SetSubresourceSpeculation() {
- NOTIMPLEMENTED();
-}
-
-void FakeSocket::SetOmniboxSpeculation() {
- NOTIMPLEMENTED();
-}
-
-bool FakeSocket::WasEverUsed() const {
- NOTIMPLEMENTED();
- return true;
-}
-
-bool FakeSocket::UsingTCPFastOpen() const {
- NOTIMPLEMENTED();
- return true;
-}
-
-int64 FakeSocket::NumBytesRead() const {
- NOTIMPLEMENTED();
- return 0;
-}
-
-base::TimeDelta FakeSocket::GetConnectTimeMicros() const {
- NOTIMPLEMENTED();
- return base::TimeDelta();
-}
-
FakeUdpSocket::FakeUdpSocket()
: read_pending_(false),
input_pos_(0) {
@@ -196,31 +135,21 @@ FakeSession::FakeSession()
FakeSession::~FakeSession() { }
-FakeSocket* FakeSession::GetStreamChannel(const std::string& name) {
- return stream_channels_[name];
-}
-
-FakeUdpSocket* FakeSession::GetDatagramChannel(const std::string& name) {
- return datagram_channels_[name];
-}
-
-void FakeSession::SetStateChangeCallback(StateChangeCallback* callback) {
+void FakeSession::SetStateChangeCallback(
+ StateChangeCallback* callback) {
callback_.reset(callback);
}
void FakeSession::CreateStreamChannel(
const std::string& name, const StreamChannelCallback& callback) {
- LOG(ERROR) << " creating channel " << name;
- FakeSocket* channel = new FakeSocket();
- stream_channels_[name] = channel;
- callback.Run(name, channel);
+ NOTIMPLEMENTED();
+ callback.Run(name, NULL);
}
void FakeSession::CreateDatagramChannel(
const std::string& name, const DatagramChannelCallback& callback) {
- FakeUdpSocket* channel = new FakeUdpSocket();
- datagram_channels_[name] = channel;
- callback.Run(name, channel);
+ NOTIMPLEMENTED();
+ callback.Run(name, NULL);
}
FakeSocket* FakeSession::control_channel() {
@@ -231,6 +160,18 @@ FakeSocket* FakeSession::event_channel() {
return &event_channel_;
}
+FakeSocket* FakeSession::video_channel() {
+ return &video_channel_;
+}
+
+FakeUdpSocket* FakeSession::video_rtp_channel() {
+ return &video_rtp_channel_;
+}
+
+FakeUdpSocket* FakeSession::video_rtcp_channel() {
+ return &video_rtcp_channel_;
+}
+
const std::string& FakeSession::jid() {
return jid_;
}
diff --git a/remoting/protocol/fake_session.h b/remoting/protocol/fake_session.h
index f0d5828..912cfb0 100644
--- a/remoting/protocol/fake_session.h
+++ b/remoting/protocol/fake_session.h
@@ -5,13 +5,11 @@
#ifndef REMOTING_PROTOCOL_FAKE_SESSION_H_
#define REMOTING_PROTOCOL_FAKE_SESSION_H_
-#include <map>
#include <string>
#include <vector>
#include "base/memory/scoped_ptr.h"
#include "net/socket/socket.h"
-#include "net/socket/stream_socket.h"
#include "remoting/protocol/session.h"
namespace remoting {
@@ -24,7 +22,7 @@ extern const char kTestJid[];
// Read() reads data from another buffer that can be set with AppendInputData().
// Pending reads are supported, so if there is a pending read AppendInputData()
// calls the read callback.
-class FakeSocket : public net::StreamSocket {
+class FakeSocket : public net::Socket {
public:
FakeSocket();
virtual ~FakeSocket();
@@ -44,21 +42,6 @@ class FakeSocket : public net::StreamSocket {
virtual bool SetReceiveBufferSize(int32 size);
virtual bool SetSendBufferSize(int32 size);
- // net::StreamSocket interface.
- virtual int Connect(net::CompletionCallback* callback) OVERRIDE;
- virtual void Disconnect() OVERRIDE;
- virtual bool IsConnected() const OVERRIDE;
- virtual bool IsConnectedAndIdle() const OVERRIDE;
- virtual int GetPeerAddress(net::AddressList* address) const OVERRIDE;
- virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE;
- virtual const net::BoundNetLog& NetLog() const OVERRIDE;
- virtual void SetSubresourceSpeculation() OVERRIDE;
- virtual void SetOmniboxSpeculation() OVERRIDE;
- virtual bool WasEverUsed() const OVERRIDE;
- virtual bool UsingTCPFastOpen() const OVERRIDE;
- virtual int64 NumBytesRead() const OVERRIDE;
- virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE;
-
private:
bool read_pending_;
scoped_refptr<net::IOBuffer> read_buffer_;
@@ -68,10 +51,6 @@ class FakeSocket : public net::StreamSocket {
std::string written_data_;
std::string input_data_;
int input_pos_;
-
- net::BoundNetLog net_log_;
-
- DISALLOW_COPY_AND_ASSIGN(FakeSocket);
};
// FakeUdpSocket is similar to FakeSocket but behaves as UDP socket. All written
@@ -107,8 +86,6 @@ class FakeUdpSocket : public net::Socket {
std::vector<std::string> written_packets_;
std::vector<std::string> input_packets_;
int input_pos_;
-
- DISALLOW_COPY_AND_ASSIGN(FakeUdpSocket);
};
// FakeSession is a dummy protocol::Session that uses FakeSocket for all
@@ -126,10 +103,6 @@ class FakeSession : public Session {
bool is_closed() const { return closed_; }
- FakeSocket* GetStreamChannel(const std::string& name);
- FakeUdpSocket* GetDatagramChannel(const std::string& name);
-
- // Session interface.
virtual void SetStateChangeCallback(StateChangeCallback* callback);
virtual void CreateStreamChannel(
@@ -139,6 +112,10 @@ class FakeSession : public Session {
virtual FakeSocket* control_channel();
virtual FakeSocket* event_channel();
+ virtual FakeSocket* video_channel();
+
+ virtual FakeUdpSocket* video_rtp_channel();
+ virtual FakeUdpSocket* video_rtcp_channel();
virtual const std::string& jid();
@@ -163,9 +140,9 @@ class FakeSession : public Session {
MessageLoop* message_loop_;
FakeSocket control_channel_;
FakeSocket event_channel_;
-
- std::map<std::string, FakeSocket*> stream_channels_;
- std::map<std::string, FakeUdpSocket*> datagram_channels_;
+ FakeSocket video_channel_;
+ FakeUdpSocket video_rtp_channel_;
+ FakeUdpSocket video_rtcp_channel_;
std::string initiator_token_;
std::string receiver_token_;
@@ -174,8 +151,6 @@ class FakeSession : public Session {
std::string jid_;
bool closed_;
-
- DISALLOW_COPY_AND_ASSIGN(FakeSession);
};
} // namespace protocol
diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc
index 7980de4..0fa7ccb 100644
--- a/remoting/protocol/jingle_session.cc
+++ b/remoting/protocol/jingle_session.cc
@@ -33,6 +33,7 @@ namespace {
const char kControlChannelName[] = "control";
const char kEventChannelName[] = "event";
+const char kVideoChannelName[] = "video";
const int kMasterKeyLength = 16;
const int kChannelKeyLength = 16;
@@ -159,6 +160,7 @@ void JingleSession::CloseInternal(int result, bool failed) {
control_channel_socket_.reset();
event_channel_socket_.reset();
+ video_channel_socket_.reset();
STLDeleteContainerPairSecondPointers(channel_connectors_.begin(),
channel_connectors_.end());
@@ -222,6 +224,23 @@ net::Socket* JingleSession::event_channel() {
return event_channel_socket_.get();
}
+net::Socket* JingleSession::video_channel() {
+ DCHECK(CalledOnValidThread());
+ return video_channel_socket_.get();
+}
+
+net::Socket* JingleSession::video_rtp_channel() {
+ DCHECK(CalledOnValidThread());
+ NOTREACHED();
+ return NULL;
+}
+
+net::Socket* JingleSession::video_rtcp_channel() {
+ DCHECK(CalledOnValidThread());
+ NOTREACHED();
+ return NULL;
+}
+
const std::string& JingleSession::jid() {
// TODO(sergeyu): Fix ChromotingHost so that it doesn't call this
// method on invalid thread and uncomment this DCHECK.
@@ -493,6 +512,7 @@ void JingleSession::CreateChannels() {
base::Unretained(this)));
CreateStreamChannel(kControlChannelName, stream_callback);
CreateStreamChannel(kEventChannelName, stream_callback);
+ CreateStreamChannel(kVideoChannelName, stream_callback);
}
void JingleSession::OnStreamChannelConnected(const std::string& name,
@@ -513,11 +533,14 @@ void JingleSession::OnChannelConnected(const std::string& name,
control_channel_socket_.reset(socket);
} else if (name == kEventChannelName) {
event_channel_socket_.reset(socket);
+ } else if (name == kVideoChannelName) {
+ video_channel_socket_.reset(socket);
} else {
NOTREACHED();
}
- if (control_channel_socket_.get() && event_channel_socket_.get()) {
+ if (control_channel_socket_.get() && event_channel_socket_.get() &&
+ video_channel_socket_.get()) {
// TODO(sergeyu): State should be set to CONNECTED in OnAccept
// independent of the channels state.
SetState(CONNECTED);
diff --git a/remoting/protocol/jingle_session.h b/remoting/protocol/jingle_session.h
index 7ac6fac..6cb15f2 100644
--- a/remoting/protocol/jingle_session.h
+++ b/remoting/protocol/jingle_session.h
@@ -38,6 +38,9 @@ class JingleSession : public protocol::Session,
const DatagramChannelCallback& callback) OVERRIDE;
virtual net::Socket* control_channel() OVERRIDE;
virtual net::Socket* event_channel() OVERRIDE;
+ virtual net::Socket* video_channel() OVERRIDE;
+ virtual net::Socket* video_rtp_channel() OVERRIDE;
+ virtual net::Socket* video_rtcp_channel() OVERRIDE;
virtual const std::string& jid() OVERRIDE;
virtual const CandidateSessionConfig* candidate_config() OVERRIDE;
virtual const SessionConfig* config() OVERRIDE;
@@ -182,6 +185,7 @@ class JingleSession : public protocol::Session,
scoped_ptr<net::Socket> control_channel_socket_;
scoped_ptr<net::Socket> event_channel_socket_;
+ scoped_ptr<net::Socket> video_channel_socket_;
ScopedRunnableMethodFactory<JingleSession> task_factory_;
diff --git a/remoting/protocol/jingle_session_unittest.cc b/remoting/protocol/jingle_session_unittest.cc
index 49f686d..1d09521 100644
--- a/remoting/protocol/jingle_session_unittest.cc
+++ b/remoting/protocol/jingle_session_unittest.cc
@@ -13,7 +13,6 @@
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/socket/socket.h"
-#include "net/socket/stream_socket.h"
#include "remoting/protocol/jingle_session.h"
#include "remoting/protocol/jingle_session_manager.h"
#include "remoting/jingle_glue/jingle_thread.h"
@@ -54,7 +53,6 @@ const int kMessages = 100;
const int kTestDataSize = kMessages * kMessageSize;
const int kUdpWriteDelayMs = 10;
const char kTestToken[] = "a_dummy_token";
-const char kChannelName[] = "test_channel";
const char kHostJid[] = "host1@gmail.com/123";
const char kClientJid[] = "host2@gmail.com/321";
@@ -294,6 +292,14 @@ class JingleSessionTest : public testing::Test {
class ChannelTesterBase : public base::RefCountedThreadSafe<ChannelTesterBase> {
public:
+ enum ChannelType {
+ CONTROL,
+ EVENT,
+ VIDEO,
+ VIDEO_RTP,
+ VIDEO_RTCP,
+ };
+
ChannelTesterBase(Session* host_session,
Session* client_session)
: host_session_(host_session),
@@ -303,9 +309,10 @@ class ChannelTesterBase : public base::RefCountedThreadSafe<ChannelTesterBase> {
virtual ~ChannelTesterBase() { }
- void Start() {
+ void Start(ChannelType channel) {
MessageLoop::current()->PostTask(
- FROM_HERE, NewRunnableMethod(this, &ChannelTesterBase::DoStart));
+ FROM_HERE, NewRunnableMethod(this, &ChannelTesterBase::DoStart,
+ channel));
}
bool WaitFinished() {
@@ -315,11 +322,14 @@ class ChannelTesterBase : public base::RefCountedThreadSafe<ChannelTesterBase> {
virtual void CheckResults() = 0;
protected:
- void DoStart() {
- InitChannels();
- }
+ void DoStart(ChannelType channel) {
+ socket_1_ = SelectChannel(host_session_, channel);
+ socket_2_ = SelectChannel(client_session_, channel);
- virtual void InitChannels() = 0;
+ InitBuffers();
+ DoRead();
+ DoWrite();
+ }
void Done() {
done_ = true;
@@ -330,9 +340,29 @@ class ChannelTesterBase : public base::RefCountedThreadSafe<ChannelTesterBase> {
virtual void DoWrite() = 0;
virtual void DoRead() = 0;
+ net::Socket* SelectChannel(Session* session,
+ ChannelType channel) {
+ switch (channel) {
+ case CONTROL:
+ return session->control_channel();
+ case EVENT:
+ return session->event_channel();
+ case VIDEO:
+ return session->video_channel();
+ case VIDEO_RTP:
+ return session->video_rtp_channel();
+ case VIDEO_RTCP:
+ return session->video_rtcp_channel();
+ default:
+ NOTREACHED();
+ return NULL;
+ }
+ }
+
Session* host_session_;
Session* client_session_;
- scoped_ptr<net::Socket> sockets_[2];
+ net::Socket* socket_1_;
+ net::Socket* socket_2_;
bool done_;
};
@@ -370,36 +400,6 @@ class TCPChannelTester : public ChannelTesterBase {
}
protected:
- virtual void InitChannels() OVERRIDE {
- host_session_->CreateStreamChannel(
- kChannelName,
- base::Bind(&TCPChannelTester::OnChannelReady,
- base::Unretained(this), 0));
- client_session_->CreateStreamChannel(
- kChannelName,
- base::Bind(&TCPChannelTester::OnChannelReady,
- base::Unretained(this), 1));
- }
-
- void OnChannelReady(int id, const std::string name,
- net::StreamSocket* socket) {
- ASSERT_TRUE(socket);
- ASSERT_EQ(name, kChannelName);
- if (!socket) {
- Done();
- return;
- }
-
- DCHECK(id >= 0 && id < 2);
- sockets_[id].reset(socket);
-
- if (sockets_[0].get() && sockets_[1].get()) {
- InitBuffers();
- DoRead();
- DoWrite();
- }
- }
-
virtual void InitBuffers() {
output_buffer_ = new net::DrainableIOBuffer(
new net::IOBuffer(test_data_size_), test_data_size_);
@@ -415,7 +415,7 @@ class TCPChannelTester : public ChannelTesterBase {
break;
int bytes_to_write = std::min(output_buffer_->BytesRemaining(),
message_size_);
- result = sockets_[0]->Write(output_buffer_, bytes_to_write, &write_cb_);
+ result = socket_1_->Write(output_buffer_, bytes_to_write, &write_cb_);
HandleWriteResult(result);
};
}
@@ -439,7 +439,7 @@ class TCPChannelTester : public ChannelTesterBase {
int result = 1;
while (result > 0) {
input_buffer_->SetCapacity(input_buffer_->offset() + message_size_);
- result = sockets_[1]->Read(input_buffer_, message_size_, &read_cb_);
+ result = socket_2_->Read(input_buffer_, message_size_, &read_cb_);
HandleReadResult(result);
};
}
@@ -536,36 +536,6 @@ class UDPChannelTester : public ChannelTesterBase {
}
protected:
- virtual void InitChannels() OVERRIDE {
- host_session_->CreateDatagramChannel(
- kChannelName,
- base::Bind(&UDPChannelTester::OnChannelReady,
- base::Unretained(this), 0));
- client_session_->CreateDatagramChannel(
- kChannelName,
- base::Bind(&UDPChannelTester::OnChannelReady,
- base::Unretained(this), 1));
- }
-
- void OnChannelReady(int id, const std::string name, net::Socket* socket) {
- ASSERT_TRUE(socket);
- ASSERT_EQ(name, kChannelName);
- if (!socket) {
- Done();
- return;
- }
-
- DCHECK(id >= 0 && id < 2);
- sockets_[id].reset(socket);
-
- if (sockets_[0].get() && sockets_[1].get()) {
- InitBuffers();
- DoRead();
- DoWrite();
- }
- }
-
-
virtual void InitBuffers() {
}
@@ -581,7 +551,7 @@ class UDPChannelTester : public ChannelTesterBase {
// Put index of this packet in the beginning of the packet body.
memcpy(packet->data(), &packets_sent_, sizeof(packets_sent_));
- int result = sockets_[0]->Write(packet, kMessageSize, &write_cb_);
+ int result = socket_1_->Write(packet, kMessageSize, &write_cb_);
HandleWriteResult(result);
}
@@ -609,7 +579,7 @@ class UDPChannelTester : public ChannelTesterBase {
int kReadSize = kMessageSize * 2;
read_buffer_ = new net::IOBuffer(kReadSize);
- result = sockets_[1]->Read(read_buffer_, kReadSize, &read_cb_);
+ result = socket_2_->Read(read_buffer_, kReadSize, &read_cb_);
HandleReadResult(result);
};
}
@@ -708,13 +678,43 @@ TEST_F(JingleSessionTest, ConnectBadChannelAuth) {
}
// Verify that data can be transmitted over the event channel.
-TEST_F(JingleSessionTest, TestTcpChannel) {
+TEST_F(JingleSessionTest, TestControlChannel) {
CreateServerPair();
ASSERT_TRUE(InitiateConnection(kTestSharedSecret));
scoped_refptr<TCPChannelTester> tester(
new TCPChannelTester(host_session_.get(), client_session_.get(),
kMessageSize, kMessages));
- tester->Start();
+ tester->Start(ChannelTesterBase::CONTROL);
+ ASSERT_TRUE(tester->WaitFinished());
+ tester->CheckResults();
+
+ // Connections must be closed while |tester| still exists.
+ CloseSessions();
+}
+
+// Verify that data can be transmitted over the video channel.
+TEST_F(JingleSessionTest, TestVideoChannel) {
+ CreateServerPair();
+ ASSERT_TRUE(InitiateConnection(kTestSharedSecret));
+ scoped_refptr<TCPChannelTester> tester(
+ new TCPChannelTester(host_session_.get(), client_session_.get(),
+ kMessageSize, kMessageSize));
+ tester->Start(ChannelTesterBase::VIDEO);
+ ASSERT_TRUE(tester->WaitFinished());
+ tester->CheckResults();
+
+ // Connections must be closed while |tester| still exists.
+ CloseSessions();
+}
+
+// Verify that data can be transmitted over the event channel.
+TEST_F(JingleSessionTest, TestEventChannel) {
+ CreateServerPair();
+ ASSERT_TRUE(InitiateConnection(kTestSharedSecret));
+ scoped_refptr<TCPChannelTester> tester(
+ new TCPChannelTester(host_session_.get(), client_session_.get(),
+ kMessageSize, kMessageSize));
+ tester->Start(ChannelTesterBase::EVENT);
ASSERT_TRUE(tester->WaitFinished());
tester->CheckResults();
@@ -723,12 +723,13 @@ TEST_F(JingleSessionTest, TestTcpChannel) {
}
// Verify that data can be transmitted over the video RTP channel.
-TEST_F(JingleSessionTest, TestUdpChannel) {
+// Disabled because RTP support is disabled, see crbug.com/91538 .
+TEST_F(JingleSessionTest, DISABLED_TestVideoRtpChannel) {
CreateServerPair();
ASSERT_TRUE(InitiateConnection(kTestSharedSecret));
scoped_refptr<UDPChannelTester> tester(
new UDPChannelTester(host_session_.get(), client_session_.get()));
- tester->Start();
+ tester->Start(ChannelTesterBase::VIDEO_RTP);
ASSERT_TRUE(tester->WaitFinished());
tester->CheckResults();
@@ -745,37 +746,28 @@ TEST_F(JingleSessionTest, TestSpeed) {
tester = new ChannelSpeedTester(host_session_.get(),
client_session_.get(), 512);
- tester->Start();
+ tester->Start(ChannelTesterBase::VIDEO);
ASSERT_TRUE(tester->WaitFinished());
LOG(INFO) << "Time for 512 bytes "
<< tester->GetElapsedTime().InMilliseconds() << " ms.";
- CloseSessions();
- ASSERT_TRUE(InitiateConnection(kTestSharedSecret));
-
tester = new ChannelSpeedTester(host_session_.get(),
client_session_.get(), 1024);
- tester->Start();
+ tester->Start(ChannelTesterBase::VIDEO);
ASSERT_TRUE(tester->WaitFinished());
LOG(INFO) << "Time for 1024 bytes "
<< tester->GetElapsedTime().InMilliseconds() << " ms.";
- CloseSessions();
- ASSERT_TRUE(InitiateConnection(kTestSharedSecret));
-
tester = new ChannelSpeedTester(host_session_.get(),
client_session_.get(), 51200);
- tester->Start();
+ tester->Start(ChannelTesterBase::VIDEO);
ASSERT_TRUE(tester->WaitFinished());
LOG(INFO) << "Time for 50k bytes "
<< tester->GetElapsedTime().InMilliseconds() << " ms.";
- CloseSessions();
- ASSERT_TRUE(InitiateConnection(kTestSharedSecret));
-
tester = new ChannelSpeedTester(host_session_.get(),
client_session_.get(), 512000);
- tester->Start();
+ tester->Start(ChannelTesterBase::VIDEO);
ASSERT_TRUE(tester->WaitFinished());
LOG(INFO) << "Time for 500k bytes "
<< tester->GetElapsedTime().InMilliseconds() << " ms.";
diff --git a/remoting/protocol/protobuf_video_reader.cc b/remoting/protocol/protobuf_video_reader.cc
index f93f2fb..a2b62388 100644
--- a/remoting/protocol/protobuf_video_reader.cc
+++ b/remoting/protocol/protobuf_video_reader.cc
@@ -4,10 +4,7 @@
#include "remoting/protocol/protobuf_video_reader.h"
-#include "base/bind.h"
#include "base/task.h"
-#include "net/socket/stream_socket.h"
-#include "remoting/base/constants.h"
#include "remoting/proto/video.pb.h"
#include "remoting/protocol/session.h"
@@ -22,28 +19,11 @@ ProtobufVideoReader::ProtobufVideoReader(VideoPacketFormat::Encoding encoding)
ProtobufVideoReader::~ProtobufVideoReader() { }
void ProtobufVideoReader::Init(protocol::Session* session,
- VideoStub* video_stub,
- const InitializedCallback& callback) {
- initialized_callback_ = callback;
+ VideoStub* video_stub) {
+ reader_.Init(
+ session->video_channel(),
+ NewCallback(this, &ProtobufVideoReader::OnNewData));
video_stub_ = video_stub;
-
- session->CreateStreamChannel(
- kVideoChannelName,
- base::Bind(&ProtobufVideoReader::OnChannelReady, base::Unretained(this)));
-}
-
-void ProtobufVideoReader::OnChannelReady(const std::string& name,
- net::StreamSocket* socket) {
- DCHECK_EQ(name, std::string(kVideoChannelName));
- if (!socket) {
- initialized_callback_.Run(false);
- return;
- }
-
- DCHECK(!channel_.get());
- channel_.reset(socket);
- reader_.Init(socket, NewCallback(this, &ProtobufVideoReader::OnNewData));
- initialized_callback_.Run(true);
}
void ProtobufVideoReader::OnNewData(VideoPacket* packet, Task* done_task) {
diff --git a/remoting/protocol/protobuf_video_reader.h b/remoting/protocol/protobuf_video_reader.h
index 165a3a8..8e8ce42 100644
--- a/remoting/protocol/protobuf_video_reader.h
+++ b/remoting/protocol/protobuf_video_reader.h
@@ -1,19 +1,14 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// 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.
#ifndef REMOTING_PROTOCOL_PROTOBUF_VIDEO_READER_H_
#define REMOTING_PROTOCOL_PROTOBUF_VIDEO_READER_H_
-#include "base/compiler_specific.h"
#include "remoting/proto/video.pb.h"
#include "remoting/protocol/message_reader.h"
#include "remoting/protocol/video_reader.h"
-namespace net {
-class StreamSocket;
-} // namespace net
-
namespace remoting {
namespace protocol {
@@ -25,21 +20,13 @@ class ProtobufVideoReader : public VideoReader {
virtual ~ProtobufVideoReader();
// VideoReader interface.
- virtual void Init(protocol::Session* session,
- VideoStub* video_stub,
- const InitializedCallback& callback) OVERRIDE;
+ virtual void Init(protocol::Session* session, VideoStub* video_stub);
private:
- void OnChannelReady(const std::string& name, net::StreamSocket* socket);
void OnNewData(VideoPacket* packet, Task* done_task);
- InitializedCallback initialized_callback_;
-
VideoPacketFormat::Encoding encoding_;
- // TODO(sergeyu): Remove |channel_| and let |reader_| own it.
- scoped_ptr<net::StreamSocket> channel_;
-
ProtobufMessageReader<VideoPacket> reader_;
// The stub that processes all received packets.
diff --git a/remoting/protocol/protobuf_video_writer.cc b/remoting/protocol/protobuf_video_writer.cc
index 2d37f65..a03a4e6 100644
--- a/remoting/protocol/protobuf_video_writer.cc
+++ b/remoting/protocol/protobuf_video_writer.cc
@@ -1,13 +1,10 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// 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_writer.h"
-#include "base/bind.h"
#include "base/task.h"
-#include "net/socket/stream_socket.h"
-#include "remoting/base/constants.h"
#include "remoting/proto/video.pb.h"
#include "remoting/protocol/rtp_writer.h"
#include "remoting/protocol/session.h"
@@ -20,35 +17,14 @@ ProtobufVideoWriter::ProtobufVideoWriter() { }
ProtobufVideoWriter::~ProtobufVideoWriter() { }
-void ProtobufVideoWriter::Init(protocol::Session* session,
- const InitializedCallback& callback) {
- initialized_callback_ = callback;
-
- session->CreateStreamChannel(
- kVideoChannelName,
- base::Bind(&ProtobufVideoWriter::OnChannelReady, base::Unretained(this)));
-}
-
-void ProtobufVideoWriter::OnChannelReady(const std::string& name,
- net::StreamSocket* socket) {
- DCHECK_EQ(name, std::string(kVideoChannelName));
- if (!socket) {
- initialized_callback_.Run(false);
- return;
- }
-
- DCHECK(!channel_.get());
- channel_.reset(socket);
+void ProtobufVideoWriter::Init(protocol::Session* session) {
buffered_writer_ = new BufferedSocketWriter();
// TODO(sergeyu): Provide WriteFailedCallback for the buffered writer.
- buffered_writer_->Init(socket, NULL);
-
- initialized_callback_.Run(true);
+ buffered_writer_->Init(session->video_channel(), NULL);
}
void ProtobufVideoWriter::Close() {
buffered_writer_->Close();
- channel_.reset();
}
void ProtobufVideoWriter::ProcessVideoPacket(const VideoPacket* packet,
diff --git a/remoting/protocol/protobuf_video_writer.h b/remoting/protocol/protobuf_video_writer.h
index a5bb4fc..189eacf 100644
--- a/remoting/protocol/protobuf_video_writer.h
+++ b/remoting/protocol/protobuf_video_writer.h
@@ -5,17 +5,10 @@
#ifndef REMOTING_PROTOCOL_PROTOBUF_VIDEO_WRITER_H_
#define REMOTING_PROTOCOL_PROTOBUF_VIDEO_WRITER_H_
-#include <string>
-
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "remoting/protocol/video_writer.h"
-namespace net {
-class StreamSocket;
-} // namespace net
-
namespace remoting {
namespace protocol {
@@ -28,8 +21,7 @@ class ProtobufVideoWriter : public VideoWriter {
virtual ~ProtobufVideoWriter();
// VideoWriter interface.
- virtual void Init(protocol::Session* session,
- const InitializedCallback& callback) OVERRIDE;
+ virtual void Init(protocol::Session* session) OVERRIDE;
virtual void Close() OVERRIDE;
// VideoStub interface.
@@ -38,13 +30,6 @@ class ProtobufVideoWriter : public VideoWriter {
virtual int GetPendingPackets() OVERRIDE;
private:
- void OnChannelReady(const std::string& name, net::StreamSocket* socket);
-
- InitializedCallback initialized_callback_;
-
- // TODO(sergeyu): Remove |channel_| and let |buffered_writer_| own it.
- scoped_ptr<net::StreamSocket> channel_;
-
scoped_refptr<BufferedSocketWriter> buffered_writer_;
DISALLOW_COPY_AND_ASSIGN(ProtobufVideoWriter);
diff --git a/remoting/protocol/rtp_video_reader.cc b/remoting/protocol/rtp_video_reader.cc
index 9b97961..b6d9e0b 100644
--- a/remoting/protocol/rtp_video_reader.cc
+++ b/remoting/protocol/rtp_video_reader.cc
@@ -4,9 +4,7 @@
#include "remoting/protocol/rtp_video_reader.h"
-#include "base/bind.h"
#include "base/task.h"
-#include "remoting/base/constants.h"
#include "remoting/proto/video.pb.h"
#include "remoting/protocol/session.h"
@@ -24,8 +22,7 @@ RtpVideoReader::PacketsQueueEntry::PacketsQueueEntry()
}
RtpVideoReader::RtpVideoReader()
- : initialized_(false),
- last_sequence_number_(0),
+ : last_sequence_number_(0),
video_stub_(NULL) {
}
@@ -33,47 +30,11 @@ RtpVideoReader::~RtpVideoReader() {
ResetQueue();
}
-void RtpVideoReader::Init(protocol::Session* session,
- VideoStub* video_stub,
- const InitializedCallback& callback) {
- initialized_callback_ = callback;
+void RtpVideoReader::Init(protocol::Session* session, VideoStub* video_stub) {
+ rtp_reader_.Init(session->video_rtp_channel(),
+ NewCallback(this, &RtpVideoReader::OnRtpPacket));
+ rtcp_writer_.Init(session->video_rtcp_channel());
video_stub_ = video_stub;
-
- session->CreateDatagramChannel(
- kVideoRtpChannelName,
- base::Bind(&RtpVideoReader::OnChannelReady, base::Unretained(this)));
- session->CreateDatagramChannel(
- kVideoRtcpChannelName,
- base::Bind(&RtpVideoReader::OnChannelReady, base::Unretained(this)));
-}
-
-void RtpVideoReader::OnChannelReady(const std::string& name,
- net::Socket* socket) {
- if (!socket) {
- if (!initialized_) {
- initialized_ = true;
- initialized_callback_.Run(false);
- }
- return;
- }
-
- if (name == kVideoRtpChannelName) {
- DCHECK(!rtp_channel_.get());
- rtp_channel_.reset(socket);
- rtp_reader_.Init(socket, NewCallback(this, &RtpVideoReader::OnRtpPacket));
- } else if (name == kVideoRtcpChannelName) {
- DCHECK(!rtcp_channel_.get());
- rtcp_channel_.reset(socket);
- rtcp_writer_.Init(socket);
- } else {
- NOTREACHED();
- }
-
- if (rtp_channel_.get() && rtcp_channel_.get()) {
- DCHECK(!initialized_);
- initialized_ = true;
- initialized_callback_.Run(true);
- }
}
void RtpVideoReader::ResetQueue() {
diff --git a/remoting/protocol/rtp_video_reader.h b/remoting/protocol/rtp_video_reader.h
index e2eaf20e..8b0d3bd 100644
--- a/remoting/protocol/rtp_video_reader.h
+++ b/remoting/protocol/rtp_video_reader.h
@@ -5,9 +5,7 @@
#ifndef REMOTING_PROTOCOL_RTP_VIDEO_READER_H_
#define REMOTING_PROTOCOL_RTP_VIDEO_READER_H_
-#include "base/compiler_specific.h"
#include "base/time.h"
-#include "base/memory/scoped_ptr.h"
#include "remoting/protocol/rtcp_writer.h"
#include "remoting/protocol/rtp_reader.h"
#include "remoting/protocol/video_reader.h"
@@ -15,8 +13,6 @@
namespace remoting {
namespace protocol {
-class RtcpWriter;
-class RtpReader;
class Session;
class RtpVideoReader : public VideoReader {
@@ -25,9 +21,7 @@ class RtpVideoReader : public VideoReader {
virtual ~RtpVideoReader();
// VideoReader interface.
- virtual void Init(protocol::Session* session,
- VideoStub* video_stub,
- const InitializedCallback& callback) OVERRIDE;
+ virtual void Init(protocol::Session* session, VideoStub* video_stub);
private:
friend class RtpVideoReaderTest;
@@ -50,8 +44,6 @@ class RtpVideoReader : public VideoReader {
typedef std::deque<PacketsQueueEntry> PacketsQueue;
- void OnChannelReady(const std::string& name, net::Socket* socket);
-
void OnRtpPacket(const RtpPacket* rtp_packet);
void CheckFullPacket(const PacketsQueue::iterator& pos);
void RebuildVideoPacket(const PacketsQueue::iterator& from,
@@ -64,12 +56,7 @@ class RtpVideoReader : public VideoReader {
// |kReceiverReportsIntervalMs|.
void SendReceiverReportIf();
- bool initialized_;
- InitializedCallback initialized_callback_;
-
- scoped_ptr<net::Socket> rtp_channel_;
RtpReader rtp_reader_;
- scoped_ptr<net::Socket> rtcp_channel_;
RtcpWriter rtcp_writer_;
PacketsQueue packets_queue_;
diff --git a/remoting/protocol/rtp_video_reader_unittest.cc b/remoting/protocol/rtp_video_reader_unittest.cc
index 3c6d5ef..2475d6a 100644
--- a/remoting/protocol/rtp_video_reader_unittest.cc
+++ b/remoting/protocol/rtp_video_reader_unittest.cc
@@ -4,7 +4,6 @@
#include <vector>
-#include "base/bind.h"
#include "base/message_loop.h"
#include "base/string_number_conversions.h"
#include "net/base/io_buffer.h"
@@ -66,16 +65,10 @@ class RtpVideoReaderTest : public testing::Test,
void Reset() {
session_.reset(new FakeSession());
reader_.reset(new RtpVideoReader());
- reader_->Init(session_.get(), this,
- base::Bind(&RtpVideoReaderTest::OnReaderInitialized,
- base::Unretained(this)));
+ reader_->Init(session_.get(), this);
received_packets_.clear();
}
- void OnReaderInitialized(bool success) {
- ASSERT_TRUE(success);
- }
-
void InitData(int size) {
data_.resize(size);
for (int i = 0; i < size; ++i) {
diff --git a/remoting/protocol/rtp_video_writer.cc b/remoting/protocol/rtp_video_writer.cc
index 2a0f950..d5d4b75 100644
--- a/remoting/protocol/rtp_video_writer.cc
+++ b/remoting/protocol/rtp_video_writer.cc
@@ -4,11 +4,9 @@
#include "remoting/protocol/rtp_video_writer.h"
-#include "base/bind.h"
#include "base/task.h"
#include "net/base/io_buffer.h"
#include "remoting/base/compound_buffer.h"
-#include "remoting/base/constants.h"
#include "remoting/proto/video.pb.h"
#include "remoting/protocol/rtp_writer.h"
#include "remoting/protocol/session.h"
@@ -20,56 +18,18 @@ namespace {
const int kMtu = 1200;
} // namespace
-RtpVideoWriter::RtpVideoWriter()
- : initialized_(false) {
-}
+RtpVideoWriter::RtpVideoWriter() { }
RtpVideoWriter::~RtpVideoWriter() {
Close();
}
-void RtpVideoWriter::Init(protocol::Session* session,
- const InitializedCallback& callback) {
- initialized_callback_ = callback;
- session->CreateDatagramChannel(
- kVideoRtpChannelName,
- base::Bind(&RtpVideoWriter::OnChannelReady, base::Unretained(this)));
- session->CreateDatagramChannel(
- kVideoRtcpChannelName,
- base::Bind(&RtpVideoWriter::OnChannelReady, base::Unretained(this)));
-}
-
-void RtpVideoWriter::OnChannelReady(const std::string& name,
- net::Socket* socket) {
- if (!socket) {
- if (!initialized_) {
- initialized_ = true;
- initialized_callback_.Run(false);
- }
- return;
- }
-
- if (name == kVideoRtpChannelName) {
- DCHECK(!rtp_channel_.get());
- rtp_channel_.reset(socket);
- rtp_writer_.Init(socket);
- } else if (name == kVideoRtcpChannelName) {
- DCHECK(!rtcp_channel_.get());
- rtcp_channel_.reset(socket);
- // TODO(sergeyu): Use RTCP channel somehow.
- }
-
- if (rtp_channel_.get() && rtcp_channel_.get()) {
- DCHECK(!initialized_);
- initialized_ = true;
- initialized_callback_.Run(true);
- }
+void RtpVideoWriter::Init(protocol::Session* session) {
+ rtp_writer_.Init(session->video_rtp_channel());
}
void RtpVideoWriter::Close() {
rtp_writer_.Close();
- rtp_channel_.reset();
- rtcp_channel_.reset();
}
void RtpVideoWriter::ProcessVideoPacket(const VideoPacket* packet, Task* done) {
diff --git a/remoting/protocol/rtp_video_writer.h b/remoting/protocol/rtp_video_writer.h
index fd7349b2..d54d721 100644
--- a/remoting/protocol/rtp_video_writer.h
+++ b/remoting/protocol/rtp_video_writer.h
@@ -5,7 +5,6 @@
#ifndef REMOTING_PROTOCOL_RTP_VIDEO_WRITER_H_
#define REMOTING_PROTOCOL_RTP_VIDEO_WRITER_H_
-#include "base/memory/scoped_ptr.h"
#include "remoting/protocol/rtp_writer.h"
#include "remoting/protocol/video_writer.h"
@@ -20,8 +19,7 @@ class RtpVideoWriter : public VideoWriter {
virtual ~RtpVideoWriter();
// VideoWriter interface.
- virtual void Init(protocol::Session* session,
- const InitializedCallback& callback) OVERRIDE;
+ virtual void Init(protocol::Session* session) OVERRIDE;
virtual void Close() OVERRIDE;
// VideoStub interface.
@@ -30,14 +28,7 @@ class RtpVideoWriter : public VideoWriter {
virtual int GetPendingPackets() OVERRIDE;
private:
- void OnChannelReady(const std::string& name, net::Socket* socket);
-
- bool initialized_;
- InitializedCallback initialized_callback_;
-
- scoped_ptr<net::Socket> rtp_channel_;
RtpWriter rtp_writer_;
- scoped_ptr<net::Socket> rtcp_channel_;
DISALLOW_COPY_AND_ASSIGN(RtpVideoWriter);
};
diff --git a/remoting/protocol/rtp_video_writer_unittest.cc b/remoting/protocol/rtp_video_writer_unittest.cc
index 118c300..2724927 100644
--- a/remoting/protocol/rtp_video_writer_unittest.cc
+++ b/remoting/protocol/rtp_video_writer_unittest.cc
@@ -5,10 +5,8 @@
#include <string>
#include <vector>
-#include "base/bind.h"
#include "base/message_loop.h"
#include "base/string_number_conversions.h"
-#include "remoting/base/constants.h"
#include "remoting/proto/video.pb.h"
#include "remoting/protocol/fake_session.h"
#include "remoting/protocol/rtp_reader.h"
@@ -59,13 +57,7 @@ class RtpVideoWriterTest : public testing::Test {
virtual void SetUp() {
session_.reset(new FakeSession());
- writer_.Init(session_.get(),
- base::Bind(&RtpVideoWriterTest::OnWriterInitialized,
- base::Unretained(this)));
- }
-
- void OnWriterInitialized(bool success) {
- ASSERT_TRUE(success);
+ writer_.Init(session_.get());
}
void InitData(int size) {
@@ -96,7 +88,7 @@ class RtpVideoWriterTest : public testing::Test {
void VerifyResult(const ExpectedPacket expected[],
int count) {
const vector<string>& rtp_packets =
- session_->GetDatagramChannel(kVideoRtpChannelName)->written_packets();
+ session_->video_rtp_channel()->written_packets();
ASSERT_EQ(count, static_cast<int>(rtp_packets.size()));
int pos = 0;
for (int i = 0; i < count; ++i) {
diff --git a/remoting/protocol/session.h b/remoting/protocol/session.h
index 89cc266..fc40a6d 100644
--- a/remoting/protocol/session.h
+++ b/remoting/protocol/session.h
@@ -64,6 +64,9 @@ class Session : public base::NonThreadSafe {
// instead.
virtual net::Socket* control_channel() = 0;
virtual net::Socket* event_channel() = 0;
+ virtual net::Socket* video_channel() = 0;
+ virtual net::Socket* video_rtp_channel() = 0;
+ virtual net::Socket* video_rtcp_channel() = 0;
// JID of the other side.
virtual const std::string& jid() = 0;
diff --git a/remoting/protocol/video_reader.h b/remoting/protocol/video_reader.h
index e539c0d..ba39be3 100644
--- a/remoting/protocol/video_reader.h
+++ b/remoting/protocol/video_reader.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// 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.
@@ -25,17 +25,12 @@ class VideoReader {
public:
static VideoReader* Create(const SessionConfig* config);
- // The callback is called when initialization is finished. The
- // parameter is set to true on success.
- typedef base::Callback<void(bool)> InitializedCallback;
-
virtual ~VideoReader();
// Initializies the reader. Doesn't take ownership of either |connection|
// or |video_stub|.
virtual void Init(Session* session,
- VideoStub* video_stub,
- const InitializedCallback& callback) = 0;
+ VideoStub* video_stub) = 0;
protected:
VideoReader() { }
diff --git a/remoting/protocol/video_writer.h b/remoting/protocol/video_writer.h
index 68b19fd..be4c715 100644
--- a/remoting/protocol/video_writer.h
+++ b/remoting/protocol/video_writer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// 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.
@@ -11,7 +11,6 @@
#define REMOTING_PROTOCOL_VIDEO_WRITER_H_
#include "base/basictypes.h"
-#include "base/callback.h"
#include "remoting/protocol/video_stub.h"
namespace remoting {
@@ -24,14 +23,10 @@ class VideoWriter : public VideoStub {
public:
virtual ~VideoWriter();
- // The callback is called when initialization is finished. The
- // parameter is set to true on success.
- typedef base::Callback<void(bool)> InitializedCallback;
-
static VideoWriter* Create(const SessionConfig* config);
// Initializes the writer.
- virtual void Init(Session* session, const InitializedCallback& callback) = 0;
+ virtual void Init(Session* session) = 0;
// Stops writing. Must be called on the network thread before this
// object is destroyed.
diff --git a/tools/valgrind/gtest_exclude/remoting_unittests.gtest-drmemory_win32.txt b/tools/valgrind/gtest_exclude/remoting_unittests.gtest-drmemory_win32.txt
index a21737c..25a2ba5 100644
--- a/tools/valgrind/gtest_exclude/remoting_unittests.gtest-drmemory_win32.txt
+++ b/tools/valgrind/gtest_exclude/remoting_unittests.gtest-drmemory_win32.txt
@@ -1,8 +1,10 @@
# Following tests create real libjingle connections, and libjingle has
# hardcoded timeouts, so these tests fail under TSan.
JingleSessionTest.Connect
-JingleSessionTest.TestUdpChannel
-JingleSessionTest.TestTcpChannel
+JingleSessionTest.TestControlChannel
+JingleSessionTest.TestEventChannel
+JingleSessionTest.TestVideoChannel
+JingleSessionTest.TestVideoRtpChannel
JingleSessionTest.TestSpeed
# This test fails on an assertion, see http://crbug.com/57266
diff --git a/tools/valgrind/gtest_exclude/remoting_unittests.gtest-tsan.txt b/tools/valgrind/gtest_exclude/remoting_unittests.gtest-tsan.txt
index af33ac1..d7ec34f 100644
--- a/tools/valgrind/gtest_exclude/remoting_unittests.gtest-tsan.txt
+++ b/tools/valgrind/gtest_exclude/remoting_unittests.gtest-tsan.txt
@@ -2,6 +2,8 @@
# hardcoded timeouts, so these tests fail under TSan.
JingleSessionTest.Connect
JingleSessionTest.ConnectBadChannelAuth
-JingleSessionTest.TestUdpChannel
-JingleSessionTest.TestTcpChannel
+JingleSessionTest.TestControlChannel
+JingleSessionTest.TestEventChannel
JingleSessionTest.TestSpeed
+JingleSessionTest.TestVideoChannel
+JingleSessionTest.TestVideoRtpChannel
diff --git a/tools/valgrind/gtest_exclude/remoting_unittests.gtest-tsan_win32.txt b/tools/valgrind/gtest_exclude/remoting_unittests.gtest-tsan_win32.txt
index 118c299..744a1e3 100644
--- a/tools/valgrind/gtest_exclude/remoting_unittests.gtest-tsan_win32.txt
+++ b/tools/valgrind/gtest_exclude/remoting_unittests.gtest-tsan_win32.txt
@@ -1,6 +1,8 @@
# Following tests create real libjingle connections, and libjingle has
# hardcoded timeouts, so these tests fail under TSan.
JingleSessionTest.Connect
-JingleSessionTest.TestUdpChannel
-JingleSessionTest.TestTcpChannel
+JingleSessionTest.TestControlChannel
+JingleSessionTest.TestEventChannel
+JingleSessionTest.TestVideoChannel
+JingleSessionTest.TestVideoRtpChannel
JingleSessionTest.TestSpeed