Modified include path after after moving files to webrtc_dev.

Review URL: http://webrtc-codereview.appspot.com/137010

git-svn-id: http://webrtc.googlecode.com/svn/trunk@485 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
perkj@google.com 2011-08-30 07:44:18 +00:00
parent 932096c84f
commit 3fcabbe45c
24 changed files with 197 additions and 54 deletions

View File

@ -656,9 +656,10 @@
['peer_connection_dev==1', {
'type': 'executable',
'sources': [
'<(libjingle_mods)/source/talk/app/peer_connection_dev/peerconnection_unittests.cc',
'<(libjingle_mods)/source/talk/app/peer_connection_dev/local_stream_dev_unittest.cc',
'<(libjingle_mods)/source/talk/app/peer_connection_dev/remote_stream_dev_unittest.cc',
'<(libjingle_mods)/source/talk/app/webrtc_dev/peerconnection_unittests.cc',
'<(libjingle_mods)/source/talk/app/webrtc_dev/local_stream_dev_unittest.cc',
'<(libjingle_mods)/source/talk/app/webrtc_dev/remote_stream_dev_unittest.cc',
'<(libjingle_mods)/source/talk/app/webrtc_dev/peerconnection_impl_dev_unittest.cc',
],
}, {
'type': 'none',

View File

@ -24,7 +24,7 @@
* 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/local_stream_dev.h"
#include "talk/app/webrtc_dev/local_stream_dev.h"
namespace webrtc {

View File

@ -24,7 +24,7 @@
* 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/local_stream_dev.h"
#include "talk/app/webrtc_dev/local_stream_dev.h"
namespace webrtc {

View File

@ -24,7 +24,7 @@
* 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/local_stream_dev.h"
#include "talk/app/webrtc_dev/local_stream_dev.h"
namespace webrtc {

View File

@ -28,8 +28,8 @@
#ifndef TALK_APP_WEBRTC_LOCAL_STREAM_H_
#define TALK_APP_WEBRTC_LOCAL_STREAM_H_
#include "talk/app/webrtc/media_stream_impl_dev.h"
#include "talk/app/webrtc/stream_dev.h"
#include "talk/app/webrtc_dev/media_stream_impl_dev.h"
#include "talk/app/webrtc_dev/stream_dev.h"
#include "talk/base/scoped_ptr.h"
namespace webrtc {

View File

@ -28,7 +28,7 @@
#include <string>
#include "gtest/gtest.h"
#include "talk/app/webrtc/local_stream_dev.h"
#include "talk/app/webrtc_dev/local_stream_dev.h"
static const char kStreamLabel1[] = "local_stream_1";
const char* kVideoDeviceName = "dummy_video_cam_1";

View File

@ -24,7 +24,7 @@
* 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/local_stream_dev.h"
#include "talk/app/webrtc_dev/local_stream_dev.h"
namespace webrtc {

View File

@ -25,7 +25,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "talk/app/webrtc/media_stream_impl_dev.h"
#include "talk/app/webrtc_dev/media_stream_impl_dev.h"
namespace webrtc {

View File

@ -31,10 +31,10 @@
#include <string>
#include <vector>
#include "talk/app/webrtc/notifier_impl.h"
#include "talk/app/webrtc/ref_count.h"
#include "talk/app/webrtc/scoped_refptr.h"
#include "talk/app/webrtc/stream_dev.h"
#include "talk/app/webrtc_dev/notifier_impl.h"
#include "talk/app/webrtc_dev/ref_count.h"
#include "talk/app/webrtc_dev/scoped_refptr.h"
#include "talk/app/webrtc_dev/stream_dev.h"
namespace webrtc {

View File

@ -31,7 +31,7 @@
#include <list>
#include "talk/base/common.h"
#include "talk/app/webrtc/stream_dev.h"
#include "talk/app/webrtc_dev/stream_dev.h"
namespace webrtc {

View File

@ -30,7 +30,7 @@
#include <string>
#include "talk/app/webrtc/stream_dev.h"
#include "talk/app/webrtc_dev/stream_dev.h"
namespace cricket {
class PortAllocator;
@ -109,6 +109,8 @@ class PeerConnection {
// and stop sending media on removed stream.
virtual void CommitStreamChanges() = 0;
protected:
// Dtor protected as objects shouldn't be deleted via this interface.
virtual ~PeerConnection() {}
};

View File

@ -26,24 +26,25 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "talk/app/webrtc/peerconnection_impl_dev.h"
#include "talk/app/webrtc_dev/peerconnection_impl_dev.h"
#include "talk/app/webrtc/webrtcsession.h"
#include "talk/app/webrtc_dev/scoped_refptr_msg.h"
#include "talk/base/logging.h"
#include "talk/session/phone/channelmanager.h"
#include "talk/p2p/base/portallocator.h"
namespace webrtc {
PeerConnectionImpl::PeerConnectionImpl(
cricket::ChannelManager* channel_manager,
cricket::PortAllocator* port_allocator)
cricket::PortAllocator* port_allocator,
talk_base::Thread* signal_thread)
: observer_(NULL),
session_(NULL),
worker_thread_(new talk_base::Thread()),
signal_thread_(signal_thread),
channel_manager_(channel_manager),
port_allocator_(port_allocator) {
ASSERT(port_allocator_ != NULL);
// TODO(perkj): // ASSERT(port_allocator_ != NULL);
}
PeerConnectionImpl::~PeerConnectionImpl() {
@ -54,11 +55,48 @@ void PeerConnectionImpl::RegisterObserver(PeerConnectionObserver* observer) {
}
void PeerConnectionImpl::AddStream(LocalMediaStream* local_stream) {
add_commit_queue_.push_back(local_stream);
ScopedRefMessageData<LocalMediaStream>* msg =
new ScopedRefMessageData<LocalMediaStream> (local_stream);
signal_thread_->Post(this, MSG_ADDMEDIASTREAM, msg);
}
void PeerConnectionImpl::RemoveStream(LocalMediaStream* remove_stream) {
remove_commit_queue_.push_back(remove_stream);
ScopedRefMessageData<LocalMediaStream>* msg =
new ScopedRefMessageData<LocalMediaStream> (remove_stream);
signal_thread_->Post(this, MSG_REMOVEMEDIASTREAM, msg);
}
} // namespace webrtc
void PeerConnectionImpl::CommitStreamChanges() {
signal_thread_->Post(this, MSG_COMMITSTREAMCHANGES);
}
void PeerConnectionImpl::OnMessage(talk_base::Message* msg) {
talk_base::MessageData* data = msg->pdata;
switch (msg->message_id) {
case MSG_ADDMEDIASTREAM: {
ScopedRefMessageData<LocalMediaStream>* s =
static_cast<ScopedRefMessageData<LocalMediaStream>*> (data);
LocalStreamMap::iterator it =
local_media_streams_.find(s->data()->label());
if (it != local_media_streams_.end())
return; // Stream already exist.
const std::string& label = s->data()->label();
local_media_streams_[label] = s->data();
break;
}
case MSG_REMOVEMEDIASTREAM: {
ScopedRefMessageData<LocalMediaStream>* s =
static_cast<ScopedRefMessageData<LocalMediaStream>*> (data);
local_media_streams_.erase(s->data()->label());
break;
}
case MSG_COMMITSTREAMCHANGES: {
// TODO(perkj): Here is where necessary signaling
// and creation of channels should happen. Also removing of channels.
// The media streams are in the local_media_streams_ array.
break;
}
}
}
} // namespace webrtc

View File

@ -29,24 +29,22 @@
#define TALK_APP_WEBRTC_PEERCONNECTION_IMPL_H_
#include <list>
#include <map>
#include <string>
#include "talk/app/webrtc/peerconnection_dev.h"
#include "talk/app/webrtc_dev/peerconnection_dev.h"
#include "talk/base/scoped_ptr.h"
#include "talk/base/messagequeue.h"
namespace cricket {
class ChannelManager;
class PortAllocator;
}
namespace talk_base {
class Message;
}
namespace webrtc {
class WebRtcSession;
class PeerConnectionImpl : public PeerConnection {
class PeerConnectionImpl : public PeerConnection,
public talk_base::MessageHandler {
public:
enum Error {
ERROR_NONE = 0, // Good
@ -60,7 +58,8 @@ class PeerConnectionImpl : public PeerConnection {
};
PeerConnectionImpl(cricket::ChannelManager* channel_manager,
cricket::PortAllocator* port_allocator);
cricket::PortAllocator* port_allocator,
talk_base::Thread* signal_thread);
virtual ~PeerConnectionImpl();
// Interfaces from PeerConnection
@ -85,15 +84,23 @@ class PeerConnectionImpl : public PeerConnection {
void RegisterObserver(PeerConnectionObserver* observer);
// Implement talk_base::MessageHandler.
void OnMessage(talk_base::Message* msg);
private:
enum {
MSG_ADDMEDIASTREAM = 1,
MSG_REMOVEMEDIASTREAM = 2,
MSG_COMMITSTREAMCHANGES = 3
};
PeerConnectionObserver* observer_;
// List of media streams to process.
std::list<scoped_refptr<LocalMediaStream> > add_commit_queue_;
std::list<scoped_refptr<LocalMediaStream> > remove_commit_queue_;
// Map of local media streams.
typedef std::map<std::string, scoped_refptr<LocalMediaStream> > LocalStreamMap;
LocalStreamMap local_media_streams_;
talk_base::scoped_ptr<WebRtcSession> session_;
talk_base::scoped_ptr<talk_base::Thread> worker_thread_;
talk_base::Thread* signal_thread_;
cricket::ChannelManager* channel_manager_;
cricket::PortAllocator* port_allocator_;
};

View File

@ -0,0 +1,36 @@
/*
* 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.
*/
#include "gtest/gtest.h"
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
// Added return_value so that it's convenient to put a breakpoint before
// exiting please note that the return value from RUN_ALL_TESTS() must
// be returned by the main function.
const int return_value = RUN_ALL_TESTS();
return return_value;
}

View File

@ -25,9 +25,9 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "talk/app/webrtc/peerconnectionmanager.h"
#include "talk/app/webrtc_dev/peerconnectionmanager.h"
#include "talk/app/webrtc/peerconnection_impl_dev.h"
#include "talk/app/webrtc_dev/peerconnection_impl_dev.h"
#include "talk/base/logging.h"
#include "talk/base/thread.h"
#include "talk/session/phone/channelmanager.h"
@ -71,6 +71,11 @@ bool PeerConnectionManager::Initialize(cricket::MediaEngine* media_engine,
return initialized_;
}
PeerConnectionManager::PeerConnectionManager()
: signal_thread_(new talk_base::Thread) {
}
bool PeerConnectionManager::Initialize(cricket::PortAllocator* port_allocator,
talk_base::Thread* worker_thread) {
port_allocator_.reset(port_allocator);
@ -85,11 +90,12 @@ PeerConnection* PeerConnectionManager::CreatePeerConnection() {
// TODO(mallinath) - It may be necessary to store the created PeerConnection
// object in manager.
return new PeerConnectionImpl(channel_manager_.get(),
port_allocator_.get());
port_allocator_.get(),
signal_thread_.get());
}
void PeerConnectionManager::DestroyPeerConnection(PeerConnection* pc) {
delete pc;
delete static_cast<PeerConnectionImpl*> (pc);
}
} // namespace webrtc

View File

@ -61,7 +61,7 @@ class PeerConnectionManager {
void DestroyPeerConnection(PeerConnection* pc);
protected:
PeerConnectionManager() {};
PeerConnectionManager();
virtual ~PeerConnectionManager() {};
private:
@ -74,6 +74,7 @@ class PeerConnectionManager {
talk_base::Thread* worker_thread);
bool initialized_;
talk_base::scoped_ptr<talk_base::Thread> signal_thread_;
talk_base::scoped_ptr<cricket::PortAllocator> port_allocator_;
talk_base::scoped_ptr<cricket::ChannelManager> channel_manager_;
};

View File

@ -1,5 +1,5 @@
#include "talk/app/webrtc/peerconnectiontransport.h"
#include "talk/app/webrtc_dev/peerconnectiontransport.h"
#include "talk/base/common.h"
#include "talk/base/logging.h"

View File

@ -24,7 +24,7 @@
* 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/remote_stream_dev.h"
#include "talk/app/webrtc_dev/remote_stream_dev.h"
#include <string>

View File

@ -28,8 +28,8 @@
#ifndef TALK_APP_WEBRTC_REMOTE_STREAM_H_
#define TALK_APP_WEBRTC_REMOTE_STREAM_H_
#include "talk/app/webrtc/media_stream_impl_dev.h"
#include "talk/app/webrtc/stream_dev.h"
#include "talk/app/webrtc_dev/media_stream_impl_dev.h"
#include "talk/app/webrtc_dev/stream_dev.h"
#include "talk/base/scoped_ptr.h"
namespace webrtc {

View File

@ -28,7 +28,7 @@
#include <string>
#include "gtest/gtest.h"
#include "talk/app/webrtc/remote_stream_dev.h"
#include "talk/app/webrtc_dev/remote_stream_dev.h"
static const char kStreamLabel1[] = "remote_stream_1";

View File

@ -0,0 +1,52 @@
/*
* 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 scoped_refptr<T>& data() const { return data_; }
scoped_refptr<T>& data() { return data_; }
private:
scoped_refptr<T> data_;
};
/*
struct ScopedTypedMessageData : public talk_base::MessageData {
ScopedRefPtrMsgParams(scoped_refptr<T> ptr)
: ptr_(ptr) {
}
scoped_refptr<T> ptr_;
};*/
#endif // TALK_APP_WEBRTC_SCOPED_REF_PTR_MSG_H_

View File

@ -30,8 +30,8 @@
#include <string>
#include "talk/app/webrtc/ref_count.h"
#include "talk/app/webrtc/scoped_refptr.h"
#include "talk/app/webrtc_dev/ref_count.h"
#include "talk/app/webrtc_dev/scoped_refptr.h"
namespace cricket {
class VideoRenderer;

View File

@ -24,7 +24,7 @@
* 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/local_stream_dev.h"
#include "talk/app/webrtc_dev/local_stream_dev.h"
namespace webrtc {

View File

@ -24,7 +24,7 @@
* 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/local_stream_dev.h"
#include "talk/app/webrtc_dev/local_stream_dev.h"
namespace webrtc {