session/phone/channel.cc updates after new push of libjingle revision.
Review URL: http://webrtc-codereview.appspot.com/225003 git-svn-id: http://webrtc.googlecode.com/svn/trunk@744 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -76,14 +76,14 @@ static bool ValidPacket(bool rtcp, const talk_base::Buffer* packet) {
|
|||||||
BaseChannel::BaseChannel(talk_base::Thread* thread,
|
BaseChannel::BaseChannel(talk_base::Thread* thread,
|
||||||
MediaEngineInterface* media_engine,
|
MediaEngineInterface* media_engine,
|
||||||
MediaChannel* media_channel, BaseSession* session,
|
MediaChannel* media_channel, BaseSession* session,
|
||||||
const std::string& content_name,
|
const std::string& content_name, bool rtcp)
|
||||||
TransportChannel* transport_channel)
|
|
||||||
: worker_thread_(thread),
|
: worker_thread_(thread),
|
||||||
media_engine_(media_engine),
|
media_engine_(media_engine),
|
||||||
session_(session),
|
session_(session),
|
||||||
media_channel_(media_channel),
|
media_channel_(media_channel),
|
||||||
content_name_(content_name),
|
content_name_(content_name),
|
||||||
transport_channel_(transport_channel),
|
rtcp_(rtcp),
|
||||||
|
transport_channel_(NULL),
|
||||||
rtcp_transport_channel_(NULL),
|
rtcp_transport_channel_(NULL),
|
||||||
enabled_(false),
|
enabled_(false),
|
||||||
writable_(false),
|
writable_(false),
|
||||||
@@ -92,17 +92,7 @@ BaseChannel::BaseChannel(talk_base::Thread* thread,
|
|||||||
has_remote_content_(false),
|
has_remote_content_(false),
|
||||||
muted_(false) {
|
muted_(false) {
|
||||||
ASSERT(worker_thread_ == talk_base::Thread::Current());
|
ASSERT(worker_thread_ == talk_base::Thread::Current());
|
||||||
media_channel_->SetInterface(this);
|
|
||||||
transport_channel_->SignalWritableState.connect(
|
|
||||||
this, &BaseChannel::OnWritableState);
|
|
||||||
transport_channel_->SignalReadPacket.connect(
|
|
||||||
this, &BaseChannel::OnChannelRead);
|
|
||||||
|
|
||||||
LOG(LS_INFO) << "Created channel";
|
LOG(LS_INFO) << "Created channel";
|
||||||
|
|
||||||
session->SignalState.connect(this, &BaseChannel::OnSessionState);
|
|
||||||
session->SignalRemoteDescriptionUpdate.connect(this,
|
|
||||||
&BaseChannel::OnRemoteDescriptionUpdate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseChannel::~BaseChannel() {
|
BaseChannel::~BaseChannel() {
|
||||||
@@ -120,6 +110,30 @@ BaseChannel::~BaseChannel() {
|
|||||||
LOG(LS_INFO) << "Destroyed channel";
|
LOG(LS_INFO) << "Destroyed channel";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BaseChannel::Init(TransportChannel* transport_channel,
|
||||||
|
TransportChannel* rtcp_transport_channel) {
|
||||||
|
if (transport_channel == NULL) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (rtcp() && rtcp_transport_channel == NULL) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
transport_channel_ = transport_channel;
|
||||||
|
media_channel_->SetInterface(this);
|
||||||
|
transport_channel_->SignalWritableState.connect(
|
||||||
|
this, &BaseChannel::OnWritableState);
|
||||||
|
transport_channel_->SignalReadPacket.connect(
|
||||||
|
this, &BaseChannel::OnChannelRead);
|
||||||
|
|
||||||
|
session_->SignalState.connect(this, &BaseChannel::OnSessionState);
|
||||||
|
session_->SignalRemoteDescriptionUpdate.connect(this,
|
||||||
|
&BaseChannel::OnRemoteDescriptionUpdate);
|
||||||
|
|
||||||
|
OnSessionState(session(), session()->state());
|
||||||
|
set_rtcp_transport_channel(rtcp_transport_channel);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool BaseChannel::Enable(bool enable) {
|
bool BaseChannel::Enable(bool enable) {
|
||||||
// Can be called from thread other than worker thread
|
// Can be called from thread other than worker thread
|
||||||
Send(enable ? MSG_ENABLE : MSG_DISABLE);
|
Send(enable ? MSG_ENABLE : MSG_DISABLE);
|
||||||
@@ -627,19 +641,8 @@ VoiceChannel::VoiceChannel(talk_base::Thread* thread,
|
|||||||
const std::string& content_name,
|
const std::string& content_name,
|
||||||
bool rtcp)
|
bool rtcp)
|
||||||
: BaseChannel(thread, media_engine, media_channel, session, content_name,
|
: BaseChannel(thread, media_engine, media_channel, session, content_name,
|
||||||
session->CreateChannel(content_name, "rtp")),
|
rtcp),
|
||||||
received_media_(false) {
|
received_media_(false) {
|
||||||
if (rtcp) {
|
|
||||||
set_rtcp_transport_channel(session->CreateChannel(content_name, "rtcp"));
|
|
||||||
}
|
|
||||||
// Can't go in BaseChannel because certain session states will
|
|
||||||
// trigger pure virtual functions, such as GetFirstContent().
|
|
||||||
OnSessionState(session, session->state());
|
|
||||||
|
|
||||||
media_channel->SignalMediaError.connect(
|
|
||||||
this, &VoiceChannel::OnVoiceChannelError);
|
|
||||||
srtp_filter()->SignalSrtpError.connect(
|
|
||||||
this, &VoiceChannel::OnSrtpError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VoiceChannel::~VoiceChannel() {
|
VoiceChannel::~VoiceChannel() {
|
||||||
@@ -649,6 +652,20 @@ VoiceChannel::~VoiceChannel() {
|
|||||||
DisableMedia_w();
|
DisableMedia_w();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool VoiceChannel::Init() {
|
||||||
|
TransportChannel* rtcp_channel = rtcp() ?
|
||||||
|
session()->CreateChannel(content_name(), "rtcp") : NULL;
|
||||||
|
if (!BaseChannel::Init(session()->CreateChannel(content_name(), "rtp"),
|
||||||
|
rtcp_channel)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
media_channel()->SignalMediaError.connect(
|
||||||
|
this, &VoiceChannel::OnVoiceChannelError);
|
||||||
|
srtp_filter()->SignalSrtpError.connect(
|
||||||
|
this, &VoiceChannel::OnSrtpError);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool VoiceChannel::AddStream(uint32 ssrc) {
|
bool VoiceChannel::AddStream(uint32 ssrc) {
|
||||||
StreamMessageData data(ssrc, 0);
|
StreamMessageData data(ssrc, 0);
|
||||||
Send(MSG_ADDSTREAM, &data);
|
Send(MSG_ADDSTREAM, &data);
|
||||||
@@ -1008,20 +1025,23 @@ VideoChannel::VideoChannel(talk_base::Thread* thread,
|
|||||||
bool rtcp,
|
bool rtcp,
|
||||||
VoiceChannel* voice_channel)
|
VoiceChannel* voice_channel)
|
||||||
: BaseChannel(thread, media_engine, media_channel, session, content_name,
|
: BaseChannel(thread, media_engine, media_channel, session, content_name,
|
||||||
session->CreateChannel(content_name, "video_rtp")),
|
rtcp),
|
||||||
voice_channel_(voice_channel), renderer_(NULL) {
|
voice_channel_(voice_channel), renderer_(NULL) {
|
||||||
if (rtcp) {
|
}
|
||||||
set_rtcp_transport_channel(
|
|
||||||
session->CreateChannel(content_name, "video_rtcp"));
|
|
||||||
}
|
|
||||||
// Can't go in BaseChannel because certain session states will
|
|
||||||
// trigger pure virtual functions, such as GetFirstContent()
|
|
||||||
OnSessionState(session, session->state());
|
|
||||||
|
|
||||||
media_channel->SignalMediaError.connect(
|
bool VideoChannel::Init() {
|
||||||
|
TransportChannel* rtcp_channel = rtcp() ?
|
||||||
|
session()->CreateChannel(content_name(), "video_rtcp") : NULL;
|
||||||
|
if (!BaseChannel::Init(
|
||||||
|
session()->CreateChannel(content_name(), "video_rtp"),
|
||||||
|
rtcp_channel)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
media_channel()->SignalMediaError.connect(
|
||||||
this, &VideoChannel::OnVideoChannelError);
|
this, &VideoChannel::OnVideoChannelError);
|
||||||
srtp_filter()->SignalSrtpError.connect(
|
srtp_filter()->SignalSrtpError.connect(
|
||||||
this, &VideoChannel::OnSrtpError);
|
this, &VideoChannel::OnSrtpError);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoiceChannel::SendLastMediaError() {
|
void VoiceChannel::SendLastMediaError() {
|
||||||
@@ -1278,6 +1298,7 @@ void VideoChannel::OnSrtpError(uint32 ssrc, SrtpFilter::Mode mode,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(mallinath) - Post on worker thread?
|
// TODO(mallinath) - Post on worker thread?
|
||||||
void VideoChannel::SetCaptureDevice(
|
void VideoChannel::SetCaptureDevice(
|
||||||
uint32 ssrc, webrtc::VideoCaptureModule* camera) {
|
uint32 ssrc, webrtc::VideoCaptureModule* camera) {
|
||||||
|
@@ -88,11 +88,10 @@ class BaseChannel
|
|||||||
public:
|
public:
|
||||||
BaseChannel(talk_base::Thread* thread, MediaEngineInterface* media_engine,
|
BaseChannel(talk_base::Thread* thread, MediaEngineInterface* media_engine,
|
||||||
MediaChannel* channel, BaseSession* session,
|
MediaChannel* channel, BaseSession* session,
|
||||||
const std::string& content_name,
|
const std::string& content_name, bool rtcp);
|
||||||
TransportChannel* transport_channel);
|
|
||||||
virtual ~BaseChannel();
|
virtual ~BaseChannel();
|
||||||
bool Init(TransportChannel* /*transport_channel*/,
|
bool Init(TransportChannel* transport_channel,
|
||||||
TransportChannel* /*rtcp_transport_channel*/) {return true;}
|
TransportChannel* rtcp_transport_channel);
|
||||||
|
|
||||||
talk_base::Thread* worker_thread() const { return worker_thread_; }
|
talk_base::Thread* worker_thread() const { return worker_thread_; }
|
||||||
BaseSession* session() const { return session_; }
|
BaseSession* session() const { return session_; }
|
||||||
@@ -177,6 +176,7 @@ class BaseChannel
|
|||||||
bool muted() const { return muted_; }
|
bool muted() const { return muted_; }
|
||||||
talk_base::Thread* signaling_thread() { return session_->signaling_thread(); }
|
talk_base::Thread* signaling_thread() { return session_->signaling_thread(); }
|
||||||
SrtpFilter* srtp_filter() { return &srtp_filter_; }
|
SrtpFilter* srtp_filter() { return &srtp_filter_; }
|
||||||
|
bool rtcp() const { return rtcp_; }
|
||||||
|
|
||||||
void Send(uint32 id, talk_base::MessageData *pdata = NULL);
|
void Send(uint32 id, talk_base::MessageData *pdata = NULL);
|
||||||
void Post(uint32 id, talk_base::MessageData *pdata = NULL);
|
void Post(uint32 id, talk_base::MessageData *pdata = NULL);
|
||||||
@@ -276,6 +276,7 @@ class BaseChannel
|
|||||||
MediaChannel *media_channel_;
|
MediaChannel *media_channel_;
|
||||||
|
|
||||||
std::string content_name_;
|
std::string content_name_;
|
||||||
|
bool rtcp_;
|
||||||
TransportChannel *transport_channel_;
|
TransportChannel *transport_channel_;
|
||||||
TransportChannel *rtcp_transport_channel_;
|
TransportChannel *rtcp_transport_channel_;
|
||||||
SrtpFilter srtp_filter_;
|
SrtpFilter srtp_filter_;
|
||||||
@@ -297,7 +298,7 @@ class VoiceChannel : public BaseChannel {
|
|||||||
VoiceMediaChannel *channel, BaseSession *session,
|
VoiceMediaChannel *channel, BaseSession *session,
|
||||||
const std::string& content_name, bool rtcp);
|
const std::string& content_name, bool rtcp);
|
||||||
~VoiceChannel();
|
~VoiceChannel();
|
||||||
bool Init() {return true;}
|
bool Init();
|
||||||
|
|
||||||
// downcasts a MediaChannel
|
// downcasts a MediaChannel
|
||||||
virtual VoiceMediaChannel* media_channel() const {
|
virtual VoiceMediaChannel* media_channel() const {
|
||||||
@@ -430,8 +431,7 @@ class VideoChannel : public BaseChannel {
|
|||||||
const std::string& content_name, bool rtcp,
|
const std::string& content_name, bool rtcp,
|
||||||
VoiceChannel *voice_channel);
|
VoiceChannel *voice_channel);
|
||||||
~VideoChannel();
|
~VideoChannel();
|
||||||
bool Init() {return true;}
|
bool Init();
|
||||||
|
|
||||||
|
|
||||||
// downcasts a MediaChannel
|
// downcasts a MediaChannel
|
||||||
virtual VideoMediaChannel* media_channel() const {
|
virtual VideoMediaChannel* media_channel() const {
|
||||||
|
Reference in New Issue
Block a user