Connecting PeerConnectionImpl with WebrtcSession and MediaStreamHandlers.
This cl connects PeerConnectionImpl with WebrtcSession and MediaStreamHandlers. BUG= TEST= Review URL: http://webrtc-codereview.appspot.com/190005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@683 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
666f56bd41
commit
1b6ff7adbe
@ -29,6 +29,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "talk/app/webrtc_dev/mediastreamhandler.h"
|
||||
#include "talk/app/webrtc_dev/scoped_refptr_msg.h"
|
||||
#include "talk/app/webrtc_dev/streamcollectionimpl.h"
|
||||
#include "talk/base/logging.h"
|
||||
@ -122,6 +123,7 @@ namespace webrtc {
|
||||
PeerConnectionImpl::PeerConnectionImpl(
|
||||
cricket::ChannelManager* channel_manager,
|
||||
talk_base::Thread* signaling_thread,
|
||||
talk_base::Thread* worker_thread,
|
||||
PcNetworkManager* network_manager,
|
||||
PcPacketSocketFactory* socket_factory)
|
||||
: observer_(NULL),
|
||||
@ -135,7 +137,10 @@ PeerConnectionImpl::PeerConnectionImpl(
|
||||
socket_factory->socket_factory(),
|
||||
std::string(kUserAgent))),
|
||||
signaling_(new PeerConnectionSignaling(channel_manager,
|
||||
signaling_thread)) {
|
||||
signaling_thread)),
|
||||
session_(new WebRtcSession(channel_manager, signaling_thread,
|
||||
worker_thread, port_allocator_.get(), signaling_.get())),
|
||||
stream_handler_(new MediaStreamHandlers(session_.get())) {
|
||||
signaling_->SignalNewPeerConnectionMessage.connect(
|
||||
this, &PeerConnectionImpl::OnNewPeerConnectionMessage);
|
||||
signaling_->SignalRemoteStreamAdded.connect(
|
||||
@ -176,8 +181,8 @@ bool PeerConnectionImpl::Initialize(const std::string& configuration,
|
||||
ASSERT(!"NOT SUPPORTED");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
// Initialize the WebRtcSession. It creates transport channels etc.
|
||||
return session_->Initialize();
|
||||
}
|
||||
|
||||
scoped_refptr<StreamCollection> PeerConnectionImpl::local_streams() {
|
||||
@ -219,6 +224,7 @@ void PeerConnectionImpl::OnMessage(talk_base::Message* msg) {
|
||||
ScopedRefMessageData<StreamCollection>* param(
|
||||
static_cast<ScopedRefMessageData<StreamCollection>*> (data));
|
||||
signaling_->CreateOffer(param->data());
|
||||
stream_handler_->CommitLocalStreams(param->data());
|
||||
delete data; // Because it is Posted.
|
||||
break;
|
||||
}
|
||||
@ -247,6 +253,7 @@ void PeerConnectionImpl::OnRemoteStreamAdded(MediaStream* remote_stream) {
|
||||
// remote streams.
|
||||
// This way we can avoid keeping a separate list of remote_media_streams_.
|
||||
remote_media_streams_->AddStream(remote_stream);
|
||||
stream_handler_->AddRemoteStream(remote_stream);
|
||||
observer_->OnAddStream(remote_stream);
|
||||
}
|
||||
|
||||
@ -255,6 +262,7 @@ void PeerConnectionImpl::OnRemoteStreamRemoved(MediaStream* remote_stream) {
|
||||
// remote streams.
|
||||
// This way we can avoid keeping a separate list of remote_media_streams_.
|
||||
remote_media_streams_->RemoveStream(remote_stream);
|
||||
stream_handler_->RemoveRemoteStream(remote_stream);
|
||||
observer_->OnRemoveStream(remote_stream);
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
#include "talk/app/webrtc_dev/peerconnection.h"
|
||||
#include "talk/app/webrtc_dev/peerconnectionsignaling.h"
|
||||
#include "talk/app/webrtc_dev/webrtcsession.h"
|
||||
#include "talk/base/scoped_ptr.h"
|
||||
#include "talk/p2p/client/httpportallocator.h"
|
||||
|
||||
@ -41,8 +42,10 @@ class ChannelManager;
|
||||
}
|
||||
|
||||
namespace webrtc {
|
||||
class MediaStreamHandlers;
|
||||
class StreamCollectionImpl;
|
||||
|
||||
|
||||
// PeerConnectionImpl implements the PeerConnection interface.
|
||||
// It uses PeerConnectionSignaling and WebRtcSession to implement
|
||||
// the PeerConnection functionality.
|
||||
@ -52,6 +55,7 @@ class PeerConnectionImpl : public PeerConnection,
|
||||
public:
|
||||
PeerConnectionImpl(cricket::ChannelManager* channel_manager,
|
||||
talk_base::Thread* signaling_thread,
|
||||
talk_base::Thread* worker_thread,
|
||||
PcNetworkManager* network_manager,
|
||||
PcPacketSocketFactory* socket_factory);
|
||||
|
||||
@ -90,6 +94,8 @@ class PeerConnectionImpl : public PeerConnection,
|
||||
scoped_refptr<PcPacketSocketFactory> socket_factory_;
|
||||
talk_base::scoped_ptr<cricket::HttpPortAllocator> port_allocator_;
|
||||
talk_base::scoped_ptr<PeerConnectionSignaling> signaling_;
|
||||
talk_base::scoped_ptr<WebRtcSession> session_;
|
||||
talk_base::scoped_ptr<MediaStreamHandlers> stream_handler_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -172,6 +172,7 @@ scoped_refptr<PeerConnection> PeerConnectionManagerImpl::CreatePeerConnection(
|
||||
RefCountImpl<PeerConnectionImpl>* pc =
|
||||
new RefCountImpl<PeerConnectionImpl>(channel_manager_.get(),
|
||||
signaling_thread_ptr_,
|
||||
worker_thread_ptr_,
|
||||
network_manager_,
|
||||
socket_factory_);
|
||||
if (!pc->Initialize(configuration, observer)) {
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "talk/base/thread.h"
|
||||
#include "talk/p2p/base/session.h"
|
||||
#include "talk/session/phone/mediasession.h"
|
||||
#include "talk/app/webrtc_dev/mediastreamprovider.h"
|
||||
|
||||
namespace cricket {
|
||||
class ChannelManager;
|
||||
@ -49,7 +50,8 @@ class PeerConnectionMessage;
|
||||
class PeerConnectionSignaling;
|
||||
class StreamCollection;
|
||||
|
||||
class WebRtcSession : public cricket::BaseSession {
|
||||
class WebRtcSession : public cricket::BaseSession,
|
||||
public MediaProviderInterface {
|
||||
public:
|
||||
WebRtcSession(cricket::ChannelManager* channel_manager,
|
||||
talk_base::Thread* signaling_thread,
|
||||
@ -75,6 +77,14 @@ class WebRtcSession : public cricket::BaseSession {
|
||||
const cricket::SessionDescription* remote_desc);
|
||||
|
||||
private:
|
||||
// Implements MediaProviderInterface.
|
||||
// TODO(mallinath): Add proper implementation.
|
||||
virtual void SetCaptureDevice(uint32 ssrc, VideoCaptureModule* camera) {};
|
||||
virtual void SetLocalRenderer(uint32 ssrc,
|
||||
cricket::VideoRenderer* renderer) {};
|
||||
virtual void SetRemoteRenderer(uint32 ssrc,
|
||||
cricket::VideoRenderer* renderer) {};
|
||||
|
||||
// Callback handling from PeerConnectionSignaling
|
||||
void OnSignalUpdateSessionDescription(
|
||||
const cricket::SessionDescription* local_desc,
|
||||
|
Loading…
x
Reference in New Issue
Block a user