Move refcount and scoped_refptr to merge with libjingle. Deleted scoped_refptr_msg.h.
git-svn-id: http://webrtc.googlecode.com/svn/trunk@833 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
250cd6f41b
commit
7e08613bda
@ -632,10 +632,12 @@
|
||||
} ], # inside_chromium_build
|
||||
['peer_connection_dev==1', {
|
||||
'sources': [
|
||||
'<(libjingle_mods)/source/talk/base/refcount.h',
|
||||
'<(libjingle_mods)/source/talk/base/scoped_refptr.h',
|
||||
'<(libjingle_mods)/source/talk/p2p/client/fakeportallocator.h',
|
||||
'<(libjingle_mods)/source/talk/session/phone/channel.cc',
|
||||
'<(libjingle_mods)/source/talk/session/phone/channel.h',
|
||||
'<(libjingle_mods)/source/talk/session/phone/mediasession.cc',
|
||||
'<(libjingle_mods)/source/talk/session/phone/mediasession.cc',
|
||||
],
|
||||
},{
|
||||
'sources': [
|
||||
@ -716,7 +718,7 @@
|
||||
'<(libjingle_mods)/source/talk/app/webrtc_dev/peerconnectionmessage.h',
|
||||
'<(libjingle_mods)/source/talk/app/webrtc_dev/peerconnectionsignaling.cc',
|
||||
'<(libjingle_mods)/source/talk/app/webrtc_dev/peerconnectionsignaling.h',
|
||||
'<(libjingle_mods)/source/talk/app/webrtc_dev/refcount.h',
|
||||
|
||||
'<(libjingle_mods)/source/talk/app/webrtc_dev/sessiondescriptionprovider.h'
|
||||
'<(libjingle_mods)/source/talk/app/webrtc_dev/streamcollectionimpl.h',
|
||||
'<(libjingle_mods)/source/talk/app/webrtc_dev/videorendererimpl.cc',
|
||||
|
@ -56,16 +56,16 @@ std::string AudioTrack::kind() const {
|
||||
talk_base::scoped_refptr<AudioTrack> AudioTrack::CreateRemote(
|
||||
const std::string& label,
|
||||
uint32 ssrc) {
|
||||
talk_base::RefCount<AudioTrack>* track =
|
||||
new talk_base::RefCount<AudioTrack>(label, ssrc);
|
||||
talk_base::RefCountedObject<AudioTrack>* track =
|
||||
new talk_base::RefCountedObject<AudioTrack>(label, ssrc);
|
||||
return track;
|
||||
}
|
||||
|
||||
talk_base::scoped_refptr<AudioTrack> AudioTrack::CreateLocal(
|
||||
const std::string& label,
|
||||
AudioDeviceModule* audio_device) {
|
||||
talk_base::RefCount<AudioTrack>* track =
|
||||
new talk_base::RefCount<AudioTrack>(label, audio_device);
|
||||
talk_base::RefCountedObject<AudioTrack>* track =
|
||||
new talk_base::RefCountedObject<AudioTrack>(label, audio_device);
|
||||
return track;
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "talk/app/webrtc_dev/mediastream.h"
|
||||
#include "talk/app/webrtc_dev/mediatrackimpl.h"
|
||||
#include "talk/app/webrtc_dev/notifierimpl.h"
|
||||
#include "talk/app/webrtc_dev/scoped_refptr.h"
|
||||
#include "talk/base/scoped_refptr.h"
|
||||
|
||||
#ifdef WEBRTC_RELATIVE_PATH
|
||||
#include "modules/audio_device/main/interface/audio_device.h"
|
||||
|
@ -36,9 +36,9 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "talk/app/webrtc_dev/refcount.h"
|
||||
#include "talk/app/webrtc_dev/scoped_refptr.h"
|
||||
#include "talk/base/basictypes.h"
|
||||
#include "talk/base/refcount.h"
|
||||
#include "talk/base/scoped_refptr.h"
|
||||
|
||||
namespace cricket {
|
||||
class VideoRenderer;
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "gtest/gtest.h"
|
||||
#include "talk/app/webrtc_dev/mediastreamproxy.h"
|
||||
#include "talk/app/webrtc_dev/mediastreamtrackproxy.h"
|
||||
#include "talk/app/webrtc_dev/refcount.h"
|
||||
#include "talk/base/refcount.h"
|
||||
#include "talk/base/scoped_ptr.h"
|
||||
#include "talk/base/thread.h"
|
||||
|
||||
@ -253,7 +253,7 @@ class MediaStreamTest: public testing::Test,
|
||||
// Create a stream proxy object that uses our mocked
|
||||
// version of a LocalMediaStream.
|
||||
scoped_refptr<MockMediaStream> mock_stream(
|
||||
new talk_base::RefCount<MockMediaStream>(label,
|
||||
new talk_base::RefCountedObject<MockMediaStream>(label,
|
||||
signaling_thread_.get()));
|
||||
stream_ = MediaStreamProxy::Create(label, signaling_thread_.get(),
|
||||
mock_stream);
|
||||
@ -266,7 +266,7 @@ class MediaStreamTest: public testing::Test,
|
||||
scoped_refptr<VideoTrack> video_track_impl(
|
||||
VideoTrack::CreateLocal(kVideoTrackLabel, NULL));
|
||||
scoped_refptr<MockLocalVideoTrack> mock_videotrack(
|
||||
new talk_base::RefCount<MockLocalVideoTrack>(video_track_impl,
|
||||
new talk_base::RefCountedObject<MockLocalVideoTrack>(video_track_impl,
|
||||
signaling_thread_.get()));
|
||||
video_track_ = VideoTrackProxy::CreateLocal(mock_videotrack,
|
||||
signaling_thread_.get());
|
||||
@ -280,7 +280,7 @@ class MediaStreamTest: public testing::Test,
|
||||
scoped_refptr<AudioTrack> audio_track_impl(
|
||||
AudioTrack::CreateLocal(kAudioTrackLabel, NULL));
|
||||
scoped_refptr<MockLocalAudioTrack> mock_audiotrack(
|
||||
new talk_base::RefCount<MockLocalAudioTrack>(audio_track_impl,
|
||||
new talk_base::RefCountedObject<MockLocalAudioTrack>(audio_track_impl,
|
||||
signaling_thread_.get()));
|
||||
audio_track_ = AudioTrackProxy::CreateLocal(mock_audiotrack,
|
||||
signaling_thread_.get());
|
||||
|
@ -27,8 +27,6 @@
|
||||
|
||||
#include "talk/app/webrtc_dev/mediastreamhandler.h"
|
||||
|
||||
#include "talk/app/webrtc_dev/scoped_refptr_msg.h"
|
||||
|
||||
#ifdef WEBRTC_RELATIVE_PATH
|
||||
#include "modules/video_capture/main/interface/video_capture.h"
|
||||
#else
|
||||
|
@ -32,8 +32,8 @@ namespace webrtc {
|
||||
|
||||
talk_base::scoped_refptr<MediaStream> MediaStream::Create(
|
||||
const std::string& label) {
|
||||
talk_base::RefCount<MediaStream>* stream =
|
||||
new talk_base::RefCount<MediaStream>(label);
|
||||
talk_base::RefCountedObject<MediaStream>* stream =
|
||||
new talk_base::RefCountedObject<MediaStream>(label);
|
||||
return stream;
|
||||
}
|
||||
|
||||
@ -41,10 +41,10 @@ MediaStream::MediaStream(const std::string& label)
|
||||
: label_(label),
|
||||
ready_state_(MediaStreamInterface::kInitializing),
|
||||
audio_track_list_(
|
||||
new talk_base::RefCount<
|
||||
new talk_base::RefCountedObject<
|
||||
MediaStreamTrackList<AudioTrackInterface> >()),
|
||||
video_track_list_(
|
||||
new talk_base::RefCount<
|
||||
new talk_base::RefCountedObject<
|
||||
MediaStreamTrackList<VideoTrackInterface> >()) {
|
||||
}
|
||||
|
||||
|
@ -26,8 +26,8 @@
|
||||
*/
|
||||
|
||||
#include "talk/app/webrtc_dev/mediastreamproxy.h"
|
||||
#include "talk/app/webrtc_dev/refcount.h"
|
||||
#include "talk/app/webrtc_dev/scoped_refptr.h"
|
||||
#include "talk/base/refcount.h"
|
||||
#include "talk/base/scoped_refptr.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@ -92,8 +92,8 @@ talk_base::scoped_refptr<MediaStreamProxy> MediaStreamProxy::Create(
|
||||
const std::string& label,
|
||||
talk_base::Thread* signaling_thread) {
|
||||
ASSERT(signaling_thread);
|
||||
talk_base::RefCount<MediaStreamProxy>* stream =
|
||||
new talk_base::RefCount<MediaStreamProxy>(
|
||||
talk_base::RefCountedObject<MediaStreamProxy>* stream =
|
||||
new talk_base::RefCountedObject<MediaStreamProxy>(
|
||||
label, signaling_thread,
|
||||
reinterpret_cast<LocalMediaStreamInterface*>(NULL));
|
||||
return stream;
|
||||
@ -105,8 +105,8 @@ talk_base::scoped_refptr<MediaStreamProxy> MediaStreamProxy::Create(
|
||||
LocalMediaStreamInterface* media_stream_impl) {
|
||||
ASSERT(signaling_thread);
|
||||
ASSERT(media_stream_impl);
|
||||
talk_base::RefCount<MediaStreamProxy>* stream =
|
||||
new talk_base::RefCount<MediaStreamProxy>(label, signaling_thread,
|
||||
talk_base::RefCountedObject<MediaStreamProxy>* stream =
|
||||
new talk_base::RefCountedObject<MediaStreamProxy>(label, signaling_thread,
|
||||
media_stream_impl);
|
||||
return stream;
|
||||
}
|
||||
@ -116,10 +116,10 @@ MediaStreamProxy::MediaStreamProxy(const std::string& label,
|
||||
LocalMediaStreamInterface* media_stream_impl)
|
||||
: signaling_thread_(signaling_thread),
|
||||
media_stream_impl_(media_stream_impl),
|
||||
audio_tracks_(new talk_base::RefCount<
|
||||
audio_tracks_(new talk_base::RefCountedObject<
|
||||
MediaStreamTrackListProxy<AudioTrackInterface> >(
|
||||
signaling_thread_)),
|
||||
video_tracks_(new talk_base::RefCount<
|
||||
video_tracks_(new talk_base::RefCountedObject<
|
||||
MediaStreamTrackListProxy<VideoTrackInterface> >(
|
||||
signaling_thread_)) {
|
||||
if (media_stream_impl_ == NULL) {
|
||||
|
@ -26,7 +26,6 @@
|
||||
*/
|
||||
|
||||
#include "talk/app/webrtc_dev/mediastreamtrackproxy.h"
|
||||
#include "talk/app/webrtc_dev/scoped_refptr_msg.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@ -266,8 +265,8 @@ talk_base::scoped_refptr<AudioTrackInterface> AudioTrackProxy::CreateRemote(
|
||||
uint32 ssrc,
|
||||
talk_base::Thread* signaling_thread) {
|
||||
ASSERT(signaling_thread);
|
||||
talk_base::RefCount<AudioTrackProxy>* track =
|
||||
new talk_base::RefCount<AudioTrackProxy>(label, ssrc,
|
||||
talk_base::RefCountedObject<AudioTrackProxy>* track =
|
||||
new talk_base::RefCountedObject<AudioTrackProxy>(label, ssrc,
|
||||
signaling_thread);
|
||||
return track;
|
||||
}
|
||||
@ -277,8 +276,8 @@ talk_base::scoped_refptr<LocalAudioTrackInterface> AudioTrackProxy::CreateLocal(
|
||||
AudioDeviceModule* audio_device,
|
||||
talk_base::Thread* signaling_thread) {
|
||||
ASSERT(signaling_thread);
|
||||
talk_base::RefCount<AudioTrackProxy>* track =
|
||||
new talk_base::RefCount<AudioTrackProxy>(label,
|
||||
talk_base::RefCountedObject<AudioTrackProxy>* track =
|
||||
new talk_base::RefCountedObject<AudioTrackProxy>(label,
|
||||
audio_device,
|
||||
signaling_thread);
|
||||
return track;
|
||||
@ -288,8 +287,8 @@ talk_base::scoped_refptr<LocalAudioTrackInterface> AudioTrackProxy::CreateLocal(
|
||||
LocalAudioTrackInterface* implementation,
|
||||
talk_base::Thread* signaling_thread) {
|
||||
ASSERT(signaling_thread);
|
||||
talk_base::RefCount<AudioTrackProxy>* track =
|
||||
new talk_base::RefCount<AudioTrackProxy>(implementation,
|
||||
talk_base::RefCountedObject<AudioTrackProxy>* track =
|
||||
new talk_base::RefCountedObject<AudioTrackProxy>(implementation,
|
||||
signaling_thread);
|
||||
return track;
|
||||
}
|
||||
@ -343,8 +342,8 @@ talk_base::scoped_refptr<VideoTrackInterface> VideoTrackProxy::CreateRemote(
|
||||
uint32 ssrc,
|
||||
talk_base::Thread* signaling_thread) {
|
||||
ASSERT(signaling_thread);
|
||||
talk_base::RefCount<VideoTrackProxy>* track =
|
||||
new talk_base::RefCount<VideoTrackProxy>(label, ssrc,
|
||||
talk_base::RefCountedObject<VideoTrackProxy>* track =
|
||||
new talk_base::RefCountedObject<VideoTrackProxy>(label, ssrc,
|
||||
signaling_thread);
|
||||
return track;
|
||||
}
|
||||
@ -354,8 +353,8 @@ talk_base::scoped_refptr<LocalVideoTrackInterface> VideoTrackProxy::CreateLocal(
|
||||
VideoCaptureModule* video_device,
|
||||
talk_base::Thread* signaling_thread) {
|
||||
ASSERT(signaling_thread);
|
||||
talk_base::RefCount<VideoTrackProxy>* track =
|
||||
new talk_base::RefCount<VideoTrackProxy>(label, video_device,
|
||||
talk_base::RefCountedObject<VideoTrackProxy>* track =
|
||||
new talk_base::RefCountedObject<VideoTrackProxy>(label, video_device,
|
||||
signaling_thread);
|
||||
return track;
|
||||
}
|
||||
@ -364,8 +363,8 @@ talk_base::scoped_refptr<LocalVideoTrackInterface> VideoTrackProxy::CreateLocal(
|
||||
LocalVideoTrackInterface* implementation,
|
||||
talk_base::Thread* signaling_thread) {
|
||||
ASSERT(signaling_thread);
|
||||
talk_base::RefCount<VideoTrackProxy>* track =
|
||||
new talk_base::RefCount<VideoTrackProxy>(implementation,
|
||||
talk_base::RefCountedObject<VideoTrackProxy>* track =
|
||||
new talk_base::RefCountedObject<VideoTrackProxy>(implementation,
|
||||
signaling_thread);
|
||||
return track;
|
||||
}
|
||||
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* libjingle
|
||||
* Copyright 2004--2011, Google Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "talk/app/webrtc/peerconnectionmanager.h"
|
||||
#include "talk/base/logging.h"
|
||||
#include "talk/p2p/client/basicportallocator.h"
|
||||
|
||||
int main() {
|
||||
LOG(INFO) << "Create PeerConnectionManager.";
|
||||
|
||||
talk_base::scoped_ptr<cricket::PortAllocator> port_allocator_;
|
||||
talk_base::scoped_ptr<talk_base::Thread> worker_thread_;
|
||||
|
||||
port_allocator_.reset(new cricket::BasicPortAllocator(
|
||||
new talk_base::BasicNetworkManager(),
|
||||
talk_base::SocketAddress("stun.l.google.com", 19302),
|
||||
talk_base::SocketAddress(),
|
||||
talk_base::SocketAddress(), talk_base::SocketAddress()));
|
||||
|
||||
worker_thread_.reset(new talk_base::Thread());
|
||||
if (!worker_thread_->SetName("workder thread", NULL) ||
|
||||
!worker_thread_->Start()) {
|
||||
LOG(WARNING) << "Failed to start libjingle workder thread";
|
||||
}
|
||||
|
||||
webrtc::PeerConnectionManager* peerconnection_manager =
|
||||
webrtc::PeerConnectionManager::Create(port_allocator_.get(),
|
||||
worker_thread_.get());
|
||||
return 0;
|
||||
}
|
@ -30,7 +30,6 @@
|
||||
#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"
|
||||
#include "talk/session/phone/channelmanager.h"
|
||||
@ -117,6 +116,12 @@ struct SignalingParams : public talk_base::MessageData {
|
||||
talk_base::scoped_refptr<webrtc::StreamCollectionInterface> local_streams;
|
||||
};
|
||||
|
||||
struct StreamCollectionParams : public talk_base::MessageData {
|
||||
explicit StreamCollectionParams(webrtc::StreamCollectionInterface* streams)
|
||||
: streams(streams) {}
|
||||
talk_base::scoped_refptr<webrtc::StreamCollectionInterface> streams;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace webrtc {
|
||||
@ -206,10 +211,9 @@ PeerConnectionImpl::local_streams() {
|
||||
|
||||
talk_base::scoped_refptr<StreamCollectionInterface>
|
||||
PeerConnectionImpl::remote_streams() {
|
||||
ScopedRefMessageData<StreamCollectionInterface>* msg =
|
||||
new ScopedRefMessageData<StreamCollectionInterface>(NULL);
|
||||
signaling_thread_->Send(this, MSG_RETURNREMOTEMEDIASTREAMS, msg);
|
||||
return msg->data();
|
||||
StreamCollectionParams msg(NULL);
|
||||
signaling_thread_->Send(this, MSG_RETURNREMOTEMEDIASTREAMS, &msg);
|
||||
return msg.streams;
|
||||
}
|
||||
|
||||
bool PeerConnectionImpl::ProcessSignalingMessage(const std::string& msg) {
|
||||
@ -228,9 +232,8 @@ void PeerConnectionImpl::RemoveStream(
|
||||
}
|
||||
|
||||
void PeerConnectionImpl::CommitStreamChanges() {
|
||||
ScopedRefMessageData<StreamCollectionInterface>* msg =
|
||||
new ScopedRefMessageData<StreamCollectionInterface> (
|
||||
StreamCollectionImpl::Create(local_media_streams_));
|
||||
StreamCollectionParams* msg(new StreamCollectionParams(
|
||||
StreamCollectionImpl::Create(local_media_streams_)));
|
||||
signaling_thread_->Post(this, MSG_COMMITSTREAMCHANGES, msg);
|
||||
}
|
||||
|
||||
@ -238,10 +241,10 @@ void PeerConnectionImpl::OnMessage(talk_base::Message* msg) {
|
||||
talk_base::MessageData* data = msg->pdata;
|
||||
switch (msg->message_id) {
|
||||
case MSG_COMMITSTREAMCHANGES: {
|
||||
ScopedRefMessageData<StreamCollectionInterface>* param(
|
||||
static_cast<ScopedRefMessageData<StreamCollectionInterface>*> (data));
|
||||
signaling_->CreateOffer(param->data());
|
||||
stream_handler_->CommitLocalStreams(param->data());
|
||||
StreamCollectionParams* param(
|
||||
static_cast<StreamCollectionParams*> (data));
|
||||
signaling_->CreateOffer(param->streams);
|
||||
stream_handler_->CommitLocalStreams(param->streams);
|
||||
delete data; // Because it is Posted.
|
||||
break;
|
||||
}
|
||||
@ -252,9 +255,9 @@ void PeerConnectionImpl::OnMessage(talk_base::Message* msg) {
|
||||
break;
|
||||
}
|
||||
case MSG_RETURNREMOTEMEDIASTREAMS: {
|
||||
ScopedRefMessageData<StreamCollectionInterface>* param(
|
||||
static_cast<ScopedRefMessageData<StreamCollectionInterface>*> (data));
|
||||
param->data() = StreamCollectionImpl::Create(remote_media_streams_);
|
||||
StreamCollectionParams* param(
|
||||
static_cast<StreamCollectionParams*> (data));
|
||||
param->streams = StreamCollectionImpl::Create(remote_media_streams_);
|
||||
break;
|
||||
}
|
||||
case MSG_TERMINATE: {
|
||||
|
@ -66,8 +66,8 @@ namespace webrtc {
|
||||
|
||||
talk_base::scoped_refptr<PcNetworkManager> PcNetworkManager::Create(
|
||||
talk_base::NetworkManager* network_manager) {
|
||||
talk_base::RefCount<PcNetworkManager>* implementation =
|
||||
new talk_base::RefCount<PcNetworkManager>(network_manager);
|
||||
talk_base::RefCountedObject<PcNetworkManager>* implementation =
|
||||
new talk_base::RefCountedObject<PcNetworkManager>(network_manager);
|
||||
return implementation;
|
||||
}
|
||||
|
||||
@ -85,8 +85,8 @@ PcNetworkManager::~PcNetworkManager() {
|
||||
|
||||
talk_base::scoped_refptr<PcPacketSocketFactory> PcPacketSocketFactory::Create(
|
||||
talk_base::PacketSocketFactory* socket_factory) {
|
||||
talk_base::RefCount<PcPacketSocketFactory>* implementation =
|
||||
new talk_base::RefCount<PcPacketSocketFactory>(socket_factory);
|
||||
talk_base::RefCountedObject<PcPacketSocketFactory>* implementation =
|
||||
new talk_base::RefCountedObject<PcPacketSocketFactory>(socket_factory);
|
||||
return implementation;
|
||||
}
|
||||
|
||||
@ -105,8 +105,8 @@ talk_base::PacketSocketFactory* PcPacketSocketFactory::socket_factory() const {
|
||||
|
||||
talk_base::scoped_refptr<PeerConnectionManager>
|
||||
PeerConnectionManager::Create() {
|
||||
talk_base::RefCount<PeerConnectionManagerImpl>* pc_manager =
|
||||
new talk_base::RefCount<PeerConnectionManagerImpl>();
|
||||
talk_base::RefCountedObject<PeerConnectionManagerImpl>* pc_manager =
|
||||
new talk_base::RefCountedObject<PeerConnectionManagerImpl>();
|
||||
|
||||
if (!pc_manager->Initialize()) {
|
||||
delete pc_manager;
|
||||
@ -121,8 +121,8 @@ talk_base::scoped_refptr<PeerConnectionManager> PeerConnectionManager::Create(
|
||||
PcNetworkManager* network_manager,
|
||||
PcPacketSocketFactory* socket_factory,
|
||||
AudioDeviceModule* default_adm) {
|
||||
talk_base::RefCount<PeerConnectionManagerImpl>* pc_manager =
|
||||
new talk_base::RefCount<PeerConnectionManagerImpl>(worker_thread,
|
||||
talk_base::RefCountedObject<PeerConnectionManagerImpl>* pc_manager =
|
||||
new talk_base::RefCountedObject<PeerConnectionManagerImpl>(worker_thread,
|
||||
signaling_thread,
|
||||
network_manager,
|
||||
socket_factory,
|
||||
@ -226,8 +226,8 @@ talk_base::scoped_refptr<PeerConnectionInterface>
|
||||
PeerConnectionManagerImpl::CreatePeerConnection_s(
|
||||
const std::string& configuration,
|
||||
PeerConnectionObserver* observer) {
|
||||
talk_base::RefCount<PeerConnectionImpl>* pc(
|
||||
new talk_base::RefCount<PeerConnectionImpl>(channel_manager_.get(),
|
||||
talk_base::RefCountedObject<PeerConnectionImpl>* pc(
|
||||
new talk_base::RefCountedObject<PeerConnectionImpl>(channel_manager_.get(),
|
||||
signaling_thread_ptr_,
|
||||
worker_thread_ptr_,
|
||||
network_manager_,
|
||||
|
@ -29,9 +29,9 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "talk/base/scoped_ptr.h"
|
||||
#include "talk/app/webrtc_dev/peerconnection.h"
|
||||
#include "talk/app/webrtc_dev/mediastream.h"
|
||||
#include "talk/base/scoped_ptr.h"
|
||||
#include "talk/base/thread.h"
|
||||
#include "talk/session/phone/channelmanager.h"
|
||||
|
||||
|
@ -34,10 +34,10 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "talk/app/webrtc_dev/refcount.h"
|
||||
#include "talk/app/webrtc_dev/scoped_refptr.h"
|
||||
#include "talk/base/refcount.h"
|
||||
#include "talk/base/basictypes.h"
|
||||
#include "talk/base/scoped_ptr.h"
|
||||
#include "talk/base/scoped_refptr.h"
|
||||
#include "talk/session/phone/mediasession.h"
|
||||
#include "talk/p2p/base/sessiondescription.h"
|
||||
|
||||
|
@ -40,13 +40,13 @@
|
||||
#include "talk/app/webrtc_dev/mediastreamproxy.h"
|
||||
#include "talk/app/webrtc_dev/peerconnection.h"
|
||||
#include "talk/app/webrtc_dev/peerconnectionmessage.h"
|
||||
#include "talk/app/webrtc_dev/refcount.h"
|
||||
#include "talk/app/webrtc_dev/scoped_refptr.h"
|
||||
#include "talk/app/webrtc_dev/sessiondescriptionprovider.h"
|
||||
#include "talk/app/webrtc_dev/webrtcsessionobserver.h"
|
||||
#include "talk/base/basictypes.h"
|
||||
#include "talk/base/messagehandler.h"
|
||||
#include "talk/base/refcount.h"
|
||||
#include "talk/base/scoped_ptr.h"
|
||||
#include "talk/base/scoped_refptr.h"
|
||||
#include "talk/base/thread.h"
|
||||
#include "talk/session/phone/mediasession.h"
|
||||
#include "talk/p2p/base/sessiondescription.h"
|
||||
|
@ -1,89 +0,0 @@
|
||||
/*
|
||||
* libjingle
|
||||
* Copyright 2011, Google Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef TALK_APP_WEBRTC_REF_COUNT_H_
|
||||
#define TALK_APP_WEBRTC_REF_COUNT_H_
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "talk/base/criticalsection.h"
|
||||
|
||||
namespace talk_base {
|
||||
|
||||
// Reference count interface.
|
||||
class RefCountInterface {
|
||||
public:
|
||||
virtual int AddRef() = 0;
|
||||
virtual int Release() = 0;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class RefCount : public T {
|
||||
public:
|
||||
RefCount() : ref_count_(0) {
|
||||
}
|
||||
|
||||
template<typename P>
|
||||
explicit RefCount(P p) : ref_count_(0), T(p) {
|
||||
}
|
||||
|
||||
template<typename P1, typename P2>
|
||||
RefCount(P1 p1, P2 p2) : ref_count_(0), T(p1, p2) {
|
||||
}
|
||||
|
||||
template<typename P1, typename P2, typename P3>
|
||||
RefCount(P1 p1, P2 p2, P3 p3) : ref_count_(0), T(p1, p2, p3) {
|
||||
}
|
||||
|
||||
template<typename P1, typename P2, typename P3, typename P4>
|
||||
RefCount(P1 p1, P2 p2, P3 p3, P4 p4) : ref_count_(0), T(p1, p2, p3, p4) {
|
||||
}
|
||||
|
||||
template<typename P1, typename P2, typename P3, typename P4, typename P5>
|
||||
RefCount(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
|
||||
: ref_count_(0), T(p1, p2, p3, p4, p5) {
|
||||
}
|
||||
|
||||
virtual int AddRef() {
|
||||
return talk_base::AtomicOps::Increment(&ref_count_);
|
||||
}
|
||||
|
||||
virtual int Release() {
|
||||
int count = talk_base::AtomicOps::Decrement(&ref_count_);
|
||||
if (!count) {
|
||||
delete this;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
protected:
|
||||
int ref_count_;
|
||||
};
|
||||
|
||||
} // namespace talk_base
|
||||
|
||||
#endif // TALK_APP_WEBRTC_REF_COUNT_H_
|
@ -1,132 +0,0 @@
|
||||
#ifndef TALK_APP_WEBRTC_SCOPED_REFPTR_H_
|
||||
#define TALK_APP_WEBRTC_SCOPED_REFPTR_H_
|
||||
// Originally these classes are copied from Chromium.
|
||||
|
||||
//
|
||||
// A smart pointer class for reference counted objects. Use this class instead
|
||||
// of calling AddRef and Release manually on a reference counted object to
|
||||
// avoid common memory leaks caused by forgetting to Release an object
|
||||
// reference. Sample usage:
|
||||
//
|
||||
// class MyFoo : public RefCounted<MyFoo> {
|
||||
// ...
|
||||
// };
|
||||
//
|
||||
// void some_function() {
|
||||
// scoped_refptr<MyFoo> foo = new MyFoo();
|
||||
// foo->Method(param);
|
||||
// // |foo| is released when this function returns
|
||||
// }
|
||||
//
|
||||
// void some_other_function() {
|
||||
// scoped_refptr<MyFoo> foo = new MyFoo();
|
||||
// ...
|
||||
// foo = NULL; // explicitly releases |foo|
|
||||
// ...
|
||||
// if (foo)
|
||||
// foo->Method(param);
|
||||
// }
|
||||
//
|
||||
// The above examples show how scoped_refptr<T> acts like a pointer to T.
|
||||
// Given two scoped_refptr<T> classes, it is also possible to exchange
|
||||
// references between the two objects, like so:
|
||||
//
|
||||
// {
|
||||
// scoped_refptr<MyFoo> a = new MyFoo();
|
||||
// scoped_refptr<MyFoo> b;
|
||||
//
|
||||
// b.swap(a);
|
||||
// // now, |b| references the MyFoo object, and |a| references NULL.
|
||||
// }
|
||||
//
|
||||
// To make both |a| and |b| in the above example reference the same MyFoo
|
||||
// object, simply use the assignment operator:
|
||||
//
|
||||
// {
|
||||
// scoped_refptr<MyFoo> a = new MyFoo();
|
||||
// scoped_refptr<MyFoo> b;
|
||||
//
|
||||
// b = a;
|
||||
// // now, |a| and |b| each own a reference to the same MyFoo object.
|
||||
// }
|
||||
//
|
||||
namespace talk_base {
|
||||
|
||||
template <class T>
|
||||
class scoped_refptr {
|
||||
public:
|
||||
scoped_refptr() : ptr_(NULL) {
|
||||
}
|
||||
|
||||
scoped_refptr(T* p) : ptr_(p) {
|
||||
if (ptr_)
|
||||
ptr_->AddRef();
|
||||
}
|
||||
|
||||
scoped_refptr(const scoped_refptr<T>& r) : ptr_(r.ptr_) {
|
||||
if (ptr_)
|
||||
ptr_->AddRef();
|
||||
}
|
||||
|
||||
template <typename U>
|
||||
scoped_refptr(const scoped_refptr<U>& r) : ptr_(r.get()) {
|
||||
if (ptr_)
|
||||
ptr_->AddRef();
|
||||
}
|
||||
|
||||
~scoped_refptr() {
|
||||
if (ptr_)
|
||||
ptr_->Release();
|
||||
}
|
||||
|
||||
T* get() const { return ptr_; }
|
||||
operator T*() const { return ptr_; }
|
||||
T* operator->() const { return ptr_; }
|
||||
|
||||
// Release a pointer.
|
||||
// The return value is the current pointer held by this object.
|
||||
// If this object holds a NULL pointer, the return value is NULL.
|
||||
// After this operation, this object will hold a NULL pointer,
|
||||
// and will not own the object any more.
|
||||
T* release() {
|
||||
T* retVal = ptr_;
|
||||
ptr_ = NULL;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
scoped_refptr<T>& operator=(T* p) {
|
||||
// AddRef first so that self assignment should work
|
||||
if (p)
|
||||
p->AddRef();
|
||||
if (ptr_ )
|
||||
ptr_ ->Release();
|
||||
ptr_ = p;
|
||||
return *this;
|
||||
}
|
||||
|
||||
scoped_refptr<T>& operator=(const scoped_refptr<T>& r) {
|
||||
return *this = r.ptr_;
|
||||
}
|
||||
|
||||
template <typename U>
|
||||
scoped_refptr<T>& operator=(const scoped_refptr<U>& r) {
|
||||
return *this = r.get();
|
||||
}
|
||||
|
||||
void swap(T** pp) {
|
||||
T* p = ptr_;
|
||||
ptr_ = *pp;
|
||||
*pp = p;
|
||||
}
|
||||
|
||||
void swap(scoped_refptr<T>& r) {
|
||||
swap(&r.ptr_);
|
||||
}
|
||||
|
||||
protected:
|
||||
T* ptr_;
|
||||
};
|
||||
|
||||
} // namespace talk_base
|
||||
|
||||
#endif // TALK_APP_WEBRTC_SCOPED_REFPTR_H_
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* libjingle
|
||||
* Copyright 2011, Google Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef TALK_APP_WEBRTC_SCOPED_REF_PTR_MSG_H_
|
||||
#define TALK_APP_WEBRTC_SCOPED_REF_PTR_MSG_H_
|
||||
|
||||
|
||||
#include "talk/base/messagequeue.h"
|
||||
|
||||
// Like ScopedRefMessageData, but for reference counting pointers.
|
||||
template <class T>
|
||||
class ScopedRefMessageData : public talk_base::MessageData {
|
||||
public:
|
||||
explicit ScopedRefMessageData(T* data) : data_(data) { }
|
||||
const talk_base::scoped_refptr<T>& data() const { return data_; }
|
||||
talk_base::scoped_refptr<T>& data() { return data_; }
|
||||
private:
|
||||
talk_base::scoped_refptr<T> data_;
|
||||
};
|
||||
/*
|
||||
struct ScopedTypedMessageData : public talk_base::MessageData {
|
||||
ScopedRefPtrMsgParams(talk_base::scoped_refptr<T> ptr)
|
||||
: ptr_(ptr) {
|
||||
}
|
||||
talk_base::scoped_refptr<T> ptr_;
|
||||
};*/
|
||||
|
||||
#endif // TALK_APP_WEBRTC_SCOPED_REF_PTR_MSG_H_
|
@ -39,15 +39,15 @@ namespace webrtc {
|
||||
class StreamCollectionImpl : public StreamCollectionInterface {
|
||||
public:
|
||||
static talk_base::scoped_refptr<StreamCollectionImpl> Create() {
|
||||
talk_base::RefCount<StreamCollectionImpl>* implementation =
|
||||
new talk_base::RefCount<StreamCollectionImpl>();
|
||||
talk_base::RefCountedObject<StreamCollectionImpl>* implementation =
|
||||
new talk_base::RefCountedObject<StreamCollectionImpl>();
|
||||
return implementation;
|
||||
}
|
||||
|
||||
static talk_base::scoped_refptr<StreamCollectionImpl> Create(
|
||||
StreamCollectionImpl* streams) {
|
||||
talk_base::RefCount<StreamCollectionImpl>* implementation =
|
||||
new talk_base::RefCount<StreamCollectionImpl>(streams);
|
||||
talk_base::RefCountedObject<StreamCollectionImpl>* implementation =
|
||||
new talk_base::RefCountedObject<StreamCollectionImpl>(streams);
|
||||
return implementation;
|
||||
}
|
||||
|
||||
|
@ -50,8 +50,8 @@ class VideoRendererImpl : public VideoRendererWrapperInterface {
|
||||
|
||||
talk_base::scoped_refptr<VideoRendererWrapperInterface> CreateVideoRenderer(
|
||||
cricket::VideoRenderer* renderer) {
|
||||
talk_base::RefCount<VideoRendererImpl>* r =
|
||||
new talk_base::RefCount<VideoRendererImpl>(renderer);
|
||||
talk_base::RefCountedObject<VideoRendererImpl>* r =
|
||||
new talk_base::RefCountedObject<VideoRendererImpl>(renderer);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -64,16 +64,16 @@ std::string VideoTrack::kind() const {
|
||||
talk_base::scoped_refptr<VideoTrack> VideoTrack::CreateRemote(
|
||||
const std::string& label,
|
||||
uint32 ssrc) {
|
||||
talk_base::RefCount<VideoTrack>* track =
|
||||
new talk_base::RefCount<VideoTrack>(label, ssrc);
|
||||
talk_base::RefCountedObject<VideoTrack>* track =
|
||||
new talk_base::RefCountedObject<VideoTrack>(label, ssrc);
|
||||
return track;
|
||||
}
|
||||
|
||||
talk_base::scoped_refptr<VideoTrack> VideoTrack::CreateLocal(
|
||||
const std::string& label,
|
||||
VideoCaptureModule* video_device) {
|
||||
talk_base::RefCount<VideoTrack>* track =
|
||||
new talk_base::RefCount<VideoTrack>(label, video_device);
|
||||
talk_base::RefCountedObject<VideoTrack>* track =
|
||||
new talk_base::RefCountedObject<VideoTrack>(label, video_device);
|
||||
return track;
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "talk/app/webrtc_dev/mediastream.h"
|
||||
#include "talk/app/webrtc_dev/mediatrackimpl.h"
|
||||
#include "talk/app/webrtc_dev/notifierimpl.h"
|
||||
#include "talk/app/webrtc_dev/scoped_refptr.h"
|
||||
#include "talk/base/scoped_refptr.h"
|
||||
|
||||
#ifdef WEBRTC_RELATIVE_PATH
|
||||
#include "modules/video_capture/main/interface/video_capture.h"
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#include "talk/examples/peerconnection_client/main_wnd.h"
|
||||
#include "talk/examples/peerconnection_client/peer_connection_client.h"
|
||||
#include "talk/app/webrtc_dev/scoped_refptr.h"
|
||||
#include "talk/base/scoped_refptr.h"
|
||||
|
||||
// Forward declarations.
|
||||
typedef struct _GtkWidget GtkWidget;
|
||||
|
Loading…
x
Reference in New Issue
Block a user