Commit 1290af9d authored by sergeyu@chromium.org's avatar sergeyu@chromium.org

Revert 96089 - Remove video_channel() from Session interface

BUG=None
TEST=Unittests.

Review URL: http://codereview.chromium.org/7508044

TBR=sergeyu@chromium.org
Review URL: http://codereview.chromium.org/7604021

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96106 0039d316-1c4b-4281-b951-d872f2087c98
parent f8aa077c
...@@ -12,8 +12,4 @@ const char kChromotingTokenDefaultServiceName[] = "chromiumsync"; ...@@ -12,8 +12,4 @@ const char kChromotingTokenDefaultServiceName[] = "chromiumsync";
const char kChromotingXmlNamespace[] = "google:remoting"; const char kChromotingXmlNamespace[] = "google:remoting";
const char kVideoChannelName[] = "video";
const char kVideoRtpChannelName[] = "videortp";
const char kVideoRtcpChannelName[] = "videortpc";
} // namespace remoting } // namespace remoting
...@@ -17,11 +17,6 @@ extern const char kChromotingTokenDefaultServiceName[]; ...@@ -17,11 +17,6 @@ extern const char kChromotingTokenDefaultServiceName[];
// Namespace used for chromoting XMPP stanzas. // Namespace used for chromoting XMPP stanzas.
extern const char kChromotingXmlNamespace[]; extern const char kChromotingXmlNamespace[];
// Channel names.
extern const char kVideoChannelName[];
extern const char kVideoRtpChannelName[];
extern const char kVideoRtcpChannelName[];
} // namespace remoting } // namespace remoting
#endif // REMOTING_BASE_CONSTANTS_H_ #endif // REMOTING_BASE_CONSTANTS_H_
...@@ -41,8 +41,7 @@ class BufferedSocketWriterBase ...@@ -41,8 +41,7 @@ class BufferedSocketWriterBase
// Initializes the writer. Must be called on the thread that will be used // 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 // to access the socket in the future. |callback| will be called after each
// failed write. Caller retains ownership of |socket|. // failed write.
// TODO(sergeyu): Change it so that it take ownership of |socket|.
void Init(net::Socket* socket, WriteFailedCallback* callback); void Init(net::Socket* socket, WriteFailedCallback* callback);
// Puts a new data chunk in the buffer. Returns false and doesn't enqueue // Puts a new data chunk in the buffer. Returns false and doesn't enqueue
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "remoting/protocol/connection_to_client.h" #include "remoting/protocol/connection_to_client.h"
#include "base/bind.h"
#include "google/protobuf/message.h" #include "google/protobuf/message.h"
#include "net/base/io_buffer.h" #include "net/base/io_buffer.h"
#include "remoting/protocol/client_control_sender.h" #include "remoting/protocol/client_control_sender.h"
...@@ -97,18 +96,20 @@ void ConnectionToClient::OnSessionStateChange(protocol::Session::State state) { ...@@ -97,18 +96,20 @@ void ConnectionToClient::OnSessionStateChange(protocol::Session::State state) {
client_control_sender_.reset( client_control_sender_.reset(
new ClientControlSender(session_->control_channel())); new ClientControlSender(session_->control_channel()));
video_writer_.reset(VideoWriter::Create(session_->config())); video_writer_.reset(VideoWriter::Create(session_->config()));
video_writer_->Init( video_writer_->Init(session_.get());
session_.get(), base::Bind(&ConnectionToClient::OnVideoInitialized,
base::Unretained(this)));
dispatcher_.reset(new HostMessageDispatcher()); dispatcher_.reset(new HostMessageDispatcher());
dispatcher_->Initialize(this, host_stub_, input_stub_); dispatcher_->Initialize(this, host_stub_, input_stub_);
handler_->OnConnectionOpened(this);
break; break;
case protocol::Session::CLOSED: case protocol::Session::CLOSED:
CloseChannels(); CloseChannels();
handler_->OnConnectionClosed(this); handler_->OnConnectionClosed(this);
break; break;
case protocol::Session::FAILED: case protocol::Session::FAILED:
CloseOnError(); CloseChannels();
handler_->OnConnectionFailed(this);
break; break;
default: default:
// We shouldn't receive other states. // We shouldn't receive other states.
...@@ -116,20 +117,6 @@ void ConnectionToClient::OnSessionStateChange(protocol::Session::State state) { ...@@ -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() { void ConnectionToClient::CloseChannels() {
if (video_writer_.get()) if (video_writer_.get())
video_writer_->Close(); video_writer_->Close();
......
...@@ -90,11 +90,6 @@ class ConnectionToClient : ...@@ -90,11 +90,6 @@ class ConnectionToClient :
// Callback for protocol Session. // Callback for protocol Session.
void OnSessionStateChange(Session::State state); void OnSessionStateChange(Session::State state);
// Callback for VideoReader::Init().
void OnVideoInitialized(bool successful);
void CloseOnError();
// Stops writing in the channels. // Stops writing in the channels.
void CloseChannels(); void CloseChannels();
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "base/message_loop.h" #include "base/message_loop.h"
#include "remoting/base/base_mock_objects.h" #include "remoting/base/base_mock_objects.h"
#include "remoting/base/constants.h"
#include "remoting/protocol/fake_session.h" #include "remoting/protocol/fake_session.h"
#include "remoting/protocol/connection_to_client.h" #include "remoting/protocol/connection_to_client.h"
#include "remoting/protocol/protocol_mock_objects.h" #include "remoting/protocol/protocol_mock_objects.h"
...@@ -61,9 +60,7 @@ TEST_F(ConnectionToClientTest, SendUpdateStream) { ...@@ -61,9 +60,7 @@ TEST_F(ConnectionToClientTest, SendUpdateStream) {
// Verify that something has been written. // Verify that something has been written.
// TODO(sergeyu): Verify that the correct data has been written. // TODO(sergeyu): Verify that the correct data has been written.
ASSERT_TRUE(session_->GetStreamChannel(kVideoChannelName)); EXPECT_GT(session_->video_channel()->written_data().size(), 0u);
EXPECT_GT(session_->GetStreamChannel(kVideoChannelName)->
written_data().size(), 0u);
// And then close the connection to ConnectionToClient. // And then close the connection to ConnectionToClient.
viewer_->Disconnect(); viewer_->Disconnect();
......
...@@ -176,7 +176,8 @@ void ConnectionToHost::OnSessionStateChange( ...@@ -176,7 +176,8 @@ void ConnectionToHost::OnSessionStateChange(
switch (state) { switch (state) {
case Session::FAILED: case Session::FAILED:
state_ = STATE_FAILED; state_ = STATE_FAILED;
CloseOnError(); CloseChannels();
event_callback_->OnConnectionFailed(this);
break; break;
case Session::CLOSED: case Session::CLOSED:
...@@ -189,10 +190,7 @@ void ConnectionToHost::OnSessionStateChange( ...@@ -189,10 +190,7 @@ void ConnectionToHost::OnSessionStateChange(
state_ = STATE_CONNECTED; state_ = STATE_CONNECTED;
// Initialize reader and writer. // Initialize reader and writer.
video_reader_.reset(VideoReader::Create(session_->config())); video_reader_.reset(VideoReader::Create(session_->config()));
video_reader_->Init( video_reader_->Init(session_.get(), video_stub_);
session_.get(), video_stub_,
base::Bind(&ConnectionToHost::OnVideoChannelInitialized,
base::Unretained(this)));
host_control_sender_.reset( host_control_sender_.reset(
new HostControlSender(session_->control_channel())); new HostControlSender(session_->control_channel()));
dispatcher_->Initialize(session_.get(), client_stub_); dispatcher_->Initialize(session_.get(), client_stub_);
...@@ -205,27 +203,12 @@ void ConnectionToHost::OnSessionStateChange( ...@@ -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() { void ConnectionToHost::CloseChannels() {
if (input_sender_.get()) if (input_sender_.get())
input_sender_->Close(); input_sender_->Close();
if (host_control_sender_.get()) if (host_control_sender_.get())
host_control_sender_->Close(); host_control_sender_->Close();
video_reader_.reset();
} }
void ConnectionToHost::OnClientAuthenticated() { void ConnectionToHost::OnClientAuthenticated() {
......
...@@ -124,14 +124,9 @@ class ConnectionToHost : public SignalStrategy::StatusObserver, ...@@ -124,14 +124,9 @@ class ConnectionToHost : public SignalStrategy::StatusObserver,
// Callback for |session_|. // Callback for |session_|.
void OnSessionStateChange(Session::State state); void OnSessionStateChange(Session::State state);
// Callback for VideoReader::Init().
void OnVideoChannelInitialized(bool successful);
// Callback for |video_reader_|. // Callback for |video_reader_|.
void OnVideoPacket(VideoPacket* packet); void OnVideoPacket(VideoPacket* packet);
void CloseOnError();
// Stops writing in the channels. // Stops writing in the channels.
void CloseChannels(); void CloseChannels();
......
...@@ -70,67 +70,6 @@ bool FakeSocket::SetSendBufferSize(int32 size) { ...@@ -70,67 +70,6 @@ bool FakeSocket::SetSendBufferSize(int32 size) {
return false; 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() FakeUdpSocket::FakeUdpSocket()
: read_pending_(false), : read_pending_(false),
input_pos_(0) { input_pos_(0) {
...@@ -196,31 +135,21 @@ FakeSession::FakeSession() ...@@ -196,31 +135,21 @@ FakeSession::FakeSession()
FakeSession::~FakeSession() { } FakeSession::~FakeSession() { }
FakeSocket* FakeSession::GetStreamChannel(const std::string& name) { void FakeSession::SetStateChangeCallback(
return stream_channels_[name]; StateChangeCallback* callback) {
}
FakeUdpSocket* FakeSession::GetDatagramChannel(const std::string& name) {
return datagram_channels_[name];
}
void FakeSession::SetStateChangeCallback(StateChangeCallback* callback) {
callback_.reset(callback); callback_.reset(callback);
} }
void FakeSession::CreateStreamChannel( void FakeSession::CreateStreamChannel(
const std::string& name, const StreamChannelCallback& callback) { const std::string& name, const StreamChannelCallback& callback) {
LOG(ERROR) << " creating channel " << name; NOTIMPLEMENTED();
FakeSocket* channel = new FakeSocket(); callback.Run(name, NULL);
stream_channels_[name] = channel;
callback.Run(name, channel);
} }
void FakeSession::CreateDatagramChannel( void FakeSession::CreateDatagramChannel(
const std::string& name, const DatagramChannelCallback& callback) { const std::string& name, const DatagramChannelCallback& callback) {
FakeUdpSocket* channel = new FakeUdpSocket(); NOTIMPLEMENTED();
datagram_channels_[name] = channel; callback.Run(name, NULL);
callback.Run(name, channel);
} }
FakeSocket* FakeSession::control_channel() { FakeSocket* FakeSession::control_channel() {
...@@ -231,6 +160,18 @@ FakeSocket* FakeSession::event_channel() { ...@@ -231,6 +160,18 @@ FakeSocket* FakeSession::event_channel() {
return &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() { const std::string& FakeSession::jid() {
return jid_; return jid_;
} }
......
...@@ -5,13 +5,11 @@ ...@@ -5,13 +5,11 @@
#ifndef REMOTING_PROTOCOL_FAKE_SESSION_H_ #ifndef REMOTING_PROTOCOL_FAKE_SESSION_H_
#define REMOTING_PROTOCOL_FAKE_SESSION_H_ #define REMOTING_PROTOCOL_FAKE_SESSION_H_
#include <map>
#include <string> #include <string>
#include <vector> #include <vector>
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "net/socket/socket.h" #include "net/socket/socket.h"
#include "net/socket/stream_socket.h"
#include "remoting/protocol/session.h" #include "remoting/protocol/session.h"
namespace remoting { namespace remoting {
...@@ -24,7 +22,7 @@ extern const char kTestJid[]; ...@@ -24,7 +22,7 @@ extern const char kTestJid[];
// Read() reads data from another buffer that can be set with AppendInputData(). // Read() reads data from another buffer that can be set with AppendInputData().
// Pending reads are supported, so if there is a pending read AppendInputData() // Pending reads are supported, so if there is a pending read AppendInputData()
// calls the read callback. // calls the read callback.
class FakeSocket : public net::StreamSocket { class FakeSocket : public net::Socket {
public: public:
FakeSocket(); FakeSocket();
virtual ~FakeSocket(); virtual ~FakeSocket();
...@@ -44,21 +42,6 @@ class FakeSocket : public net::StreamSocket { ...@@ -44,21 +42,6 @@ class FakeSocket : public net::StreamSocket {
virtual bool SetReceiveBufferSize(int32 size); virtual bool SetReceiveBufferSize(int32 size);
virtual bool SetSendBufferSize(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: private:
bool read_pending_; bool read_pending_;
scoped_refptr<net::IOBuffer> read_buffer_; scoped_refptr<net::IOBuffer> read_buffer_;
...@@ -68,10 +51,6 @@ class FakeSocket : public net::StreamSocket { ...@@ -68,10 +51,6 @@ class FakeSocket : public net::StreamSocket {
std::string written_data_; std::string written_data_;
std::string input_data_; std::string input_data_;
int input_pos_; int input_pos_;
net::BoundNetLog net_log_;
DISALLOW_COPY_AND_ASSIGN(FakeSocket);
}; };
// FakeUdpSocket is similar to FakeSocket but behaves as UDP socket. All written // FakeUdpSocket is similar to FakeSocket but behaves as UDP socket. All written
...@@ -107,8 +86,6 @@ class FakeUdpSocket : public net::Socket { ...@@ -107,8 +86,6 @@ class FakeUdpSocket : public net::Socket {
std::vector<std::string> written_packets_; std::vector<std::string> written_packets_;
std::vector<std::string> input_packets_; std::vector<std::string> input_packets_;
int input_pos_; int input_pos_;
DISALLOW_COPY_AND_ASSIGN(FakeUdpSocket);
}; };
// FakeSession is a dummy protocol::Session that uses FakeSocket for all // FakeSession is a dummy protocol::Session that uses FakeSocket for all
...@@ -126,10 +103,6 @@ class FakeSession : public Session { ...@@ -126,10 +103,6 @@ class FakeSession : public Session {
bool is_closed() const { return closed_; } 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 SetStateChangeCallback(StateChangeCallback* callback);
virtual void CreateStreamChannel( virtual void CreateStreamChannel(
...@@ -139,6 +112,10 @@ class FakeSession : public Session { ...@@ -139,6 +112,10 @@ class FakeSession : public Session {
virtual FakeSocket* control_channel(); virtual FakeSocket* control_channel();
virtual FakeSocket* event_channel(); virtual FakeSocket* event_channel();
virtual FakeSocket* video_channel();
virtual FakeUdpSocket* video_rtp_channel();
virtual FakeUdpSocket* video_rtcp_channel();
virtual const std::string& jid(); virtual const std::string& jid();
...@@ -163,9 +140,9 @@ class FakeSession : public Session { ...@@ -163,9 +140,9 @@ class FakeSession : public Session {
MessageLoop* message_loop_; MessageLoop* message_loop_;
FakeSocket control_channel_; FakeSocket control_channel_;
FakeSocket event_channel_; FakeSocket event_channel_;
FakeSocket video_channel_;
std::map<std::string, FakeSocket*> stream_channels_; FakeUdpSocket video_rtp_channel_;
std::map<std::string, FakeUdpSocket*> datagram_channels_; FakeUdpSocket video_rtcp_channel_;
std::string initiator_token_; std::string initiator_token_;
std::string receiver_token_; std::string receiver_token_;
...@@ -174,8 +151,6 @@ class FakeSession : public Session { ...@@ -174,8 +151,6 @@ class FakeSession : public Session {
std::string jid_; std::string jid_;
bool closed_; bool closed_;
DISALLOW_COPY_AND_ASSIGN(FakeSession);
}; };
} // namespace protocol } // namespace protocol
......
...@@ -33,6 +33,7 @@ namespace { ...@@ -33,6 +33,7 @@ namespace {
const char kControlChannelName[] = "control"; const char kControlChannelName[] = "control";
const char kEventChannelName[] = "event"; const char kEventChannelName[] = "event";
const char kVideoChannelName[] = "video";
const int kMasterKeyLength = 16; const int kMasterKeyLength = 16;
const int kChannelKeyLength = 16; const int kChannelKeyLength = 16;
...@@ -159,6 +160,7 @@ void JingleSession::CloseInternal(int result, bool failed) { ...@@ -159,6 +160,7 @@ void JingleSession::CloseInternal(int result, bool failed) {
control_channel_socket_.reset(); control_channel_socket_.reset();
event_channel_socket_.reset(); event_channel_socket_.reset();
video_channel_socket_.reset();
STLDeleteContainerPairSecondPointers(channel_connectors_.begin(), STLDeleteContainerPairSecondPointers(channel_connectors_.begin(),
channel_connectors_.end()); channel_connectors_.end());
...@@ -222,6 +224,23 @@ net::Socket* JingleSession::event_channel() { ...@@ -222,6 +224,23 @@ net::Socket* JingleSession::event_channel() {
return event_channel_socket_.get(); 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() { const std::string& JingleSession::jid() {
// TODO(sergeyu): Fix ChromotingHost so that it doesn't call this // TODO(sergeyu): Fix ChromotingHost so that it doesn't call this
// method on invalid thread and uncomment this DCHECK. // method on invalid thread and uncomment this DCHECK.
...@@ -493,6 +512,7 @@ void JingleSession::CreateChannels() { ...@@ -493,6 +512,7 @@ void JingleSession::CreateChannels() {
base::Unretained(this))); base::Unretained(this)));
CreateStreamChannel(kControlChannelName, stream_callback); CreateStreamChannel(kControlChannelName, stream_callback);
CreateStreamChannel(kEventChannelName, stream_callback); CreateStreamChannel(kEventChannelName, stream_callback);
CreateStreamChannel(kVideoChannelName, stream_callback);
} }
void JingleSession::OnStreamChannelConnected(const std::string& name, void JingleSession::OnStreamChannelConnected(const std::string& name,
...@@ -513,11 +533,14 @@ void JingleSession::OnChannelConnected(const std::string& name, ...@@ -513,11 +533,14 @@ void JingleSession::OnChannelConnected(const std::string& name,
control_channel_socket_.reset(socket); control_channel_socket_.reset(socket);
} else if (name == kEventChannelName) { } else if (name == kEventChannelName) {
event_channel_socket_.reset(socket); event_channel_socket_.reset(socket);
} else if (name == kVideoChannelName) {
video_channel_socket_.reset(socket);
} else { } else {
NOTREACHED(); 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 // TODO(sergeyu): State should be set to CONNECTED in OnAccept
// independent of the channels state. // independent of the channels state.
SetState(CONNECTED); SetState(CONNECTED);
......
...@@ -38,6 +38,9 @@ class JingleSession : public protocol::Session, ...@@ -38,6 +38,9 @@ class JingleSession : public protocol::Session,
const DatagramChannelCallback& callback) OVERRIDE; const DatagramChannelCallback& callback) OVERRIDE;
virtual net::Socket* control_channel() OVERRIDE; virtual net::Socket* control_channel() OVERRIDE;
virtual net::Socket* event_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 std::string& jid() OVERRIDE;
virtual const CandidateSessionConfig* candidate_config() OVERRIDE; virtual const CandidateSessionConfig* candidate_config() OVERRIDE;
virtual const SessionConfig* config() OVERRIDE; virtual const SessionConfig* config() OVERRIDE;
...@@ -182,6 +185,7 @@ class JingleSession : public protocol::Session, ...@@ -182,6 +185,7 @@ class JingleSession : public protocol::Session,
scoped_ptr<net::Socket> control_channel_socket_; scoped_ptr<net::Socket> control_channel_socket_;
scoped_ptr<net::Socket> event_channel_socket_; scoped_ptr<net::Socket> event_channel_socket_;
scoped_ptr<net::Socket> video_channel_socket_;
ScopedRunnableMethodFactory<JingleSession> task_factory_; ScopedRunnableMethodFactory<JingleSession> task_factory_;
......
...@@ -4,10 +4,7 @@ ...@@ -4,10 +4,7 @@
#include "remoting/protocol/protobuf_video_reader.h" #include "remoting/protocol/protobuf_video_reader.h"
#include "base/bind.h"
#include "base/task.h" #include "base/task.h"
#include "net/socket/stream_socket.h"
#include "remoting/base/constants.h"
#include "remoting/proto/video.pb.h" #include "remoting/proto/video.pb.h"
#include "remoting/protocol/session.h" #include "remoting/protocol/session.h"
...@@ -22,28 +19,11 @@ ProtobufVideoReader::ProtobufVideoReader(VideoPacketFormat::Encoding encoding) ...@@ -22,28 +19,11 @@ ProtobufVideoReader::ProtobufVideoReader(VideoPacketFormat::Encoding encoding)
ProtobufVideoReader::~ProtobufVideoReader() { } ProtobufVideoReader::~ProtobufVideoReader() { }
void ProtobufVideoReader::Init(protocol::Session* session, void ProtobufVideoReader::Init(protocol::Session* session,
VideoStub* video_stub, VideoStub* video_stub) {
const InitializedCallback& callback) { reader_.Init(
initialized_callback_ = callback; session->video_channel(),
NewCallback(this, &ProtobufVideoReader::OnNewData));
video_stub_ = video_stub; 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) { void ProtobufVideoReader::OnNewData(VideoPacket* packet, Task* done_task) {
......
// 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 // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef REMOTING_PROTOCOL_PROTOBUF_VIDEO_READER_H_ #ifndef REMOTING_PROTOCOL_PROTOBUF_VIDEO_READER_H_
#define 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/proto/video.pb.h"
#include "remoting/protocol/message_reader.h" #include "remoting/protocol/message_reader.h"
#include "remoting/protocol/video_reader.h" #include "remoting/protocol/video_reader.h"
namespace net {
class StreamSocket;
} // namespace net
namespace remoting { namespace remoting {
namespace protocol { namespace protocol {
...@@ -25,21 +20,13 @@ class ProtobufVideoReader : public VideoReader { ...@@ -25,21 +20,13 @@ class ProtobufVideoReader : public VideoReader {
virtual ~ProtobufVideoReader(); virtual ~ProtobufVideoReader();
// VideoReader interface. // VideoReader interface.
virtual void Init(protocol::Session* session, virtual void Init(protocol::Session* session, VideoStub* video_stub);
VideoStub* video_stub,
const InitializedCallback& callback) OVERRIDE;
private: private:
void OnChannelReady(const std::string& name, net::StreamSocket* socket);
void OnNewData(VideoPacket* packet, Task* done_task); void OnNewData(VideoPacket* packet, Task* done_task);
InitializedCallback initialized_callback_;
VideoPacketFormat::Encoding encoding_; VideoPacketFormat::Encoding encoding_;
// TODO(sergeyu): Remove |channel_| and let |reader_| own it.
scoped_ptr<net::StreamSocket> channel_;
ProtobufMessageReader<VideoPacket> reader_; ProtobufMessageReader<VideoPacket> reader_;
// The stub that processes all received packets. // The stub that processes all received packets.
......
// 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 // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "remoting/protocol/protobuf_video_writer.h" #include "remoting/protocol/protobuf_video_writer.h"
#include "base/bind.h"
#include "base/task.h" #include "base/task.h"
#include "net/socket/stream_socket.h"
#include "remoting/base/constants.h"
#include "remoting/proto/video.pb.h" #include "remoting/proto/video.pb.h"
#include "remoting/protocol/rtp_writer.h" #include "remoting/protocol/rtp_writer.h"
#include "remoting/protocol/session.h" #include "remoting/protocol/session.h"
...@@ -20,35 +17,14 @@ ProtobufVideoWriter::ProtobufVideoWriter() { } ...@@ -20,35 +17,14 @@ ProtobufVideoWriter::ProtobufVideoWriter() { }
ProtobufVideoWriter::~ProtobufVideoWriter() { } ProtobufVideoWriter::~ProtobufVideoWriter() { }
void ProtobufVideoWriter::Init(protocol::Session* session, 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);
buffered_writer_ = new BufferedSocketWriter(); buffered_writer_ = new BufferedSocketWriter();
// TODO(sergeyu): Provide WriteFailedCallback for the buffered writer. // TODO(sergeyu): Provide WriteFailedCallback for the buffered writer.
buffered_writer_->Init(socket, NULL); buffered_writer_->Init(session->video_channel(), NULL);
initialized_callback_.Run(true);
} }
void ProtobufVideoWriter::Close() { void ProtobufVideoWriter::Close() {
buffered_writer_->Close(); buffered_writer_->Close();
channel_.reset();
} }
void ProtobufVideoWriter::ProcessVideoPacket(const VideoPacket* packet, void ProtobufVideoWriter::ProcessVideoPacket(const VideoPacket* packet,
......
...@@ -5,17 +5,10 @@ ...@@ -5,17 +5,10 @@
#ifndef REMOTING_PROTOCOL_PROTOBUF_VIDEO_WRITER_H_ #ifndef REMOTING_PROTOCOL_PROTOBUF_VIDEO_WRITER_H_
#define REMOTING_PROTOCOL_PROTOBUF_VIDEO_WRITER_H_ #define REMOTING_PROTOCOL_PROTOBUF_VIDEO_WRITER_H_
#include <string>
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "remoting/protocol/video_writer.h" #include "remoting/protocol/video_writer.h"
namespace net {
class StreamSocket;
} // namespace net
namespace remoting { namespace remoting {
namespace protocol { namespace protocol {
...@@ -28,8 +21,7 @@ class ProtobufVideoWriter : public VideoWriter { ...@@ -28,8 +21,7 @@ class ProtobufVideoWriter : public VideoWriter {
virtual ~ProtobufVideoWriter(); virtual ~ProtobufVideoWriter();
// VideoWriter interface. // VideoWriter interface.
virtual void Init(protocol::Session* session, virtual void Init(protocol::Session* session) OVERRIDE;
const InitializedCallback& callback) OVERRIDE;
virtual void Close() OVERRIDE; virtual void Close() OVERRIDE;
// VideoStub interface. // VideoStub interface.
...@@ -38,13 +30,6 @@ class ProtobufVideoWriter : public VideoWriter { ...@@ -38,13 +30,6 @@ class ProtobufVideoWriter : public VideoWriter {
virtual int GetPendingPackets() OVERRIDE; virtual int GetPendingPackets() OVERRIDE;
private: 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_; scoped_refptr<BufferedSocketWriter> buffered_writer_;
DISALLOW_COPY_AND_ASSIGN(ProtobufVideoWriter); DISALLOW_COPY_AND_ASSIGN(ProtobufVideoWriter);
......
...@@ -4,9 +4,7 @@ ...@@ -4,9 +4,7 @@
#include "remoting/protocol/rtp_video_reader.h" #include "remoting/protocol/rtp_video_reader.h"
#include "base/bind.h"
#include "base/task.h" #include "base/task.h"
#include "remoting/base/constants.h"
#include "remoting/proto/video.pb.h" #include "remoting/proto/video.pb.h"
#include "remoting/protocol/session.h" #include "remoting/protocol/session.h"
...@@ -24,8 +22,7 @@ RtpVideoReader::PacketsQueueEntry::PacketsQueueEntry() ...@@ -24,8 +22,7 @@ RtpVideoReader::PacketsQueueEntry::PacketsQueueEntry()
} }
RtpVideoReader::RtpVideoReader() RtpVideoReader::RtpVideoReader()
: initialized_(false), : last_sequence_number_(0),
last_sequence_number_(0),
video_stub_(NULL) { video_stub_(NULL) {
} }
...@@ -33,47 +30,11 @@ RtpVideoReader::~RtpVideoReader() { ...@@ -33,47 +30,11 @@ RtpVideoReader::~RtpVideoReader() {
ResetQueue(); ResetQueue();
} }
void RtpVideoReader::Init(protocol::Session* session, void RtpVideoReader::Init(protocol::Session* session, VideoStub* video_stub) {
VideoStub* video_stub, rtp_reader_.Init(session->video_rtp_channel(),
const InitializedCallback& callback) { NewCallback(this, &RtpVideoReader::OnRtpPacket));
initialized_callback_ = callback; rtcp_writer_.Init(session->video_rtcp_channel());
video_stub_ = video_stub; 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() { void RtpVideoReader::ResetQueue() {
......
...@@ -5,9 +5,7 @@ ...@@ -5,9 +5,7 @@
#ifndef REMOTING_PROTOCOL_RTP_VIDEO_READER_H_ #ifndef REMOTING_PROTOCOL_RTP_VIDEO_READER_H_
#define REMOTING_PROTOCOL_RTP_VIDEO_READER_H_ #define REMOTING_PROTOCOL_RTP_VIDEO_READER_H_
#include "base/compiler_specific.h"
#include "base/time.h" #include "base/time.h"
#include "base/memory/scoped_ptr.h"
#include "remoting/protocol/rtcp_writer.h" #include "remoting/protocol/rtcp_writer.h"
#include "remoting/protocol/rtp_reader.h" #include "remoting/protocol/rtp_reader.h"
#include "remoting/protocol/video_reader.h" #include "remoting/protocol/video_reader.h"
...@@ -15,8 +13,6 @@ ...@@ -15,8 +13,6 @@
namespace remoting { namespace remoting {
namespace protocol { namespace protocol {
class RtcpWriter;
class RtpReader;
class Session; class Session;
class RtpVideoReader : public VideoReader { class RtpVideoReader : public VideoReader {
...@@ -25,9 +21,7 @@ class RtpVideoReader : public VideoReader { ...@@ -25,9 +21,7 @@ class RtpVideoReader : public VideoReader {
virtual ~RtpVideoReader(); virtual ~RtpVideoReader();
// VideoReader interface. // VideoReader interface.
virtual void Init(protocol::Session* session, virtual void Init(protocol::Session* session, VideoStub* video_stub);
VideoStub* video_stub,
const InitializedCallback& callback) OVERRIDE;
private: private:
friend class RtpVideoReaderTest; friend class RtpVideoReaderTest;
...@@ -50,8 +44,6 @@ class RtpVideoReader : public VideoReader { ...@@ -50,8 +44,6 @@ class RtpVideoReader : public VideoReader {
typedef std::deque<PacketsQueueEntry> PacketsQueue; typedef std::deque<PacketsQueueEntry> PacketsQueue;
void OnChannelReady(const std::string& name, net::Socket* socket);
void OnRtpPacket(const RtpPacket* rtp_packet); void OnRtpPacket(const RtpPacket* rtp_packet);
void CheckFullPacket(const PacketsQueue::iterator& pos); void CheckFullPacket(const PacketsQueue::iterator& pos);
void RebuildVideoPacket(const PacketsQueue::iterator& from, void RebuildVideoPacket(const PacketsQueue::iterator& from,
...@@ -64,12 +56,7 @@ class RtpVideoReader : public VideoReader { ...@@ -64,12 +56,7 @@ class RtpVideoReader : public VideoReader {
// |kReceiverReportsIntervalMs|. // |kReceiverReportsIntervalMs|.
void SendReceiverReportIf(); void SendReceiverReportIf();
bool initialized_;
InitializedCallback initialized_callback_;
scoped_ptr<net::Socket> rtp_channel_;
RtpReader rtp_reader_; RtpReader rtp_reader_;
scoped_ptr<net::Socket> rtcp_channel_;
RtcpWriter rtcp_writer_; RtcpWriter rtcp_writer_;
PacketsQueue packets_queue_; PacketsQueue packets_queue_;
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include <vector> #include <vector>
#include "base/bind.h"
#include "base/message_loop.h" #include "base/message_loop.h"
#include "base/string_number_conversions.h" #include "base/string_number_conversions.h"
#include "net/base/io_buffer.h" #include "net/base/io_buffer.h"
...@@ -66,16 +65,10 @@ class RtpVideoReaderTest : public testing::Test, ...@@ -66,16 +65,10 @@ class RtpVideoReaderTest : public testing::Test,
void Reset() { void Reset() {
session_.reset(new FakeSession()); session_.reset(new FakeSession());
reader_.reset(new RtpVideoReader()); reader_.reset(new RtpVideoReader());
reader_->Init(session_.get(), this, reader_->Init(session_.get(), this);
base::Bind(&RtpVideoReaderTest::OnReaderInitialized,
base::Unretained(this)));
received_packets_.clear(); received_packets_.clear();
} }
void OnReaderInitialized(bool success) {
ASSERT_TRUE(success);
}
void InitData(int size) { void InitData(int size) {
data_.resize(size); data_.resize(size);
for (int i = 0; i < size; ++i) { for (int i = 0; i < size; ++i) {
......
...@@ -4,11 +4,9 @@ ...@@ -4,11 +4,9 @@
#include "remoting/protocol/rtp_video_writer.h" #include "remoting/protocol/rtp_video_writer.h"
#include "base/bind.h"
#include "base/task.h" #include "base/task.h"
#include "net/base/io_buffer.h" #include "net/base/io_buffer.h"
#include "remoting/base/compound_buffer.h" #include "remoting/base/compound_buffer.h"
#include "remoting/base/constants.h"
#include "remoting/proto/video.pb.h" #include "remoting/proto/video.pb.h"
#include "remoting/protocol/rtp_writer.h" #include "remoting/protocol/rtp_writer.h"
#include "remoting/protocol/session.h" #include "remoting/protocol/session.h"
...@@ -20,56 +18,18 @@ namespace { ...@@ -20,56 +18,18 @@ namespace {
const int kMtu = 1200; const int kMtu = 1200;
} // namespace } // namespace
RtpVideoWriter::RtpVideoWriter() RtpVideoWriter::RtpVideoWriter() { }
: initialized_(false) {
}
RtpVideoWriter::~RtpVideoWriter() { RtpVideoWriter::~RtpVideoWriter() {
Close(); Close();
} }
void RtpVideoWriter::Init(protocol::Session* session, void RtpVideoWriter::Init(protocol::Session* session) {
const InitializedCallback& callback) { rtp_writer_.Init(session->video_rtp_channel());
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::Close() { void RtpVideoWriter::Close() {
rtp_writer_.Close(); rtp_writer_.Close();
rtp_channel_.reset();
rtcp_channel_.reset();
} }
void RtpVideoWriter::ProcessVideoPacket(const VideoPacket* packet, Task* done) { void RtpVideoWriter::ProcessVideoPacket(const VideoPacket* packet, Task* done) {
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#ifndef REMOTING_PROTOCOL_RTP_VIDEO_WRITER_H_ #ifndef REMOTING_PROTOCOL_RTP_VIDEO_WRITER_H_
#define 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/rtp_writer.h"
#include "remoting/protocol/video_writer.h" #include "remoting/protocol/video_writer.h"
...@@ -20,8 +19,7 @@ class RtpVideoWriter : public VideoWriter { ...@@ -20,8 +19,7 @@ class RtpVideoWriter : public VideoWriter {
virtual ~RtpVideoWriter(); virtual ~RtpVideoWriter();
// VideoWriter interface. // VideoWriter interface.
virtual void Init(protocol::Session* session, virtual void Init(protocol::Session* session) OVERRIDE;
const InitializedCallback& callback) OVERRIDE;
virtual void Close() OVERRIDE; virtual void Close() OVERRIDE;
// VideoStub interface. // VideoStub interface.
...@@ -30,14 +28,7 @@ class RtpVideoWriter : public VideoWriter { ...@@ -30,14 +28,7 @@ class RtpVideoWriter : public VideoWriter {
virtual int GetPendingPackets() OVERRIDE; virtual int GetPendingPackets() OVERRIDE;
private: private:
void OnChannelReady(const std::string& name, net::Socket* socket);
bool initialized_;
InitializedCallback initialized_callback_;
scoped_ptr<net::Socket> rtp_channel_;
RtpWriter rtp_writer_; RtpWriter rtp_writer_;
scoped_ptr<net::Socket> rtcp_channel_;
DISALLOW_COPY_AND_ASSIGN(RtpVideoWriter); DISALLOW_COPY_AND_ASSIGN(RtpVideoWriter);
}; };
......
...@@ -5,10 +5,8 @@ ...@@ -5,10 +5,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "base/bind.h"
#include "base/message_loop.h" #include "base/message_loop.h"
#include "base/string_number_conversions.h" #include "base/string_number_conversions.h"
#include "remoting/base/constants.h"
#include "remoting/proto/video.pb.h" #include "remoting/proto/video.pb.h"
#include "remoting/protocol/fake_session.h" #include "remoting/protocol/fake_session.h"
#include "remoting/protocol/rtp_reader.h" #include "remoting/protocol/rtp_reader.h"
...@@ -59,13 +57,7 @@ class RtpVideoWriterTest : public testing::Test { ...@@ -59,13 +57,7 @@ class RtpVideoWriterTest : public testing::Test {
virtual void SetUp() { virtual void SetUp() {
session_.reset(new FakeSession()); session_.reset(new FakeSession());
writer_.Init(session_.get(), writer_.Init(session_.get());
base::Bind(&RtpVideoWriterTest::OnWriterInitialized,
base::Unretained(this)));
}
void OnWriterInitialized(bool success) {
ASSERT_TRUE(success);
} }
void InitData(int size) { void InitData(int size) {
...@@ -96,7 +88,7 @@ class RtpVideoWriterTest : public testing::Test { ...@@ -96,7 +88,7 @@ class RtpVideoWriterTest : public testing::Test {
void VerifyResult(const ExpectedPacket expected[], void VerifyResult(const ExpectedPacket expected[],
int count) { int count) {
const vector<string>& rtp_packets = 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())); ASSERT_EQ(count, static_cast<int>(rtp_packets.size()));
int pos = 0; int pos = 0;
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
......
...@@ -64,6 +64,9 @@ class Session : public base::NonThreadSafe { ...@@ -64,6 +64,9 @@ class Session : public base::NonThreadSafe {
// instead. // instead.
virtual net::Socket* control_channel() = 0; virtual net::Socket* control_channel() = 0;
virtual net::Socket* event_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. // JID of the other side.
virtual const std::string& jid() = 0; virtual const std::string& jid() = 0;
......
// 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 // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -25,17 +25,12 @@ class VideoReader { ...@@ -25,17 +25,12 @@ class VideoReader {
public: public:
static VideoReader* Create(const SessionConfig* config); 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(); virtual ~VideoReader();
// Initializies the reader. Doesn't take ownership of either |connection| // Initializies the reader. Doesn't take ownership of either |connection|
// or |video_stub|. // or |video_stub|.
virtual void Init(Session* session, virtual void Init(Session* session,
VideoStub* video_stub, VideoStub* video_stub) = 0;
const InitializedCallback& callback) = 0;
protected: protected:
VideoReader() { } VideoReader() { }
......
// 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 // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#define REMOTING_PROTOCOL_VIDEO_WRITER_H_ #define REMOTING_PROTOCOL_VIDEO_WRITER_H_
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/callback.h"
#include "remoting/protocol/video_stub.h" #include "remoting/protocol/video_stub.h"
namespace remoting { namespace remoting {
...@@ -24,14 +23,10 @@ class VideoWriter : public VideoStub { ...@@ -24,14 +23,10 @@ class VideoWriter : public VideoStub {
public: public:
virtual ~VideoWriter(); 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); static VideoWriter* Create(const SessionConfig* config);
// Initializes the writer. // 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 // Stops writing. Must be called on the network thread before this
// object is destroyed. // object is destroyed.
......
# Following tests create real libjingle connections, and libjingle has # Following tests create real libjingle connections, and libjingle has
# hardcoded timeouts, so these tests fail under TSan. # hardcoded timeouts, so these tests fail under TSan.
JingleSessionTest.Connect JingleSessionTest.Connect
JingleSessionTest.TestUdpChannel JingleSessionTest.TestControlChannel
JingleSessionTest.TestTcpChannel JingleSessionTest.TestEventChannel
JingleSessionTest.TestVideoChannel
JingleSessionTest.TestVideoRtpChannel
JingleSessionTest.TestSpeed JingleSessionTest.TestSpeed
# This test fails on an assertion, see http://crbug.com/57266 # This test fails on an assertion, see http://crbug.com/57266
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
# hardcoded timeouts, so these tests fail under TSan. # hardcoded timeouts, so these tests fail under TSan.
JingleSessionTest.Connect JingleSessionTest.Connect
JingleSessionTest.ConnectBadChannelAuth JingleSessionTest.ConnectBadChannelAuth
JingleSessionTest.TestUdpChannel JingleSessionTest.TestControlChannel
JingleSessionTest.TestTcpChannel JingleSessionTest.TestEventChannel
JingleSessionTest.TestSpeed JingleSessionTest.TestSpeed
JingleSessionTest.TestVideoChannel
JingleSessionTest.TestVideoRtpChannel
# Following tests create real libjingle connections, and libjingle has # Following tests create real libjingle connections, and libjingle has
# hardcoded timeouts, so these tests fail under TSan. # hardcoded timeouts, so these tests fail under TSan.
JingleSessionTest.Connect JingleSessionTest.Connect
JingleSessionTest.TestUdpChannel JingleSessionTest.TestControlChannel
JingleSessionTest.TestTcpChannel JingleSessionTest.TestEventChannel
JingleSessionTest.TestVideoChannel
JingleSessionTest.TestVideoRtpChannel
JingleSessionTest.TestSpeed JingleSessionTest.TestSpeed
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment