Merge from Chromium at DEPS revision 288042
This commit was generated by merge_to_master.py.
Change-Id: I4e8637e16a2e9bc05449ac063fd12b3f48ca383b
diff --git a/app/webrtc/audiotrack.cc b/app/webrtc/audiotrack.cc
index a8d45ba..5ac9b96 100644
--- a/app/webrtc/audiotrack.cc
+++ b/app/webrtc/audiotrack.cc
@@ -42,10 +42,10 @@
return kAudioTrackKind;
}
-talk_base::scoped_refptr<AudioTrack> AudioTrack::Create(
+rtc::scoped_refptr<AudioTrack> AudioTrack::Create(
const std::string& id, AudioSourceInterface* source) {
- talk_base::RefCountedObject<AudioTrack>* track =
- new talk_base::RefCountedObject<AudioTrack>(id, source);
+ rtc::RefCountedObject<AudioTrack>* track =
+ new rtc::RefCountedObject<AudioTrack>(id, source);
return track;
}
diff --git a/app/webrtc/audiotrack.h b/app/webrtc/audiotrack.h
index 2f96527..f0094d3 100644
--- a/app/webrtc/audiotrack.h
+++ b/app/webrtc/audiotrack.h
@@ -31,14 +31,14 @@
#include "talk/app/webrtc/mediastreaminterface.h"
#include "talk/app/webrtc/mediastreamtrack.h"
#include "talk/app/webrtc/notifier.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/scoped_ref_ptr.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/scoped_ref_ptr.h"
namespace webrtc {
class AudioTrack : public MediaStreamTrack<AudioTrackInterface> {
public:
- static talk_base::scoped_refptr<AudioTrack> Create(
+ static rtc::scoped_refptr<AudioTrack> Create(
const std::string& id, AudioSourceInterface* source);
// AudioTrackInterface implementation.
@@ -49,7 +49,7 @@
virtual void AddSink(AudioTrackSinkInterface* sink) OVERRIDE {}
virtual void RemoveSink(AudioTrackSinkInterface* sink) OVERRIDE {}
virtual bool GetSignalLevel(int* level) OVERRIDE { return false; }
- virtual talk_base::scoped_refptr<AudioProcessorInterface> GetAudioProcessor()
+ virtual rtc::scoped_refptr<AudioProcessorInterface> GetAudioProcessor()
OVERRIDE { return NULL; }
virtual cricket::AudioRenderer* GetRenderer() OVERRIDE {
return NULL;
@@ -62,7 +62,7 @@
AudioTrack(const std::string& label, AudioSourceInterface* audio_source);
private:
- talk_base::scoped_refptr<AudioSourceInterface> audio_source_;
+ rtc::scoped_refptr<AudioSourceInterface> audio_source_;
};
} // namespace webrtc
diff --git a/app/webrtc/audiotrackrenderer.cc b/app/webrtc/audiotrackrenderer.cc
index 92d3449..c812697 100644
--- a/app/webrtc/audiotrackrenderer.cc
+++ b/app/webrtc/audiotrackrenderer.cc
@@ -26,7 +26,7 @@
*/
#include "talk/app/webrtc/audiotrackrenderer.h"
-#include "talk/base/common.h"
+#include "webrtc/base/common.h"
namespace webrtc {
diff --git a/app/webrtc/audiotrackrenderer.h b/app/webrtc/audiotrackrenderer.h
index a4c58c4..4a9bf6e 100644
--- a/app/webrtc/audiotrackrenderer.h
+++ b/app/webrtc/audiotrackrenderer.h
@@ -28,7 +28,7 @@
#ifndef TALK_APP_WEBRTC_AUDIOTRACKRENDERER_H_
#define TALK_APP_WEBRTC_AUDIOTRACKRENDERER_H_
-#include "talk/base/thread.h"
+#include "webrtc/base/thread.h"
#include "talk/media/base/audiorenderer.h"
namespace webrtc {
diff --git a/app/webrtc/datachannel.cc b/app/webrtc/datachannel.cc
index af4fb24..952f5bf 100644
--- a/app/webrtc/datachannel.cc
+++ b/app/webrtc/datachannel.cc
@@ -30,8 +30,8 @@
#include "talk/app/webrtc/mediastreamprovider.h"
#include "talk/app/webrtc/sctputils.h"
-#include "talk/base/logging.h"
-#include "talk/base/refcount.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/refcount.h"
namespace webrtc {
@@ -86,13 +86,13 @@
other->packets_.swap(packets_);
}
-talk_base::scoped_refptr<DataChannel> DataChannel::Create(
+rtc::scoped_refptr<DataChannel> DataChannel::Create(
DataChannelProviderInterface* provider,
cricket::DataChannelType dct,
const std::string& label,
const InternalDataChannelInit& config) {
- talk_base::scoped_refptr<DataChannel> channel(
- new talk_base::RefCountedObject<DataChannel>(provider, dct, label));
+ rtc::scoped_refptr<DataChannel> channel(
+ new rtc::RefCountedObject<DataChannel>(provider, dct, label));
if (!channel->Init(config)) {
return NULL;
}
@@ -151,7 +151,7 @@
// Chrome glue and WebKit) are not wired up properly until after this
// function returns.
if (provider_->ReadyToSendData()) {
- talk_base::Thread::Current()->Post(this, MSG_CHANNELREADY, NULL);
+ rtc::Thread::Current()->Post(this, MSG_CHANNELREADY, NULL);
}
}
@@ -195,6 +195,14 @@
if (state_ != kOpen) {
return false;
}
+
+ // TODO(jiayl): the spec is unclear about if the remote side should get the
+ // onmessage event. We need to figure out the expected behavior and change the
+ // code accordingly.
+ if (buffer.size() == 0) {
+ return true;
+ }
+
// If the queue is non-empty, we're waiting for SignalReadyToSend,
// so just add to the end of the queue and keep waiting.
if (!queued_send_data_.Empty()) {
@@ -263,7 +271,7 @@
UpdateState();
}
-void DataChannel::OnMessage(talk_base::Message* msg) {
+void DataChannel::OnMessage(rtc::Message* msg) {
switch (msg->message_id) {
case MSG_CHANNELREADY:
OnChannelReady(true);
@@ -280,7 +288,7 @@
void DataChannel::OnDataReceived(cricket::DataChannel* channel,
const cricket::ReceiveDataParams& params,
- const talk_base::Buffer& payload) {
+ const rtc::Buffer& payload) {
uint32 expected_ssrc =
(data_channel_type_ == cricket::DCT_RTP) ? receive_ssrc_ : config_.id;
if (params.ssrc != expected_ssrc) {
@@ -317,7 +325,7 @@
waiting_for_open_ack_ = false;
bool binary = (params.type == cricket::DMT_BINARY);
- talk_base::scoped_ptr<DataBuffer> buffer(new DataBuffer(payload, binary));
+ rtc::scoped_ptr<DataBuffer> buffer(new DataBuffer(payload, binary));
if (was_ever_writable_ && observer_) {
observer_->OnMessage(*buffer.get());
} else {
@@ -347,7 +355,7 @@
was_ever_writable_ = true;
if (data_channel_type_ == cricket::DCT_SCTP) {
- talk_base::Buffer payload;
+ rtc::Buffer payload;
if (config_.open_handshake_role == InternalDataChannelInit::kOpener) {
WriteDataChannelOpenMessage(label_, config_, &payload);
@@ -444,7 +452,7 @@
}
while (!queued_received_data_.Empty()) {
- talk_base::scoped_ptr<DataBuffer> buffer(queued_received_data_.Front());
+ rtc::scoped_ptr<DataBuffer> buffer(queued_received_data_.Front());
observer_->OnMessage(*buffer);
queued_received_data_.Pop();
}
@@ -457,7 +465,7 @@
packet_buffer.Swap(&queued_send_data_);
while (!packet_buffer.Empty()) {
- talk_base::scoped_ptr<DataBuffer> buffer(packet_buffer.Front());
+ rtc::scoped_ptr<DataBuffer> buffer(packet_buffer.Front());
SendDataMessage(*buffer);
packet_buffer.Pop();
}
@@ -512,17 +520,17 @@
control_packets.Swap(&queued_control_data_);
while (!control_packets.Empty()) {
- talk_base::scoped_ptr<DataBuffer> buf(control_packets.Front());
+ rtc::scoped_ptr<DataBuffer> buf(control_packets.Front());
SendControlMessage(buf->data);
control_packets.Pop();
}
}
-void DataChannel::QueueControlMessage(const talk_base::Buffer& buffer) {
+void DataChannel::QueueControlMessage(const rtc::Buffer& buffer) {
queued_control_data_.Push(new DataBuffer(buffer, true));
}
-bool DataChannel::SendControlMessage(const talk_base::Buffer& buffer) {
+bool DataChannel::SendControlMessage(const rtc::Buffer& buffer) {
bool is_open_message =
(config_.open_handshake_role == InternalDataChannelInit::kOpener);
diff --git a/app/webrtc/datachannel.h b/app/webrtc/datachannel.h
index 0510f7e..184ad91 100644
--- a/app/webrtc/datachannel.h
+++ b/app/webrtc/datachannel.h
@@ -33,9 +33,9 @@
#include "talk/app/webrtc/datachannelinterface.h"
#include "talk/app/webrtc/proxy.h"
-#include "talk/base/messagehandler.h"
-#include "talk/base/scoped_ref_ptr.h"
-#include "talk/base/sigslot.h"
+#include "webrtc/base/messagehandler.h"
+#include "webrtc/base/scoped_ref_ptr.h"
+#include "webrtc/base/sigslot.h"
#include "talk/media/base/mediachannel.h"
#include "talk/session/media/channel.h"
@@ -47,7 +47,7 @@
public:
// Sends the data to the transport.
virtual bool SendData(const cricket::SendDataParams& params,
- const talk_base::Buffer& payload,
+ const rtc::Buffer& payload,
cricket::SendDataResult* result) = 0;
// Connects to the transport signals.
virtual bool ConnectDataChannel(DataChannel* data_channel) = 0;
@@ -100,9 +100,9 @@
// SSRC==0.
class DataChannel : public DataChannelInterface,
public sigslot::has_slots<>,
- public talk_base::MessageHandler {
+ public rtc::MessageHandler {
public:
- static talk_base::scoped_refptr<DataChannel> Create(
+ static rtc::scoped_refptr<DataChannel> Create(
DataChannelProviderInterface* provider,
cricket::DataChannelType dct,
const std::string& label,
@@ -128,8 +128,8 @@
virtual DataState state() const { return state_; }
virtual bool Send(const DataBuffer& buffer);
- // talk_base::MessageHandler override.
- virtual void OnMessage(talk_base::Message* msg);
+ // rtc::MessageHandler override.
+ virtual void OnMessage(rtc::Message* msg);
// Called if the underlying data engine is closing.
void OnDataEngineClose();
@@ -142,7 +142,7 @@
// Sigslots from cricket::DataChannel
void OnDataReceived(cricket::DataChannel* channel,
const cricket::ReceiveDataParams& params,
- const talk_base::Buffer& payload);
+ const rtc::Buffer& payload);
// The remote peer request that this channel should be closed.
void RemotePeerRequestClose();
@@ -217,8 +217,8 @@
bool QueueSendDataMessage(const DataBuffer& buffer);
void SendQueuedControlMessages();
- void QueueControlMessage(const talk_base::Buffer& buffer);
- bool SendControlMessage(const talk_base::Buffer& buffer);
+ void QueueControlMessage(const rtc::Buffer& buffer);
+ bool SendControlMessage(const rtc::Buffer& buffer);
std::string label_;
InternalDataChannelInit config_;
@@ -242,7 +242,7 @@
class DataChannelFactory {
public:
- virtual talk_base::scoped_refptr<DataChannel> CreateDataChannel(
+ virtual rtc::scoped_refptr<DataChannel> CreateDataChannel(
const std::string& label,
const InternalDataChannelInit* config) = 0;
diff --git a/app/webrtc/datachannel_unittest.cc b/app/webrtc/datachannel_unittest.cc
index 6f223fe..84a6935 100644
--- a/app/webrtc/datachannel_unittest.cc
+++ b/app/webrtc/datachannel_unittest.cc
@@ -28,7 +28,7 @@
#include "talk/app/webrtc/datachannel.h"
#include "talk/app/webrtc/sctputils.h"
#include "talk/app/webrtc/test/fakedatachannelprovider.h"
-#include "talk/base/gunit.h"
+#include "webrtc/base/gunit.h"
using webrtc::DataChannel;
@@ -86,14 +86,14 @@
webrtc::InternalDataChannelInit init_;
FakeDataChannelProvider provider_;
- talk_base::scoped_ptr<FakeDataChannelObserver> observer_;
- talk_base::scoped_refptr<DataChannel> webrtc_data_channel_;
+ rtc::scoped_ptr<FakeDataChannelObserver> observer_;
+ rtc::scoped_refptr<DataChannel> webrtc_data_channel_;
};
// Verifies that the data channel is connected to the transport after creation.
TEST_F(SctpDataChannelTest, ConnectedToTransportOnCreated) {
provider_.set_transport_available(true);
- talk_base::scoped_refptr<DataChannel> dc = DataChannel::Create(
+ rtc::scoped_refptr<DataChannel> dc = DataChannel::Create(
&provider_, cricket::DCT_SCTP, "test1", init_);
EXPECT_TRUE(provider_.IsConnected(dc.get()));
@@ -190,7 +190,7 @@
SetChannelReady();
webrtc::InternalDataChannelInit init;
init.id = 1;
- talk_base::scoped_refptr<DataChannel> dc = DataChannel::Create(
+ rtc::scoped_refptr<DataChannel> dc = DataChannel::Create(
&provider_, cricket::DCT_SCTP, "test1", init);
EXPECT_EQ(webrtc::DataChannelInterface::kConnecting, dc->state());
EXPECT_TRUE_WAIT(webrtc::DataChannelInterface::kOpen == dc->state(),
@@ -204,7 +204,7 @@
webrtc::InternalDataChannelInit init;
init.id = 1;
init.ordered = false;
- talk_base::scoped_refptr<DataChannel> dc = DataChannel::Create(
+ rtc::scoped_refptr<DataChannel> dc = DataChannel::Create(
&provider_, cricket::DCT_SCTP, "test1", init);
EXPECT_EQ_WAIT(webrtc::DataChannelInterface::kOpen, dc->state(), 1000);
@@ -218,7 +218,7 @@
cricket::ReceiveDataParams params;
params.ssrc = init.id;
params.type = cricket::DMT_CONTROL;
- talk_base::Buffer payload;
+ rtc::Buffer payload;
webrtc::WriteDataChannelOpenAckMessage(&payload);
dc->OnDataReceived(NULL, params, payload);
@@ -234,7 +234,7 @@
webrtc::InternalDataChannelInit init;
init.id = 1;
init.ordered = false;
- talk_base::scoped_refptr<DataChannel> dc = DataChannel::Create(
+ rtc::scoped_refptr<DataChannel> dc = DataChannel::Create(
&provider_, cricket::DCT_SCTP, "test1", init);
EXPECT_EQ_WAIT(webrtc::DataChannelInterface::kOpen, dc->state(), 1000);
@@ -299,7 +299,7 @@
config.open_handshake_role = webrtc::InternalDataChannelInit::kNone;
SetChannelReady();
- talk_base::scoped_refptr<DataChannel> dc = DataChannel::Create(
+ rtc::scoped_refptr<DataChannel> dc = DataChannel::Create(
&provider_, cricket::DCT_SCTP, "test1", config);
EXPECT_EQ_WAIT(webrtc::DataChannelInterface::kOpen, dc->state(), 1000);
@@ -315,7 +315,7 @@
config.open_handshake_role = webrtc::InternalDataChannelInit::kAcker;
SetChannelReady();
- talk_base::scoped_refptr<DataChannel> dc = DataChannel::Create(
+ rtc::scoped_refptr<DataChannel> dc = DataChannel::Create(
&provider_, cricket::DCT_SCTP, "test1", config);
EXPECT_EQ_WAIT(webrtc::DataChannelInterface::kOpen, dc->state(), 1000);
@@ -342,7 +342,7 @@
SetChannelReady();
const size_t buffer_size = 1024;
- talk_base::Buffer buffer;
+ rtc::Buffer buffer;
buffer.SetLength(buffer_size);
memset(buffer.data(), 0, buffer_size);
@@ -396,7 +396,7 @@
TEST_F(SctpDataChannelTest, ClosedWhenReceivedBufferFull) {
SetChannelReady();
const size_t buffer_size = 1024;
- talk_base::Buffer buffer;
+ rtc::Buffer buffer;
buffer.SetLength(buffer_size);
memset(buffer.data(), 0, buffer_size);
@@ -410,3 +410,16 @@
EXPECT_EQ(webrtc::DataChannelInterface::kClosed,
webrtc_data_channel_->state());
}
+
+// Tests that sending empty data returns no error and keeps the channel open.
+TEST_F(SctpDataChannelTest, SendEmptyData) {
+ webrtc_data_channel_->SetSctpSid(1);
+ SetChannelReady();
+ EXPECT_EQ(webrtc::DataChannelInterface::kOpen,
+ webrtc_data_channel_->state());
+
+ webrtc::DataBuffer buffer("");
+ EXPECT_TRUE(webrtc_data_channel_->Send(buffer));
+ EXPECT_EQ(webrtc::DataChannelInterface::kOpen,
+ webrtc_data_channel_->state());
+}
diff --git a/app/webrtc/datachannelinterface.h b/app/webrtc/datachannelinterface.h
index 57fe200..5684cc2 100644
--- a/app/webrtc/datachannelinterface.h
+++ b/app/webrtc/datachannelinterface.h
@@ -33,9 +33,9 @@
#include <string>
-#include "talk/base/basictypes.h"
-#include "talk/base/buffer.h"
-#include "talk/base/refcount.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/buffer.h"
+#include "webrtc/base/refcount.h"
namespace webrtc {
@@ -66,7 +66,7 @@
};
struct DataBuffer {
- DataBuffer(const talk_base::Buffer& data, bool binary)
+ DataBuffer(const rtc::Buffer& data, bool binary)
: data(data),
binary(binary) {
}
@@ -77,7 +77,7 @@
}
size_t size() const { return data.length(); }
- talk_base::Buffer data;
+ rtc::Buffer data;
// Indicates if the received data contains UTF-8 or binary data.
// Note that the upper layers are left to verify the UTF-8 encoding.
// TODO(jiayl): prefer to use an enum instead of a bool.
@@ -95,7 +95,7 @@
virtual ~DataChannelObserver() {}
};
-class DataChannelInterface : public talk_base::RefCountInterface {
+class DataChannelInterface : public rtc::RefCountInterface {
public:
// Keep in sync with DataChannel.java:State and
// RTCDataChannel.h:RTCDataChannelState.
diff --git a/app/webrtc/dtmfsender.cc b/app/webrtc/dtmfsender.cc
index 6556acd..4eade16 100644
--- a/app/webrtc/dtmfsender.cc
+++ b/app/webrtc/dtmfsender.cc
@@ -31,8 +31,8 @@
#include <string>
-#include "talk/base/logging.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/thread.h"
namespace webrtc {
@@ -75,21 +75,21 @@
return true;
}
-talk_base::scoped_refptr<DtmfSender> DtmfSender::Create(
+rtc::scoped_refptr<DtmfSender> DtmfSender::Create(
AudioTrackInterface* track,
- talk_base::Thread* signaling_thread,
+ rtc::Thread* signaling_thread,
DtmfProviderInterface* provider) {
if (!track || !signaling_thread) {
return NULL;
}
- talk_base::scoped_refptr<DtmfSender> dtmf_sender(
- new talk_base::RefCountedObject<DtmfSender>(track, signaling_thread,
+ rtc::scoped_refptr<DtmfSender> dtmf_sender(
+ new rtc::RefCountedObject<DtmfSender>(track, signaling_thread,
provider));
return dtmf_sender;
}
DtmfSender::DtmfSender(AudioTrackInterface* track,
- talk_base::Thread* signaling_thread,
+ rtc::Thread* signaling_thread,
DtmfProviderInterface* provider)
: track_(track),
observer_(NULL),
@@ -176,7 +176,7 @@
return inter_tone_gap_;
}
-void DtmfSender::OnMessage(talk_base::Message* msg) {
+void DtmfSender::OnMessage(rtc::Message* msg) {
switch (msg->message_id) {
case MSG_DO_INSERT_DTMF: {
DoInsertDtmf();
diff --git a/app/webrtc/dtmfsender.h b/app/webrtc/dtmfsender.h
index f2bebde..e875d3a 100644
--- a/app/webrtc/dtmfsender.h
+++ b/app/webrtc/dtmfsender.h
@@ -33,15 +33,15 @@
#include "talk/app/webrtc/dtmfsenderinterface.h"
#include "talk/app/webrtc/mediastreaminterface.h"
#include "talk/app/webrtc/proxy.h"
-#include "talk/base/common.h"
-#include "talk/base/messagehandler.h"
-#include "talk/base/refcount.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/messagehandler.h"
+#include "webrtc/base/refcount.h"
// DtmfSender is the native implementation of the RTCDTMFSender defined by
// the WebRTC W3C Editor's Draft.
// http://dev.w3.org/2011/webrtc/editor/webrtc.html
-namespace talk_base {
+namespace rtc {
class Thread;
}
@@ -70,11 +70,11 @@
class DtmfSender
: public DtmfSenderInterface,
public sigslot::has_slots<>,
- public talk_base::MessageHandler {
+ public rtc::MessageHandler {
public:
- static talk_base::scoped_refptr<DtmfSender> Create(
+ static rtc::scoped_refptr<DtmfSender> Create(
AudioTrackInterface* track,
- talk_base::Thread* signaling_thread,
+ rtc::Thread* signaling_thread,
DtmfProviderInterface* provider);
// Implements DtmfSenderInterface.
@@ -90,7 +90,7 @@
protected:
DtmfSender(AudioTrackInterface* track,
- talk_base::Thread* signaling_thread,
+ rtc::Thread* signaling_thread,
DtmfProviderInterface* provider);
virtual ~DtmfSender();
@@ -98,7 +98,7 @@
DtmfSender();
// Implements MessageHandler.
- virtual void OnMessage(talk_base::Message* msg);
+ virtual void OnMessage(rtc::Message* msg);
// The DTMF sending task.
void DoInsertDtmf();
@@ -107,9 +107,9 @@
void StopSending();
- talk_base::scoped_refptr<AudioTrackInterface> track_;
+ rtc::scoped_refptr<AudioTrackInterface> track_;
DtmfSenderObserverInterface* observer_;
- talk_base::Thread* signaling_thread_;
+ rtc::Thread* signaling_thread_;
DtmfProviderInterface* provider_;
std::string tones_;
int duration_;
diff --git a/app/webrtc/dtmfsender_unittest.cc b/app/webrtc/dtmfsender_unittest.cc
index a483505..c5b19cc 100644
--- a/app/webrtc/dtmfsender_unittest.cc
+++ b/app/webrtc/dtmfsender_unittest.cc
@@ -32,9 +32,9 @@
#include <vector>
#include "talk/app/webrtc/audiotrack.h"
-#include "talk/base/gunit.h"
-#include "talk/base/logging.h"
-#include "talk/base/timeutils.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/timeutils.h"
using webrtc::AudioTrackInterface;
using webrtc::AudioTrack;
@@ -97,12 +97,12 @@
virtual bool InsertDtmf(const std::string& track_label,
int code, int duration) OVERRIDE {
int gap = 0;
- // TODO(ronghuawu): Make the timer (basically the talk_base::TimeNanos)
+ // TODO(ronghuawu): Make the timer (basically the rtc::TimeNanos)
// mockable and use a fake timer in the unit tests.
if (last_insert_dtmf_call_ > 0) {
- gap = static_cast<int>(talk_base::Time() - last_insert_dtmf_call_);
+ gap = static_cast<int>(rtc::Time() - last_insert_dtmf_call_);
}
- last_insert_dtmf_call_ = talk_base::Time();
+ last_insert_dtmf_call_ = rtc::Time();
LOG(LS_VERBOSE) << "FakeDtmfProvider::InsertDtmf code=" << code
<< " duration=" << duration
@@ -139,10 +139,10 @@
protected:
DtmfSenderTest()
: track_(AudioTrack::Create(kTestAudioLabel, NULL)),
- observer_(new talk_base::RefCountedObject<FakeDtmfObserver>()),
+ observer_(new rtc::RefCountedObject<FakeDtmfObserver>()),
provider_(new FakeDtmfProvider()) {
provider_->AddCanInsertDtmfTrack(kTestAudioLabel);
- dtmf_ = DtmfSender::Create(track_, talk_base::Thread::Current(),
+ dtmf_ = DtmfSender::Create(track_, rtc::Thread::Current(),
provider_.get());
dtmf_->RegisterObserver(observer_.get());
}
@@ -229,10 +229,10 @@
}
}
- talk_base::scoped_refptr<AudioTrackInterface> track_;
- talk_base::scoped_ptr<FakeDtmfObserver> observer_;
- talk_base::scoped_ptr<FakeDtmfProvider> provider_;
- talk_base::scoped_refptr<DtmfSender> dtmf_;
+ rtc::scoped_refptr<AudioTrackInterface> track_;
+ rtc::scoped_ptr<FakeDtmfObserver> observer_;
+ rtc::scoped_ptr<FakeDtmfProvider> provider_;
+ rtc::scoped_refptr<DtmfSender> dtmf_;
};
TEST_F(DtmfSenderTest, CanInsertDtmf) {
diff --git a/app/webrtc/dtmfsenderinterface.h b/app/webrtc/dtmfsenderinterface.h
index 46f3924..93b4543 100644
--- a/app/webrtc/dtmfsenderinterface.h
+++ b/app/webrtc/dtmfsenderinterface.h
@@ -31,8 +31,8 @@
#include <string>
#include "talk/app/webrtc/mediastreaminterface.h"
-#include "talk/base/common.h"
-#include "talk/base/refcount.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/refcount.h"
// This file contains interfaces for DtmfSender.
@@ -53,7 +53,7 @@
// The interface of native implementation of the RTCDTMFSender defined by the
// WebRTC W3C Editor's Draft.
-class DtmfSenderInterface : public talk_base::RefCountInterface {
+class DtmfSenderInterface : public rtc::RefCountInterface {
public:
virtual void RegisterObserver(DtmfSenderObserverInterface* observer) = 0;
virtual void UnregisterObserver() = 0;
diff --git a/app/webrtc/fakeportallocatorfactory.h b/app/webrtc/fakeportallocatorfactory.h
index c1727ae..eee98b0 100644
--- a/app/webrtc/fakeportallocatorfactory.h
+++ b/app/webrtc/fakeportallocatorfactory.h
@@ -39,8 +39,8 @@
class FakePortAllocatorFactory : public PortAllocatorFactoryInterface {
public:
static FakePortAllocatorFactory* Create() {
- talk_base::RefCountedObject<FakePortAllocatorFactory>* allocator =
- new talk_base::RefCountedObject<FakePortAllocatorFactory>();
+ rtc::RefCountedObject<FakePortAllocatorFactory>* allocator =
+ new rtc::RefCountedObject<FakePortAllocatorFactory>();
return allocator;
}
@@ -49,7 +49,7 @@
const std::vector<TurnConfiguration>& turn_configurations) {
stun_configs_ = stun_configurations;
turn_configs_ = turn_configurations;
- return new cricket::FakePortAllocator(talk_base::Thread::Current(), NULL);
+ return new cricket::FakePortAllocator(rtc::Thread::Current(), NULL);
}
const std::vector<StunConfiguration>& stun_configs() const {
diff --git a/app/webrtc/java/jni/peerconnection_jni.cc b/app/webrtc/java/jni/peerconnection_jni.cc
index 3353de7..fadbc8a 100644
--- a/app/webrtc/java/jni/peerconnection_jni.cc
+++ b/app/webrtc/java/jni/peerconnection_jni.cc
@@ -66,16 +66,18 @@
#include "talk/app/webrtc/mediaconstraintsinterface.h"
#include "talk/app/webrtc/peerconnectioninterface.h"
#include "talk/app/webrtc/videosourceinterface.h"
-#include "talk/base/bind.h"
-#include "talk/base/logging.h"
-#include "talk/base/messagequeue.h"
-#include "talk/base/ssladapter.h"
+#include "webrtc/base/bind.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/messagequeue.h"
+#include "webrtc/base/ssladapter.h"
#include "talk/media/base/videocapturer.h"
#include "talk/media/base/videorenderer.h"
#include "talk/media/devices/videorendererfactory.h"
#include "talk/media/webrtc/webrtcvideocapturer.h"
+#include "talk/media/webrtc/webrtcvideodecoderfactory.h"
#include "talk/media/webrtc/webrtcvideoencoderfactory.h"
#include "third_party/icu/source/common/unicode/unistr.h"
+#include "third_party/libyuv/include/libyuv/convert.h"
#include "third_party/libyuv/include/libyuv/convert_from.h"
#include "third_party/libyuv/include/libyuv/video_common.h"
#include "webrtc/modules/video_coding/codecs/interface/video_codec_interface.h"
@@ -86,14 +88,20 @@
#ifdef ANDROID
#include "webrtc/system_wrappers/interface/logcat_trace_context.h"
+using webrtc::CodecSpecificInfo;
+using webrtc::DecodedImageCallback;
+using webrtc::EncodedImage;
+using webrtc::I420VideoFrame;
using webrtc::LogcatTraceContext;
+using webrtc::RTPFragmentationHeader;
+using webrtc::VideoCodec;
#endif
using icu::UnicodeString;
-using talk_base::Bind;
-using talk_base::Thread;
-using talk_base::ThreadManager;
-using talk_base::scoped_ptr;
+using rtc::Bind;
+using rtc::Thread;
+using rtc::ThreadManager;
+using rtc::scoped_ptr;
using webrtc::AudioSourceInterface;
using webrtc::AudioTrackInterface;
using webrtc::AudioTrackVector;
@@ -264,6 +272,7 @@
#ifdef ANDROID
LoadClass(jni, "org/webrtc/MediaCodecVideoEncoder");
LoadClass(jni, "org/webrtc/MediaCodecVideoEncoder$OutputBufferInfo");
+ LoadClass(jni, "org/webrtc/MediaCodecVideoDecoder");
#endif
LoadClass(jni, "org/webrtc/MediaSource$State");
LoadClass(jni, "org/webrtc/MediaStream");
@@ -1134,14 +1143,16 @@
// into its own .h/.cc pair, if/when the JNI helper stuff above is extracted
// from this file.
-//#define TRACK_BUFFER_TIMING
-#ifdef TRACK_BUFFER_TIMING
#include <android/log.h>
-#define TAG "MediaCodecVideoEncoder"
+//#define TRACK_BUFFER_TIMING
+#define TAG "MediaCodecVideo"
+#ifdef TRACK_BUFFER_TIMING
#define ALOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, TAG, __VA_ARGS__)
#else
#define ALOGV(...)
#endif
+#define ALOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__)
+#define ALOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__)
// Color formats supported by encoder - should mirror supportedColorList
// from MediaCodecVideoEncoder.java
@@ -1166,7 +1177,7 @@
// MediaCodecVideoEncoder is created, operated, and destroyed on a single
// thread, currently the libjingle Worker thread.
class MediaCodecVideoEncoder : public webrtc::VideoEncoder,
- public talk_base::MessageHandler {
+ public rtc::MessageHandler {
public:
virtual ~MediaCodecVideoEncoder();
explicit MediaCodecVideoEncoder(JNIEnv* jni);
@@ -1187,8 +1198,8 @@
int /* rtt */) OVERRIDE;
virtual int32_t SetRates(uint32_t new_bit_rate, uint32_t frame_rate) OVERRIDE;
- // talk_base::MessageHandler implementation.
- virtual void OnMessage(talk_base::Message* msg) OVERRIDE;
+ // rtc::MessageHandler implementation.
+ virtual void OnMessage(rtc::Message* msg) OVERRIDE;
private:
// CHECK-fail if not running on |codec_thread_|.
@@ -1254,6 +1265,7 @@
// Touched only on codec_thread_ so no explicit synchronization necessary.
int width_; // Frame width in pixels.
int height_; // Frame height in pixels.
+ bool inited_;
enum libyuv::FourCC encoder_fourcc_; // Encoder color space format.
int last_set_bitrate_kbps_; // Last-requested bitrate in kbps.
int last_set_fps_; // Last-requested frame rate.
@@ -1389,7 +1401,7 @@
frame_rate));
}
-void MediaCodecVideoEncoder::OnMessage(talk_base::Message* msg) {
+void MediaCodecVideoEncoder::OnMessage(rtc::Message* msg) {
JNIEnv* jni = AttachCurrentThreadIfNeeded();
ScopedLocalRefFrame local_ref_frame(jni);
@@ -1412,7 +1424,7 @@
}
void MediaCodecVideoEncoder::ResetCodec() {
- LOG(LS_ERROR) << "ResetCodec";
+ ALOGE("ResetCodec");
if (Release() != WEBRTC_VIDEO_CODEC_OK ||
codec_thread_->Invoke<int32_t>(Bind(
&MediaCodecVideoEncoder::InitEncodeOnCodecThread, this, 0, 0, 0, 0))
@@ -1428,7 +1440,7 @@
CheckOnCodecThread();
JNIEnv* jni = AttachCurrentThreadIfNeeded();
ScopedLocalRefFrame local_ref_frame(jni);
- LOG(LS_INFO) << "InitEncodeOnCodecThread " << width << " x " << height;
+ ALOGD("InitEncodeOnCodecThread %d x %d", width, height);
if (width == 0) {
width = width_;
@@ -1459,6 +1471,7 @@
if (IsNull(jni, input_buffers))
return WEBRTC_VIDEO_CODEC_ERROR;
+ inited_ = true;
switch (GetIntField(jni, *j_media_codec_video_encoder_,
j_color_format_field_)) {
case COLOR_FormatYUV420Planar:
@@ -1542,7 +1555,7 @@
return WEBRTC_VIDEO_CODEC_ERROR;
}
- ALOGV("Frame # %d. Buffer # %d. TS: %lld.",
+ ALOGV("Encode frame # %d. Buffer # %d. TS: %lld.",
frames_received_, j_input_buffer_index, frame.render_time_ms());
jobject j_input_buffer = input_buffers_[j_input_buffer_index];
@@ -1586,10 +1599,12 @@
}
int32_t MediaCodecVideoEncoder::ReleaseOnCodecThread() {
+ if (!inited_)
+ return WEBRTC_VIDEO_CODEC_OK;
CheckOnCodecThread();
JNIEnv* jni = AttachCurrentThreadIfNeeded();
- LOG(LS_INFO) << "Frames received: " << frames_received_ <<
- ". Frames dropped: " << frames_dropped_;
+ ALOGD("EncoderRelease: Frames received: %d. Frames dropped: %d.",
+ frames_received_,frames_dropped_);
ScopedLocalRefFrame local_ref_frame(jni);
for (size_t i = 0; i < input_buffers_.size(); ++i)
jni->DeleteGlobalRef(input_buffers_[i]);
@@ -1624,11 +1639,12 @@
}
void MediaCodecVideoEncoder::ResetParameters(JNIEnv* jni) {
- talk_base::MessageQueueManager::Clear(this);
+ rtc::MessageQueueManager::Clear(this);
width_ = 0;
height_ = 0;
yuv_size_ = 0;
drop_next_input_frame_ = false;
+ inited_ = false;
CHECK(input_buffers_.empty(),
"ResetParameters called while holding input_buffers_!");
}
@@ -1678,7 +1694,7 @@
1000;
last_output_timestamp_ms_ = capture_time_ms;
frames_in_queue_--;
- ALOGV("Got output buffer # %d. TS: %lld. Latency: %lld",
+ ALOGV("Encoder got output buffer # %d. TS: %lld. Latency: %lld",
output_buffer_index, last_output_timestamp_ms_,
last_input_timestamp_ms_ - last_output_timestamp_ms_);
@@ -1774,7 +1790,7 @@
// encoder? Sure would be. Too bad it doesn't. So we hard-code some
// reasonable defaults.
supported_codecs_.push_back(
- VideoCodec(kVideoCodecVP8, "VP8", 1920, 1088, 30));
+ VideoCodec(kVideoCodecVP8, "VP8", 1280, 1280, 30));
}
MediaCodecVideoEncoderFactory::~MediaCodecVideoEncoderFactory() {}
@@ -1801,6 +1817,429 @@
delete encoder;
}
+class MediaCodecVideoDecoder : public webrtc::VideoDecoder,
+ public rtc::MessageHandler {
+ public:
+ explicit MediaCodecVideoDecoder(JNIEnv* jni);
+ virtual ~MediaCodecVideoDecoder();
+
+ virtual int32_t InitDecode(const VideoCodec* codecSettings,
+ int32_t numberOfCores) OVERRIDE;
+
+ virtual int32_t
+ Decode(const EncodedImage& inputImage, bool missingFrames,
+ const RTPFragmentationHeader* fragmentation,
+ const CodecSpecificInfo* codecSpecificInfo = NULL,
+ int64_t renderTimeMs = -1) OVERRIDE;
+
+ virtual int32_t RegisterDecodeCompleteCallback(
+ DecodedImageCallback* callback) OVERRIDE;
+
+ virtual int32_t Release() OVERRIDE;
+
+ virtual int32_t Reset() OVERRIDE;
+ // rtc::MessageHandler implementation.
+ virtual void OnMessage(rtc::Message* msg) OVERRIDE;
+
+ private:
+ // CHECK-fail if not running on |codec_thread_|.
+ void CheckOnCodecThread();
+
+ int32_t InitDecodeOnCodecThread();
+ int32_t ReleaseOnCodecThread();
+ int32_t DecodeOnCodecThread(const EncodedImage& inputImage);
+
+ bool key_frame_required_;
+ bool inited_;
+ VideoCodec codec_;
+ I420VideoFrame decoded_image_;
+ DecodedImageCallback* callback_;
+ int frames_received_; // Number of frames received by decoder.
+
+ // State that is constant for the lifetime of this object once the ctor
+ // returns.
+ scoped_ptr<Thread> codec_thread_; // Thread on which to operate MediaCodec.
+ ScopedGlobalRef<jclass> j_media_codec_video_decoder_class_;
+ ScopedGlobalRef<jobject> j_media_codec_video_decoder_;
+ jmethodID j_init_decode_method_;
+ jmethodID j_release_method_;
+ jmethodID j_dequeue_input_buffer_method_;
+ jmethodID j_queue_input_buffer_method_;
+ jmethodID j_dequeue_output_buffer_method_;
+ jmethodID j_release_output_buffer_method_;
+ jfieldID j_input_buffers_field_;
+ jfieldID j_output_buffers_field_;
+ jfieldID j_color_format_field_;
+ jfieldID j_width_field_;
+ jfieldID j_height_field_;
+ jfieldID j_stride_field_;
+ jfieldID j_slice_height_field_;
+
+ // Global references; must be deleted in Release().
+ std::vector<jobject> input_buffers_;
+};
+
+MediaCodecVideoDecoder::MediaCodecVideoDecoder(JNIEnv* jni) :
+ key_frame_required_(true),
+ inited_(false),
+ codec_thread_(new Thread()),
+ j_media_codec_video_decoder_class_(
+ jni,
+ FindClass(jni, "org/webrtc/MediaCodecVideoDecoder")),
+ j_media_codec_video_decoder_(
+ jni,
+ jni->NewObject(*j_media_codec_video_decoder_class_,
+ GetMethodID(jni,
+ *j_media_codec_video_decoder_class_,
+ "<init>",
+ "()V"))) {
+ ScopedLocalRefFrame local_ref_frame(jni);
+ codec_thread_->SetName("MediaCodecVideoDecoder", NULL);
+ CHECK(codec_thread_->Start(), "Failed to start MediaCodecVideoDecoder");
+
+ j_init_decode_method_ = GetMethodID(jni,
+ *j_media_codec_video_decoder_class_,
+ "initDecode", "(II)Z");
+ j_release_method_ =
+ GetMethodID(jni, *j_media_codec_video_decoder_class_, "release", "()V");
+ j_dequeue_input_buffer_method_ = GetMethodID(
+ jni, *j_media_codec_video_decoder_class_, "dequeueInputBuffer", "()I");
+ j_queue_input_buffer_method_ = GetMethodID(
+ jni, *j_media_codec_video_decoder_class_, "queueInputBuffer", "(IIJ)Z");
+ j_dequeue_output_buffer_method_ = GetMethodID(
+ jni, *j_media_codec_video_decoder_class_, "dequeueOutputBuffer", "()I");
+ j_release_output_buffer_method_ = GetMethodID(
+ jni, *j_media_codec_video_decoder_class_, "releaseOutputBuffer", "(I)Z");
+
+ j_input_buffers_field_ = GetFieldID(
+ jni, *j_media_codec_video_decoder_class_,
+ "inputBuffers", "[Ljava/nio/ByteBuffer;");
+ j_output_buffers_field_ = GetFieldID(
+ jni, *j_media_codec_video_decoder_class_,
+ "outputBuffers", "[Ljava/nio/ByteBuffer;");
+ j_color_format_field_ = GetFieldID(
+ jni, *j_media_codec_video_decoder_class_, "colorFormat", "I");
+ j_width_field_ = GetFieldID(
+ jni, *j_media_codec_video_decoder_class_, "width", "I");
+ j_height_field_ = GetFieldID(
+ jni, *j_media_codec_video_decoder_class_, "height", "I");
+ j_stride_field_ = GetFieldID(
+ jni, *j_media_codec_video_decoder_class_, "stride", "I");
+ j_slice_height_field_ = GetFieldID(
+ jni, *j_media_codec_video_decoder_class_, "sliceHeight", "I");
+
+ CHECK_EXCEPTION(jni, "MediaCodecVideoDecoder ctor failed");
+ memset(&codec_, 0, sizeof(codec_));
+}
+
+MediaCodecVideoDecoder::~MediaCodecVideoDecoder() {
+ Release();
+}
+
+int32_t MediaCodecVideoDecoder::InitDecode(const VideoCodec* inst,
+ int32_t numberOfCores) {
+ if (inst == NULL) {
+ return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
+ }
+ int ret_val = Release();
+ if (ret_val < 0) {
+ return ret_val;
+ }
+ // Save VideoCodec instance for later.
+ if (&codec_ != inst) {
+ codec_ = *inst;
+ }
+ codec_.maxFramerate = (codec_.maxFramerate >= 1) ? codec_.maxFramerate : 1;
+
+ // Always start with a complete key frame.
+ key_frame_required_ = true;
+ frames_received_ = 0;
+
+ // Call Java init.
+ return codec_thread_->Invoke<int32_t>(
+ Bind(&MediaCodecVideoDecoder::InitDecodeOnCodecThread, this));
+}
+
+int32_t MediaCodecVideoDecoder::InitDecodeOnCodecThread() {
+ CheckOnCodecThread();
+ JNIEnv* jni = AttachCurrentThreadIfNeeded();
+ ScopedLocalRefFrame local_ref_frame(jni);
+ ALOGD("InitDecodeOnCodecThread: %d x %d. FPS: %d",
+ codec_.width, codec_.height, codec_.maxFramerate);
+
+ bool success = jni->CallBooleanMethod(*j_media_codec_video_decoder_,
+ j_init_decode_method_,
+ codec_.width,
+ codec_.height);
+ CHECK_EXCEPTION(jni, "");
+ if (!success)
+ return WEBRTC_VIDEO_CODEC_ERROR;
+ inited_ = true;
+
+ jobjectArray input_buffers = (jobjectArray)GetObjectField(
+ jni, *j_media_codec_video_decoder_, j_input_buffers_field_);
+ size_t num_input_buffers = jni->GetArrayLength(input_buffers);
+
+ input_buffers_.resize(num_input_buffers);
+ for (size_t i = 0; i < num_input_buffers; ++i) {
+ input_buffers_[i] =
+ jni->NewGlobalRef(jni->GetObjectArrayElement(input_buffers, i));
+ CHECK_EXCEPTION(jni, "");
+ }
+ return WEBRTC_VIDEO_CODEC_OK;
+}
+
+int32_t MediaCodecVideoDecoder::Release() {
+ return codec_thread_->Invoke<int32_t>(
+ Bind(&MediaCodecVideoDecoder::ReleaseOnCodecThread, this));
+}
+
+int32_t MediaCodecVideoDecoder::ReleaseOnCodecThread() {
+ if (!inited_)
+ return WEBRTC_VIDEO_CODEC_OK;
+ CheckOnCodecThread();
+ JNIEnv* jni = AttachCurrentThreadIfNeeded();
+ ALOGD("DecoderRelease: Frames received: %d.", frames_received_);
+ ScopedLocalRefFrame local_ref_frame(jni);
+ for (size_t i = 0; i < input_buffers_.size(); ++i)
+ jni->DeleteGlobalRef(input_buffers_[i]);
+ input_buffers_.clear();
+ jni->CallVoidMethod(*j_media_codec_video_decoder_, j_release_method_);
+ CHECK_EXCEPTION(jni, "");
+ inited_ = false;
+ return WEBRTC_VIDEO_CODEC_OK;
+}
+
+
+void MediaCodecVideoDecoder::CheckOnCodecThread() {
+ CHECK(codec_thread_ == ThreadManager::Instance()->CurrentThread(),
+ "Running on wrong thread!");
+}
+
+int32_t MediaCodecVideoDecoder::Decode(
+ const EncodedImage& inputImage,
+ bool missingFrames,
+ const RTPFragmentationHeader* fragmentation,
+ const CodecSpecificInfo* codecSpecificInfo,
+ int64_t renderTimeMs) {
+ if (!inited_) {
+ return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
+ }
+ if (callback_ == NULL) {
+ return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
+ }
+ if (inputImage._buffer == NULL && inputImage._length > 0) {
+ return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
+ }
+ // Check if encoded frame dimension has changed.
+ if ((inputImage._encodedWidth * inputImage._encodedHeight > 0) &&
+ (inputImage._encodedWidth != codec_.width ||
+ inputImage._encodedHeight != codec_.height)) {
+ codec_.width = inputImage._encodedWidth;
+ codec_.height = inputImage._encodedHeight;
+ InitDecode(&codec_, 1);
+ }
+
+ // Always start with a complete key frame.
+ if (key_frame_required_) {
+ if (inputImage._frameType != webrtc::kKeyFrame) {
+ return WEBRTC_VIDEO_CODEC_ERROR;
+ }
+ if (!inputImage._completeFrame) {
+ return WEBRTC_VIDEO_CODEC_ERROR;
+ }
+ key_frame_required_ = false;
+ }
+ if (inputImage._length == 0) {
+ return WEBRTC_VIDEO_CODEC_ERROR;
+ }
+
+ return codec_thread_->Invoke<int32_t>(Bind(
+ &MediaCodecVideoDecoder::DecodeOnCodecThread, this, inputImage));
+}
+
+int32_t MediaCodecVideoDecoder::DecodeOnCodecThread(
+ const EncodedImage& inputImage) {
+ static uint8_t yVal_ = 0x7f;
+
+ CheckOnCodecThread();
+ JNIEnv* jni = AttachCurrentThreadIfNeeded();
+ ScopedLocalRefFrame local_ref_frame(jni);
+
+ // Get input buffer.
+ int j_input_buffer_index = jni->CallIntMethod(*j_media_codec_video_decoder_,
+ j_dequeue_input_buffer_method_);
+ CHECK_EXCEPTION(jni, "");
+ if (j_input_buffer_index < 0) {
+ ALOGE("dequeueInputBuffer error");
+ Reset();
+ return WEBRTC_VIDEO_CODEC_ERROR;
+ }
+
+ // Copy encoded data to Java ByteBuffer.
+ jobject j_input_buffer = input_buffers_[j_input_buffer_index];
+ uint8* buffer =
+ reinterpret_cast<uint8*>(jni->GetDirectBufferAddress(j_input_buffer));
+ CHECK(buffer, "Indirect buffer??");
+ int64 buffer_capacity = jni->GetDirectBufferCapacity(j_input_buffer);
+ CHECK_EXCEPTION(jni, "");
+ if (buffer_capacity < inputImage._length) {
+ ALOGE("Input frame size %d is bigger than buffer size %d.",
+ inputImage._length, buffer_capacity);
+ Reset();
+ return WEBRTC_VIDEO_CODEC_ERROR;
+ }
+ ALOGV("Decode frame # %d. Buffer # %d. Size: %d",
+ frames_received_, j_input_buffer_index, inputImage._length);
+ memcpy(buffer, inputImage._buffer, inputImage._length);
+
+ // Feed input to decoder.
+ jlong timestamp_us = (frames_received_ * 1000000) / codec_.maxFramerate;
+ bool success = jni->CallBooleanMethod(*j_media_codec_video_decoder_,
+ j_queue_input_buffer_method_,
+ j_input_buffer_index,
+ inputImage._length,
+ timestamp_us);
+ CHECK_EXCEPTION(jni, "");
+ if (!success) {
+ ALOGE("queueInputBuffer error");
+ Reset();
+ return WEBRTC_VIDEO_CODEC_ERROR;
+ }
+
+ // Get output index.
+ int j_output_buffer_index =
+ jni->CallIntMethod(*j_media_codec_video_decoder_,
+ j_dequeue_output_buffer_method_);
+ CHECK_EXCEPTION(jni, "");
+ if (j_output_buffer_index < 0) {
+ ALOGE("dequeueOutputBuffer error");
+ Reset();
+ return WEBRTC_VIDEO_CODEC_ERROR;
+ }
+
+ // Extract data from Java ByteBuffer.
+ jobjectArray output_buffers = reinterpret_cast<jobjectArray>(GetObjectField(
+ jni, *j_media_codec_video_decoder_, j_output_buffers_field_));
+ jobject output_buffer =
+ jni->GetObjectArrayElement(output_buffers, j_output_buffer_index);
+ buffer_capacity = jni->GetDirectBufferCapacity(output_buffer);
+ uint8_t* payload =
+ reinterpret_cast<uint8_t*>(jni->GetDirectBufferAddress(output_buffer));
+ CHECK_EXCEPTION(jni, "");
+ int color_format = GetIntField(jni, *j_media_codec_video_decoder_,
+ j_color_format_field_);
+ int width = GetIntField(jni, *j_media_codec_video_decoder_, j_width_field_);
+ int height = GetIntField(jni, *j_media_codec_video_decoder_, j_height_field_);
+ int stride = GetIntField(jni, *j_media_codec_video_decoder_, j_stride_field_);
+ int slice_height = GetIntField(jni, *j_media_codec_video_decoder_,
+ j_slice_height_field_);
+ if (buffer_capacity < width * height * 3 / 2) {
+ ALOGE("Insufficient output buffer capacity: %d", buffer_capacity);
+ Reset();
+ return WEBRTC_VIDEO_CODEC_ERROR;
+ }
+ ALOGV("Decoder got output buffer %d x %d. %d x %d. Color: 0x%x. Size: %d",
+ width, height, stride, slice_height, color_format, buffer_capacity);
+
+ if (color_format == COLOR_FormatYUV420Planar) {
+ decoded_image_.CreateFrame(
+ stride * slice_height, payload,
+ (stride * slice_height) / 4, payload + (stride * slice_height),
+ (stride * slice_height) / 4, payload + (5 * stride * slice_height / 4),
+ width, height,
+ stride, stride / 2, stride / 2);
+ } else {
+ // All other supported formats are nv12.
+ decoded_image_.CreateEmptyFrame(width, height, width, width / 2, width / 2);
+ libyuv::NV12ToI420(
+ payload, stride,
+ payload + stride * slice_height, stride,
+ decoded_image_.buffer(webrtc::kYPlane),
+ decoded_image_.stride(webrtc::kYPlane),
+ decoded_image_.buffer(webrtc::kUPlane),
+ decoded_image_.stride(webrtc::kUPlane),
+ decoded_image_.buffer(webrtc::kVPlane),
+ decoded_image_.stride(webrtc::kVPlane),
+ width, height);
+ }
+
+ // Return output buffer back to codec.
+ success = jni->CallBooleanMethod(*j_media_codec_video_decoder_,
+ j_release_output_buffer_method_,
+ j_output_buffer_index);
+ CHECK_EXCEPTION(jni, "");
+ if (!success) {
+ ALOGE("releaseOutputBuffer error");
+ Reset();
+ return WEBRTC_VIDEO_CODEC_ERROR;
+ }
+
+ // Callback.
+ decoded_image_.set_timestamp(inputImage._timeStamp);
+ decoded_image_.set_ntp_time_ms(inputImage.ntp_time_ms_);
+ frames_received_++;
+ return callback_->Decoded(decoded_image_);
+}
+
+int32_t MediaCodecVideoDecoder::RegisterDecodeCompleteCallback(
+ DecodedImageCallback* callback) {
+ callback_ = callback;
+ return WEBRTC_VIDEO_CODEC_OK;
+}
+
+int32_t MediaCodecVideoDecoder::Reset() {
+ ALOGD("DecoderReset");
+ if (!inited_) {
+ return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
+ }
+ return InitDecode(&codec_, 1);
+}
+
+void MediaCodecVideoDecoder::OnMessage(rtc::Message* msg) {
+}
+
+class MediaCodecVideoDecoderFactory
+ : public cricket::WebRtcVideoDecoderFactory {
+ public:
+ MediaCodecVideoDecoderFactory();
+ virtual ~MediaCodecVideoDecoderFactory();
+ // WebRtcVideoDecoderFactory implementation.
+ virtual webrtc::VideoDecoder* CreateVideoDecoder(
+ webrtc::VideoCodecType type) OVERRIDE;
+
+ virtual void DestroyVideoDecoder(webrtc::VideoDecoder* decoder) OVERRIDE;
+
+ private:
+ bool is_platform_supported_;
+};
+
+MediaCodecVideoDecoderFactory::MediaCodecVideoDecoderFactory() {
+ JNIEnv* jni = AttachCurrentThreadIfNeeded();
+ ScopedLocalRefFrame local_ref_frame(jni);
+ jclass j_decoder_class = FindClass(jni, "org/webrtc/MediaCodecVideoDecoder");
+ is_platform_supported_ = jni->CallStaticBooleanMethod(
+ j_decoder_class,
+ GetStaticMethodID(jni, j_decoder_class, "isPlatformSupported", "()Z"));
+ CHECK_EXCEPTION(jni, "");
+}
+
+MediaCodecVideoDecoderFactory::~MediaCodecVideoDecoderFactory() {}
+
+webrtc::VideoDecoder* MediaCodecVideoDecoderFactory::CreateVideoDecoder(
+ webrtc::VideoCodecType type) {
+ if (type != kVideoCodecVP8 || !is_platform_supported_) {
+ return NULL;
+ }
+ return new MediaCodecVideoDecoder(AttachCurrentThreadIfNeeded());
+}
+
+
+void MediaCodecVideoDecoderFactory::DestroyVideoDecoder(
+ webrtc::VideoDecoder* decoder) {
+ delete decoder;
+}
+
#endif // ANDROID
} // anonymous namespace
@@ -1817,7 +2256,7 @@
CHECK(!pthread_once(&g_jni_ptr_once, &CreateJNIPtrKey), "pthread_once");
- CHECK(talk_base::InitializeSSL(), "Failed to InitializeSSL()");
+ CHECK(rtc::InitializeSSL(), "Failed to InitializeSSL()");
JNIEnv* jni;
if (jvm->GetEnv(reinterpret_cast<void**>(&jni), JNI_VERSION_1_6) != JNI_OK)
@@ -1831,7 +2270,7 @@
g_class_reference_holder->FreeReferences(AttachCurrentThreadIfNeeded());
delete g_class_reference_holder;
g_class_reference_holder = NULL;
- CHECK(talk_base::CleanupSSL(), "Failed to CleanupSSL()");
+ CHECK(rtc::CleanupSSL(), "Failed to CleanupSSL()");
g_jvm = NULL;
}
@@ -1880,7 +2319,7 @@
jbyteArray data, jboolean binary) {
jbyte* bytes = jni->GetByteArrayElements(data, NULL);
bool ret = ExtractNativeDC(jni, j_dc)->Send(DataBuffer(
- talk_base::Buffer(bytes, jni->GetArrayLength(data)),
+ rtc::Buffer(bytes, jni->GetArrayLength(data)),
binary));
jni->ReleaseByteArrayElements(data, bytes, JNI_ABORT);
return ret;
@@ -1909,7 +2348,7 @@
}
#endif
}
- talk_base::LogMessage::LogToDebug(nativeSeverity);
+ rtc::LogMessage::LogToDebug(nativeSeverity);
}
JOW(void, PeerConnection_freePeerConnection)(JNIEnv*, jclass, jlong j_p) {
@@ -2019,9 +2458,9 @@
// talk/ assumes pretty widely that the current Thread is ThreadManager'd, but
// ThreadManager only WrapCurrentThread()s the thread where it is first
// created. Since the semantics around when auto-wrapping happens in
- // talk/base/ are convoluted, we simply wrap here to avoid having to think
+ // webrtc/base/ are convoluted, we simply wrap here to avoid having to think
// about ramifications of auto-wrapping there.
- talk_base::ThreadManager::Instance()->WrapCurrentThread();
+ rtc::ThreadManager::Instance()->WrapCurrentThread();
webrtc::Trace::CreateTrace();
Thread* worker_thread = new Thread();
worker_thread->SetName("worker_thread", NULL);
@@ -2030,15 +2469,17 @@
CHECK(worker_thread->Start() && signaling_thread->Start(),
"Failed to start threads");
scoped_ptr<cricket::WebRtcVideoEncoderFactory> encoder_factory;
+ scoped_ptr<cricket::WebRtcVideoDecoderFactory> decoder_factory;
#ifdef ANDROID
encoder_factory.reset(new MediaCodecVideoEncoderFactory());
+ decoder_factory.reset(new MediaCodecVideoDecoderFactory());
#endif
- talk_base::scoped_refptr<PeerConnectionFactoryInterface> factory(
+ rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
webrtc::CreatePeerConnectionFactory(worker_thread,
signaling_thread,
NULL,
encoder_factory.release(),
- NULL));
+ decoder_factory.release()));
OwnedFactoryAndThreads* owned_factory = new OwnedFactoryAndThreads(
worker_thread, signaling_thread, factory.release());
return jlongFromPointer(owned_factory);
@@ -2055,9 +2496,9 @@
JOW(jlong, PeerConnectionFactory_nativeCreateLocalMediaStream)(
JNIEnv* jni, jclass, jlong native_factory, jstring label) {
- talk_base::scoped_refptr<PeerConnectionFactoryInterface> factory(
+ rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
factoryFromJava(native_factory));
- talk_base::scoped_refptr<MediaStreamInterface> stream(
+ rtc::scoped_refptr<MediaStreamInterface> stream(
factory->CreateLocalMediaStream(JavaToStdString(jni, label)));
return (jlong)stream.release();
}
@@ -2067,9 +2508,9 @@
jobject j_constraints) {
scoped_ptr<ConstraintsWrapper> constraints(
new ConstraintsWrapper(jni, j_constraints));
- talk_base::scoped_refptr<PeerConnectionFactoryInterface> factory(
+ rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
factoryFromJava(native_factory));
- talk_base::scoped_refptr<VideoSourceInterface> source(
+ rtc::scoped_refptr<VideoSourceInterface> source(
factory->CreateVideoSource(
reinterpret_cast<cricket::VideoCapturer*>(native_capturer),
constraints.get()));
@@ -2079,9 +2520,9 @@
JOW(jlong, PeerConnectionFactory_nativeCreateVideoTrack)(
JNIEnv* jni, jclass, jlong native_factory, jstring id,
jlong native_source) {
- talk_base::scoped_refptr<PeerConnectionFactoryInterface> factory(
+ rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
factoryFromJava(native_factory));
- talk_base::scoped_refptr<VideoTrackInterface> track(
+ rtc::scoped_refptr<VideoTrackInterface> track(
factory->CreateVideoTrack(
JavaToStdString(jni, id),
reinterpret_cast<VideoSourceInterface*>(native_source)));
@@ -2092,9 +2533,9 @@
JNIEnv* jni, jclass, jlong native_factory, jobject j_constraints) {
scoped_ptr<ConstraintsWrapper> constraints(
new ConstraintsWrapper(jni, j_constraints));
- talk_base::scoped_refptr<PeerConnectionFactoryInterface> factory(
+ rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
factoryFromJava(native_factory));
- talk_base::scoped_refptr<AudioSourceInterface> source(
+ rtc::scoped_refptr<AudioSourceInterface> source(
factory->CreateAudioSource(constraints.get()));
return (jlong)source.release();
}
@@ -2102,9 +2543,9 @@
JOW(jlong, PeerConnectionFactory_nativeCreateAudioTrack)(
JNIEnv* jni, jclass, jlong native_factory, jstring id,
jlong native_source) {
- talk_base::scoped_refptr<PeerConnectionFactoryInterface> factory(
+ rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
factoryFromJava(native_factory));
- talk_base::scoped_refptr<AudioTrackInterface> track(factory->CreateAudioTrack(
+ rtc::scoped_refptr<AudioTrackInterface> track(factory->CreateAudioTrack(
JavaToStdString(jni, id),
reinterpret_cast<AudioSourceInterface*>(native_source)));
return (jlong)track.release();
@@ -2151,24 +2592,24 @@
JOW(jlong, PeerConnectionFactory_nativeCreatePeerConnection)(
JNIEnv *jni, jclass, jlong factory, jobject j_ice_servers,
jobject j_constraints, jlong observer_p) {
- talk_base::scoped_refptr<PeerConnectionFactoryInterface> f(
+ rtc::scoped_refptr<PeerConnectionFactoryInterface> f(
reinterpret_cast<PeerConnectionFactoryInterface*>(
factoryFromJava(factory)));
PeerConnectionInterface::IceServers servers;
JavaIceServersToJsepIceServers(jni, j_ice_servers, &servers);
PCOJava* observer = reinterpret_cast<PCOJava*>(observer_p);
observer->SetConstraints(new ConstraintsWrapper(jni, j_constraints));
- talk_base::scoped_refptr<PeerConnectionInterface> pc(f->CreatePeerConnection(
+ rtc::scoped_refptr<PeerConnectionInterface> pc(f->CreatePeerConnection(
servers, observer->constraints(), NULL, NULL, observer));
return (jlong)pc.release();
}
-static talk_base::scoped_refptr<PeerConnectionInterface> ExtractNativePC(
+static rtc::scoped_refptr<PeerConnectionInterface> ExtractNativePC(
JNIEnv* jni, jobject j_pc) {
jfieldID native_pc_id = GetFieldID(jni,
GetObjectClass(jni, j_pc), "nativePeerConnection", "J");
jlong j_p = GetLongField(jni, j_pc, native_pc_id);
- return talk_base::scoped_refptr<PeerConnectionInterface>(
+ return rtc::scoped_refptr<PeerConnectionInterface>(
reinterpret_cast<PeerConnectionInterface*>(j_p));
}
@@ -2187,7 +2628,7 @@
JOW(jobject, PeerConnection_createDataChannel)(
JNIEnv* jni, jobject j_pc, jstring j_label, jobject j_init) {
DataChannelInit init = JavaDataChannelInitToNative(jni, j_init);
- talk_base::scoped_refptr<DataChannelInterface> channel(
+ rtc::scoped_refptr<DataChannelInterface> channel(
ExtractNativePC(jni, j_pc)->CreateDataChannel(
JavaToStdString(jni, j_label), &init));
// Mustn't pass channel.get() directly through NewObject to avoid reading its
@@ -2211,8 +2652,8 @@
JNIEnv* jni, jobject j_pc, jobject j_observer, jobject j_constraints) {
ConstraintsWrapper* constraints =
new ConstraintsWrapper(jni, j_constraints);
- talk_base::scoped_refptr<CreateSdpObserverWrapper> observer(
- new talk_base::RefCountedObject<CreateSdpObserverWrapper>(
+ rtc::scoped_refptr<CreateSdpObserverWrapper> observer(
+ new rtc::RefCountedObject<CreateSdpObserverWrapper>(
jni, j_observer, constraints));
ExtractNativePC(jni, j_pc)->CreateOffer(observer, constraints);
}
@@ -2221,8 +2662,8 @@
JNIEnv* jni, jobject j_pc, jobject j_observer, jobject j_constraints) {
ConstraintsWrapper* constraints =
new ConstraintsWrapper(jni, j_constraints);
- talk_base::scoped_refptr<CreateSdpObserverWrapper> observer(
- new talk_base::RefCountedObject<CreateSdpObserverWrapper>(
+ rtc::scoped_refptr<CreateSdpObserverWrapper> observer(
+ new rtc::RefCountedObject<CreateSdpObserverWrapper>(
jni, j_observer, constraints));
ExtractNativePC(jni, j_pc)->CreateAnswer(observer, constraints);
}
@@ -2254,8 +2695,8 @@
JOW(void, PeerConnection_setLocalDescription)(
JNIEnv* jni, jobject j_pc,
jobject j_observer, jobject j_sdp) {
- talk_base::scoped_refptr<SetSdpObserverWrapper> observer(
- new talk_base::RefCountedObject<SetSdpObserverWrapper>(
+ rtc::scoped_refptr<SetSdpObserverWrapper> observer(
+ new rtc::RefCountedObject<SetSdpObserverWrapper>(
jni, j_observer, reinterpret_cast<ConstraintsWrapper*>(NULL)));
ExtractNativePC(jni, j_pc)->SetLocalDescription(
observer, JavaSdpToNativeSdp(jni, j_sdp));
@@ -2264,8 +2705,8 @@
JOW(void, PeerConnection_setRemoteDescription)(
JNIEnv* jni, jobject j_pc,
jobject j_observer, jobject j_sdp) {
- talk_base::scoped_refptr<SetSdpObserverWrapper> observer(
- new talk_base::RefCountedObject<SetSdpObserverWrapper>(
+ rtc::scoped_refptr<SetSdpObserverWrapper> observer(
+ new rtc::RefCountedObject<SetSdpObserverWrapper>(
jni, j_observer, reinterpret_cast<ConstraintsWrapper*>(NULL)));
ExtractNativePC(jni, j_pc)->SetRemoteDescription(
observer, JavaSdpToNativeSdp(jni, j_sdp));
@@ -2307,8 +2748,8 @@
JOW(bool, PeerConnection_nativeGetStats)(
JNIEnv* jni, jobject j_pc, jobject j_observer, jlong native_track) {
- talk_base::scoped_refptr<StatsObserverWrapper> observer(
- new talk_base::RefCountedObject<StatsObserverWrapper>(jni, j_observer));
+ rtc::scoped_refptr<StatsObserverWrapper> observer(
+ new rtc::RefCountedObject<StatsObserverWrapper>(jni, j_observer));
return ExtractNativePC(jni, j_pc)->GetStats(
observer,
reinterpret_cast<MediaStreamTrackInterface*>(native_track),
@@ -2339,7 +2780,7 @@
}
JOW(jobject, MediaSource_nativeState)(JNIEnv* jni, jclass, jlong j_p) {
- talk_base::scoped_refptr<MediaSourceInterface> p(
+ rtc::scoped_refptr<MediaSourceInterface> p(
reinterpret_cast<MediaSourceInterface*>(j_p));
return JavaEnumFromIndex(jni, "MediaSource$State", p->state());
}
diff --git a/app/webrtc/java/src/org/webrtc/Logging.java b/app/webrtc/java/src/org/webrtc/Logging.java
index 8b23daf..b8d6c6e 100644
--- a/app/webrtc/java/src/org/webrtc/Logging.java
+++ b/app/webrtc/java/src/org/webrtc/Logging.java
@@ -59,7 +59,7 @@
}
};
- // Keep in sync with talk/base/logging.h:LoggingSeverity.
+ // Keep in sync with webrtc/base/logging.h:LoggingSeverity.
public enum Severity {
LS_SENSITIVE, LS_VERBOSE, LS_INFO, LS_WARNING, LS_ERROR,
};
diff --git a/app/webrtc/java/src/org/webrtc/MediaCodecVideoDecoder.java b/app/webrtc/java/src/org/webrtc/MediaCodecVideoDecoder.java
new file mode 100644
index 0000000..f0c56ee
--- /dev/null
+++ b/app/webrtc/java/src/org/webrtc/MediaCodecVideoDecoder.java
@@ -0,0 +1,291 @@
+/*
+ * libjingle
+ * Copyright 2014, 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.
+ */
+
+package org.webrtc;
+
+import android.media.MediaCodec;
+import android.media.MediaCodecInfo;
+import android.media.MediaCodecInfo.CodecCapabilities;
+import android.media.MediaCodecList;
+import android.media.MediaFormat;
+import android.os.Build;
+import android.os.Bundle;
+import android.util.Log;
+import java.nio.ByteBuffer;
+
+// Java-side of peerconnection_jni.cc:MediaCodecVideoDecoder.
+// This class is an implementation detail of the Java PeerConnection API.
+// MediaCodec is thread-hostile so this class must be operated on a single
+// thread.
+class MediaCodecVideoDecoder {
+ // This class is constructed, operated, and destroyed by its C++ incarnation,
+ // so the class and its methods have non-public visibility. The API this
+ // class exposes aims to mimic the webrtc::VideoDecoder API as closely as
+ // possibly to minimize the amount of translation work necessary.
+
+ private static final String TAG = "MediaCodecVideoDecoder";
+
+ private static final int DEQUEUE_TIMEOUT = 1000000; // 1 sec timeout.
+ private Thread mediaCodecThread;
+ private MediaCodec mediaCodec;
+ private ByteBuffer[] inputBuffers;
+ private ByteBuffer[] outputBuffers;
+ private static final String VP8_MIME_TYPE = "video/x-vnd.on2.vp8";
+ // List of supported HW VP8 decoders.
+ private static final String[] supportedHwCodecPrefixes =
+ {"OMX.Nvidia."};
+ // NV12 color format supported by QCOM codec, but not declared in MediaCodec -
+ // see /hardware/qcom/media/mm-core/inc/OMX_QCOMExtns.h
+ private static final int
+ COLOR_QCOM_FORMATYUV420PackedSemiPlanar32m = 0x7FA30C04;
+ // Allowable color formats supported by codec - in order of preference.
+ private static final int[] supportedColorList = {
+ CodecCapabilities.COLOR_FormatYUV420Planar,
+ CodecCapabilities.COLOR_FormatYUV420SemiPlanar,
+ CodecCapabilities.COLOR_QCOM_FormatYUV420SemiPlanar,
+ COLOR_QCOM_FORMATYUV420PackedSemiPlanar32m
+ };
+ private int colorFormat;
+ private int width;
+ private int height;
+ private int stride;
+ private int sliceHeight;
+
+ private MediaCodecVideoDecoder() { }
+
+ // Helper struct for findVp8HwDecoder() below.
+ private static class DecoderProperties {
+ DecoderProperties(String codecName, int colorFormat) {
+ this.codecName = codecName;
+ this.colorFormat = colorFormat;
+ }
+ public final String codecName; // OpenMax component name for VP8 codec.
+ public final int colorFormat; // Color format supported by codec.
+ }
+
+ private static DecoderProperties findVp8HwDecoder() {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT)
+ return null; // MediaCodec.setParameters is missing.
+
+ for (int i = 0; i < MediaCodecList.getCodecCount(); ++i) {
+ MediaCodecInfo info = MediaCodecList.getCodecInfoAt(i);
+ if (info.isEncoder()) {
+ continue;
+ }
+ String name = null;
+ for (String mimeType : info.getSupportedTypes()) {
+ if (mimeType.equals(VP8_MIME_TYPE)) {
+ name = info.getName();
+ break;
+ }
+ }
+ if (name == null) {
+ continue; // No VP8 support in this codec; try the next one.
+ }
+ Log.d(TAG, "Found candidate decoder " + name);
+ CodecCapabilities capabilities =
+ info.getCapabilitiesForType(VP8_MIME_TYPE);
+ for (int colorFormat : capabilities.colorFormats) {
+ Log.d(TAG, " Color: 0x" + Integer.toHexString(colorFormat));
+ }
+
+ // Check if this is supported HW decoder
+ for (String hwCodecPrefix : supportedHwCodecPrefixes) {
+ if (!name.startsWith(hwCodecPrefix)) {
+ continue;
+ }
+ // Check if codec supports either yuv420 or nv12
+ for (int supportedColorFormat : supportedColorList) {
+ for (int codecColorFormat : capabilities.colorFormats) {
+ if (codecColorFormat == supportedColorFormat) {
+ // Found supported HW VP8 decoder
+ Log.d(TAG, "Found target decoder " + name +
+ ". Color: 0x" + Integer.toHexString(codecColorFormat));
+ return new DecoderProperties(name, codecColorFormat);
+ }
+ }
+ }
+ }
+ }
+ return null; // No HW VP8 decoder.
+ }
+
+ private static boolean isPlatformSupported() {
+ return findVp8HwDecoder() != null;
+ }
+
+ private void checkOnMediaCodecThread() {
+ if (mediaCodecThread.getId() != Thread.currentThread().getId()) {
+ throw new RuntimeException(
+ "MediaCodecVideoDecoder previously operated on " + mediaCodecThread +
+ " but is now called on " + Thread.currentThread());
+ }
+ }
+
+ private boolean initDecode(int width, int height) {
+ if (mediaCodecThread != null) {
+ throw new RuntimeException("Forgot to release()?");
+ }
+ DecoderProperties properties = findVp8HwDecoder();
+ if (properties == null) {
+ throw new RuntimeException("Cannot find HW VP8 decoder");
+ }
+ Log.d(TAG, "Java initDecode: " + width + " x " + height +
+ ". Color: 0x" + Integer.toHexString(properties.colorFormat));
+ mediaCodecThread = Thread.currentThread();
+ try {
+ this.width = width;
+ this.height = height;
+ stride = width;
+ sliceHeight = height;
+ MediaFormat format =
+ MediaFormat.createVideoFormat(VP8_MIME_TYPE, width, height);
+ format.setInteger(MediaFormat.KEY_COLOR_FORMAT, properties.colorFormat);
+ Log.d(TAG, " Format: " + format);
+ mediaCodec = MediaCodec.createByCodecName(properties.codecName);
+ if (mediaCodec == null) {
+ return false;
+ }
+ mediaCodec.configure(format, null, null, 0);
+ mediaCodec.start();
+ colorFormat = properties.colorFormat;
+ outputBuffers = mediaCodec.getOutputBuffers();
+ inputBuffers = mediaCodec.getInputBuffers();
+ Log.d(TAG, "Input buffers: " + inputBuffers.length +
+ ". Output buffers: " + outputBuffers.length);
+ return true;
+ } catch (IllegalStateException e) {
+ Log.e(TAG, "initDecode failed", e);
+ return false;
+ }
+ }
+
+ private void release() {
+ Log.d(TAG, "Java releaseDecoder");
+ checkOnMediaCodecThread();
+ try {
+ mediaCodec.stop();
+ mediaCodec.release();
+ } catch (IllegalStateException e) {
+ Log.e(TAG, "release failed", e);
+ }
+ mediaCodec = null;
+ mediaCodecThread = null;
+ }
+
+ // Dequeue an input buffer and return its index, -1 if no input buffer is
+ // available, or -2 if the codec is no longer operative.
+ private int dequeueInputBuffer() {
+ checkOnMediaCodecThread();
+ try {
+ return mediaCodec.dequeueInputBuffer(DEQUEUE_TIMEOUT);
+ } catch (IllegalStateException e) {
+ Log.e(TAG, "dequeueIntputBuffer failed", e);
+ return -2;
+ }
+ }
+
+ private boolean queueInputBuffer(
+ int inputBufferIndex, int size, long timestampUs) {
+ checkOnMediaCodecThread();
+ try {
+ inputBuffers[inputBufferIndex].position(0);
+ inputBuffers[inputBufferIndex].limit(size);
+ mediaCodec.queueInputBuffer(inputBufferIndex, 0, size, timestampUs, 0);
+ return true;
+ }
+ catch (IllegalStateException e) {
+ Log.e(TAG, "decode failed", e);
+ return false;
+ }
+ }
+
+ // Dequeue and return an output buffer index, -1 if no output
+ // buffer available or -2 if error happened.
+ private int dequeueOutputBuffer() {
+ checkOnMediaCodecThread();
+ try {
+ MediaCodec.BufferInfo info = new MediaCodec.BufferInfo();
+ int result = mediaCodec.dequeueOutputBuffer(info, DEQUEUE_TIMEOUT);
+ while (result == MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED ||
+ result == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) {
+ if (result == MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED) {
+ outputBuffers = mediaCodec.getOutputBuffers();
+ } else if (result == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) {
+ MediaFormat format = mediaCodec.getOutputFormat();
+ Log.d(TAG, "Format changed: " + format.toString());
+ width = format.getInteger(MediaFormat.KEY_WIDTH);
+ height = format.getInteger(MediaFormat.KEY_HEIGHT);
+ if (format.containsKey(MediaFormat.KEY_COLOR_FORMAT)) {
+ colorFormat = format.getInteger(MediaFormat.KEY_COLOR_FORMAT);
+ Log.d(TAG, "Color: 0x" + Integer.toHexString(colorFormat));
+ // Check if new color space is supported.
+ boolean validColorFormat = false;
+ for (int supportedColorFormat : supportedColorList) {
+ if (colorFormat == supportedColorFormat) {
+ validColorFormat = true;
+ break;
+ }
+ }
+ if (!validColorFormat) {
+ Log.e(TAG, "Non supported color format");
+ return -2;
+ }
+ }
+ if (format.containsKey("stride")) {
+ stride = format.getInteger("stride");
+ }
+ if (format.containsKey("slice-height")) {
+ sliceHeight = format.getInteger("slice-height");
+ }
+ Log.d(TAG, "Frame stride and slice height: "
+ + stride + " x " + sliceHeight);
+ stride = Math.max(width, stride);
+ sliceHeight = Math.max(height, sliceHeight);
+ }
+ result = mediaCodec.dequeueOutputBuffer(info, DEQUEUE_TIMEOUT);
+ }
+ return result;
+ } catch (IllegalStateException e) {
+ Log.e(TAG, "dequeueOutputBuffer failed", e);
+ return -2;
+ }
+ }
+
+ // Release a dequeued output buffer back to the codec for re-use. Return
+ // false if the codec is no longer operable.
+ private boolean releaseOutputBuffer(int index) {
+ checkOnMediaCodecThread();
+ try {
+ mediaCodec.releaseOutputBuffer(index, false);
+ return true;
+ } catch (IllegalStateException e) {
+ Log.e(TAG, "releaseOutputBuffer failed", e);
+ return false;
+ }
+ }
+}
diff --git a/app/webrtc/java/src/org/webrtc/MediaCodecVideoEncoder.java b/app/webrtc/java/src/org/webrtc/MediaCodecVideoEncoder.java
index 971c427..b1029dc 100644
--- a/app/webrtc/java/src/org/webrtc/MediaCodecVideoEncoder.java
+++ b/app/webrtc/java/src/org/webrtc/MediaCodecVideoEncoder.java
@@ -156,7 +156,7 @@
// Return the array of input buffers, or null on failure.
private ByteBuffer[] initEncode(int width, int height, int kbps, int fps) {
- Log.d(TAG, "initEncode: " + width + " x " + height +
+ Log.d(TAG, "Java initEncode: " + width + " x " + height +
". @ " + kbps + " kbps. Fps: " + fps +
". Color: 0x" + Integer.toHexString(colorFormat));
if (mediaCodecThread != null) {
@@ -222,7 +222,7 @@
}
private void release() {
- Log.d(TAG, "release");
+ Log.d(TAG, "Java releaseEncoder");
checkOnMediaCodecThread();
try {
mediaCodec.stop();
diff --git a/app/webrtc/jsep.h b/app/webrtc/jsep.h
index 5f28fc8..e748da1 100644
--- a/app/webrtc/jsep.h
+++ b/app/webrtc/jsep.h
@@ -33,8 +33,8 @@
#include <string>
#include <vector>
-#include "talk/base/basictypes.h"
-#include "talk/base/refcount.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/refcount.h"
namespace cricket {
class SessionDescription;
@@ -138,7 +138,7 @@
SdpParseError* error);
// Jsep CreateOffer and CreateAnswer callback interface.
-class CreateSessionDescriptionObserver : public talk_base::RefCountInterface {
+class CreateSessionDescriptionObserver : public rtc::RefCountInterface {
public:
// The implementation of the CreateSessionDescriptionObserver takes
// the ownership of the |desc|.
@@ -150,7 +150,7 @@
};
// Jsep SetLocalDescription and SetRemoteDescription callback interface.
-class SetSessionDescriptionObserver : public talk_base::RefCountInterface {
+class SetSessionDescriptionObserver : public rtc::RefCountInterface {
public:
virtual void OnSuccess() = 0;
virtual void OnFailure(const std::string& error) = 0;
diff --git a/app/webrtc/jsepicecandidate.cc b/app/webrtc/jsepicecandidate.cc
index 13cc812..755403e 100644
--- a/app/webrtc/jsepicecandidate.cc
+++ b/app/webrtc/jsepicecandidate.cc
@@ -30,7 +30,7 @@
#include <vector>
#include "talk/app/webrtc/webrtcsdp.h"
-#include "talk/base/stringencode.h"
+#include "webrtc/base/stringencode.h"
namespace webrtc {
diff --git a/app/webrtc/jsepicecandidate.h b/app/webrtc/jsepicecandidate.h
index 54de950..3463c82 100644
--- a/app/webrtc/jsepicecandidate.h
+++ b/app/webrtc/jsepicecandidate.h
@@ -33,7 +33,7 @@
#include <string>
#include "talk/app/webrtc/jsep.h"
-#include "talk/base/constructormagic.h"
+#include "webrtc/base/constructormagic.h"
#include "talk/p2p/base/candidate.h"
namespace webrtc {
diff --git a/app/webrtc/jsepsessiondescription.cc b/app/webrtc/jsepsessiondescription.cc
index 13604b4..eb42392 100644
--- a/app/webrtc/jsepsessiondescription.cc
+++ b/app/webrtc/jsepsessiondescription.cc
@@ -27,10 +27,10 @@
#include "talk/app/webrtc/jsepsessiondescription.h"
#include "talk/app/webrtc/webrtcsdp.h"
-#include "talk/base/stringencode.h"
+#include "webrtc/base/stringencode.h"
#include "talk/session/media/mediasession.h"
-using talk_base::scoped_ptr;
+using rtc::scoped_ptr;
using cricket::SessionDescription;
namespace webrtc {
diff --git a/app/webrtc/jsepsessiondescription.h b/app/webrtc/jsepsessiondescription.h
index 7ca7a22..07d13a3 100644
--- a/app/webrtc/jsepsessiondescription.h
+++ b/app/webrtc/jsepsessiondescription.h
@@ -35,7 +35,7 @@
#include "talk/app/webrtc/jsep.h"
#include "talk/app/webrtc/jsepicecandidate.h"
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/scoped_ptr.h"
namespace cricket {
class SessionDescription;
@@ -89,7 +89,7 @@
static const int kDefaultVideoCodecPreference;
private:
- talk_base::scoped_ptr<cricket::SessionDescription> description_;
+ rtc::scoped_ptr<cricket::SessionDescription> description_;
std::string session_id_;
std::string session_version_;
std::string type_;
diff --git a/app/webrtc/jsepsessiondescription_unittest.cc b/app/webrtc/jsepsessiondescription_unittest.cc
index 55eb3d5..12db9d4 100644
--- a/app/webrtc/jsepsessiondescription_unittest.cc
+++ b/app/webrtc/jsepsessiondescription_unittest.cc
@@ -29,11 +29,11 @@
#include "talk/app/webrtc/jsepicecandidate.h"
#include "talk/app/webrtc/jsepsessiondescription.h"
-#include "talk/base/gunit.h"
-#include "talk/base/helpers.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/ssladapter.h"
-#include "talk/base/stringencode.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/ssladapter.h"
+#include "webrtc/base/stringencode.h"
#include "talk/p2p/base/candidate.h"
#include "talk/p2p/base/constants.h"
#include "talk/p2p/base/sessiondescription.h"
@@ -44,7 +44,7 @@
using webrtc::JsepIceCandidate;
using webrtc::JsepSessionDescription;
using webrtc::SessionDescriptionInterface;
-using talk_base::scoped_ptr;
+using rtc::scoped_ptr;
static const char kCandidateUfrag[] = "ufrag";
static const char kCandidatePwd[] = "pwd";
@@ -98,24 +98,24 @@
class JsepSessionDescriptionTest : public testing::Test {
protected:
static void SetUpTestCase() {
- talk_base::InitializeSSL();
+ rtc::InitializeSSL();
}
static void TearDownTestCase() {
- talk_base::CleanupSSL();
+ rtc::CleanupSSL();
}
virtual void SetUp() {
int port = 1234;
- talk_base::SocketAddress address("127.0.0.1", port++);
+ rtc::SocketAddress address("127.0.0.1", port++);
cricket::Candidate candidate("rtp", cricket::ICE_CANDIDATE_COMPONENT_RTP,
"udp", address, 1, "",
"", "local", "eth0", 0, "1");
candidate_ = candidate;
const std::string session_id =
- talk_base::ToString(talk_base::CreateRandomId64());
+ rtc::ToString(rtc::CreateRandomId64());
const std::string session_version =
- talk_base::ToString(talk_base::CreateRandomId());
+ rtc::ToString(rtc::CreateRandomId());
jsep_desc_.reset(new JsepSessionDescription("dummy"));
ASSERT_TRUE(jsep_desc_->Initialize(CreateCricketSessionDescription(),
session_id, session_version));
@@ -135,7 +135,7 @@
}
cricket::Candidate candidate_;
- talk_base::scoped_ptr<JsepSessionDescription> jsep_desc_;
+ rtc::scoped_ptr<JsepSessionDescription> jsep_desc_;
};
// Test that number_of_mediasections() returns the number of media contents in
diff --git a/app/webrtc/localaudiosource.cc b/app/webrtc/localaudiosource.cc
index ab9ae4f..9a37112 100644
--- a/app/webrtc/localaudiosource.cc
+++ b/app/webrtc/localaudiosource.cc
@@ -53,7 +53,7 @@
for (iter = constraints.begin(); iter != constraints.end(); ++iter) {
bool value = false;
- if (!talk_base::FromString(iter->value, &value)) {
+ if (!rtc::FromString(iter->value, &value)) {
success = false;
continue;
}
@@ -87,11 +87,11 @@
} // namespace
-talk_base::scoped_refptr<LocalAudioSource> LocalAudioSource::Create(
+rtc::scoped_refptr<LocalAudioSource> LocalAudioSource::Create(
const PeerConnectionFactoryInterface::Options& options,
const MediaConstraintsInterface* constraints) {
- talk_base::scoped_refptr<LocalAudioSource> source(
- new talk_base::RefCountedObject<LocalAudioSource>());
+ rtc::scoped_refptr<LocalAudioSource> source(
+ new rtc::RefCountedObject<LocalAudioSource>());
source->Initialize(options, constraints);
return source;
}
diff --git a/app/webrtc/localaudiosource.h b/app/webrtc/localaudiosource.h
index fb769ed..84fa763 100644
--- a/app/webrtc/localaudiosource.h
+++ b/app/webrtc/localaudiosource.h
@@ -31,7 +31,7 @@
#include "talk/app/webrtc/mediastreaminterface.h"
#include "talk/app/webrtc/notifier.h"
#include "talk/app/webrtc/peerconnectioninterface.h"
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/media/base/mediachannel.h"
// LocalAudioSource implements AudioSourceInterface.
@@ -44,7 +44,7 @@
class LocalAudioSource : public Notifier<AudioSourceInterface> {
public:
// Creates an instance of LocalAudioSource.
- static talk_base::scoped_refptr<LocalAudioSource> Create(
+ static rtc::scoped_refptr<LocalAudioSource> Create(
const PeerConnectionFactoryInterface::Options& options,
const MediaConstraintsInterface* constraints);
diff --git a/app/webrtc/localaudiosource_unittest.cc b/app/webrtc/localaudiosource_unittest.cc
index f8880e0..3a14bec 100644
--- a/app/webrtc/localaudiosource_unittest.cc
+++ b/app/webrtc/localaudiosource_unittest.cc
@@ -31,7 +31,7 @@
#include <vector>
#include "talk/app/webrtc/test/fakeconstraints.h"
-#include "talk/base/gunit.h"
+#include "webrtc/base/gunit.h"
#include "talk/media/base/fakemediaengine.h"
#include "talk/media/base/fakevideorenderer.h"
#include "talk/media/devices/fakedevicemanager.h"
@@ -52,7 +52,7 @@
constraints.AddMandatory(MediaConstraintsInterface::kNoiseSuppression, false);
constraints.AddOptional(MediaConstraintsInterface::kHighpassFilter, true);
- talk_base::scoped_refptr<LocalAudioSource> source =
+ rtc::scoped_refptr<LocalAudioSource> source =
LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(),
&constraints);
@@ -73,7 +73,7 @@
TEST(LocalAudioSourceTest, OptionNotSet) {
webrtc::FakeConstraints constraints;
- talk_base::scoped_refptr<LocalAudioSource> source =
+ rtc::scoped_refptr<LocalAudioSource> source =
LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(),
&constraints);
bool value;
@@ -85,7 +85,7 @@
constraints.AddMandatory(MediaConstraintsInterface::kEchoCancellation, false);
constraints.AddOptional(MediaConstraintsInterface::kEchoCancellation, true);
- talk_base::scoped_refptr<LocalAudioSource> source =
+ rtc::scoped_refptr<LocalAudioSource> source =
LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(),
&constraints);
@@ -99,7 +99,7 @@
constraints.AddOptional(MediaConstraintsInterface::kHighpassFilter, false);
constraints.AddOptional("invalidKey", false);
- talk_base::scoped_refptr<LocalAudioSource> source =
+ rtc::scoped_refptr<LocalAudioSource> source =
LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(),
&constraints);
@@ -114,7 +114,7 @@
constraints.AddMandatory(MediaConstraintsInterface::kHighpassFilter, false);
constraints.AddMandatory("invalidKey", false);
- talk_base::scoped_refptr<LocalAudioSource> source =
+ rtc::scoped_refptr<LocalAudioSource> source =
LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(),
&constraints);
diff --git a/app/webrtc/mediaconstraintsinterface.cc b/app/webrtc/mediaconstraintsinterface.cc
index 0ecadd6..874ce64 100644
--- a/app/webrtc/mediaconstraintsinterface.cc
+++ b/app/webrtc/mediaconstraintsinterface.cc
@@ -27,7 +27,7 @@
#include "talk/app/webrtc/mediaconstraintsinterface.h"
-#include "talk/base/stringencode.h"
+#include "webrtc/base/stringencode.h"
namespace webrtc {
@@ -97,8 +97,6 @@
"googImprovedWifiBwe";
const char MediaConstraintsInterface::kScreencastMinBitrate[] =
"googScreencastMinBitrate";
-const char MediaConstraintsInterface::kSkipEncodingUnusedStreams[] =
- "googSkipEncodingUnusedStreams";
// TODO(ronghuawu): Remove once cpu overuse detection is stable.
const char MediaConstraintsInterface::kCpuOveruseDetection[] =
"googCpuOveruseDetection";
@@ -155,10 +153,10 @@
if (constraints->GetMandatory().FindFirst(key, &string_value)) {
if (mandatory_constraints)
++*mandatory_constraints;
- return talk_base::FromString(string_value, value);
+ return rtc::FromString(string_value, value);
}
if (constraints->GetOptional().FindFirst(key, &string_value)) {
- return talk_base::FromString(string_value, value);
+ return rtc::FromString(string_value, value);
}
return false;
}
diff --git a/app/webrtc/mediaconstraintsinterface.h b/app/webrtc/mediaconstraintsinterface.h
index 2ac2516..1304d88 100644
--- a/app/webrtc/mediaconstraintsinterface.h
+++ b/app/webrtc/mediaconstraintsinterface.h
@@ -117,8 +117,6 @@
// googSuspendBelowMinBitrate
static const char kImprovedWifiBwe[]; // googImprovedWifiBwe
static const char kScreencastMinBitrate[]; // googScreencastMinBitrate
- static const char kSkipEncodingUnusedStreams[];
- // googSkipEncodingUnusedStreams
static const char kCpuOveruseDetection[]; // googCpuOveruseDetection
static const char kCpuUnderuseThreshold[]; // googCpuUnderuseThreshold
static const char kCpuOveruseThreshold[]; // googCpuOveruseThreshold
diff --git a/app/webrtc/mediastream.cc b/app/webrtc/mediastream.cc
index aad8e85..2bd5b53 100644
--- a/app/webrtc/mediastream.cc
+++ b/app/webrtc/mediastream.cc
@@ -26,7 +26,7 @@
*/
#include "talk/app/webrtc/mediastream.h"
-#include "talk/base/logging.h"
+#include "webrtc/base/logging.h"
namespace webrtc {
@@ -42,10 +42,10 @@
return it;
};
-talk_base::scoped_refptr<MediaStream> MediaStream::Create(
+rtc::scoped_refptr<MediaStream> MediaStream::Create(
const std::string& label) {
- talk_base::RefCountedObject<MediaStream>* stream =
- new talk_base::RefCountedObject<MediaStream>(label);
+ rtc::RefCountedObject<MediaStream>* stream =
+ new rtc::RefCountedObject<MediaStream>(label);
return stream;
}
@@ -69,7 +69,7 @@
return RemoveTrack<VideoTrackVector>(&video_tracks_, track);
}
-talk_base::scoped_refptr<AudioTrackInterface>
+rtc::scoped_refptr<AudioTrackInterface>
MediaStream::FindAudioTrack(const std::string& track_id) {
AudioTrackVector::iterator it = FindTrack(&audio_tracks_, track_id);
if (it == audio_tracks_.end())
@@ -77,7 +77,7 @@
return *it;
}
-talk_base::scoped_refptr<VideoTrackInterface>
+rtc::scoped_refptr<VideoTrackInterface>
MediaStream::FindVideoTrack(const std::string& track_id) {
VideoTrackVector::iterator it = FindTrack(&video_tracks_, track_id);
if (it == video_tracks_.end())
diff --git a/app/webrtc/mediastream.h b/app/webrtc/mediastream.h
index e5ac6eb..c8e0bcc 100644
--- a/app/webrtc/mediastream.h
+++ b/app/webrtc/mediastream.h
@@ -40,7 +40,7 @@
class MediaStream : public Notifier<MediaStreamInterface> {
public:
- static talk_base::scoped_refptr<MediaStream> Create(const std::string& label);
+ static rtc::scoped_refptr<MediaStream> Create(const std::string& label);
virtual std::string label() const OVERRIDE { return label_; }
@@ -48,9 +48,9 @@
virtual bool AddTrack(VideoTrackInterface* track) OVERRIDE;
virtual bool RemoveTrack(AudioTrackInterface* track) OVERRIDE;
virtual bool RemoveTrack(VideoTrackInterface* track) OVERRIDE;
- virtual talk_base::scoped_refptr<AudioTrackInterface>
+ virtual rtc::scoped_refptr<AudioTrackInterface>
FindAudioTrack(const std::string& track_id);
- virtual talk_base::scoped_refptr<VideoTrackInterface>
+ virtual rtc::scoped_refptr<VideoTrackInterface>
FindVideoTrack(const std::string& track_id);
virtual AudioTrackVector GetAudioTracks() OVERRIDE { return audio_tracks_; }
diff --git a/app/webrtc/mediastream_unittest.cc b/app/webrtc/mediastream_unittest.cc
index 113242f..4711e9c 100644
--- a/app/webrtc/mediastream_unittest.cc
+++ b/app/webrtc/mediastream_unittest.cc
@@ -30,9 +30,9 @@
#include "talk/app/webrtc/audiotrack.h"
#include "talk/app/webrtc/mediastream.h"
#include "talk/app/webrtc/videotrack.h"
-#include "talk/base/refcount.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/gunit.h"
+#include "webrtc/base/refcount.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/gunit.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -40,7 +40,7 @@
static const char kVideoTrackId[] = "dummy_video_cam_1";
static const char kAudioTrackId[] = "dummy_microphone_1";
-using talk_base::scoped_refptr;
+using rtc::scoped_refptr;
using ::testing::Exactly;
namespace webrtc {
diff --git a/app/webrtc/mediastreamhandler.cc b/app/webrtc/mediastreamhandler.cc
index ca28cf4..57aa4f5 100644
--- a/app/webrtc/mediastreamhandler.cc
+++ b/app/webrtc/mediastreamhandler.cc
@@ -59,7 +59,7 @@
LocalAudioSinkAdapter::LocalAudioSinkAdapter() : sink_(NULL) {}
LocalAudioSinkAdapter::~LocalAudioSinkAdapter() {
- talk_base::CritScope lock(&lock_);
+ rtc::CritScope lock(&lock_);
if (sink_)
sink_->OnClose();
}
@@ -69,7 +69,7 @@
int sample_rate,
int number_of_channels,
int number_of_frames) {
- talk_base::CritScope lock(&lock_);
+ rtc::CritScope lock(&lock_);
if (sink_) {
sink_->OnData(audio_data, bits_per_sample, sample_rate,
number_of_channels, number_of_frames);
@@ -77,7 +77,7 @@
}
void LocalAudioSinkAdapter::SetSink(cricket::AudioRenderer::Sink* sink) {
- talk_base::CritScope lock(&lock_);
+ rtc::CritScope lock(&lock_);
ASSERT(!sink || !sink_);
sink_ = sink;
}
diff --git a/app/webrtc/mediastreamhandler.h b/app/webrtc/mediastreamhandler.h
index 53afd55..63864ce 100644
--- a/app/webrtc/mediastreamhandler.h
+++ b/app/webrtc/mediastreamhandler.h
@@ -39,7 +39,7 @@
#include "talk/app/webrtc/mediastreaminterface.h"
#include "talk/app/webrtc/mediastreamprovider.h"
#include "talk/app/webrtc/peerconnectioninterface.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/thread.h"
#include "talk/media/base/audiorenderer.h"
namespace webrtc {
@@ -62,7 +62,7 @@
virtual void OnEnabledChanged() = 0;
private:
- talk_base::scoped_refptr<MediaStreamTrackInterface> track_;
+ rtc::scoped_refptr<MediaStreamTrackInterface> track_;
uint32 ssrc_;
MediaStreamTrackInterface::TrackState state_;
bool enabled_;
@@ -87,7 +87,7 @@
cricket::AudioRenderer::Sink* sink_;
// Critical section protecting |sink_|.
- talk_base::CriticalSection lock_;
+ rtc::CriticalSection lock_;
};
// LocalAudioTrackHandler listen to events on a local AudioTrack instance
@@ -112,7 +112,7 @@
// Used to pass the data callback from the |audio_track_| to the other
// end of cricket::AudioRenderer.
- talk_base::scoped_ptr<LocalAudioSinkAdapter> sink_adapter_;
+ rtc::scoped_ptr<LocalAudioSinkAdapter> sink_adapter_;
};
// RemoteAudioTrackHandler listen to events on a remote AudioTrack instance
@@ -196,7 +196,7 @@
protected:
TrackHandler* FindTrackHandler(MediaStreamTrackInterface* track);
- talk_base::scoped_refptr<MediaStreamInterface> stream_;
+ rtc::scoped_refptr<MediaStreamInterface> stream_;
AudioProviderInterface* audio_provider_;
VideoProviderInterface* video_provider_;
typedef std::vector<TrackHandler*> TrackHandlers;
diff --git a/app/webrtc/mediastreamhandler_unittest.cc b/app/webrtc/mediastreamhandler_unittest.cc
index 9a53f35..7727086 100644
--- a/app/webrtc/mediastreamhandler_unittest.cc
+++ b/app/webrtc/mediastreamhandler_unittest.cc
@@ -35,7 +35,7 @@
#include "talk/app/webrtc/streamcollection.h"
#include "talk/app/webrtc/videosource.h"
#include "talk/app/webrtc/videotrack.h"
-#include "talk/base/gunit.h"
+#include "webrtc/base/gunit.h"
#include "talk/media/base/fakevideocapturer.h"
#include "talk/media/base/mediachannel.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -79,8 +79,8 @@
class FakeVideoSource : public Notifier<VideoSourceInterface> {
public:
- static talk_base::scoped_refptr<FakeVideoSource> Create() {
- return new talk_base::RefCountedObject<FakeVideoSource>();
+ static rtc::scoped_refptr<FakeVideoSource> Create() {
+ return new rtc::RefCountedObject<FakeVideoSource>();
}
virtual cricket::VideoCapturer* GetVideoCapturer() {
return &fake_capturer_;
@@ -109,7 +109,7 @@
virtual void SetUp() {
stream_ = MediaStream::Create(kStreamLabel1);
- talk_base::scoped_refptr<VideoSourceInterface> source(
+ rtc::scoped_refptr<VideoSourceInterface> source(
FakeVideoSource::Create());
video_track_ = VideoTrack::Create(kVideoTrackId, source);
EXPECT_TRUE(stream_->AddTrack(video_track_));
@@ -175,9 +175,9 @@
MockAudioProvider audio_provider_;
MockVideoProvider video_provider_;
MediaStreamHandlerContainer handlers_;
- talk_base::scoped_refptr<MediaStreamInterface> stream_;
- talk_base::scoped_refptr<VideoTrackInterface> video_track_;
- talk_base::scoped_refptr<AudioTrackInterface> audio_track_;
+ rtc::scoped_refptr<MediaStreamInterface> stream_;
+ rtc::scoped_refptr<VideoTrackInterface> video_track_;
+ rtc::scoped_refptr<AudioTrackInterface> audio_track_;
};
// Test that |audio_provider_| is notified when an audio track is associated
diff --git a/app/webrtc/mediastreaminterface.h b/app/webrtc/mediastreaminterface.h
index a3439c5..5d6c659 100644
--- a/app/webrtc/mediastreaminterface.h
+++ b/app/webrtc/mediastreaminterface.h
@@ -37,9 +37,9 @@
#include <string>
#include <vector>
-#include "talk/base/basictypes.h"
-#include "talk/base/refcount.h"
-#include "talk/base/scoped_ref_ptr.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/refcount.h"
+#include "webrtc/base/scoped_ref_ptr.h"
namespace cricket {
@@ -73,7 +73,7 @@
// provide media. A source can be shared with multiple tracks.
// TODO(perkj): Implement sources for local and remote audio tracks and
// remote video tracks.
-class MediaSourceInterface : public talk_base::RefCountInterface,
+class MediaSourceInterface : public rtc::RefCountInterface,
public NotifierInterface {
public:
enum SourceState {
@@ -90,7 +90,7 @@
};
// Information about a track.
-class MediaStreamTrackInterface : public talk_base::RefCountInterface,
+class MediaStreamTrackInterface : public rtc::RefCountInterface,
public NotifierInterface {
public:
enum TrackState {
@@ -176,7 +176,7 @@
// Interface of the audio processor used by the audio track to collect
// statistics.
-class AudioProcessorInterface : public talk_base::RefCountInterface {
+class AudioProcessorInterface : public rtc::RefCountInterface {
public:
struct AudioProcessorStats {
AudioProcessorStats() : typing_noise_detected(false),
@@ -220,7 +220,7 @@
// Get the audio processor used by the audio track. Return NULL if the track
// does not have any processor.
// TODO(xians): Make the interface pure virtual.
- virtual talk_base::scoped_refptr<AudioProcessorInterface>
+ virtual rtc::scoped_refptr<AudioProcessorInterface>
GetAudioProcessor() { return NULL; }
// Get a pointer to the audio renderer of this AudioTrack.
@@ -233,21 +233,21 @@
virtual ~AudioTrackInterface() {}
};
-typedef std::vector<talk_base::scoped_refptr<AudioTrackInterface> >
+typedef std::vector<rtc::scoped_refptr<AudioTrackInterface> >
AudioTrackVector;
-typedef std::vector<talk_base::scoped_refptr<VideoTrackInterface> >
+typedef std::vector<rtc::scoped_refptr<VideoTrackInterface> >
VideoTrackVector;
-class MediaStreamInterface : public talk_base::RefCountInterface,
+class MediaStreamInterface : public rtc::RefCountInterface,
public NotifierInterface {
public:
virtual std::string label() const = 0;
virtual AudioTrackVector GetAudioTracks() = 0;
virtual VideoTrackVector GetVideoTracks() = 0;
- virtual talk_base::scoped_refptr<AudioTrackInterface>
+ virtual rtc::scoped_refptr<AudioTrackInterface>
FindAudioTrack(const std::string& track_id) = 0;
- virtual talk_base::scoped_refptr<VideoTrackInterface>
+ virtual rtc::scoped_refptr<VideoTrackInterface>
FindVideoTrack(const std::string& track_id) = 0;
virtual bool AddTrack(AudioTrackInterface* track) = 0;
diff --git a/app/webrtc/mediastreamproxy.h b/app/webrtc/mediastreamproxy.h
index 7d018d5..484690e 100644
--- a/app/webrtc/mediastreamproxy.h
+++ b/app/webrtc/mediastreamproxy.h
@@ -37,9 +37,9 @@
PROXY_CONSTMETHOD0(std::string, label)
PROXY_METHOD0(AudioTrackVector, GetAudioTracks)
PROXY_METHOD0(VideoTrackVector, GetVideoTracks)
- PROXY_METHOD1(talk_base::scoped_refptr<AudioTrackInterface>,
+ PROXY_METHOD1(rtc::scoped_refptr<AudioTrackInterface>,
FindAudioTrack, const std::string&)
- PROXY_METHOD1(talk_base::scoped_refptr<VideoTrackInterface>,
+ PROXY_METHOD1(rtc::scoped_refptr<VideoTrackInterface>,
FindVideoTrack, const std::string&)
PROXY_METHOD1(bool, AddTrack, AudioTrackInterface*)
PROXY_METHOD1(bool, AddTrack, VideoTrackInterface*)
diff --git a/app/webrtc/mediastreamsignaling.cc b/app/webrtc/mediastreamsignaling.cc
index 99f627a..7cdd5ed 100644
--- a/app/webrtc/mediastreamsignaling.cc
+++ b/app/webrtc/mediastreamsignaling.cc
@@ -38,8 +38,8 @@
#include "talk/app/webrtc/sctputils.h"
#include "talk/app/webrtc/videosource.h"
#include "talk/app/webrtc/videotrack.h"
-#include "talk/base/bytebuffer.h"
-#include "talk/base/stringutils.h"
+#include "webrtc/base/bytebuffer.h"
+#include "webrtc/base/stringutils.h"
#include "talk/media/sctp/sctpdataengine.h"
static const char kDefaultStreamLabel[] = "default";
@@ -48,8 +48,8 @@
namespace webrtc {
-using talk_base::scoped_ptr;
-using talk_base::scoped_refptr;
+using rtc::scoped_ptr;
+using rtc::scoped_refptr;
static bool ParseConstraints(
const MediaConstraintsInterface* constraints,
@@ -123,16 +123,26 @@
(options.has_audio || options.has_video || options.has_data());
}
+static bool MediaContentDirectionHasSend(cricket::MediaContentDirection dir) {
+ return dir == cricket::MD_SENDONLY || dir == cricket::MD_SENDRECV;
+}
+
+static bool IsValidOfferToReceiveMedia(int value) {
+ typedef PeerConnectionInterface::RTCOfferAnswerOptions Options;
+ return (value >= Options::kUndefined) &&
+ (value <= Options::kMaxOfferToReceiveMedia);
+}
+
// Factory class for creating remote MediaStreams and MediaStreamTracks.
class RemoteMediaStreamFactory {
public:
- explicit RemoteMediaStreamFactory(talk_base::Thread* signaling_thread,
+ explicit RemoteMediaStreamFactory(rtc::Thread* signaling_thread,
cricket::ChannelManager* channel_manager)
: signaling_thread_(signaling_thread),
channel_manager_(channel_manager) {
}
- talk_base::scoped_refptr<MediaStreamInterface> CreateMediaStream(
+ rtc::scoped_refptr<MediaStreamInterface> CreateMediaStream(
const std::string& stream_label) {
return MediaStreamProxy::Create(
signaling_thread_, MediaStream::Create(stream_label));
@@ -156,7 +166,7 @@
template <typename TI, typename T, typename TP, typename S>
TI* AddTrack(MediaStreamInterface* stream, const std::string& track_id,
S* source) {
- talk_base::scoped_refptr<TI> track(
+ rtc::scoped_refptr<TI> track(
TP::Create(signaling_thread_, T::Create(track_id, source)));
track->set_state(webrtc::MediaStreamTrackInterface::kLive);
if (stream->AddTrack(track)) {
@@ -165,12 +175,12 @@
return NULL;
}
- talk_base::Thread* signaling_thread_;
+ rtc::Thread* signaling_thread_;
cricket::ChannelManager* channel_manager_;
};
MediaStreamSignaling::MediaStreamSignaling(
- talk_base::Thread* signaling_thread,
+ rtc::Thread* signaling_thread,
MediaStreamSignalingObserver* stream_observer,
cricket::ChannelManager* channel_manager)
: signaling_thread_(signaling_thread),
@@ -206,8 +216,8 @@
// SSL_CLIENT, the allocated id starts from 0 and takes even numbers; otherwise,
// the id starts from 1 and takes odd numbers. Returns false if no id can be
// allocated.
-bool MediaStreamSignaling::AllocateSctpSid(talk_base::SSLRole role, int* sid) {
- int& last_id = (role == talk_base::SSL_CLIENT) ?
+bool MediaStreamSignaling::AllocateSctpSid(rtc::SSLRole role, int* sid) {
+ int& last_id = (role == rtc::SSL_CLIENT) ?
last_allocated_sctp_even_sid_ : last_allocated_sctp_odd_sid_;
do {
@@ -246,7 +256,7 @@
bool MediaStreamSignaling::AddDataChannelFromOpenMessage(
const cricket::ReceiveDataParams& params,
- const talk_base::Buffer& payload) {
+ const rtc::Buffer& payload) {
if (!data_channel_factory_) {
LOG(LS_WARNING) << "Remote peer requested a DataChannel but DataChannels "
<< "are not supported.";
@@ -281,9 +291,9 @@
if ((*iter)->id() == sid) {
sctp_data_channels_.erase(iter);
- if (talk_base::IsEven(sid) && sid <= last_allocated_sctp_even_sid_) {
+ if (rtc::IsEven(sid) && sid <= last_allocated_sctp_even_sid_) {
last_allocated_sctp_even_sid_ = sid - 2;
- } else if (talk_base::IsOdd(sid) && sid <= last_allocated_sctp_odd_sid_) {
+ } else if (rtc::IsOdd(sid) && sid <= last_allocated_sctp_odd_sid_) {
last_allocated_sctp_odd_sid_ = sid - 2;
}
return;
@@ -359,14 +369,32 @@
}
bool MediaStreamSignaling::GetOptionsForOffer(
- const MediaConstraintsInterface* constraints,
- cricket::MediaSessionOptions* options) {
- UpdateSessionOptions();
- if (!ParseConstraints(constraints, &options_, false)) {
+ const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options,
+ cricket::MediaSessionOptions* session_options) {
+ typedef PeerConnectionInterface::RTCOfferAnswerOptions RTCOfferAnswerOptions;
+ if (!IsValidOfferToReceiveMedia(rtc_options.offer_to_receive_audio) ||
+ !IsValidOfferToReceiveMedia(rtc_options.offer_to_receive_video)) {
return false;
}
+
+ UpdateSessionOptions();
+
+ // |options.has_audio| and |options.has_video| can only change from false to
+ // true, but never change from true to false. This is to make sure
+ // CreateOffer / CreateAnswer doesn't remove a media content
+ // description that has been created.
+ if (rtc_options.offer_to_receive_audio > 0) {
+ options_.has_audio = true;
+ }
+ if (rtc_options.offer_to_receive_video > 0) {
+ options_.has_video = true;
+ }
+ options_.vad_enabled = rtc_options.voice_activity_detection;
+ options_.transport_options.ice_restart = rtc_options.ice_restart;
+ options_.bundle_enabled = rtc_options.use_rtp_mux;
+
options_.bundle_enabled = EvaluateNeedForBundle(options_);
- *options = options_;
+ *session_options = options_;
return true;
}
@@ -394,7 +422,7 @@
void MediaStreamSignaling::OnRemoteDescriptionChanged(
const SessionDescriptionInterface* desc) {
const cricket::SessionDescription* remote_desc = desc->description();
- talk_base::scoped_refptr<StreamCollection> new_streams(
+ rtc::scoped_refptr<StreamCollection> new_streams(
StreamCollection::Create());
// Find all audio rtp streams and create corresponding remote AudioTracks
@@ -406,7 +434,8 @@
audio_content->description);
UpdateRemoteStreamsList(desc->streams(), desc->type(), new_streams);
remote_info_.default_audio_track_needed =
- desc->direction() == cricket::MD_SENDRECV && desc->streams().empty();
+ MediaContentDirectionHasSend(desc->direction()) &&
+ desc->streams().empty();
}
// Find all video rtp streams and create corresponding remote VideoTracks
@@ -418,7 +447,8 @@
video_content->description);
UpdateRemoteStreamsList(desc->streams(), desc->type(), new_streams);
remote_info_.default_video_track_needed =
- desc->direction() == cricket::MD_SENDRECV && desc->streams().empty();
+ MediaContentDirectionHasSend(desc->direction()) &&
+ desc->streams().empty();
}
// Update the DataChannels with the information from the remote peer.
@@ -427,7 +457,7 @@
const cricket::DataContentDescription* data_desc =
static_cast<const cricket::DataContentDescription*>(
data_content->description);
- if (talk_base::starts_with(
+ if (rtc::starts_with(
data_desc->protocol().data(), cricket::kMediaProtocolRtpPrefix)) {
UpdateRemoteRtpDataChannels(data_desc->streams());
}
@@ -482,7 +512,7 @@
const cricket::DataContentDescription* data_desc =
static_cast<const cricket::DataContentDescription*>(
data_content->description);
- if (talk_base::starts_with(
+ if (rtc::starts_with(
data_desc->protocol().data(), cricket::kMediaProtocolRtpPrefix)) {
UpdateLocalRtpDataChannels(data_desc->streams());
}
@@ -593,7 +623,7 @@
const std::string& track_id = it->id;
uint32 ssrc = it->first_ssrc();
- talk_base::scoped_refptr<MediaStreamInterface> stream =
+ rtc::scoped_refptr<MediaStreamInterface> stream =
remote_streams_->find(stream_label);
if (!stream) {
// This is a new MediaStream. Create a new remote MediaStream.
@@ -637,7 +667,7 @@
MediaStreamInterface* stream = remote_streams_->find(stream_label);
if (media_type == cricket::MEDIA_TYPE_AUDIO) {
- talk_base::scoped_refptr<AudioTrackInterface> audio_track =
+ rtc::scoped_refptr<AudioTrackInterface> audio_track =
stream->FindAudioTrack(track_id);
if (audio_track) {
audio_track->set_state(webrtc::MediaStreamTrackInterface::kEnded);
@@ -645,7 +675,7 @@
stream_observer_->OnRemoveRemoteAudioTrack(stream, audio_track);
}
} else if (media_type == cricket::MEDIA_TYPE_VIDEO) {
- talk_base::scoped_refptr<VideoTrackInterface> video_track =
+ rtc::scoped_refptr<VideoTrackInterface> video_track =
stream->FindVideoTrack(track_id);
if (video_track) {
video_track->set_state(webrtc::MediaStreamTrackInterface::kEnded);
@@ -892,7 +922,7 @@
// The data channel label is either the mslabel or the SSRC if the mslabel
// does not exist. Ex a=ssrc:444330170 mslabel:test1.
std::string label = it->sync_label.empty() ?
- talk_base::ToString(it->first_ssrc()) : it->sync_label;
+ rtc::ToString(it->first_ssrc()) : it->sync_label;
RtpDataChannels::iterator data_channel_it =
rtp_data_channels_.find(label);
if (data_channel_it == rtp_data_channels_.end()) {
@@ -957,7 +987,7 @@
}
}
-void MediaStreamSignaling::OnDtlsRoleReadyForSctp(talk_base::SSLRole role) {
+void MediaStreamSignaling::OnDtlsRoleReadyForSctp(rtc::SSLRole role) {
SctpDataChannels::iterator it = sctp_data_channels_.begin();
for (; it != sctp_data_channels_.end(); ++it) {
if ((*it)->id() < 0) {
diff --git a/app/webrtc/mediastreamsignaling.h b/app/webrtc/mediastreamsignaling.h
index 7378166..214c6a1 100644
--- a/app/webrtc/mediastreamsignaling.h
+++ b/app/webrtc/mediastreamsignaling.h
@@ -36,13 +36,13 @@
#include "talk/app/webrtc/mediastream.h"
#include "talk/app/webrtc/peerconnectioninterface.h"
#include "talk/app/webrtc/streamcollection.h"
-#include "talk/base/scoped_ref_ptr.h"
-#include "talk/base/sigslot.h"
+#include "webrtc/base/scoped_ref_ptr.h"
+#include "webrtc/base/sigslot.h"
#include "talk/session/media/mediasession.h"
-namespace talk_base {
+namespace rtc {
class Thread;
-} // namespace talk_base
+} // namespace rtc
namespace webrtc {
@@ -160,7 +160,7 @@
class MediaStreamSignaling : public sigslot::has_slots<> {
public:
- MediaStreamSignaling(talk_base::Thread* signaling_thread,
+ MediaStreamSignaling(rtc::Thread* signaling_thread,
MediaStreamSignalingObserver* stream_observer,
cricket::ChannelManager* channel_manager);
virtual ~MediaStreamSignaling();
@@ -180,7 +180,7 @@
// Gets the first available SCTP id that is not assigned to any existing
// data channels.
- bool AllocateSctpSid(talk_base::SSLRole role, int* sid);
+ bool AllocateSctpSid(rtc::SSLRole role, int* sid);
// Adds |local_stream| to the collection of known MediaStreams that will be
// offered in a SessionDescription.
@@ -197,14 +197,14 @@
bool AddDataChannel(DataChannel* data_channel);
// After we receive an OPEN message, create a data channel and add it.
bool AddDataChannelFromOpenMessage(const cricket::ReceiveDataParams& params,
- const talk_base::Buffer& payload);
+ const rtc::Buffer& payload);
void RemoveSctpDataChannel(int sid);
- // Returns a MediaSessionOptions struct with options decided by |constraints|,
+ // Returns a MediaSessionOptions struct with options decided by |options|,
// the local MediaStreams and DataChannels.
virtual bool GetOptionsForOffer(
- const MediaConstraintsInterface* constraints,
- cricket::MediaSessionOptions* options);
+ const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options,
+ cricket::MediaSessionOptions* session_options);
// Returns a MediaSessionOptions struct with options decided by
// |constraints|, the local MediaStreams and DataChannels.
@@ -249,7 +249,7 @@
return remote_streams_.get();
}
void OnDataTransportCreatedForSctp();
- void OnDtlsRoleReadyForSctp(talk_base::SSLRole role);
+ void OnDtlsRoleReadyForSctp(rtc::SSLRole role);
void OnRemoteSctpDataChannelClosed(uint32 sid);
private:
@@ -376,13 +376,13 @@
int FindDataChannelBySid(int sid) const;
RemotePeerInfo remote_info_;
- talk_base::Thread* signaling_thread_;
+ rtc::Thread* signaling_thread_;
DataChannelFactory* data_channel_factory_;
cricket::MediaSessionOptions options_;
MediaStreamSignalingObserver* stream_observer_;
- talk_base::scoped_refptr<StreamCollection> local_streams_;
- talk_base::scoped_refptr<StreamCollection> remote_streams_;
- talk_base::scoped_ptr<RemoteMediaStreamFactory> remote_stream_factory_;
+ rtc::scoped_refptr<StreamCollection> local_streams_;
+ rtc::scoped_refptr<StreamCollection> remote_streams_;
+ rtc::scoped_ptr<RemoteMediaStreamFactory> remote_stream_factory_;
TrackInfos remote_audio_tracks_;
TrackInfos remote_video_tracks_;
@@ -392,9 +392,9 @@
int last_allocated_sctp_even_sid_;
int last_allocated_sctp_odd_sid_;
- typedef std::map<std::string, talk_base::scoped_refptr<DataChannel> >
+ typedef std::map<std::string, rtc::scoped_refptr<DataChannel> >
RtpDataChannels;
- typedef std::vector<talk_base::scoped_refptr<DataChannel> > SctpDataChannels;
+ typedef std::vector<rtc::scoped_refptr<DataChannel> > SctpDataChannels;
RtpDataChannels rtp_data_channels_;
SctpDataChannels sctp_data_channels_;
diff --git a/app/webrtc/mediastreamsignaling_unittest.cc b/app/webrtc/mediastreamsignaling_unittest.cc
index 150058e..3c89d49 100644
--- a/app/webrtc/mediastreamsignaling_unittest.cc
+++ b/app/webrtc/mediastreamsignaling_unittest.cc
@@ -36,10 +36,10 @@
#include "talk/app/webrtc/test/fakeconstraints.h"
#include "talk/app/webrtc/test/fakedatachannelprovider.h"
#include "talk/app/webrtc/videotrack.h"
-#include "talk/base/gunit.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/stringutils.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/stringutils.h"
+#include "webrtc/base/thread.h"
#include "talk/media/base/fakemediaengine.h"
#include "talk/media/devices/fakedevicemanager.h"
#include "talk/p2p/base/constants.h"
@@ -62,11 +62,14 @@
using webrtc::MediaConstraintsInterface;
using webrtc::MediaStreamInterface;
using webrtc::MediaStreamTrackInterface;
+using webrtc::PeerConnectionInterface;
using webrtc::SdpParseError;
using webrtc::SessionDescriptionInterface;
using webrtc::StreamCollection;
using webrtc::StreamCollectionInterface;
+typedef PeerConnectionInterface::RTCOfferAnswerOptions RTCOfferAnswerOptions;
+
// Reference SDP with a MediaStream with label "stream1" and audio track with
// id "audio_1" and a video track with id "video_1;
static const char kSdpStringWithStream1[] =
@@ -148,6 +151,21 @@
"a=mid:audio\r\n"
"a=rtpmap:103 ISAC/16000\r\n";
+// Reference SENDONLY SDP without MediaStreams. Msid is not supported.
+static const char kSdpStringSendOnlyWithWithoutStreams[] =
+ "v=0\r\n"
+ "o=- 0 0 IN IP4 127.0.0.1\r\n"
+ "s=-\r\n"
+ "t=0 0\r\n"
+ "m=audio 1 RTP/AVPF 103\r\n"
+ "a=mid:audio\r\n"
+ "a=sendonly"
+ "a=rtpmap:103 ISAC/16000\r\n"
+ "m=video 1 RTP/AVPF 120\r\n"
+ "a=mid:video\r\n"
+ "a=sendonly"
+ "a=rtpmap:120 VP8/90000\r\n";
+
static const char kSdpStringInit[] =
"v=0\r\n"
"o=- 0 0 IN IP4 127.0.0.1\r\n"
@@ -246,7 +264,7 @@
cricket::DataChannelType dct)
: provider_(provider), type_(dct) {}
- virtual talk_base::scoped_refptr<webrtc::DataChannel> CreateDataChannel(
+ virtual rtc::scoped_refptr<webrtc::DataChannel> CreateDataChannel(
const std::string& label,
const webrtc::InternalDataChannelInit* config) {
last_init_ = *config;
@@ -434,14 +452,14 @@
TrackInfos local_audio_tracks_;
TrackInfos local_video_tracks_;
- talk_base::scoped_refptr<StreamCollection> remote_media_streams_;
+ rtc::scoped_refptr<StreamCollection> remote_media_streams_;
};
class MediaStreamSignalingForTest : public webrtc::MediaStreamSignaling {
public:
MediaStreamSignalingForTest(MockSignalingObserver* observer,
cricket::ChannelManager* channel_manager)
- : webrtc::MediaStreamSignaling(talk_base::Thread::Current(), observer,
+ : webrtc::MediaStreamSignaling(rtc::Thread::Current(), observer,
channel_manager) {
};
@@ -458,7 +476,7 @@
channel_manager_.reset(
new cricket::ChannelManager(new cricket::FakeMediaEngine(),
new cricket::FakeDeviceManager(),
- talk_base::Thread::Current()));
+ rtc::Thread::Current()));
signaling_.reset(new MediaStreamSignalingForTest(observer_.get(),
channel_manager_.get()));
data_channel_provider_.reset(new FakeDataChannelProvider());
@@ -468,22 +486,22 @@
// CreateStreamCollection(1) creates a collection that
// correspond to kSdpString1.
// CreateStreamCollection(2) correspond to kSdpString2.
- talk_base::scoped_refptr<StreamCollection>
+ rtc::scoped_refptr<StreamCollection>
CreateStreamCollection(int number_of_streams) {
- talk_base::scoped_refptr<StreamCollection> local_collection(
+ rtc::scoped_refptr<StreamCollection> local_collection(
StreamCollection::Create());
for (int i = 0; i < number_of_streams; ++i) {
- talk_base::scoped_refptr<webrtc::MediaStreamInterface> stream(
+ rtc::scoped_refptr<webrtc::MediaStreamInterface> stream(
webrtc::MediaStream::Create(kStreams[i]));
// Add a local audio track.
- talk_base::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
+ rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
webrtc::AudioTrack::Create(kAudioTracks[i], NULL));
stream->AddTrack(audio_track);
// Add a local video track.
- talk_base::scoped_refptr<webrtc::VideoTrackInterface> video_track(
+ rtc::scoped_refptr<webrtc::VideoTrackInterface> video_track(
webrtc::VideoTrack::Create(kVideoTracks[i], NULL));
stream->AddTrack(video_track);
@@ -510,7 +528,7 @@
std::string mediastream_label = kStreams[0];
- talk_base::scoped_refptr<webrtc::MediaStreamInterface> stream(
+ rtc::scoped_refptr<webrtc::MediaStreamInterface> stream(
webrtc::MediaStream::Create(mediastream_label));
reference_collection_->AddStream(stream);
@@ -540,23 +558,23 @@
void AddAudioTrack(const std::string& track_id,
MediaStreamInterface* stream) {
- talk_base::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
+ rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
webrtc::AudioTrack::Create(track_id, NULL));
ASSERT_TRUE(stream->AddTrack(audio_track));
}
void AddVideoTrack(const std::string& track_id,
MediaStreamInterface* stream) {
- talk_base::scoped_refptr<webrtc::VideoTrackInterface> video_track(
+ rtc::scoped_refptr<webrtc::VideoTrackInterface> video_track(
webrtc::VideoTrack::Create(track_id, NULL));
ASSERT_TRUE(stream->AddTrack(video_track));
}
- talk_base::scoped_refptr<webrtc::DataChannel> AddDataChannel(
+ rtc::scoped_refptr<webrtc::DataChannel> AddDataChannel(
cricket::DataChannelType type, const std::string& label, int id) {
webrtc::InternalDataChannelInit config;
config.id = id;
- talk_base::scoped_refptr<webrtc::DataChannel> data_channel(
+ rtc::scoped_refptr<webrtc::DataChannel> data_channel(
webrtc::DataChannel::Create(
data_channel_provider_.get(), type, label, config));
EXPECT_TRUE(data_channel.get() != NULL);
@@ -566,122 +584,144 @@
// ChannelManager is used by VideoSource, so it should be released after all
// the video tracks. Put it as the first private variable should ensure that.
- talk_base::scoped_ptr<cricket::ChannelManager> channel_manager_;
- talk_base::scoped_refptr<StreamCollection> reference_collection_;
- talk_base::scoped_ptr<MockSignalingObserver> observer_;
- talk_base::scoped_ptr<MediaStreamSignalingForTest> signaling_;
- talk_base::scoped_ptr<FakeDataChannelProvider> data_channel_provider_;
+ rtc::scoped_ptr<cricket::ChannelManager> channel_manager_;
+ rtc::scoped_refptr<StreamCollection> reference_collection_;
+ rtc::scoped_ptr<MockSignalingObserver> observer_;
+ rtc::scoped_ptr<MediaStreamSignalingForTest> signaling_;
+ rtc::scoped_ptr<FakeDataChannelProvider> data_channel_provider_;
};
+TEST_F(MediaStreamSignalingTest, GetOptionsForOfferWithInvalidAudioOption) {
+ RTCOfferAnswerOptions rtc_options;
+ rtc_options.offer_to_receive_audio = RTCOfferAnswerOptions::kUndefined - 1;
+
+ cricket::MediaSessionOptions options;
+ EXPECT_FALSE(signaling_->GetOptionsForOffer(rtc_options, &options));
+
+ rtc_options.offer_to_receive_audio =
+ RTCOfferAnswerOptions::kMaxOfferToReceiveMedia + 1;
+ EXPECT_FALSE(signaling_->GetOptionsForOffer(rtc_options, &options));
+}
+
+
+TEST_F(MediaStreamSignalingTest, GetOptionsForOfferWithInvalidVideoOption) {
+ RTCOfferAnswerOptions rtc_options;
+ rtc_options.offer_to_receive_video =
+ RTCOfferAnswerOptions::kUndefined - 1;
+
+ cricket::MediaSessionOptions options;
+ EXPECT_FALSE(signaling_->GetOptionsForOffer(rtc_options, &options));
+
+ rtc_options.offer_to_receive_video =
+ RTCOfferAnswerOptions::kMaxOfferToReceiveMedia + 1;
+ EXPECT_FALSE(signaling_->GetOptionsForOffer(rtc_options, &options));
+}
+
// Test that a MediaSessionOptions is created for an offer if
-// kOfferToReceiveAudio and kOfferToReceiveVideo constraints are set but no
+// OfferToReceiveAudio and OfferToReceiveVideo options are set but no
// MediaStreams are sent.
TEST_F(MediaStreamSignalingTest, GetMediaSessionOptionsForOfferWithAudioVideo) {
- FakeConstraints constraints;
- constraints.SetMandatoryReceiveAudio(true);
- constraints.SetMandatoryReceiveVideo(true);
+ RTCOfferAnswerOptions rtc_options;
+ rtc_options.offer_to_receive_audio = 1;
+ rtc_options.offer_to_receive_video = 1;
+
cricket::MediaSessionOptions options;
- EXPECT_TRUE(signaling_->GetOptionsForOffer(&constraints, &options));
+ EXPECT_TRUE(signaling_->GetOptionsForOffer(rtc_options, &options));
EXPECT_TRUE(options.has_audio);
EXPECT_TRUE(options.has_video);
EXPECT_TRUE(options.bundle_enabled);
}
// Test that a correct MediaSessionOptions is created for an offer if
-// kOfferToReceiveAudio constraints is set but no MediaStreams are sent.
+// OfferToReceiveAudio is set but no MediaStreams are sent.
TEST_F(MediaStreamSignalingTest, GetMediaSessionOptionsForOfferWithAudio) {
- FakeConstraints constraints;
- constraints.SetMandatoryReceiveAudio(true);
+ RTCOfferAnswerOptions rtc_options;
+ rtc_options.offer_to_receive_audio = 1;
+
cricket::MediaSessionOptions options;
- EXPECT_TRUE(signaling_->GetOptionsForOffer(&constraints, &options));
+ EXPECT_TRUE(signaling_->GetOptionsForOffer(rtc_options, &options));
EXPECT_TRUE(options.has_audio);
EXPECT_FALSE(options.has_video);
EXPECT_TRUE(options.bundle_enabled);
}
// Test that a correct MediaSessionOptions is created for an offer if
-// no constraints or MediaStreams are sent.
+// the default OfferOptons is used or MediaStreams are sent.
TEST_F(MediaStreamSignalingTest, GetDefaultMediaSessionOptionsForOffer) {
+ RTCOfferAnswerOptions rtc_options;
+
cricket::MediaSessionOptions options;
- EXPECT_TRUE(signaling_->GetOptionsForOffer(NULL, &options));
- EXPECT_TRUE(options.has_audio);
+ EXPECT_TRUE(signaling_->GetOptionsForOffer(rtc_options, &options));
+ EXPECT_FALSE(options.has_audio);
EXPECT_FALSE(options.has_video);
- EXPECT_TRUE(options.bundle_enabled);
+ EXPECT_FALSE(options.bundle_enabled);
+ EXPECT_TRUE(options.vad_enabled);
+ EXPECT_FALSE(options.transport_options.ice_restart);
}
// Test that a correct MediaSessionOptions is created for an offer if
-// kOfferToReceiveVideo constraints is set but no MediaStreams are sent.
+// OfferToReceiveVideo is set but no MediaStreams are sent.
TEST_F(MediaStreamSignalingTest, GetMediaSessionOptionsForOfferWithVideo) {
- FakeConstraints constraints;
- constraints.SetMandatoryReceiveAudio(false);
- constraints.SetMandatoryReceiveVideo(true);
+ RTCOfferAnswerOptions rtc_options;
+ rtc_options.offer_to_receive_audio = 0;
+ rtc_options.offer_to_receive_video = 1;
+
cricket::MediaSessionOptions options;
- EXPECT_TRUE(signaling_->GetOptionsForOffer(&constraints, &options));
+ EXPECT_TRUE(signaling_->GetOptionsForOffer(rtc_options, &options));
EXPECT_FALSE(options.has_audio);
EXPECT_TRUE(options.has_video);
EXPECT_TRUE(options.bundle_enabled);
}
// Test that a correct MediaSessionOptions is created for an offer if
-// kUseRtpMux constraints is set to false.
+// UseRtpMux is set to false.
TEST_F(MediaStreamSignalingTest,
GetMediaSessionOptionsForOfferWithBundleDisabled) {
- FakeConstraints constraints;
- constraints.SetMandatoryReceiveAudio(true);
- constraints.SetMandatoryReceiveVideo(true);
- constraints.SetMandatoryUseRtpMux(false);
+ RTCOfferAnswerOptions rtc_options;
+ rtc_options.offer_to_receive_audio = 1;
+ rtc_options.offer_to_receive_video = 1;
+ rtc_options.use_rtp_mux = false;
+
cricket::MediaSessionOptions options;
- EXPECT_TRUE(signaling_->GetOptionsForOffer(&constraints, &options));
+ EXPECT_TRUE(signaling_->GetOptionsForOffer(rtc_options, &options));
EXPECT_TRUE(options.has_audio);
EXPECT_TRUE(options.has_video);
EXPECT_FALSE(options.bundle_enabled);
}
// Test that a correct MediaSessionOptions is created to restart ice if
-// kIceRestart constraints is set. It also tests that subsequent
-// MediaSessionOptions don't have |transport_options.ice_restart| set.
+// IceRestart is set. It also tests that subsequent MediaSessionOptions don't
+// have |transport_options.ice_restart| set.
TEST_F(MediaStreamSignalingTest,
GetMediaSessionOptionsForOfferWithIceRestart) {
- FakeConstraints constraints;
- constraints.SetMandatoryIceRestart(true);
+ RTCOfferAnswerOptions rtc_options;
+ rtc_options.ice_restart = true;
+
cricket::MediaSessionOptions options;
- EXPECT_TRUE(signaling_->GetOptionsForOffer(&constraints, &options));
+ EXPECT_TRUE(signaling_->GetOptionsForOffer(rtc_options, &options));
EXPECT_TRUE(options.transport_options.ice_restart);
- EXPECT_TRUE(signaling_->GetOptionsForOffer(NULL, &options));
+ rtc_options = RTCOfferAnswerOptions();
+ EXPECT_TRUE(signaling_->GetOptionsForOffer(rtc_options, &options));
EXPECT_FALSE(options.transport_options.ice_restart);
}
-// Test that GetMediaSessionOptionsForOffer and GetOptionsForAnswer work as
-// expected if unknown constraints are used.
-TEST_F(MediaStreamSignalingTest, GetMediaSessionOptionsWithBadConstraints) {
- FakeConstraints mandatory;
- mandatory.AddMandatory("bad_key", "bad_value");
- cricket::MediaSessionOptions options;
- EXPECT_FALSE(signaling_->GetOptionsForOffer(&mandatory, &options));
- EXPECT_FALSE(signaling_->GetOptionsForAnswer(&mandatory, &options));
-
- FakeConstraints optional;
- optional.AddOptional("bad_key", "bad_value");
- EXPECT_TRUE(signaling_->GetOptionsForOffer(&optional, &options));
- EXPECT_TRUE(signaling_->GetOptionsForAnswer(&optional, &options));
-}
-
// Test that a correct MediaSessionOptions are created for an offer if
// a MediaStream is sent and later updated with a new track.
// MediaConstraints are not used.
TEST_F(MediaStreamSignalingTest, AddTrackToLocalMediaStream) {
- talk_base::scoped_refptr<StreamCollection> local_streams(
+ RTCOfferAnswerOptions rtc_options;
+ rtc::scoped_refptr<StreamCollection> local_streams(
CreateStreamCollection(1));
MediaStreamInterface* local_stream = local_streams->at(0);
EXPECT_TRUE(signaling_->AddLocalStream(local_stream));
cricket::MediaSessionOptions options;
- EXPECT_TRUE(signaling_->GetOptionsForOffer(NULL, &options));
+ EXPECT_TRUE(signaling_->GetOptionsForOffer(rtc_options, &options));
VerifyMediaOptions(local_streams, options);
cricket::MediaSessionOptions updated_options;
local_stream->AddTrack(AudioTrack::Create(kAudioTracks[1], NULL));
- EXPECT_TRUE(signaling_->GetOptionsForOffer(NULL, &options));
+ EXPECT_TRUE(signaling_->GetOptionsForOffer(rtc_options, &options));
VerifyMediaOptions(local_streams, options);
}
@@ -699,21 +739,20 @@
EXPECT_TRUE(answer_options.has_audio);
EXPECT_TRUE(answer_options.has_video);
- FakeConstraints offer_c;
- offer_c.SetMandatoryReceiveAudio(false);
- offer_c.SetMandatoryReceiveVideo(false);
+ RTCOfferAnswerOptions rtc_offer_optoins;
cricket::MediaSessionOptions offer_options;
- EXPECT_TRUE(signaling_->GetOptionsForOffer(&offer_c, &offer_options));
+ EXPECT_TRUE(
+ signaling_->GetOptionsForOffer(rtc_offer_optoins, &offer_options));
EXPECT_FALSE(offer_options.has_audio);
EXPECT_FALSE(offer_options.has_video);
- FakeConstraints updated_offer_c;
- updated_offer_c.SetMandatoryReceiveAudio(true);
- updated_offer_c.SetMandatoryReceiveVideo(true);
+ RTCOfferAnswerOptions updated_rtc_offer_optoins;
+ updated_rtc_offer_optoins.offer_to_receive_audio = 1;
+ updated_rtc_offer_optoins.offer_to_receive_video = 1;
cricket::MediaSessionOptions updated_offer_options;
- EXPECT_TRUE(signaling_->GetOptionsForOffer(&updated_offer_c,
+ EXPECT_TRUE(signaling_->GetOptionsForOffer(updated_rtc_offer_optoins,
&updated_offer_options));
EXPECT_TRUE(updated_offer_options.has_audio);
EXPECT_TRUE(updated_offer_options.has_video);
@@ -733,7 +772,8 @@
EXPECT_TRUE(updated_answer_options.has_audio);
EXPECT_TRUE(updated_answer_options.has_video);
- EXPECT_TRUE(signaling_->GetOptionsForOffer(NULL,
+ RTCOfferAnswerOptions default_rtc_options;
+ EXPECT_TRUE(signaling_->GetOptionsForOffer(default_rtc_options,
&updated_offer_options));
EXPECT_TRUE(updated_offer_options.has_audio);
EXPECT_TRUE(updated_offer_options.has_video);
@@ -743,13 +783,13 @@
// SDP string is created. In this test the two separate MediaStreams are
// signaled.
TEST_F(MediaStreamSignalingTest, UpdateRemoteStreams) {
- talk_base::scoped_ptr<SessionDescriptionInterface> desc(
+ rtc::scoped_ptr<SessionDescriptionInterface> desc(
webrtc::CreateSessionDescription(SessionDescriptionInterface::kOffer,
kSdpStringWithStream1, NULL));
EXPECT_TRUE(desc != NULL);
signaling_->OnRemoteDescriptionChanged(desc.get());
- talk_base::scoped_refptr<StreamCollection> reference(
+ rtc::scoped_refptr<StreamCollection> reference(
CreateStreamCollection(1));
EXPECT_TRUE(CompareStreamCollections(signaling_->remote_streams(),
reference.get()));
@@ -765,13 +805,13 @@
// Create a session description based on another SDP with another
// MediaStream.
- talk_base::scoped_ptr<SessionDescriptionInterface> update_desc(
+ rtc::scoped_ptr<SessionDescriptionInterface> update_desc(
webrtc::CreateSessionDescription(SessionDescriptionInterface::kOffer,
kSdpStringWith2Stream, NULL));
EXPECT_TRUE(update_desc != NULL);
signaling_->OnRemoteDescriptionChanged(update_desc.get());
- talk_base::scoped_refptr<StreamCollection> reference2(
+ rtc::scoped_refptr<StreamCollection> reference2(
CreateStreamCollection(2));
EXPECT_TRUE(CompareStreamCollections(signaling_->remote_streams(),
reference2.get()));
@@ -790,14 +830,14 @@
// SDP string is created. In this test the same remote MediaStream is signaled
// but MediaStream tracks are added and removed.
TEST_F(MediaStreamSignalingTest, AddRemoveTrackFromExistingRemoteMediaStream) {
- talk_base::scoped_ptr<SessionDescriptionInterface> desc_ms1;
+ rtc::scoped_ptr<SessionDescriptionInterface> desc_ms1;
CreateSessionDescriptionAndReference(1, 1, desc_ms1.use());
signaling_->OnRemoteDescriptionChanged(desc_ms1.get());
EXPECT_TRUE(CompareStreamCollections(signaling_->remote_streams(),
reference_collection_));
// Add extra audio and video tracks to the same MediaStream.
- talk_base::scoped_ptr<SessionDescriptionInterface> desc_ms1_two_tracks;
+ rtc::scoped_ptr<SessionDescriptionInterface> desc_ms1_two_tracks;
CreateSessionDescriptionAndReference(2, 2, desc_ms1_two_tracks.use());
signaling_->OnRemoteDescriptionChanged(desc_ms1_two_tracks.get());
EXPECT_TRUE(CompareStreamCollections(signaling_->remote_streams(),
@@ -806,7 +846,7 @@
reference_collection_));
// Remove the extra audio and video tracks again.
- talk_base::scoped_ptr<SessionDescriptionInterface> desc_ms2;
+ rtc::scoped_ptr<SessionDescriptionInterface> desc_ms2;
CreateSessionDescriptionAndReference(1, 1, desc_ms2.use());
signaling_->OnRemoteDescriptionChanged(desc_ms2.get());
EXPECT_TRUE(CompareStreamCollections(signaling_->remote_streams(),
@@ -818,7 +858,7 @@
// This test that remote tracks are ended if a
// local session description is set that rejects the media content type.
TEST_F(MediaStreamSignalingTest, RejectMediaContent) {
- talk_base::scoped_ptr<SessionDescriptionInterface> desc(
+ rtc::scoped_ptr<SessionDescriptionInterface> desc(
webrtc::CreateSessionDescription(SessionDescriptionInterface::kOffer,
kSdpStringWithStream1, NULL));
EXPECT_TRUE(desc != NULL);
@@ -829,10 +869,10 @@
ASSERT_EQ(1u, remote_stream->GetVideoTracks().size());
ASSERT_EQ(1u, remote_stream->GetAudioTracks().size());
- talk_base::scoped_refptr<webrtc::VideoTrackInterface> remote_video =
+ rtc::scoped_refptr<webrtc::VideoTrackInterface> remote_video =
remote_stream->GetVideoTracks()[0];
EXPECT_EQ(webrtc::MediaStreamTrackInterface::kLive, remote_video->state());
- talk_base::scoped_refptr<webrtc::AudioTrackInterface> remote_audio =
+ rtc::scoped_refptr<webrtc::AudioTrackInterface> remote_audio =
remote_stream->GetAudioTracks()[0];
EXPECT_EQ(webrtc::MediaStreamTrackInterface::kLive, remote_audio->state());
@@ -856,7 +896,7 @@
// of MediaStreamSignaling and then MediaStreamSignaling tries to reject
// this track.
TEST_F(MediaStreamSignalingTest, RemoveTrackThenRejectMediaContent) {
- talk_base::scoped_ptr<SessionDescriptionInterface> desc(
+ rtc::scoped_ptr<SessionDescriptionInterface> desc(
webrtc::CreateSessionDescription(SessionDescriptionInterface::kOffer,
kSdpStringWithStream1, NULL));
EXPECT_TRUE(desc != NULL);
@@ -884,7 +924,7 @@
// It also tests that the default stream is updated if a video m-line is added
// in a subsequent session description.
TEST_F(MediaStreamSignalingTest, SdpWithoutMsidCreatesDefaultStream) {
- talk_base::scoped_ptr<SessionDescriptionInterface> desc_audio_only(
+ rtc::scoped_ptr<SessionDescriptionInterface> desc_audio_only(
webrtc::CreateSessionDescription(SessionDescriptionInterface::kOffer,
kSdpStringWithoutStreamsAudioOnly,
NULL));
@@ -899,7 +939,7 @@
EXPECT_EQ(0u, remote_stream->GetVideoTracks().size());
EXPECT_EQ("default", remote_stream->label());
- talk_base::scoped_ptr<SessionDescriptionInterface> desc(
+ rtc::scoped_ptr<SessionDescriptionInterface> desc(
webrtc::CreateSessionDescription(SessionDescriptionInterface::kOffer,
kSdpStringWithoutStreams, NULL));
ASSERT_TRUE(desc != NULL);
@@ -913,10 +953,29 @@
observer_->VerifyRemoteVideoTrack("default", "defaultv0", 0);
}
+// This tests that a default MediaStream is created if a remote session
+// description doesn't contain any streams and media direction is send only.
+TEST_F(MediaStreamSignalingTest, RecvOnlySdpWithoutMsidCreatesDefaultStream) {
+ rtc::scoped_ptr<SessionDescriptionInterface> desc(
+ webrtc::CreateSessionDescription(SessionDescriptionInterface::kOffer,
+ kSdpStringSendOnlyWithWithoutStreams,
+ NULL));
+ ASSERT_TRUE(desc != NULL);
+ signaling_->OnRemoteDescriptionChanged(desc.get());
+
+ EXPECT_EQ(1u, signaling_->remote_streams()->count());
+ ASSERT_EQ(1u, observer_->remote_streams()->count());
+ MediaStreamInterface* remote_stream = observer_->remote_streams()->at(0);
+
+ EXPECT_EQ(1u, remote_stream->GetAudioTracks().size());
+ EXPECT_EQ(1u, remote_stream->GetVideoTracks().size());
+ EXPECT_EQ("default", remote_stream->label());
+}
+
// This tests that it won't crash when MediaStreamSignaling tries to remove
// a remote track that as already been removed from the mediastream.
TEST_F(MediaStreamSignalingTest, RemoveAlreadyGoneRemoteStream) {
- talk_base::scoped_ptr<SessionDescriptionInterface> desc_audio_only(
+ rtc::scoped_ptr<SessionDescriptionInterface> desc_audio_only(
webrtc::CreateSessionDescription(SessionDescriptionInterface::kOffer,
kSdpStringWithoutStreams,
NULL));
@@ -926,7 +985,7 @@
remote_stream->RemoveTrack(remote_stream->GetAudioTracks()[0]);
remote_stream->RemoveTrack(remote_stream->GetVideoTracks()[0]);
- talk_base::scoped_ptr<SessionDescriptionInterface> desc(
+ rtc::scoped_ptr<SessionDescriptionInterface> desc(
webrtc::CreateSessionDescription(SessionDescriptionInterface::kOffer,
kSdpStringWithoutStreams, NULL));
ASSERT_TRUE(desc != NULL);
@@ -940,7 +999,7 @@
// MSID is supported.
TEST_F(MediaStreamSignalingTest,
SdpWithoutMsidAndStreamsCreatesDefaultStream) {
- talk_base::scoped_ptr<SessionDescriptionInterface> desc(
+ rtc::scoped_ptr<SessionDescriptionInterface> desc(
webrtc::CreateSessionDescription(SessionDescriptionInterface::kOffer,
kSdpStringWithoutStreams,
NULL));
@@ -956,7 +1015,7 @@
// This tests that a default MediaStream is not created if the remote session
// description doesn't contain any streams but does support MSID.
TEST_F(MediaStreamSignalingTest, SdpWitMsidDontCreatesDefaultStream) {
- talk_base::scoped_ptr<SessionDescriptionInterface> desc_msid_without_streams(
+ rtc::scoped_ptr<SessionDescriptionInterface> desc_msid_without_streams(
webrtc::CreateSessionDescription(SessionDescriptionInterface::kOffer,
kSdpStringWithMsidWithoutStreams,
NULL));
@@ -967,18 +1026,18 @@
// This test that a default MediaStream is not created if a remote session
// description is updated to not have any MediaStreams.
TEST_F(MediaStreamSignalingTest, VerifyDefaultStreamIsNotCreated) {
- talk_base::scoped_ptr<SessionDescriptionInterface> desc(
+ rtc::scoped_ptr<SessionDescriptionInterface> desc(
webrtc::CreateSessionDescription(SessionDescriptionInterface::kOffer,
kSdpStringWithStream1,
NULL));
ASSERT_TRUE(desc != NULL);
signaling_->OnRemoteDescriptionChanged(desc.get());
- talk_base::scoped_refptr<StreamCollection> reference(
+ rtc::scoped_refptr<StreamCollection> reference(
CreateStreamCollection(1));
EXPECT_TRUE(CompareStreamCollections(observer_->remote_streams(),
reference.get()));
- talk_base::scoped_ptr<SessionDescriptionInterface> desc_without_streams(
+ rtc::scoped_ptr<SessionDescriptionInterface> desc_without_streams(
webrtc::CreateSessionDescription(SessionDescriptionInterface::kOffer,
kSdpStringWithoutStreams,
NULL));
@@ -990,7 +1049,7 @@
// when MediaStreamSignaling::OnLocalDescriptionChanged is called with an
// updated local session description.
TEST_F(MediaStreamSignalingTest, LocalDescriptionChanged) {
- talk_base::scoped_ptr<SessionDescriptionInterface> desc_1;
+ rtc::scoped_ptr<SessionDescriptionInterface> desc_1;
CreateSessionDescriptionAndReference(2, 2, desc_1.use());
signaling_->AddLocalStream(reference_collection_->at(0));
@@ -1003,7 +1062,7 @@
observer_->VerifyLocalVideoTrack(kStreams[0], kVideoTracks[1], 4);
// Remove an audio and video track.
- talk_base::scoped_ptr<SessionDescriptionInterface> desc_2;
+ rtc::scoped_ptr<SessionDescriptionInterface> desc_2;
CreateSessionDescriptionAndReference(1, 1, desc_2.use());
signaling_->OnLocalDescriptionChanged(desc_2.get());
EXPECT_EQ(1u, observer_->NumberOfLocalAudioTracks());
@@ -1016,7 +1075,7 @@
// when MediaStreamSignaling::AddLocalStream is called after
// MediaStreamSignaling::OnLocalDescriptionChanged is called.
TEST_F(MediaStreamSignalingTest, AddLocalStreamAfterLocalDescriptionChanged) {
- talk_base::scoped_ptr<SessionDescriptionInterface> desc_1;
+ rtc::scoped_ptr<SessionDescriptionInterface> desc_1;
CreateSessionDescriptionAndReference(2, 2, desc_1.use());
signaling_->OnLocalDescriptionChanged(desc_1.get());
@@ -1036,7 +1095,7 @@
// if the ssrc on a local track is changed when
// MediaStreamSignaling::OnLocalDescriptionChanged is called.
TEST_F(MediaStreamSignalingTest, ChangeSsrcOnTrackInLocalSessionDescription) {
- talk_base::scoped_ptr<SessionDescriptionInterface> desc;
+ rtc::scoped_ptr<SessionDescriptionInterface> desc;
CreateSessionDescriptionAndReference(1, 1, desc.use());
signaling_->AddLocalStream(reference_collection_->at(0));
@@ -1051,15 +1110,15 @@
desc->ToString(&sdp);
std::string ssrc_org = "a=ssrc:1";
std::string ssrc_to = "a=ssrc:97";
- talk_base::replace_substrs(ssrc_org.c_str(), ssrc_org.length(),
+ rtc::replace_substrs(ssrc_org.c_str(), ssrc_org.length(),
ssrc_to.c_str(), ssrc_to.length(),
&sdp);
ssrc_org = "a=ssrc:2";
ssrc_to = "a=ssrc:98";
- talk_base::replace_substrs(ssrc_org.c_str(), ssrc_org.length(),
+ rtc::replace_substrs(ssrc_org.c_str(), ssrc_org.length(),
ssrc_to.c_str(), ssrc_to.length(),
&sdp);
- talk_base::scoped_ptr<SessionDescriptionInterface> updated_desc(
+ rtc::scoped_ptr<SessionDescriptionInterface> updated_desc(
webrtc::CreateSessionDescription(SessionDescriptionInterface::kOffer,
sdp, NULL));
@@ -1074,7 +1133,7 @@
// if a new session description is set with the same tracks but they are now
// sent on a another MediaStream.
TEST_F(MediaStreamSignalingTest, SignalSameTracksInSeparateMediaStream) {
- talk_base::scoped_ptr<SessionDescriptionInterface> desc;
+ rtc::scoped_ptr<SessionDescriptionInterface> desc;
CreateSessionDescriptionAndReference(1, 1, desc.use());
signaling_->AddLocalStream(reference_collection_->at(0));
@@ -1088,7 +1147,7 @@
// Add a new MediaStream but with the same tracks as in the first stream.
std::string stream_label_1 = kStreams[1];
- talk_base::scoped_refptr<webrtc::MediaStreamInterface> stream_1(
+ rtc::scoped_refptr<webrtc::MediaStreamInterface> stream_1(
webrtc::MediaStream::Create(kStreams[1]));
stream_1->AddTrack(reference_collection_->at(0)->GetVideoTracks()[0]);
stream_1->AddTrack(reference_collection_->at(0)->GetAudioTracks()[0]);
@@ -1097,10 +1156,10 @@
// Replace msid in the original SDP.
std::string sdp;
desc->ToString(&sdp);
- talk_base::replace_substrs(
+ rtc::replace_substrs(
kStreams[0], strlen(kStreams[0]), kStreams[1], strlen(kStreams[1]), &sdp);
- talk_base::scoped_ptr<SessionDescriptionInterface> updated_desc(
+ rtc::scoped_ptr<SessionDescriptionInterface> updated_desc(
webrtc::CreateSessionDescription(SessionDescriptionInterface::kOffer,
sdp, NULL));
@@ -1115,13 +1174,13 @@
// SSL_SERVER.
TEST_F(MediaStreamSignalingTest, SctpIdAllocationBasedOnRole) {
int id;
- ASSERT_TRUE(signaling_->AllocateSctpSid(talk_base::SSL_SERVER, &id));
+ ASSERT_TRUE(signaling_->AllocateSctpSid(rtc::SSL_SERVER, &id));
EXPECT_EQ(1, id);
- ASSERT_TRUE(signaling_->AllocateSctpSid(talk_base::SSL_CLIENT, &id));
+ ASSERT_TRUE(signaling_->AllocateSctpSid(rtc::SSL_CLIENT, &id));
EXPECT_EQ(0, id);
- ASSERT_TRUE(signaling_->AllocateSctpSid(talk_base::SSL_SERVER, &id));
+ ASSERT_TRUE(signaling_->AllocateSctpSid(rtc::SSL_SERVER, &id));
EXPECT_EQ(3, id);
- ASSERT_TRUE(signaling_->AllocateSctpSid(talk_base::SSL_CLIENT, &id));
+ ASSERT_TRUE(signaling_->AllocateSctpSid(rtc::SSL_CLIENT, &id));
EXPECT_EQ(2, id);
}
@@ -1131,13 +1190,13 @@
AddDataChannel(cricket::DCT_SCTP, "a", old_id);
int new_id;
- ASSERT_TRUE(signaling_->AllocateSctpSid(talk_base::SSL_SERVER, &new_id));
+ ASSERT_TRUE(signaling_->AllocateSctpSid(rtc::SSL_SERVER, &new_id));
EXPECT_NE(old_id, new_id);
// Creates a DataChannel with id 0.
old_id = 0;
AddDataChannel(cricket::DCT_SCTP, "a", old_id);
- ASSERT_TRUE(signaling_->AllocateSctpSid(talk_base::SSL_CLIENT, &new_id));
+ ASSERT_TRUE(signaling_->AllocateSctpSid(rtc::SSL_CLIENT, &new_id));
EXPECT_NE(old_id, new_id);
}
@@ -1149,12 +1208,12 @@
AddDataChannel(cricket::DCT_SCTP, "a", even_id);
int allocated_id = -1;
- ASSERT_TRUE(signaling_->AllocateSctpSid(talk_base::SSL_SERVER,
+ ASSERT_TRUE(signaling_->AllocateSctpSid(rtc::SSL_SERVER,
&allocated_id));
EXPECT_EQ(odd_id + 2, allocated_id);
AddDataChannel(cricket::DCT_SCTP, "a", allocated_id);
- ASSERT_TRUE(signaling_->AllocateSctpSid(talk_base::SSL_CLIENT,
+ ASSERT_TRUE(signaling_->AllocateSctpSid(rtc::SSL_CLIENT,
&allocated_id));
EXPECT_EQ(even_id + 2, allocated_id);
AddDataChannel(cricket::DCT_SCTP, "a", allocated_id);
@@ -1163,20 +1222,20 @@
signaling_->RemoveSctpDataChannel(even_id);
// Verifies that removed DataChannel ids are reused.
- ASSERT_TRUE(signaling_->AllocateSctpSid(talk_base::SSL_SERVER,
+ ASSERT_TRUE(signaling_->AllocateSctpSid(rtc::SSL_SERVER,
&allocated_id));
EXPECT_EQ(odd_id, allocated_id);
- ASSERT_TRUE(signaling_->AllocateSctpSid(talk_base::SSL_CLIENT,
+ ASSERT_TRUE(signaling_->AllocateSctpSid(rtc::SSL_CLIENT,
&allocated_id));
EXPECT_EQ(even_id, allocated_id);
// Verifies that used higher DataChannel ids are not reused.
- ASSERT_TRUE(signaling_->AllocateSctpSid(talk_base::SSL_SERVER,
+ ASSERT_TRUE(signaling_->AllocateSctpSid(rtc::SSL_SERVER,
&allocated_id));
EXPECT_NE(odd_id + 2, allocated_id);
- ASSERT_TRUE(signaling_->AllocateSctpSid(talk_base::SSL_CLIENT,
+ ASSERT_TRUE(signaling_->AllocateSctpSid(rtc::SSL_CLIENT,
&allocated_id));
EXPECT_NE(even_id + 2, allocated_id);
@@ -1187,7 +1246,7 @@
AddDataChannel(cricket::DCT_RTP, "a", -1);
webrtc::InternalDataChannelInit config;
- talk_base::scoped_refptr<webrtc::DataChannel> data_channel =
+ rtc::scoped_refptr<webrtc::DataChannel> data_channel =
webrtc::DataChannel::Create(
data_channel_provider_.get(), cricket::DCT_RTP, "a", config);
ASSERT_TRUE(data_channel.get() != NULL);
@@ -1208,7 +1267,7 @@
signaling_->SetDataChannelFactory(&fake_factory);
webrtc::DataChannelInit config;
config.id = 1;
- talk_base::Buffer payload;
+ rtc::Buffer payload;
webrtc::WriteDataChannelOpenMessage("a", config, &payload);
cricket::ReceiveDataParams params;
params.ssrc = config.id;
@@ -1228,7 +1287,7 @@
signaling_->SetDataChannelFactory(&fake_factory);
webrtc::DataChannelInit config;
config.id = 0;
- talk_base::Buffer payload;
+ rtc::Buffer payload;
webrtc::WriteDataChannelOpenMessage("a", config, &payload);
cricket::ReceiveDataParams params;
params.ssrc = config.id;
@@ -1241,7 +1300,7 @@
webrtc::InternalDataChannelInit config;
config.id = 0;
- talk_base::scoped_refptr<webrtc::DataChannel> data_channel =
+ rtc::scoped_refptr<webrtc::DataChannel> data_channel =
webrtc::DataChannel::Create(
data_channel_provider_.get(), cricket::DCT_SCTP, "a", config);
ASSERT_TRUE(data_channel.get() != NULL);
diff --git a/app/webrtc/mediastreamtrackproxy.h b/app/webrtc/mediastreamtrackproxy.h
index 19750b0..56ad1e3 100644
--- a/app/webrtc/mediastreamtrackproxy.h
+++ b/app/webrtc/mediastreamtrackproxy.h
@@ -45,7 +45,7 @@
PROXY_METHOD1(void, AddSink, AudioTrackSinkInterface*)
PROXY_METHOD1(void, RemoveSink, AudioTrackSinkInterface*)
PROXY_METHOD1(bool, GetSignalLevel, int*)
- PROXY_METHOD0(talk_base::scoped_refptr<AudioProcessorInterface>,
+ PROXY_METHOD0(rtc::scoped_refptr<AudioProcessorInterface>,
GetAudioProcessor)
PROXY_METHOD0(cricket::AudioRenderer*, GetRenderer)
diff --git a/app/webrtc/notifier.h b/app/webrtc/notifier.h
index eaa0063..0237ecf 100644
--- a/app/webrtc/notifier.h
+++ b/app/webrtc/notifier.h
@@ -30,7 +30,7 @@
#include <list>
-#include "talk/base/common.h"
+#include "webrtc/base/common.h"
#include "talk/app/webrtc/mediastreaminterface.h"
namespace webrtc {
diff --git a/app/webrtc/objc/RTCAudioTrack+Internal.h b/app/webrtc/objc/RTCAudioTrack+Internal.h
index 17d2723..60e40bf 100644
--- a/app/webrtc/objc/RTCAudioTrack+Internal.h
+++ b/app/webrtc/objc/RTCAudioTrack+Internal.h
@@ -32,6 +32,6 @@
@interface RTCAudioTrack (Internal)
@property(nonatomic, assign, readonly)
- talk_base::scoped_refptr<webrtc::AudioTrackInterface> audioTrack;
+ rtc::scoped_refptr<webrtc::AudioTrackInterface> audioTrack;
@end
diff --git a/app/webrtc/objc/RTCAudioTrack.mm b/app/webrtc/objc/RTCAudioTrack.mm
index 2364c29..bdc89b5 100644
--- a/app/webrtc/objc/RTCAudioTrack.mm
+++ b/app/webrtc/objc/RTCAudioTrack.mm
@@ -38,7 +38,7 @@
@implementation RTCAudioTrack (Internal)
-- (talk_base::scoped_refptr<webrtc::AudioTrackInterface>)audioTrack {
+- (rtc::scoped_refptr<webrtc::AudioTrackInterface>)audioTrack {
return static_cast<webrtc::AudioTrackInterface*>(self.mediaTrack.get());
}
diff --git a/app/webrtc/objc/RTCDataChannel+Internal.h b/app/webrtc/objc/RTCDataChannel+Internal.h
index a550891..0a8079b 100644
--- a/app/webrtc/objc/RTCDataChannel+Internal.h
+++ b/app/webrtc/objc/RTCDataChannel+Internal.h
@@ -28,7 +28,7 @@
#import "RTCDataChannel.h"
#include "talk/app/webrtc/datachannelinterface.h"
-#include "talk/base/scoped_ref_ptr.h"
+#include "webrtc/base/scoped_ref_ptr.h"
@interface RTCDataBuffer (Internal)
@@ -47,9 +47,9 @@
@interface RTCDataChannel (Internal)
@property(nonatomic, readonly)
- talk_base::scoped_refptr<webrtc::DataChannelInterface> dataChannel;
+ rtc::scoped_refptr<webrtc::DataChannelInterface> dataChannel;
- (instancetype)initWithDataChannel:
- (talk_base::scoped_refptr<webrtc::DataChannelInterface>)dataChannel;
+ (rtc::scoped_refptr<webrtc::DataChannelInterface>)dataChannel;
@end
diff --git a/app/webrtc/objc/RTCDataChannel.mm b/app/webrtc/objc/RTCDataChannel.mm
index 0837940..2cf8bf8 100644
--- a/app/webrtc/objc/RTCDataChannel.mm
+++ b/app/webrtc/objc/RTCDataChannel.mm
@@ -135,13 +135,13 @@
@end
@implementation RTCDataBuffer {
- talk_base::scoped_ptr<webrtc::DataBuffer> _dataBuffer;
+ rtc::scoped_ptr<webrtc::DataBuffer> _dataBuffer;
}
- (instancetype)initWithData:(NSData*)data isBinary:(BOOL)isBinary {
NSAssert(data, @"data cannot be nil");
if (self = [super init]) {
- talk_base::Buffer buffer([data bytes], [data length]);
+ rtc::Buffer buffer([data bytes], [data length]);
_dataBuffer.reset(new webrtc::DataBuffer(buffer, isBinary));
}
return self;
@@ -174,8 +174,8 @@
@end
@implementation RTCDataChannel {
- talk_base::scoped_refptr<webrtc::DataChannelInterface> _dataChannel;
- talk_base::scoped_ptr<webrtc::RTCDataChannelObserver> _observer;
+ rtc::scoped_refptr<webrtc::DataChannelInterface> _dataChannel;
+ rtc::scoped_ptr<webrtc::RTCDataChannelObserver> _observer;
BOOL _isObserverRegistered;
}
@@ -256,7 +256,7 @@
@implementation RTCDataChannel (Internal)
- (instancetype)initWithDataChannel:
- (talk_base::scoped_refptr<webrtc::DataChannelInterface>)
+ (rtc::scoped_refptr<webrtc::DataChannelInterface>)
dataChannel {
NSAssert(dataChannel != NULL, @"dataChannel cannot be NULL");
if (self = [super init]) {
@@ -266,7 +266,7 @@
return self;
}
-- (talk_base::scoped_refptr<webrtc::DataChannelInterface>)dataChannel {
+- (rtc::scoped_refptr<webrtc::DataChannelInterface>)dataChannel {
return _dataChannel;
}
diff --git a/app/webrtc/objc/RTCI420Frame.mm b/app/webrtc/objc/RTCI420Frame.mm
index eff3102..61903bc 100644
--- a/app/webrtc/objc/RTCI420Frame.mm
+++ b/app/webrtc/objc/RTCI420Frame.mm
@@ -27,11 +27,11 @@
#import "RTCI420Frame.h"
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/media/base/videoframe.h"
@implementation RTCI420Frame {
- talk_base::scoped_ptr<cricket::VideoFrame> _videoFrame;
+ rtc::scoped_ptr<cricket::VideoFrame> _videoFrame;
}
- (NSUInteger)width {
diff --git a/app/webrtc/objc/RTCMediaConstraints.mm b/app/webrtc/objc/RTCMediaConstraints.mm
index a1cc5a5..e44dd59 100644
--- a/app/webrtc/objc/RTCMediaConstraints.mm
+++ b/app/webrtc/objc/RTCMediaConstraints.mm
@@ -33,13 +33,13 @@
#import "RTCPair.h"
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/scoped_ptr.h"
// TODO(hughv): Add accessors for mandatory and optional constraints.
// TODO(hughv): Add description.
@implementation RTCMediaConstraints {
- talk_base::scoped_ptr<webrtc::RTCMediaConstraintsNative> _constraints;
+ rtc::scoped_ptr<webrtc::RTCMediaConstraintsNative> _constraints;
webrtc::MediaConstraintsInterface::Constraints _mandatory;
webrtc::MediaConstraintsInterface::Constraints _optional;
}
diff --git a/app/webrtc/objc/RTCMediaSource+Internal.h b/app/webrtc/objc/RTCMediaSource+Internal.h
index 98f8e9c..96341f2 100644
--- a/app/webrtc/objc/RTCMediaSource+Internal.h
+++ b/app/webrtc/objc/RTCMediaSource+Internal.h
@@ -32,9 +32,9 @@
@interface RTCMediaSource (Internal)
@property(nonatomic, assign, readonly)
- talk_base::scoped_refptr<webrtc::MediaSourceInterface> mediaSource;
+ rtc::scoped_refptr<webrtc::MediaSourceInterface> mediaSource;
- (id)initWithMediaSource:
- (talk_base::scoped_refptr<webrtc::MediaSourceInterface>)mediaSource;
+ (rtc::scoped_refptr<webrtc::MediaSourceInterface>)mediaSource;
@end
diff --git a/app/webrtc/objc/RTCMediaSource.mm b/app/webrtc/objc/RTCMediaSource.mm
index 28af3ad..b94bf05 100644
--- a/app/webrtc/objc/RTCMediaSource.mm
+++ b/app/webrtc/objc/RTCMediaSource.mm
@@ -34,7 +34,7 @@
#import "RTCEnumConverter.h"
@implementation RTCMediaSource {
- talk_base::scoped_refptr<webrtc::MediaSourceInterface> _mediaSource;
+ rtc::scoped_refptr<webrtc::MediaSourceInterface> _mediaSource;
}
- (RTCSourceState)state {
@@ -46,7 +46,7 @@
@implementation RTCMediaSource (Internal)
- (id)initWithMediaSource:
- (talk_base::scoped_refptr<webrtc::MediaSourceInterface>)mediaSource {
+ (rtc::scoped_refptr<webrtc::MediaSourceInterface>)mediaSource {
if (!mediaSource) {
NSAssert(NO, @"nil arguments not allowed");
self = nil;
@@ -58,7 +58,7 @@
return self;
}
-- (talk_base::scoped_refptr<webrtc::MediaSourceInterface>)mediaSource {
+- (rtc::scoped_refptr<webrtc::MediaSourceInterface>)mediaSource {
return _mediaSource;
}
diff --git a/app/webrtc/objc/RTCMediaStream+Internal.h b/app/webrtc/objc/RTCMediaStream+Internal.h
index 2123c2d..bde7631 100644
--- a/app/webrtc/objc/RTCMediaStream+Internal.h
+++ b/app/webrtc/objc/RTCMediaStream+Internal.h
@@ -32,9 +32,9 @@
@interface RTCMediaStream (Internal)
@property(nonatomic, assign, readonly)
- talk_base::scoped_refptr<webrtc::MediaStreamInterface> mediaStream;
+ rtc::scoped_refptr<webrtc::MediaStreamInterface> mediaStream;
- (id)initWithMediaStream:
- (talk_base::scoped_refptr<webrtc::MediaStreamInterface>)mediaStream;
+ (rtc::scoped_refptr<webrtc::MediaStreamInterface>)mediaStream;
@end
diff --git a/app/webrtc/objc/RTCMediaStream.mm b/app/webrtc/objc/RTCMediaStream.mm
index 94e14fc..27d20b8 100644
--- a/app/webrtc/objc/RTCMediaStream.mm
+++ b/app/webrtc/objc/RTCMediaStream.mm
@@ -40,7 +40,7 @@
@implementation RTCMediaStream {
NSMutableArray* _audioTracks;
NSMutableArray* _videoTracks;
- talk_base::scoped_refptr<webrtc::MediaStreamInterface> _mediaStream;
+ rtc::scoped_refptr<webrtc::MediaStreamInterface> _mediaStream;
}
- (NSString*)description {
@@ -105,7 +105,7 @@
@implementation RTCMediaStream (Internal)
- (id)initWithMediaStream:
- (talk_base::scoped_refptr<webrtc::MediaStreamInterface>)mediaStream {
+ (rtc::scoped_refptr<webrtc::MediaStreamInterface>)mediaStream {
if (!mediaStream) {
NSAssert(NO, @"nil arguments not allowed");
self = nil;
@@ -120,7 +120,7 @@
_mediaStream = mediaStream;
for (size_t i = 0; i < audio_tracks.size(); ++i) {
- talk_base::scoped_refptr<webrtc::AudioTrackInterface> track =
+ rtc::scoped_refptr<webrtc::AudioTrackInterface> track =
audio_tracks[i];
RTCAudioTrack* audioTrack =
[[RTCAudioTrack alloc] initWithMediaTrack:track];
@@ -128,7 +128,7 @@
}
for (size_t i = 0; i < video_tracks.size(); ++i) {
- talk_base::scoped_refptr<webrtc::VideoTrackInterface> track =
+ rtc::scoped_refptr<webrtc::VideoTrackInterface> track =
video_tracks[i];
RTCVideoTrack* videoTrack =
[[RTCVideoTrack alloc] initWithMediaTrack:track];
@@ -138,7 +138,7 @@
return self;
}
-- (talk_base::scoped_refptr<webrtc::MediaStreamInterface>)mediaStream {
+- (rtc::scoped_refptr<webrtc::MediaStreamInterface>)mediaStream {
return _mediaStream;
}
diff --git a/app/webrtc/objc/RTCMediaStreamTrack+Internal.h b/app/webrtc/objc/RTCMediaStreamTrack+Internal.h
index 9a0cab3..d815c79 100644
--- a/app/webrtc/objc/RTCMediaStreamTrack+Internal.h
+++ b/app/webrtc/objc/RTCMediaStreamTrack+Internal.h
@@ -32,9 +32,9 @@
@interface RTCMediaStreamTrack (Internal)
@property(nonatomic, assign, readonly)
- talk_base::scoped_refptr<webrtc::MediaStreamTrackInterface> mediaTrack;
+ rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> mediaTrack;
- (id)initWithMediaTrack:
- (talk_base::scoped_refptr<webrtc::MediaStreamTrackInterface>)mediaTrack;
+ (rtc::scoped_refptr<webrtc::MediaStreamTrackInterface>)mediaTrack;
@end
diff --git a/app/webrtc/objc/RTCMediaStreamTrack.mm b/app/webrtc/objc/RTCMediaStreamTrack.mm
index 5931312..a821bcc 100644
--- a/app/webrtc/objc/RTCMediaStreamTrack.mm
+++ b/app/webrtc/objc/RTCMediaStreamTrack.mm
@@ -48,8 +48,8 @@
}
@implementation RTCMediaStreamTrack {
- talk_base::scoped_refptr<webrtc::MediaStreamTrackInterface> _mediaTrack;
- talk_base::scoped_ptr<webrtc::RTCMediaStreamTrackObserver> _observer;
+ rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> _mediaTrack;
+ rtc::scoped_ptr<webrtc::RTCMediaStreamTrackObserver> _observer;
}
@synthesize label;
@@ -100,7 +100,7 @@
@implementation RTCMediaStreamTrack (Internal)
- (id)initWithMediaTrack:
- (talk_base::scoped_refptr<webrtc::MediaStreamTrackInterface>)
+ (rtc::scoped_refptr<webrtc::MediaStreamTrackInterface>)
mediaTrack {
if (!mediaTrack) {
NSAssert(NO, @"nil arguments not allowed");
@@ -120,7 +120,7 @@
_mediaTrack->UnregisterObserver(_observer.get());
}
-- (talk_base::scoped_refptr<webrtc::MediaStreamTrackInterface>)mediaTrack {
+- (rtc::scoped_refptr<webrtc::MediaStreamTrackInterface>)mediaTrack {
return _mediaTrack;
}
diff --git a/app/webrtc/objc/RTCPeerConnection+Internal.h b/app/webrtc/objc/RTCPeerConnection+Internal.h
index ad1c334..305bd5e 100644
--- a/app/webrtc/objc/RTCPeerConnection+Internal.h
+++ b/app/webrtc/objc/RTCPeerConnection+Internal.h
@@ -34,7 +34,7 @@
@interface RTCPeerConnection (Internal)
@property(nonatomic, assign, readonly)
- talk_base::scoped_refptr<webrtc::PeerConnectionInterface> peerConnection;
+ rtc::scoped_refptr<webrtc::PeerConnectionInterface> peerConnection;
- (instancetype)initWithFactory:(webrtc::PeerConnectionFactoryInterface*)factory
iceServers:(const webrtc::PeerConnectionInterface::IceServers&)iceServers
diff --git a/app/webrtc/objc/RTCPeerConnection.mm b/app/webrtc/objc/RTCPeerConnection.mm
index 738fb31..58c1342 100644
--- a/app/webrtc/objc/RTCPeerConnection.mm
+++ b/app/webrtc/objc/RTCPeerConnection.mm
@@ -141,12 +141,12 @@
@implementation RTCPeerConnection {
NSMutableArray* _localStreams;
- talk_base::scoped_ptr<webrtc::RTCPeerConnectionObserver> _observer;
- talk_base::scoped_refptr<webrtc::PeerConnectionInterface> _peerConnection;
+ rtc::scoped_ptr<webrtc::RTCPeerConnectionObserver> _observer;
+ rtc::scoped_refptr<webrtc::PeerConnectionInterface> _peerConnection;
}
- (BOOL)addICECandidate:(RTCICECandidate*)candidate {
- talk_base::scoped_ptr<const webrtc::IceCandidateInterface> iceCandidate(
+ rtc::scoped_ptr<const webrtc::IceCandidateInterface> iceCandidate(
candidate.candidate);
return self.peerConnection->AddIceCandidate(iceCandidate.get());
}
@@ -165,7 +165,7 @@
- (RTCDataChannel*)createDataChannelWithLabel:(NSString*)label
config:(RTCDataChannelInit*)config {
std::string labelString([label UTF8String]);
- talk_base::scoped_refptr<webrtc::DataChannelInterface> dataChannel =
+ rtc::scoped_refptr<webrtc::DataChannelInterface> dataChannel =
self.peerConnection->CreateDataChannel(labelString,
config.dataChannelInit);
return [[RTCDataChannel alloc] initWithDataChannel:dataChannel];
@@ -173,16 +173,16 @@
- (void)createAnswerWithDelegate:(id<RTCSessionDescriptionDelegate>)delegate
constraints:(RTCMediaConstraints*)constraints {
- talk_base::scoped_refptr<webrtc::RTCCreateSessionDescriptionObserver>
- observer(new talk_base::RefCountedObject<
+ rtc::scoped_refptr<webrtc::RTCCreateSessionDescriptionObserver>
+ observer(new rtc::RefCountedObject<
webrtc::RTCCreateSessionDescriptionObserver>(delegate, self));
self.peerConnection->CreateAnswer(observer, constraints.constraints);
}
- (void)createOfferWithDelegate:(id<RTCSessionDescriptionDelegate>)delegate
constraints:(RTCMediaConstraints*)constraints {
- talk_base::scoped_refptr<webrtc::RTCCreateSessionDescriptionObserver>
- observer(new talk_base::RefCountedObject<
+ rtc::scoped_refptr<webrtc::RTCCreateSessionDescriptionObserver>
+ observer(new rtc::RefCountedObject<
webrtc::RTCCreateSessionDescriptionObserver>(delegate, self));
self.peerConnection->CreateOffer(observer, constraints.constraints);
}
@@ -195,8 +195,8 @@
- (void)setLocalDescriptionWithDelegate:
(id<RTCSessionDescriptionDelegate>)delegate
sessionDescription:(RTCSessionDescription*)sdp {
- talk_base::scoped_refptr<webrtc::RTCSetSessionDescriptionObserver> observer(
- new talk_base::RefCountedObject<webrtc::RTCSetSessionDescriptionObserver>(
+ rtc::scoped_refptr<webrtc::RTCSetSessionDescriptionObserver> observer(
+ new rtc::RefCountedObject<webrtc::RTCSetSessionDescriptionObserver>(
delegate, self));
self.peerConnection->SetLocalDescription(observer, sdp.sessionDescription);
}
@@ -204,8 +204,8 @@
- (void)setRemoteDescriptionWithDelegate:
(id<RTCSessionDescriptionDelegate>)delegate
sessionDescription:(RTCSessionDescription*)sdp {
- talk_base::scoped_refptr<webrtc::RTCSetSessionDescriptionObserver> observer(
- new talk_base::RefCountedObject<webrtc::RTCSetSessionDescriptionObserver>(
+ rtc::scoped_refptr<webrtc::RTCSetSessionDescriptionObserver> observer(
+ new rtc::RefCountedObject<webrtc::RTCSetSessionDescriptionObserver>(
delegate, self));
self.peerConnection->SetRemoteDescription(observer, sdp.sessionDescription);
}
@@ -261,8 +261,8 @@
- (BOOL)getStatsWithDelegate:(id<RTCStatsDelegate>)delegate
mediaStreamTrack:(RTCMediaStreamTrack*)mediaStreamTrack
statsOutputLevel:(RTCStatsOutputLevel)statsOutputLevel {
- talk_base::scoped_refptr<webrtc::RTCStatsObserver> observer(
- new talk_base::RefCountedObject<webrtc::RTCStatsObserver>(delegate,
+ rtc::scoped_refptr<webrtc::RTCStatsObserver> observer(
+ new rtc::RefCountedObject<webrtc::RTCStatsObserver>(delegate,
self));
webrtc::PeerConnectionInterface::StatsOutputLevel nativeOutputLevel =
[RTCEnumConverter convertStatsOutputLevelToNative:statsOutputLevel];
@@ -287,7 +287,7 @@
return self;
}
-- (talk_base::scoped_refptr<webrtc::PeerConnectionInterface>)peerConnection {
+- (rtc::scoped_refptr<webrtc::PeerConnectionInterface>)peerConnection {
return _peerConnection;
}
diff --git a/app/webrtc/objc/RTCPeerConnectionFactory.mm b/app/webrtc/objc/RTCPeerConnectionFactory.mm
index 8ada166..b7d2ce3 100644
--- a/app/webrtc/objc/RTCPeerConnectionFactory.mm
+++ b/app/webrtc/objc/RTCPeerConnectionFactory.mm
@@ -51,12 +51,12 @@
#include "talk/app/webrtc/peerconnectioninterface.h"
#include "talk/app/webrtc/videosourceinterface.h"
#include "talk/app/webrtc/videotrack.h"
-#include "talk/base/logging.h"
-#include "talk/base/ssladapter.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/ssladapter.h"
@interface RTCPeerConnectionFactory ()
-@property(nonatomic, assign) talk_base::scoped_refptr<
+@property(nonatomic, assign) rtc::scoped_refptr<
webrtc::PeerConnectionFactoryInterface> nativeFactory;
@end
@@ -66,12 +66,12 @@
@synthesize nativeFactory = _nativeFactory;
+ (void)initializeSSL {
- BOOL initialized = talk_base::InitializeSSL();
+ BOOL initialized = rtc::InitializeSSL();
NSAssert(initialized, @"Failed to initialize SSL library");
}
+ (void)deinitializeSSL {
- BOOL deinitialized = talk_base::CleanupSSL();
+ BOOL deinitialized = rtc::CleanupSSL();
NSAssert(deinitialized, @"Failed to deinitialize SSL library");
}
@@ -80,7 +80,7 @@
_nativeFactory = webrtc::CreatePeerConnectionFactory();
NSAssert(_nativeFactory, @"Failed to initialize PeerConnectionFactory!");
// Uncomment to get sensitive logs emitted (to stderr or logcat).
- // talk_base::LogMessage::LogToDebug(talk_base::LS_SENSITIVE);
+ // rtc::LogMessage::LogToDebug(rtc::LS_SENSITIVE);
}
return self;
}
@@ -102,7 +102,7 @@
}
- (RTCMediaStream*)mediaStreamWithLabel:(NSString*)label {
- talk_base::scoped_refptr<webrtc::MediaStreamInterface> nativeMediaStream =
+ rtc::scoped_refptr<webrtc::MediaStreamInterface> nativeMediaStream =
self.nativeFactory->CreateLocalMediaStream([label UTF8String]);
return [[RTCMediaStream alloc] initWithMediaStream:nativeMediaStream];
}
@@ -112,7 +112,7 @@
if (!capturer) {
return nil;
}
- talk_base::scoped_refptr<webrtc::VideoSourceInterface> source =
+ rtc::scoped_refptr<webrtc::VideoSourceInterface> source =
self.nativeFactory->CreateVideoSource([capturer takeNativeCapturer],
constraints.constraints);
return [[RTCVideoSource alloc] initWithMediaSource:source];
@@ -120,14 +120,14 @@
- (RTCVideoTrack*)videoTrackWithID:(NSString*)videoId
source:(RTCVideoSource*)source {
- talk_base::scoped_refptr<webrtc::VideoTrackInterface> track =
+ rtc::scoped_refptr<webrtc::VideoTrackInterface> track =
self.nativeFactory->CreateVideoTrack([videoId UTF8String],
source.videoSource);
return [[RTCVideoTrack alloc] initWithMediaTrack:track];
}
- (RTCAudioTrack*)audioTrackWithID:(NSString*)audioId {
- talk_base::scoped_refptr<webrtc::AudioTrackInterface> track =
+ rtc::scoped_refptr<webrtc::AudioTrackInterface> track =
self.nativeFactory->CreateAudioTrack([audioId UTF8String], NULL);
return [[RTCAudioTrack alloc] initWithMediaTrack:track];
}
diff --git a/app/webrtc/objc/RTCVideoCapturer.mm b/app/webrtc/objc/RTCVideoCapturer.mm
index d947f02..ea8e7ad 100644
--- a/app/webrtc/objc/RTCVideoCapturer.mm
+++ b/app/webrtc/objc/RTCVideoCapturer.mm
@@ -35,12 +35,12 @@
#include "talk/media/devices/devicemanager.h"
@implementation RTCVideoCapturer {
- talk_base::scoped_ptr<cricket::VideoCapturer> _capturer;
+ rtc::scoped_ptr<cricket::VideoCapturer> _capturer;
}
+ (RTCVideoCapturer*)capturerWithDeviceName:(NSString*)deviceName {
const std::string& device_name = std::string([deviceName UTF8String]);
- talk_base::scoped_ptr<cricket::DeviceManagerInterface> device_manager(
+ rtc::scoped_ptr<cricket::DeviceManagerInterface> device_manager(
cricket::DeviceManagerFactory::Create());
bool initialized = device_manager->Init();
NSAssert(initialized, @"DeviceManager::Init() failed");
@@ -49,7 +49,7 @@
LOG(LS_ERROR) << "GetVideoCaptureDevice failed";
return 0;
}
- talk_base::scoped_ptr<cricket::VideoCapturer> capturer(
+ rtc::scoped_ptr<cricket::VideoCapturer> capturer(
device_manager->CreateVideoCapturer(device));
RTCVideoCapturer* rtcCapturer =
[[RTCVideoCapturer alloc] initWithCapturer:capturer.release()];
diff --git a/app/webrtc/objc/RTCVideoRenderer.mm b/app/webrtc/objc/RTCVideoRenderer.mm
index 0704181..de03a1e 100644
--- a/app/webrtc/objc/RTCVideoRenderer.mm
+++ b/app/webrtc/objc/RTCVideoRenderer.mm
@@ -61,7 +61,7 @@
}
@implementation RTCVideoRenderer {
- talk_base::scoped_ptr<webrtc::RTCVideoRendererAdapter> _adapter;
+ rtc::scoped_ptr<webrtc::RTCVideoRendererAdapter> _adapter;
#if TARGET_OS_IPHONE
RTCEAGLVideoView* _videoView;
#endif
diff --git a/app/webrtc/objc/RTCVideoSource+Internal.h b/app/webrtc/objc/RTCVideoSource+Internal.h
index 1d3c4c9..962fa43 100644
--- a/app/webrtc/objc/RTCVideoSource+Internal.h
+++ b/app/webrtc/objc/RTCVideoSource+Internal.h
@@ -32,6 +32,6 @@
@interface RTCVideoSource (Internal)
@property(nonatomic, assign, readonly)
- talk_base::scoped_refptr<webrtc::VideoSourceInterface>videoSource;
+ rtc::scoped_refptr<webrtc::VideoSourceInterface>videoSource;
@end
diff --git a/app/webrtc/objc/RTCVideoSource.mm b/app/webrtc/objc/RTCVideoSource.mm
index b4554e0..7ad423c 100644
--- a/app/webrtc/objc/RTCVideoSource.mm
+++ b/app/webrtc/objc/RTCVideoSource.mm
@@ -37,7 +37,7 @@
@implementation RTCVideoSource (Internal)
-- (talk_base::scoped_refptr<webrtc::VideoSourceInterface>)videoSource {
+- (rtc::scoped_refptr<webrtc::VideoSourceInterface>)videoSource {
return static_cast<webrtc::VideoSourceInterface*>(self.mediaSource.get());
}
diff --git a/app/webrtc/objc/RTCVideoTrack+Internal.h b/app/webrtc/objc/RTCVideoTrack+Internal.h
index b5da54b..03c8f95 100644
--- a/app/webrtc/objc/RTCVideoTrack+Internal.h
+++ b/app/webrtc/objc/RTCVideoTrack+Internal.h
@@ -35,6 +35,6 @@
@interface RTCVideoTrack (Internal)
@property(nonatomic, assign, readonly)
- talk_base::scoped_refptr<webrtc::VideoTrackInterface> videoTrack;
+ rtc::scoped_refptr<webrtc::VideoTrackInterface> videoTrack;
@end
diff --git a/app/webrtc/objc/RTCVideoTrack.mm b/app/webrtc/objc/RTCVideoTrack.mm
index d6c8ed8..beebde0 100644
--- a/app/webrtc/objc/RTCVideoTrack.mm
+++ b/app/webrtc/objc/RTCVideoTrack.mm
@@ -39,7 +39,7 @@
}
- (id)initWithMediaTrack:
- (talk_base::scoped_refptr<webrtc::MediaStreamTrackInterface>)
+ (rtc::scoped_refptr<webrtc::MediaStreamTrackInterface>)
mediaTrack {
if (self = [super initWithMediaTrack:mediaTrack]) {
_rendererArray = [NSMutableArray array];
@@ -71,7 +71,7 @@
@implementation RTCVideoTrack (Internal)
-- (talk_base::scoped_refptr<webrtc::VideoTrackInterface>)videoTrack {
+- (rtc::scoped_refptr<webrtc::VideoTrackInterface>)videoTrack {
return static_cast<webrtc::VideoTrackInterface*>(self.mediaTrack.get());
}
diff --git a/app/webrtc/objctests/RTCPeerConnectionTest.mm b/app/webrtc/objctests/RTCPeerConnectionTest.mm
index 7a178f3..909503a 100644
--- a/app/webrtc/objctests/RTCPeerConnectionTest.mm
+++ b/app/webrtc/objctests/RTCPeerConnectionTest.mm
@@ -39,8 +39,8 @@
#import "RTCVideoRenderer.h"
#import "RTCVideoTrack.h"
-#include "talk/base/gunit.h"
-#include "talk/base/ssladapter.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/ssladapter.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
@@ -299,7 +299,7 @@
// a TestBase since it's not.
TEST(RTCPeerConnectionTest, SessionTest) {
@autoreleasepool {
- talk_base::InitializeSSL();
+ rtc::InitializeSSL();
// Since |factory| will own the signaling & worker threads, it's important
// that it outlive the created PeerConnections since they self-delete on the
// signaling thread, and if |factory| is freed first then a last refcount on
@@ -312,6 +312,6 @@
RTCPeerConnectionTest* pcTest = [[RTCPeerConnectionTest alloc] init];
[pcTest testCompleteSessionWithFactory:factory];
}
- talk_base::CleanupSSL();
+ rtc::CleanupSSL();
}
}
diff --git a/app/webrtc/objctests/mac/main.mm b/app/webrtc/objctests/mac/main.mm
index 4995b7f..7af1a2b 100644
--- a/app/webrtc/objctests/mac/main.mm
+++ b/app/webrtc/objctests/mac/main.mm
@@ -25,7 +25,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/gunit.h"
+#include "webrtc/base/gunit.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
diff --git a/app/webrtc/peerconnection.cc b/app/webrtc/peerconnection.cc
index ec20593..7c02793 100644
--- a/app/webrtc/peerconnection.cc
+++ b/app/webrtc/peerconnection.cc
@@ -35,8 +35,8 @@
#include "talk/app/webrtc/mediaconstraintsinterface.h"
#include "talk/app/webrtc/mediastreamhandler.h"
#include "talk/app/webrtc/streamcollection.h"
-#include "talk/base/logging.h"
-#include "talk/base/stringencode.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/stringencode.h"
#include "talk/p2p/client/basicportallocator.h"
#include "talk/session/media/channelmanager.h"
@@ -74,22 +74,22 @@
MSG_GETSTATS,
};
-struct SetSessionDescriptionMsg : public talk_base::MessageData {
+struct SetSessionDescriptionMsg : public rtc::MessageData {
explicit SetSessionDescriptionMsg(
webrtc::SetSessionDescriptionObserver* observer)
: observer(observer) {
}
- talk_base::scoped_refptr<webrtc::SetSessionDescriptionObserver> observer;
+ rtc::scoped_refptr<webrtc::SetSessionDescriptionObserver> observer;
std::string error;
};
-struct GetStatsMsg : public talk_base::MessageData {
+struct GetStatsMsg : public rtc::MessageData {
explicit GetStatsMsg(webrtc::StatsObserver* observer)
: observer(observer) {
}
webrtc::StatsReports reports;
- talk_base::scoped_refptr<webrtc::StatsObserver> observer;
+ rtc::scoped_refptr<webrtc::StatsObserver> observer;
};
// |in_str| should be of format
@@ -136,7 +136,7 @@
*host = in_str.substr(1, closebracket - 1);
std::string::size_type colonpos = in_str.find(':', closebracket);
if (std::string::npos != colonpos) {
- if (!talk_base::FromString(
+ if (!rtc::FromString(
in_str.substr(closebracket + 2, std::string::npos), port)) {
return false;
}
@@ -148,7 +148,7 @@
std::string::size_type colonpos = in_str.find(':');
if (std::string::npos != colonpos) {
*host = in_str.substr(0, colonpos);
- if (!talk_base::FromString(
+ if (!rtc::FromString(
in_str.substr(colonpos + 1, std::string::npos), port)) {
return false;
}
@@ -189,12 +189,12 @@
}
std::vector<std::string> tokens;
std::string turn_transport_type = kUdpTransportType;
- talk_base::tokenize(server.uri, '?', &tokens);
+ rtc::tokenize(server.uri, '?', &tokens);
std::string uri_without_transport = tokens[0];
// Let's look into transport= param, if it exists.
if (tokens.size() == kTurnTransportTokensNum) { // ?transport= is present.
std::string uri_transport_param = tokens[1];
- talk_base::tokenize(uri_transport_param, '=', &tokens);
+ rtc::tokenize(uri_transport_param, '=', &tokens);
if (tokens[0] == kTransport) {
// As per above grammar transport param will be consist of lower case
// letters.
@@ -218,10 +218,10 @@
// Let's break hostname.
tokens.clear();
- talk_base::tokenize(hoststring, '@', &tokens);
+ rtc::tokenize(hoststring, '@', &tokens);
hoststring = tokens[0];
if (tokens.size() == kTurnHostTokensNum) {
- server.username = talk_base::s_url_decode(tokens[0]);
+ server.username = rtc::s_url_decode(tokens[0]);
hoststring = tokens[1];
}
@@ -253,9 +253,9 @@
if (server.username.empty()) {
// Turn url example from the spec |url:"turn:user@turn.example.org"|.
std::vector<std::string> turn_tokens;
- talk_base::tokenize(address, '@', &turn_tokens);
+ rtc::tokenize(address, '@', &turn_tokens);
if (turn_tokens.size() == kTurnHostTokensNum) {
- server.username = talk_base::s_url_decode(turn_tokens[0]);
+ server.username = rtc::s_url_decode(turn_tokens[0]);
address = turn_tokens[1];
}
}
@@ -387,12 +387,12 @@
return true;
}
-talk_base::scoped_refptr<StreamCollectionInterface>
+rtc::scoped_refptr<StreamCollectionInterface>
PeerConnection::local_streams() {
return mediastream_signaling_->local_streams();
}
-talk_base::scoped_refptr<StreamCollectionInterface>
+rtc::scoped_refptr<StreamCollectionInterface>
PeerConnection::remote_streams() {
return mediastream_signaling_->remote_streams();
}
@@ -423,7 +423,7 @@
observer_->OnRenegotiationNeeded();
}
-talk_base::scoped_refptr<DtmfSenderInterface> PeerConnection::CreateDtmfSender(
+rtc::scoped_refptr<DtmfSenderInterface> PeerConnection::CreateDtmfSender(
AudioTrackInterface* track) {
if (!track) {
LOG(LS_ERROR) << "CreateDtmfSender - track is NULL.";
@@ -434,7 +434,7 @@
return NULL;
}
- talk_base::scoped_refptr<DtmfSenderInterface> sender(
+ rtc::scoped_refptr<DtmfSenderInterface> sender(
DtmfSender::Create(track, signaling_thread(), session_.get()));
if (!sender.get()) {
LOG(LS_ERROR) << "CreateDtmfSender failed on DtmfSender::Create.";
@@ -452,7 +452,7 @@
}
stats_->UpdateStats(level);
- talk_base::scoped_ptr<GetStatsMsg> msg(new GetStatsMsg(observer));
+ rtc::scoped_ptr<GetStatsMsg> msg(new GetStatsMsg(observer));
if (!stats_->GetStats(track, &(msg->reports))) {
return false;
}
@@ -478,17 +478,17 @@
return ice_gathering_state_;
}
-talk_base::scoped_refptr<DataChannelInterface>
+rtc::scoped_refptr<DataChannelInterface>
PeerConnection::CreateDataChannel(
const std::string& label,
const DataChannelInit* config) {
bool first_datachannel = !mediastream_signaling_->HasDataChannels();
- talk_base::scoped_ptr<InternalDataChannelInit> internal_config;
+ rtc::scoped_ptr<InternalDataChannelInit> internal_config;
if (config) {
internal_config.reset(new InternalDataChannelInit(*config));
}
- talk_base::scoped_refptr<DataChannelInterface> channel(
+ rtc::scoped_refptr<DataChannelInterface> channel(
session_->CreateDataChannel(label, internal_config.get()));
if (!channel.get())
return NULL;
@@ -508,7 +508,62 @@
LOG(LS_ERROR) << "CreateOffer - observer is NULL.";
return;
}
- session_->CreateOffer(observer, constraints);
+ RTCOfferAnswerOptions options;
+ // Defaults to receiving audio and not receiving video.
+ options.offer_to_receive_audio =
+ RTCOfferAnswerOptions::kOfferToReceiveMediaTrue;
+ options.offer_to_receive_video = 0;
+
+ bool value;
+ size_t mandatory_constraints = 0;
+
+ if (FindConstraint(constraints,
+ MediaConstraintsInterface::kOfferToReceiveAudio,
+ &value,
+ &mandatory_constraints)) {
+ options.offer_to_receive_audio =
+ value ? RTCOfferAnswerOptions::kOfferToReceiveMediaTrue : 0;
+ }
+
+ if (FindConstraint(constraints,
+ MediaConstraintsInterface::kOfferToReceiveVideo,
+ &value,
+ &mandatory_constraints)) {
+ options.offer_to_receive_video =
+ value ? RTCOfferAnswerOptions::kOfferToReceiveMediaTrue : 0;
+ }
+
+ if (FindConstraint(constraints,
+ MediaConstraintsInterface::kVoiceActivityDetection,
+ &value,
+ &mandatory_constraints)) {
+ options.voice_activity_detection = value;
+ }
+
+ if (FindConstraint(constraints,
+ MediaConstraintsInterface::kIceRestart,
+ &value,
+ &mandatory_constraints)) {
+ options.ice_restart = value;
+ }
+
+ if (FindConstraint(constraints,
+ MediaConstraintsInterface::kUseRtpMux,
+ &value,
+ &mandatory_constraints)) {
+ options.use_rtp_mux = value;
+ }
+
+ CreateOffer(observer, options);
+}
+
+void PeerConnection::CreateOffer(CreateSessionDescriptionObserver* observer,
+ const RTCOfferAnswerOptions& options) {
+ if (!VERIFY(observer != NULL)) {
+ LOG(LS_ERROR) << "CreateOffer - observer is NULL.";
+ return;
+ }
+ session_->CreateOffer(observer, options);
}
void PeerConnection::CreateAnswer(
@@ -588,13 +643,13 @@
return false;
}
- std::vector<talk_base::SocketAddress> stun_hosts;
+ std::vector<rtc::SocketAddress> stun_hosts;
typedef std::vector<StunConfiguration>::const_iterator StunIt;
for (StunIt stun_it = stuns.begin(); stun_it != stuns.end(); ++stun_it) {
stun_hosts.push_back(stun_it->server);
}
- talk_base::SocketAddress stun_addr;
+ rtc::SocketAddress stun_addr;
if (!stun_hosts.empty()) {
stun_addr = stun_hosts.front();
LOG(LS_INFO) << "UpdateIce: StunServer Address: " << stun_addr.ToString();
@@ -684,7 +739,7 @@
}
}
-void PeerConnection::OnMessage(talk_base::Message* msg) {
+void PeerConnection::OnMessage(rtc::Message* msg) {
switch (msg->message_id) {
case MSG_SET_SESSIONDESCRIPTION_SUCCESS: {
SetSessionDescriptionMsg* param =
diff --git a/app/webrtc/peerconnection.h b/app/webrtc/peerconnection.h
index ebb5dba..b1d4462 100644
--- a/app/webrtc/peerconnection.h
+++ b/app/webrtc/peerconnection.h
@@ -36,7 +36,7 @@
#include "talk/app/webrtc/statscollector.h"
#include "talk/app/webrtc/streamcollection.h"
#include "talk/app/webrtc/webrtcsession.h"
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/scoped_ptr.h"
namespace webrtc {
class MediaStreamHandlerContainer;
@@ -52,7 +52,7 @@
class PeerConnection : public PeerConnectionInterface,
public MediaStreamSignalingObserver,
public IceObserver,
- public talk_base::MessageHandler,
+ public rtc::MessageHandler,
public sigslot::has_slots<> {
public:
explicit PeerConnection(PeerConnectionFactory* factory);
@@ -63,16 +63,16 @@
PortAllocatorFactoryInterface* allocator_factory,
DTLSIdentityServiceInterface* dtls_identity_service,
PeerConnectionObserver* observer);
- virtual talk_base::scoped_refptr<StreamCollectionInterface> local_streams();
- virtual talk_base::scoped_refptr<StreamCollectionInterface> remote_streams();
+ virtual rtc::scoped_refptr<StreamCollectionInterface> local_streams();
+ virtual rtc::scoped_refptr<StreamCollectionInterface> remote_streams();
virtual bool AddStream(MediaStreamInterface* local_stream,
const MediaConstraintsInterface* constraints);
virtual void RemoveStream(MediaStreamInterface* local_stream);
- virtual talk_base::scoped_refptr<DtmfSenderInterface> CreateDtmfSender(
+ virtual rtc::scoped_refptr<DtmfSenderInterface> CreateDtmfSender(
AudioTrackInterface* track);
- virtual talk_base::scoped_refptr<DataChannelInterface> CreateDataChannel(
+ virtual rtc::scoped_refptr<DataChannelInterface> CreateDataChannel(
const std::string& label,
const DataChannelInit* config);
virtual bool GetStats(StatsObserver* observer,
@@ -92,6 +92,8 @@
// JSEP01
virtual void CreateOffer(CreateSessionDescriptionObserver* observer,
const MediaConstraintsInterface* constraints);
+ virtual void CreateOffer(CreateSessionDescriptionObserver* observer,
+ const RTCOfferAnswerOptions& options);
virtual void CreateAnswer(CreateSessionDescriptionObserver* observer,
const MediaConstraintsInterface* constraints);
virtual void SetLocalDescription(SetSessionDescriptionObserver* observer,
@@ -114,7 +116,7 @@
private:
// Implements MessageHandler.
- virtual void OnMessage(talk_base::Message* msg);
+ virtual void OnMessage(rtc::Message* msg);
// Implements MediaStreamSignalingObserver.
virtual void OnAddRemoteStream(MediaStreamInterface* stream) OVERRIDE;
@@ -166,7 +168,7 @@
DTLSIdentityServiceInterface* dtls_identity_service,
PeerConnectionObserver* observer);
- talk_base::Thread* signaling_thread() const {
+ rtc::Thread* signaling_thread() const {
return factory_->signaling_thread();
}
@@ -183,7 +185,7 @@
// However, since the reference counting is done in the
// PeerConnectionFactoryInteface all instances created using the raw pointer
// will refer to the same reference count.
- talk_base::scoped_refptr<PeerConnectionFactory> factory_;
+ rtc::scoped_refptr<PeerConnectionFactory> factory_;
PeerConnectionObserver* observer_;
UMAObserver* uma_observer_;
SignalingState signaling_state_;
@@ -192,11 +194,11 @@
IceConnectionState ice_connection_state_;
IceGatheringState ice_gathering_state_;
- talk_base::scoped_ptr<cricket::PortAllocator> port_allocator_;
- talk_base::scoped_ptr<WebRtcSession> session_;
- talk_base::scoped_ptr<MediaStreamSignaling> mediastream_signaling_;
- talk_base::scoped_ptr<MediaStreamHandlerContainer> stream_handler_container_;
- talk_base::scoped_ptr<StatsCollector> stats_;
+ rtc::scoped_ptr<cricket::PortAllocator> port_allocator_;
+ rtc::scoped_ptr<WebRtcSession> session_;
+ rtc::scoped_ptr<MediaStreamSignaling> mediastream_signaling_;
+ rtc::scoped_ptr<MediaStreamHandlerContainer> stream_handler_container_;
+ rtc::scoped_ptr<StatsCollector> stats_;
};
} // namespace webrtc
diff --git a/app/webrtc/peerconnection_unittest.cc b/app/webrtc/peerconnection_unittest.cc
index 0c39297..44009c0 100644
--- a/app/webrtc/peerconnection_unittest.cc
+++ b/app/webrtc/peerconnection_unittest.cc
@@ -45,11 +45,11 @@
#include "talk/app/webrtc/test/fakeperiodicvideocapturer.h"
#include "talk/app/webrtc/test/mockpeerconnectionobservers.h"
#include "talk/app/webrtc/videosourceinterface.h"
-#include "talk/base/gunit.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/ssladapter.h"
-#include "talk/base/sslstreamadapter.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/ssladapter.h"
+#include "webrtc/base/sslstreamadapter.h"
+#include "webrtc/base/thread.h"
#include "talk/media/webrtc/fakewebrtcvideoengine.h"
#include "talk/p2p/base/constants.h"
#include "talk/p2p/base/sessiondescription.h"
@@ -155,9 +155,9 @@
void AddMediaStream(bool audio, bool video) {
std::string label = kStreamLabelBase +
- talk_base::ToString<int>(
+ rtc::ToString<int>(
static_cast<int>(peer_connection_->local_streams()->count()));
- talk_base::scoped_refptr<webrtc::MediaStreamInterface> stream =
+ rtc::scoped_refptr<webrtc::MediaStreamInterface> stream =
peer_connection_factory_->CreateLocalMediaStream(label);
if (audio && can_receive_audio()) {
@@ -165,11 +165,11 @@
// Disable highpass filter so that we can get all the test audio frames.
constraints.AddMandatory(
MediaConstraintsInterface::kHighpassFilter, false);
- talk_base::scoped_refptr<webrtc::AudioSourceInterface> source =
+ rtc::scoped_refptr<webrtc::AudioSourceInterface> source =
peer_connection_factory_->CreateAudioSource(&constraints);
// TODO(perkj): Test audio source when it is implemented. Currently audio
// always use the default input.
- talk_base::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
+ rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
peer_connection_factory_->CreateAudioTrack(kAudioTrackLabelBase,
source));
stream->AddTrack(audio_track);
@@ -236,13 +236,13 @@
}
// Verify the CreateDtmfSender interface
void VerifyDtmf() {
- talk_base::scoped_ptr<DummyDtmfObserver> observer(new DummyDtmfObserver());
- talk_base::scoped_refptr<DtmfSenderInterface> dtmf_sender;
+ rtc::scoped_ptr<DummyDtmfObserver> observer(new DummyDtmfObserver());
+ rtc::scoped_refptr<DtmfSenderInterface> dtmf_sender;
// We can't create a DTMF sender with an invalid audio track or a non local
// track.
EXPECT_TRUE(peer_connection_->CreateDtmfSender(NULL) == NULL);
- talk_base::scoped_refptr<webrtc::AudioTrackInterface> non_localtrack(
+ rtc::scoped_refptr<webrtc::AudioTrackInterface> non_localtrack(
peer_connection_factory_->CreateAudioTrack("dummy_track",
NULL));
EXPECT_TRUE(peer_connection_->CreateDtmfSender(non_localtrack) == NULL);
@@ -333,8 +333,8 @@
}
int GetAudioOutputLevelStats(webrtc::MediaStreamTrackInterface* track) {
- talk_base::scoped_refptr<MockStatsObserver>
- observer(new talk_base::RefCountedObject<MockStatsObserver>());
+ rtc::scoped_refptr<MockStatsObserver>
+ observer(new rtc::RefCountedObject<MockStatsObserver>());
EXPECT_TRUE(peer_connection_->GetStats(
observer, track, PeerConnectionInterface::kStatsOutputLevelStandard));
EXPECT_TRUE_WAIT(observer->called(), kMaxWaitMs);
@@ -342,8 +342,8 @@
}
int GetAudioInputLevelStats() {
- talk_base::scoped_refptr<MockStatsObserver>
- observer(new talk_base::RefCountedObject<MockStatsObserver>());
+ rtc::scoped_refptr<MockStatsObserver>
+ observer(new rtc::RefCountedObject<MockStatsObserver>());
EXPECT_TRUE(peer_connection_->GetStats(
observer, NULL, PeerConnectionInterface::kStatsOutputLevelStandard));
EXPECT_TRUE_WAIT(observer->called(), kMaxWaitMs);
@@ -351,8 +351,8 @@
}
int GetBytesReceivedStats(webrtc::MediaStreamTrackInterface* track) {
- talk_base::scoped_refptr<MockStatsObserver>
- observer(new talk_base::RefCountedObject<MockStatsObserver>());
+ rtc::scoped_refptr<MockStatsObserver>
+ observer(new rtc::RefCountedObject<MockStatsObserver>());
EXPECT_TRUE(peer_connection_->GetStats(
observer, track, PeerConnectionInterface::kStatsOutputLevelStandard));
EXPECT_TRUE_WAIT(observer->called(), kMaxWaitMs);
@@ -360,8 +360,8 @@
}
int GetBytesSentStats(webrtc::MediaStreamTrackInterface* track) {
- talk_base::scoped_refptr<MockStatsObserver>
- observer(new talk_base::RefCountedObject<MockStatsObserver>());
+ rtc::scoped_refptr<MockStatsObserver>
+ observer(new rtc::RefCountedObject<MockStatsObserver>());
EXPECT_TRUE(peer_connection_->GetStats(
observer, track, PeerConnectionInterface::kStatsOutputLevelStandard));
EXPECT_TRUE_WAIT(observer->called(), kMaxWaitMs);
@@ -474,7 +474,7 @@
fake_video_decoder_factory_ = new FakeWebRtcVideoDecoderFactory();
fake_video_encoder_factory_ = new FakeWebRtcVideoEncoderFactory();
peer_connection_factory_ = webrtc::CreatePeerConnectionFactory(
- talk_base::Thread::Current(), talk_base::Thread::Current(),
+ rtc::Thread::Current(), rtc::Thread::Current(),
fake_audio_capture_module_, fake_video_encoder_factory_,
fake_video_decoder_factory_);
if (!peer_connection_factory_) {
@@ -484,7 +484,7 @@
constraints);
return peer_connection_.get() != NULL;
}
- virtual talk_base::scoped_refptr<webrtc::PeerConnectionInterface>
+ virtual rtc::scoped_refptr<webrtc::PeerConnectionInterface>
CreatePeerConnection(webrtc::PortAllocatorFactoryInterface* factory,
const MediaConstraintsInterface* constraints) = 0;
MessageReceiver* signaling_message_receiver() {
@@ -523,13 +523,13 @@
std::vector<std::string> tones_;
};
- talk_base::scoped_refptr<webrtc::VideoTrackInterface>
+ rtc::scoped_refptr<webrtc::VideoTrackInterface>
CreateLocalVideoTrack(const std::string stream_label) {
// Set max frame rate to 10fps to reduce the risk of the tests to be flaky.
FakeConstraints source_constraints = video_constraints_;
source_constraints.SetMandatoryMaxFrameRate(10);
- talk_base::scoped_refptr<webrtc::VideoSourceInterface> source =
+ rtc::scoped_refptr<webrtc::VideoSourceInterface> source =
peer_connection_factory_->CreateVideoSource(
new webrtc::FakePeriodicVideoCapturer(),
&source_constraints);
@@ -543,12 +543,12 @@
// signaling time constraints and relative complexity of the audio pipeline.
// This is consistent with the video pipeline that us a a separate thread for
// encoding and decoding.
- talk_base::Thread audio_thread_;
+ rtc::Thread audio_thread_;
- talk_base::scoped_refptr<webrtc::PortAllocatorFactoryInterface>
+ rtc::scoped_refptr<webrtc::PortAllocatorFactoryInterface>
allocator_factory_;
- talk_base::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_;
- talk_base::scoped_refptr<webrtc::PeerConnectionFactoryInterface>
+ rtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_;
+ rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface>
peer_connection_factory_;
typedef std::pair<std::string, std::string> IceUfragPwdPair;
@@ -556,7 +556,7 @@
bool expect_ice_restart_;
// Needed to keep track of number of frames send.
- talk_base::scoped_refptr<FakeAudioCaptureModule> fake_audio_capture_module_;
+ rtc::scoped_refptr<FakeAudioCaptureModule> fake_audio_capture_module_;
// Needed to keep track of number of frames received.
typedef std::map<std::string, webrtc::FakeVideoTrackRenderer*> RenderMap;
RenderMap fake_video_renderers_;
@@ -590,7 +590,7 @@
Negotiate(true, true);
}
virtual void Negotiate(bool audio, bool video) {
- talk_base::scoped_ptr<SessionDescriptionInterface> offer;
+ rtc::scoped_ptr<SessionDescriptionInterface> offer;
EXPECT_TRUE(DoCreateOffer(offer.use()));
if (offer->description()->GetContentByName("audio")) {
@@ -621,7 +621,7 @@
int sdp_mline_index,
const std::string& msg) {
LOG(INFO) << id() << "ReceiveIceMessage";
- talk_base::scoped_ptr<webrtc::IceCandidateInterface> candidate(
+ rtc::scoped_ptr<webrtc::IceCandidateInterface> candidate(
webrtc::CreateIceCandidate(sdp_mid, sdp_mline_index, msg, NULL));
EXPECT_TRUE(pc()->AddIceCandidate(candidate.get()));
}
@@ -723,7 +723,7 @@
remove_sdes_(false) {
}
- virtual talk_base::scoped_refptr<webrtc::PeerConnectionInterface>
+ virtual rtc::scoped_refptr<webrtc::PeerConnectionInterface>
CreatePeerConnection(webrtc::PortAllocatorFactoryInterface* factory,
const MediaConstraintsInterface* constraints) {
// CreatePeerConnection with IceServers.
@@ -733,7 +733,7 @@
ice_servers.push_back(ice_server);
FakeIdentityService* dtls_service =
- talk_base::SSLStreamAdapter::HaveDtlsSrtp() ?
+ rtc::SSLStreamAdapter::HaveDtlsSrtp() ?
new FakeIdentityService() : NULL;
return peer_connection_factory()->CreatePeerConnection(
ice_servers, constraints, factory, dtls_service, this);
@@ -745,10 +745,10 @@
// If we are not sending any streams ourselves it is time to add some.
AddMediaStream(true, true);
}
- talk_base::scoped_ptr<SessionDescriptionInterface> desc(
+ rtc::scoped_ptr<SessionDescriptionInterface> desc(
webrtc::CreateSessionDescription("offer", msg, NULL));
EXPECT_TRUE(DoSetRemoteDescription(desc.release()));
- talk_base::scoped_ptr<SessionDescriptionInterface> answer;
+ rtc::scoped_ptr<SessionDescriptionInterface> answer;
EXPECT_TRUE(DoCreateAnswer(answer.use()));
std::string sdp;
EXPECT_TRUE(answer->ToString(&sdp));
@@ -761,15 +761,15 @@
void HandleIncomingAnswer(const std::string& msg) {
LOG(INFO) << id() << "HandleIncomingAnswer";
- talk_base::scoped_ptr<SessionDescriptionInterface> desc(
+ rtc::scoped_ptr<SessionDescriptionInterface> desc(
webrtc::CreateSessionDescription("answer", msg, NULL));
EXPECT_TRUE(DoSetRemoteDescription(desc.release()));
}
bool DoCreateOfferAnswer(SessionDescriptionInterface** desc,
bool offer) {
- talk_base::scoped_refptr<MockCreateSessionDescriptionObserver>
- observer(new talk_base::RefCountedObject<
+ rtc::scoped_refptr<MockCreateSessionDescriptionObserver>
+ observer(new rtc::RefCountedObject<
MockCreateSessionDescriptionObserver>());
if (offer) {
pc()->CreateOffer(observer, &session_description_constraints_);
@@ -793,8 +793,8 @@
}
bool DoSetLocalDescription(SessionDescriptionInterface* desc) {
- talk_base::scoped_refptr<MockSetSessionDescriptionObserver>
- observer(new talk_base::RefCountedObject<
+ rtc::scoped_refptr<MockSetSessionDescriptionObserver>
+ observer(new rtc::RefCountedObject<
MockSetSessionDescriptionObserver>());
LOG(INFO) << id() << "SetLocalDescription ";
pc()->SetLocalDescription(observer, desc);
@@ -802,7 +802,7 @@
// EXPECT_TRUE_WAIT, local ice candidates might be sent to the remote peer
// before the offer which is an error.
// The reason is that EXPECT_TRUE_WAIT uses
- // talk_base::Thread::Current()->ProcessMessages(1);
+ // rtc::Thread::Current()->ProcessMessages(1);
// ProcessMessages waits at least 1ms but processes all messages before
// returning. Since this test is synchronous and send messages to the remote
// peer whenever a callback is invoked, this can lead to messages being
@@ -814,8 +814,8 @@
}
bool DoSetRemoteDescription(SessionDescriptionInterface* desc) {
- talk_base::scoped_refptr<MockSetSessionDescriptionObserver>
- observer(new talk_base::RefCountedObject<
+ rtc::scoped_refptr<MockSetSessionDescriptionObserver>
+ observer(new rtc::RefCountedObject<
MockSetSessionDescriptionObserver>());
LOG(INFO) << id() << "SetRemoteDescription ";
pc()->SetRemoteDescription(observer, desc);
@@ -847,8 +847,8 @@
bool remove_bundle_; // True if bundle should be removed in received SDP.
bool remove_sdes_; // True if a=crypto should be removed in received SDP.
- talk_base::scoped_refptr<DataChannelInterface> data_channel_;
- talk_base::scoped_ptr<MockDataChannelObserver> data_observer_;
+ rtc::scoped_refptr<DataChannelInterface> data_channel_;
+ rtc::scoped_ptr<MockDataChannelObserver> data_observer_;
};
template <typename SignalingClass>
@@ -904,7 +904,7 @@
}
P2PTestConductor() {
- talk_base::InitializeSSL(NULL);
+ rtc::InitializeSSL(NULL);
}
~P2PTestConductor() {
if (initiating_client_) {
@@ -913,7 +913,7 @@
if (receiving_client_) {
receiving_client_->set_signaling_message_receiver(NULL);
}
- talk_base::CleanupSSL();
+ rtc::CleanupSSL();
}
bool CreateTestClients() {
@@ -1023,8 +1023,8 @@
SignalingClass* receiving_client() { return receiving_client_.get(); }
private:
- talk_base::scoped_ptr<SignalingClass> initiating_client_;
- talk_base::scoped_ptr<SignalingClass> receiving_client_;
+ rtc::scoped_ptr<SignalingClass> initiating_client_;
+ rtc::scoped_ptr<SignalingClass> receiving_client_;
};
typedef P2PTestConductor<JsepTestClient> JsepPeerConnectionP2PTestClient;
@@ -1081,7 +1081,7 @@
// This test sets up a call between two endpoints that are configured to use
// DTLS key agreement. As a result, DTLS is negotiated and used for transport.
TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTestDtls) {
- MAYBE_SKIP_TEST(talk_base::SSLStreamAdapter::HaveDtlsSrtp);
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
FakeConstraints setup_constraints;
setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp,
true);
@@ -1093,7 +1093,7 @@
// This test sets up a audio call initially and then upgrades to audio/video,
// using DTLS.
TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTestDtlsRenegotiate) {
- MAYBE_SKIP_TEST(talk_base::SSLStreamAdapter::HaveDtlsSrtp);
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
FakeConstraints setup_constraints;
setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp,
true);
@@ -1108,7 +1108,7 @@
// DTLS key agreement. The offerer don't support SDES. As a result, DTLS is
// negotiated and used for transport.
TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTestOfferDtlsButNotSdes) {
- MAYBE_SKIP_TEST(talk_base::SSLStreamAdapter::HaveDtlsSrtp);
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
FakeConstraints setup_constraints;
setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp,
true);
@@ -1320,7 +1320,7 @@
// Wait a while to allow the sent data to arrive before an observer is
// registered..
- talk_base::Thread::Current()->ProcessMessages(100);
+ rtc::Thread::Current()->ProcessMessages(100);
MockDataChannelObserver new_observer(receiving_client()->data_channel());
EXPECT_EQ_WAIT(data, new_observer.last_message(), kMaxWaitMs);
@@ -1367,7 +1367,7 @@
// negotiation is completed without error.
#ifdef HAVE_SCTP
TEST_F(JsepPeerConnectionP2PTestClient, CreateOfferWithSctpDataChannel) {
- MAYBE_SKIP_TEST(talk_base::SSLStreamAdapter::HaveDtlsSrtp);
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
FakeConstraints constraints;
constraints.SetMandatory(
MediaConstraintsInterface::kEnableDtlsSrtp, true);
diff --git a/app/webrtc/peerconnectionendtoend_unittest.cc b/app/webrtc/peerconnectionendtoend_unittest.cc
index f701e06..8984781 100644
--- a/app/webrtc/peerconnectionendtoend_unittest.cc
+++ b/app/webrtc/peerconnectionendtoend_unittest.cc
@@ -27,12 +27,12 @@
#include "talk/app/webrtc/test/peerconnectiontestwrapper.h"
#include "talk/app/webrtc/test/mockpeerconnectionobservers.h"
-#include "talk/base/gunit.h"
-#include "talk/base/logging.h"
-#include "talk/base/ssladapter.h"
-#include "talk/base/sslstreamadapter.h"
-#include "talk/base/stringencode.h"
-#include "talk/base/stringutils.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/ssladapter.h"
+#include "webrtc/base/sslstreamadapter.h"
+#include "webrtc/base/stringencode.h"
+#include "webrtc/base/stringutils.h"
#define MAYBE_SKIP_TEST(feature) \
if (!(feature())) { \
@@ -68,14 +68,14 @@
const std::string& newlines,
std::string* message) {
const std::string tmp = line + newlines;
- talk_base::replace_substrs(line.c_str(), line.length(),
+ rtc::replace_substrs(line.c_str(), line.length(),
tmp.c_str(), tmp.length(), message);
}
void Replace(const std::string& line,
const std::string& newlines,
std::string* message) {
- talk_base::replace_substrs(line.c_str(), line.length(),
+ rtc::replace_substrs(line.c_str(), line.length(),
newlines.c_str(), newlines.length(), message);
}
@@ -126,15 +126,15 @@
: public sigslot::has_slots<>,
public testing::Test {
public:
- typedef std::vector<talk_base::scoped_refptr<DataChannelInterface> >
+ typedef std::vector<rtc::scoped_refptr<DataChannelInterface> >
DataChannelList;
PeerConnectionEndToEndTest()
- : caller_(new talk_base::RefCountedObject<PeerConnectionTestWrapper>(
+ : caller_(new rtc::RefCountedObject<PeerConnectionTestWrapper>(
"caller")),
- callee_(new talk_base::RefCountedObject<PeerConnectionTestWrapper>(
+ callee_(new rtc::RefCountedObject<PeerConnectionTestWrapper>(
"callee")) {
- talk_base::InitializeSSL(NULL);
+ rtc::InitializeSSL(NULL);
}
void CreatePcs() {
@@ -222,10 +222,10 @@
// Tests that |dc1| and |dc2| can send to and receive from each other.
void TestDataChannelSendAndReceive(
DataChannelInterface* dc1, DataChannelInterface* dc2) {
- talk_base::scoped_ptr<webrtc::MockDataChannelObserver> dc1_observer(
+ rtc::scoped_ptr<webrtc::MockDataChannelObserver> dc1_observer(
new webrtc::MockDataChannelObserver(dc1));
- talk_base::scoped_ptr<webrtc::MockDataChannelObserver> dc2_observer(
+ rtc::scoped_ptr<webrtc::MockDataChannelObserver> dc2_observer(
new webrtc::MockDataChannelObserver(dc2));
static const std::string kDummyData = "abcdefg";
@@ -263,12 +263,12 @@
}
~PeerConnectionEndToEndTest() {
- talk_base::CleanupSSL();
+ rtc::CleanupSSL();
}
protected:
- talk_base::scoped_refptr<PeerConnectionTestWrapper> caller_;
- talk_base::scoped_refptr<PeerConnectionTestWrapper> callee_;
+ rtc::scoped_refptr<PeerConnectionTestWrapper> caller_;
+ rtc::scoped_refptr<PeerConnectionTestWrapper> callee_;
DataChannelList caller_signaled_data_channels_;
DataChannelList callee_signaled_data_channels_;
};
@@ -300,14 +300,14 @@
// Verifies that a DataChannel created before the negotiation can transition to
// "OPEN" and transfer data.
TEST_F(PeerConnectionEndToEndTest, CreateDataChannelBeforeNegotiate) {
- MAYBE_SKIP_TEST(talk_base::SSLStreamAdapter::HaveDtlsSrtp);
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
CreatePcs();
webrtc::DataChannelInit init;
- talk_base::scoped_refptr<DataChannelInterface> caller_dc(
+ rtc::scoped_refptr<DataChannelInterface> caller_dc(
caller_->CreateDataChannel("data", init));
- talk_base::scoped_refptr<DataChannelInterface> callee_dc(
+ rtc::scoped_refptr<DataChannelInterface> callee_dc(
callee_->CreateDataChannel("data", init));
Negotiate();
@@ -326,22 +326,22 @@
// Verifies that a DataChannel created after the negotiation can transition to
// "OPEN" and transfer data.
TEST_F(PeerConnectionEndToEndTest, CreateDataChannelAfterNegotiate) {
- MAYBE_SKIP_TEST(talk_base::SSLStreamAdapter::HaveDtlsSrtp);
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
CreatePcs();
webrtc::DataChannelInit init;
// This DataChannel is for creating the data content in the negotiation.
- talk_base::scoped_refptr<DataChannelInterface> dummy(
+ rtc::scoped_refptr<DataChannelInterface> dummy(
caller_->CreateDataChannel("data", init));
Negotiate();
WaitForConnection();
// Creates new DataChannels after the negotiation and verifies their states.
- talk_base::scoped_refptr<DataChannelInterface> caller_dc(
+ rtc::scoped_refptr<DataChannelInterface> caller_dc(
caller_->CreateDataChannel("hello", init));
- talk_base::scoped_refptr<DataChannelInterface> callee_dc(
+ rtc::scoped_refptr<DataChannelInterface> callee_dc(
callee_->CreateDataChannel("hello", init));
WaitForDataChannelsToOpen(caller_dc, callee_signaled_data_channels_, 1);
@@ -356,14 +356,14 @@
// Verifies that DataChannel IDs are even/odd based on the DTLS roles.
TEST_F(PeerConnectionEndToEndTest, DataChannelIdAssignment) {
- MAYBE_SKIP_TEST(talk_base::SSLStreamAdapter::HaveDtlsSrtp);
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
CreatePcs();
webrtc::DataChannelInit init;
- talk_base::scoped_refptr<DataChannelInterface> caller_dc_1(
+ rtc::scoped_refptr<DataChannelInterface> caller_dc_1(
caller_->CreateDataChannel("data", init));
- talk_base::scoped_refptr<DataChannelInterface> callee_dc_1(
+ rtc::scoped_refptr<DataChannelInterface> callee_dc_1(
callee_->CreateDataChannel("data", init));
Negotiate();
@@ -372,9 +372,9 @@
EXPECT_EQ(1U, caller_dc_1->id() % 2);
EXPECT_EQ(0U, callee_dc_1->id() % 2);
- talk_base::scoped_refptr<DataChannelInterface> caller_dc_2(
+ rtc::scoped_refptr<DataChannelInterface> caller_dc_2(
caller_->CreateDataChannel("data", init));
- talk_base::scoped_refptr<DataChannelInterface> callee_dc_2(
+ rtc::scoped_refptr<DataChannelInterface> callee_dc_2(
callee_->CreateDataChannel("data", init));
EXPECT_EQ(1U, caller_dc_2->id() % 2);
@@ -385,15 +385,15 @@
// there are multiple DataChannels.
TEST_F(PeerConnectionEndToEndTest,
MessageTransferBetweenTwoPairsOfDataChannels) {
- MAYBE_SKIP_TEST(talk_base::SSLStreamAdapter::HaveDtlsSrtp);
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
CreatePcs();
webrtc::DataChannelInit init;
- talk_base::scoped_refptr<DataChannelInterface> caller_dc_1(
+ rtc::scoped_refptr<DataChannelInterface> caller_dc_1(
caller_->CreateDataChannel("data", init));
- talk_base::scoped_refptr<DataChannelInterface> caller_dc_2(
+ rtc::scoped_refptr<DataChannelInterface> caller_dc_2(
caller_->CreateDataChannel("data", init));
Negotiate();
@@ -401,10 +401,10 @@
WaitForDataChannelsToOpen(caller_dc_1, callee_signaled_data_channels_, 0);
WaitForDataChannelsToOpen(caller_dc_2, callee_signaled_data_channels_, 1);
- talk_base::scoped_ptr<webrtc::MockDataChannelObserver> dc_1_observer(
+ rtc::scoped_ptr<webrtc::MockDataChannelObserver> dc_1_observer(
new webrtc::MockDataChannelObserver(callee_signaled_data_channels_[0]));
- talk_base::scoped_ptr<webrtc::MockDataChannelObserver> dc_2_observer(
+ rtc::scoped_ptr<webrtc::MockDataChannelObserver> dc_2_observer(
new webrtc::MockDataChannelObserver(callee_signaled_data_channels_[1]));
const std::string message_1 = "hello 1";
diff --git a/app/webrtc/peerconnectionfactory.cc b/app/webrtc/peerconnectionfactory.cc
index 3628c59..81d864c 100644
--- a/app/webrtc/peerconnectionfactory.cc
+++ b/app/webrtc/peerconnectionfactory.cc
@@ -43,13 +43,13 @@
#include "talk/media/webrtc/webrtcvideoencoderfactory.h"
#include "webrtc/modules/audio_device/include/audio_device.h"
-using talk_base::scoped_refptr;
+using rtc::scoped_refptr;
namespace {
-typedef talk_base::TypedMessageData<bool> InitMessageData;
+typedef rtc::TypedMessageData<bool> InitMessageData;
-struct CreatePeerConnectionParams : public talk_base::MessageData {
+struct CreatePeerConnectionParams : public rtc::MessageData {
CreatePeerConnectionParams(
const webrtc::PeerConnectionInterface::RTCConfiguration& configuration,
const webrtc::MediaConstraintsInterface* constraints,
@@ -70,7 +70,7 @@
webrtc::PeerConnectionObserver* observer;
};
-struct CreateAudioSourceParams : public talk_base::MessageData {
+struct CreateAudioSourceParams : public rtc::MessageData {
explicit CreateAudioSourceParams(
const webrtc::MediaConstraintsInterface* constraints)
: constraints(constraints) {
@@ -79,7 +79,7 @@
scoped_refptr<webrtc::AudioSourceInterface> source;
};
-struct CreateVideoSourceParams : public talk_base::MessageData {
+struct CreateVideoSourceParams : public rtc::MessageData {
CreateVideoSourceParams(cricket::VideoCapturer* capturer,
const webrtc::MediaConstraintsInterface* constraints)
: capturer(capturer),
@@ -90,11 +90,11 @@
scoped_refptr<webrtc::VideoSourceInterface> source;
};
-struct StartAecDumpParams : public talk_base::MessageData {
- explicit StartAecDumpParams(talk_base::PlatformFile aec_dump_file)
+struct StartAecDumpParams : public rtc::MessageData {
+ explicit StartAecDumpParams(rtc::PlatformFile aec_dump_file)
: aec_dump_file(aec_dump_file) {
}
- talk_base::PlatformFile aec_dump_file;
+ rtc::PlatformFile aec_dump_file;
bool result;
};
@@ -111,10 +111,10 @@
namespace webrtc {
-talk_base::scoped_refptr<PeerConnectionFactoryInterface>
+rtc::scoped_refptr<PeerConnectionFactoryInterface>
CreatePeerConnectionFactory() {
- talk_base::scoped_refptr<PeerConnectionFactory> pc_factory(
- new talk_base::RefCountedObject<PeerConnectionFactory>());
+ rtc::scoped_refptr<PeerConnectionFactory> pc_factory(
+ new rtc::RefCountedObject<PeerConnectionFactory>());
if (!pc_factory->Initialize()) {
return NULL;
@@ -122,15 +122,15 @@
return pc_factory;
}
-talk_base::scoped_refptr<PeerConnectionFactoryInterface>
+rtc::scoped_refptr<PeerConnectionFactoryInterface>
CreatePeerConnectionFactory(
- talk_base::Thread* worker_thread,
- talk_base::Thread* signaling_thread,
+ rtc::Thread* worker_thread,
+ rtc::Thread* signaling_thread,
AudioDeviceModule* default_adm,
cricket::WebRtcVideoEncoderFactory* encoder_factory,
cricket::WebRtcVideoDecoderFactory* decoder_factory) {
- talk_base::scoped_refptr<PeerConnectionFactory> pc_factory(
- new talk_base::RefCountedObject<PeerConnectionFactory>(worker_thread,
+ rtc::scoped_refptr<PeerConnectionFactory> pc_factory(
+ new rtc::RefCountedObject<PeerConnectionFactory>(worker_thread,
signaling_thread,
default_adm,
encoder_factory,
@@ -143,8 +143,8 @@
PeerConnectionFactory::PeerConnectionFactory()
: owns_ptrs_(true),
- signaling_thread_(new talk_base::Thread),
- worker_thread_(new talk_base::Thread) {
+ signaling_thread_(new rtc::Thread),
+ worker_thread_(new rtc::Thread) {
bool result = signaling_thread_->Start();
ASSERT(result);
result = worker_thread_->Start();
@@ -152,8 +152,8 @@
}
PeerConnectionFactory::PeerConnectionFactory(
- talk_base::Thread* worker_thread,
- talk_base::Thread* signaling_thread,
+ rtc::Thread* worker_thread,
+ rtc::Thread* signaling_thread,
AudioDeviceModule* default_adm,
cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
cricket::WebRtcVideoDecoderFactory* video_decoder_factory)
@@ -185,7 +185,7 @@
return result.data();
}
-void PeerConnectionFactory::OnMessage(talk_base::Message* msg) {
+void PeerConnectionFactory::OnMessage(rtc::Message* msg) {
switch (msg->message_id) {
case MSG_INIT_FACTORY: {
InitMessageData* pdata = static_cast<InitMessageData*>(msg->pdata);
@@ -229,7 +229,7 @@
}
bool PeerConnectionFactory::Initialize_s() {
- talk_base::InitRandom(talk_base::Time());
+ rtc::InitRandom(rtc::Time());
allocator_factory_ = PortAllocatorFactory::Create(worker_thread_);
if (!allocator_factory_)
@@ -260,28 +260,28 @@
allocator_factory_ = NULL;
}
-talk_base::scoped_refptr<AudioSourceInterface>
+rtc::scoped_refptr<AudioSourceInterface>
PeerConnectionFactory::CreateAudioSource_s(
const MediaConstraintsInterface* constraints) {
- talk_base::scoped_refptr<LocalAudioSource> source(
+ rtc::scoped_refptr<LocalAudioSource> source(
LocalAudioSource::Create(options_, constraints));
return source;
}
-talk_base::scoped_refptr<VideoSourceInterface>
+rtc::scoped_refptr<VideoSourceInterface>
PeerConnectionFactory::CreateVideoSource_s(
cricket::VideoCapturer* capturer,
const MediaConstraintsInterface* constraints) {
- talk_base::scoped_refptr<VideoSource> source(
+ rtc::scoped_refptr<VideoSource> source(
VideoSource::Create(channel_manager_.get(), capturer, constraints));
return VideoSourceProxy::Create(signaling_thread_, source);
}
-bool PeerConnectionFactory::StartAecDump_s(talk_base::PlatformFile file) {
+bool PeerConnectionFactory::StartAecDump_s(rtc::PlatformFile file) {
return channel_manager_->StartAecDump(file);
}
-talk_base::scoped_refptr<PeerConnectionInterface>
+rtc::scoped_refptr<PeerConnectionInterface>
PeerConnectionFactory::CreatePeerConnection(
const PeerConnectionInterface::RTCConfiguration& configuration,
const MediaConstraintsInterface* constraints,
@@ -296,7 +296,7 @@
return params.peerconnection;
}
-talk_base::scoped_refptr<PeerConnectionInterface>
+rtc::scoped_refptr<PeerConnectionInterface>
PeerConnectionFactory::CreatePeerConnection_s(
const PeerConnectionInterface::RTCConfiguration& configuration,
const MediaConstraintsInterface* constraints,
@@ -304,8 +304,8 @@
DTLSIdentityServiceInterface* dtls_identity_service,
PeerConnectionObserver* observer) {
ASSERT(allocator_factory || allocator_factory_);
- talk_base::scoped_refptr<PeerConnection> pc(
- new talk_base::RefCountedObject<PeerConnection>(this));
+ rtc::scoped_refptr<PeerConnection> pc(
+ new rtc::RefCountedObject<PeerConnection>(this));
if (!pc->Initialize(
configuration,
constraints,
@@ -317,13 +317,13 @@
return PeerConnectionProxy::Create(signaling_thread(), pc);
}
-talk_base::scoped_refptr<MediaStreamInterface>
+rtc::scoped_refptr<MediaStreamInterface>
PeerConnectionFactory::CreateLocalMediaStream(const std::string& label) {
return MediaStreamProxy::Create(signaling_thread_,
MediaStream::Create(label));
}
-talk_base::scoped_refptr<AudioSourceInterface>
+rtc::scoped_refptr<AudioSourceInterface>
PeerConnectionFactory::CreateAudioSource(
const MediaConstraintsInterface* constraints) {
CreateAudioSourceParams params(constraints);
@@ -331,7 +331,7 @@
return params.source;
}
-talk_base::scoped_refptr<VideoSourceInterface>
+rtc::scoped_refptr<VideoSourceInterface>
PeerConnectionFactory::CreateVideoSource(
cricket::VideoCapturer* capturer,
const MediaConstraintsInterface* constraints) {
@@ -342,24 +342,24 @@
return params.source;
}
-talk_base::scoped_refptr<VideoTrackInterface>
+rtc::scoped_refptr<VideoTrackInterface>
PeerConnectionFactory::CreateVideoTrack(
const std::string& id,
VideoSourceInterface* source) {
- talk_base::scoped_refptr<VideoTrackInterface> track(
+ rtc::scoped_refptr<VideoTrackInterface> track(
VideoTrack::Create(id, source));
return VideoTrackProxy::Create(signaling_thread_, track);
}
-talk_base::scoped_refptr<AudioTrackInterface>
+rtc::scoped_refptr<AudioTrackInterface>
PeerConnectionFactory::CreateAudioTrack(const std::string& id,
AudioSourceInterface* source) {
- talk_base::scoped_refptr<AudioTrackInterface> track(
+ rtc::scoped_refptr<AudioTrackInterface> track(
AudioTrack::Create(id, source));
return AudioTrackProxy::Create(signaling_thread_, track);
}
-bool PeerConnectionFactory::StartAecDump(talk_base::PlatformFile file) {
+bool PeerConnectionFactory::StartAecDump(rtc::PlatformFile file) {
StartAecDumpParams params(file);
signaling_thread_->Send(this, MSG_START_AEC_DUMP, ¶ms);
return params.result;
@@ -369,11 +369,11 @@
return channel_manager_.get();
}
-talk_base::Thread* PeerConnectionFactory::signaling_thread() {
+rtc::Thread* PeerConnectionFactory::signaling_thread() {
return signaling_thread_;
}
-talk_base::Thread* PeerConnectionFactory::worker_thread() {
+rtc::Thread* PeerConnectionFactory::worker_thread() {
return worker_thread_;
}
diff --git a/app/webrtc/peerconnectionfactory.h b/app/webrtc/peerconnectionfactory.h
index 633d281..2cadaaa 100644
--- a/app/webrtc/peerconnectionfactory.h
+++ b/app/webrtc/peerconnectionfactory.h
@@ -31,20 +31,20 @@
#include "talk/app/webrtc/mediastreaminterface.h"
#include "talk/app/webrtc/peerconnectioninterface.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/thread.h"
#include "talk/session/media/channelmanager.h"
namespace webrtc {
class PeerConnectionFactory : public PeerConnectionFactoryInterface,
- public talk_base::MessageHandler {
+ public rtc::MessageHandler {
public:
virtual void SetOptions(const Options& options) {
options_ = options;
}
- virtual talk_base::scoped_refptr<PeerConnectionInterface>
+ virtual rtc::scoped_refptr<PeerConnectionInterface>
CreatePeerConnection(
const PeerConnectionInterface::RTCConfiguration& configuration,
const MediaConstraintsInterface* constraints,
@@ -54,36 +54,36 @@
bool Initialize();
- virtual talk_base::scoped_refptr<MediaStreamInterface>
+ virtual rtc::scoped_refptr<MediaStreamInterface>
CreateLocalMediaStream(const std::string& label);
- virtual talk_base::scoped_refptr<AudioSourceInterface> CreateAudioSource(
+ virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource(
const MediaConstraintsInterface* constraints);
- virtual talk_base::scoped_refptr<VideoSourceInterface> CreateVideoSource(
+ virtual rtc::scoped_refptr<VideoSourceInterface> CreateVideoSource(
cricket::VideoCapturer* capturer,
const MediaConstraintsInterface* constraints);
- virtual talk_base::scoped_refptr<VideoTrackInterface>
+ virtual rtc::scoped_refptr<VideoTrackInterface>
CreateVideoTrack(const std::string& id,
VideoSourceInterface* video_source);
- virtual talk_base::scoped_refptr<AudioTrackInterface>
+ virtual rtc::scoped_refptr<AudioTrackInterface>
CreateAudioTrack(const std::string& id,
AudioSourceInterface* audio_source);
- virtual bool StartAecDump(talk_base::PlatformFile file);
+ virtual bool StartAecDump(rtc::PlatformFile file);
virtual cricket::ChannelManager* channel_manager();
- virtual talk_base::Thread* signaling_thread();
- virtual talk_base::Thread* worker_thread();
+ virtual rtc::Thread* signaling_thread();
+ virtual rtc::Thread* worker_thread();
const Options& options() const { return options_; }
protected:
PeerConnectionFactory();
PeerConnectionFactory(
- talk_base::Thread* worker_thread,
- talk_base::Thread* signaling_thread,
+ rtc::Thread* worker_thread,
+ rtc::Thread* signaling_thread,
AudioDeviceModule* default_adm,
cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
cricket::WebRtcVideoDecoderFactory* video_decoder_factory);
@@ -92,39 +92,39 @@
private:
bool Initialize_s();
void Terminate_s();
- talk_base::scoped_refptr<AudioSourceInterface> CreateAudioSource_s(
+ rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource_s(
const MediaConstraintsInterface* constraints);
- talk_base::scoped_refptr<VideoSourceInterface> CreateVideoSource_s(
+ rtc::scoped_refptr<VideoSourceInterface> CreateVideoSource_s(
cricket::VideoCapturer* capturer,
const MediaConstraintsInterface* constraints);
- talk_base::scoped_refptr<PeerConnectionInterface> CreatePeerConnection_s(
+ rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection_s(
const PeerConnectionInterface::RTCConfiguration& configuration,
const MediaConstraintsInterface* constraints,
PortAllocatorFactoryInterface* allocator_factory,
DTLSIdentityServiceInterface* dtls_identity_service,
PeerConnectionObserver* observer);
- bool StartAecDump_s(talk_base::PlatformFile file);
+ bool StartAecDump_s(rtc::PlatformFile file);
- // Implements talk_base::MessageHandler.
- void OnMessage(talk_base::Message* msg);
+ // Implements rtc::MessageHandler.
+ void OnMessage(rtc::Message* msg);
bool owns_ptrs_;
- talk_base::Thread* signaling_thread_;
- talk_base::Thread* worker_thread_;
+ rtc::Thread* signaling_thread_;
+ rtc::Thread* worker_thread_;
Options options_;
- talk_base::scoped_refptr<PortAllocatorFactoryInterface> allocator_factory_;
+ rtc::scoped_refptr<PortAllocatorFactoryInterface> allocator_factory_;
// External Audio device used for audio playback.
- talk_base::scoped_refptr<AudioDeviceModule> default_adm_;
- talk_base::scoped_ptr<cricket::ChannelManager> channel_manager_;
+ rtc::scoped_refptr<AudioDeviceModule> default_adm_;
+ rtc::scoped_ptr<cricket::ChannelManager> channel_manager_;
// External Video encoder factory. This can be NULL if the client has not
// injected any. In that case, video engine will use the internal SW encoder.
- talk_base::scoped_ptr<cricket::WebRtcVideoEncoderFactory>
+ rtc::scoped_ptr<cricket::WebRtcVideoEncoderFactory>
video_encoder_factory_;
// External Video decoder factory. This can be NULL if the client has not
// injected any. In that case, video engine will use the internal SW decoder.
- talk_base::scoped_ptr<cricket::WebRtcVideoDecoderFactory>
+ rtc::scoped_ptr<cricket::WebRtcVideoDecoderFactory>
video_decoder_factory_;
};
diff --git a/app/webrtc/peerconnectionfactory_unittest.cc b/app/webrtc/peerconnectionfactory_unittest.cc
index 01f35d9..a18069e 100644
--- a/app/webrtc/peerconnectionfactory_unittest.cc
+++ b/app/webrtc/peerconnectionfactory_unittest.cc
@@ -32,9 +32,9 @@
#include "talk/app/webrtc/peerconnectionfactory.h"
#include "talk/app/webrtc/videosourceinterface.h"
#include "talk/app/webrtc/test/fakevideotrackrenderer.h"
-#include "talk/base/gunit.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/thread.h"
#include "talk/media/base/fakevideocapturer.h"
#include "talk/media/webrtc/webrtccommon.h"
#include "talk/media/webrtc/webrtcvoe.h"
@@ -102,8 +102,8 @@
class PeerConnectionFactoryTest : public testing::Test {
void SetUp() {
- factory_ = webrtc::CreatePeerConnectionFactory(talk_base::Thread::Current(),
- talk_base::Thread::Current(),
+ factory_ = webrtc::CreatePeerConnectionFactory(rtc::Thread::Current(),
+ rtc::Thread::Current(),
NULL,
NULL,
NULL);
@@ -141,21 +141,21 @@
}
}
- talk_base::scoped_refptr<PeerConnectionFactoryInterface> factory_;
+ rtc::scoped_refptr<PeerConnectionFactoryInterface> factory_;
NullPeerConnectionObserver observer_;
- talk_base::scoped_refptr<PortAllocatorFactoryInterface> allocator_factory_;
+ rtc::scoped_refptr<PortAllocatorFactoryInterface> allocator_factory_;
};
// Verify creation of PeerConnection using internal ADM, video factory and
// internal libjingle threads.
TEST(PeerConnectionFactoryTestInternal, CreatePCUsingInternalModules) {
- talk_base::scoped_refptr<PeerConnectionFactoryInterface> factory(
+ rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
webrtc::CreatePeerConnectionFactory());
NullPeerConnectionObserver observer;
webrtc::PeerConnectionInterface::IceServers servers;
- talk_base::scoped_refptr<PeerConnectionInterface> pc(
+ rtc::scoped_refptr<PeerConnectionInterface> pc(
factory->CreatePeerConnection(servers, NULL, NULL, NULL, &observer));
EXPECT_TRUE(pc.get() != NULL);
@@ -174,7 +174,7 @@
ice_server.uri = kTurnIceServerWithTransport;
ice_server.password = kTurnPassword;
config.servers.push_back(ice_server);
- talk_base::scoped_refptr<PeerConnectionInterface> pc(
+ rtc::scoped_refptr<PeerConnectionInterface> pc(
factory_->CreatePeerConnection(config, NULL,
allocator_factory_.get(),
NULL,
@@ -210,7 +210,7 @@
ice_server.uri = kTurnIceServerWithTransport;
ice_server.password = kTurnPassword;
ice_servers.push_back(ice_server);
- talk_base::scoped_refptr<PeerConnectionInterface> pc(
+ rtc::scoped_refptr<PeerConnectionInterface> pc(
factory_->CreatePeerConnection(ice_servers, NULL,
allocator_factory_.get(),
NULL,
@@ -240,7 +240,7 @@
ice_server.username = kTurnUsername;
ice_server.password = kTurnPassword;
config.servers.push_back(ice_server);
- talk_base::scoped_refptr<PeerConnectionInterface> pc(
+ rtc::scoped_refptr<PeerConnectionInterface> pc(
factory_->CreatePeerConnection(config, NULL,
allocator_factory_.get(),
NULL,
@@ -261,7 +261,7 @@
ice_server.uri = kTurnIceServerWithTransport;
ice_server.password = kTurnPassword;
config.servers.push_back(ice_server);
- talk_base::scoped_refptr<PeerConnectionInterface> pc(
+ rtc::scoped_refptr<PeerConnectionInterface> pc(
factory_->CreatePeerConnection(config, NULL,
allocator_factory_.get(),
NULL,
@@ -286,7 +286,7 @@
ice_server.uri = kSecureTurnIceServerWithoutTransportAndPortParam;
ice_server.password = kTurnPassword;
config.servers.push_back(ice_server);
- talk_base::scoped_refptr<PeerConnectionInterface> pc(
+ rtc::scoped_refptr<PeerConnectionInterface> pc(
factory_->CreatePeerConnection(config, NULL,
allocator_factory_.get(),
NULL,
@@ -323,7 +323,7 @@
ice_server.uri = kTurnIceServerWithIPv6Address;
ice_server.password = kTurnPassword;
config.servers.push_back(ice_server);
- talk_base::scoped_refptr<PeerConnectionInterface> pc(
+ rtc::scoped_refptr<PeerConnectionInterface> pc(
factory_->CreatePeerConnection(config, NULL,
allocator_factory_.get(),
NULL,
@@ -356,10 +356,10 @@
TEST_F(PeerConnectionFactoryTest, LocalRendering) {
cricket::FakeVideoCapturer* capturer = new cricket::FakeVideoCapturer();
// The source take ownership of |capturer|.
- talk_base::scoped_refptr<VideoSourceInterface> source(
+ rtc::scoped_refptr<VideoSourceInterface> source(
factory_->CreateVideoSource(capturer, NULL));
ASSERT_TRUE(source.get() != NULL);
- talk_base::scoped_refptr<VideoTrackInterface> track(
+ rtc::scoped_refptr<VideoTrackInterface> track(
factory_->CreateVideoTrack("testlabel", source));
ASSERT_TRUE(track.get() != NULL);
FakeVideoTrackRenderer local_renderer(track);
diff --git a/app/webrtc/peerconnectioninterface.h b/app/webrtc/peerconnectioninterface.h
index ed4033c..59785e8 100644
--- a/app/webrtc/peerconnectioninterface.h
+++ b/app/webrtc/peerconnectioninterface.h
@@ -77,10 +77,10 @@
#include "talk/app/webrtc/mediastreaminterface.h"
#include "talk/app/webrtc/statstypes.h"
#include "talk/app/webrtc/umametrics.h"
-#include "talk/base/fileutils.h"
-#include "talk/base/socketaddress.h"
+#include "webrtc/base/fileutils.h"
+#include "webrtc/base/socketaddress.h"
-namespace talk_base {
+namespace rtc {
class Thread;
}
@@ -95,7 +95,7 @@
class MediaConstraintsInterface;
// MediaStream container interface.
-class StreamCollectionInterface : public talk_base::RefCountInterface {
+class StreamCollectionInterface : public rtc::RefCountInterface {
public:
// TODO(ronghuawu): Update the function names to c++ style, e.g. find -> Find.
virtual size_t count() = 0;
@@ -111,7 +111,7 @@
~StreamCollectionInterface() {}
};
-class StatsObserver : public talk_base::RefCountInterface {
+class StatsObserver : public rtc::RefCountInterface {
public:
virtual void OnComplete(const std::vector<StatsReport>& reports) = 0;
@@ -119,7 +119,7 @@
virtual ~StatsObserver() {}
};
-class UMAObserver : public talk_base::RefCountInterface {
+class UMAObserver : public rtc::RefCountInterface {
public:
virtual void IncrementCounter(PeerConnectionUMAMetricsCounter type) = 0;
virtual void AddHistogramSample(PeerConnectionUMAMetricsName type,
@@ -129,7 +129,7 @@
virtual ~UMAObserver() {}
};
-class PeerConnectionInterface : public talk_base::RefCountInterface {
+class PeerConnectionInterface : public rtc::RefCountInterface {
public:
// See http://dev.w3.org/2011/webrtc/editor/webrtc.html#state-definitions .
enum SignalingState {
@@ -192,6 +192,38 @@
explicit RTCConfiguration(IceTransportsType type) : type(type) {}
};
+ struct RTCOfferAnswerOptions {
+ static const int kUndefined = -1;
+ static const int kMaxOfferToReceiveMedia = 1;
+
+ // The default value for constraint offerToReceiveX:true.
+ static const int kOfferToReceiveMediaTrue = 1;
+
+ int offer_to_receive_video;
+ int offer_to_receive_audio;
+ bool voice_activity_detection;
+ bool ice_restart;
+ bool use_rtp_mux;
+
+ RTCOfferAnswerOptions()
+ : offer_to_receive_video(kUndefined),
+ offer_to_receive_audio(kUndefined),
+ voice_activity_detection(true),
+ ice_restart(false),
+ use_rtp_mux(true) {}
+
+ RTCOfferAnswerOptions(int offer_to_receive_video,
+ int offer_to_receive_audio,
+ bool voice_activity_detection,
+ bool ice_restart,
+ bool use_rtp_mux)
+ : offer_to_receive_video(offer_to_receive_video),
+ offer_to_receive_audio(offer_to_receive_audio),
+ voice_activity_detection(voice_activity_detection),
+ ice_restart(ice_restart),
+ use_rtp_mux(use_rtp_mux) {}
+ };
+
// Used by GetStats to decide which stats to include in the stats reports.
// |kStatsOutputLevelStandard| includes the standard stats for Javascript API;
// |kStatsOutputLevelDebug| includes both the standard stats and additional
@@ -202,11 +234,11 @@
};
// Accessor methods to active local streams.
- virtual talk_base::scoped_refptr<StreamCollectionInterface>
+ virtual rtc::scoped_refptr<StreamCollectionInterface>
local_streams() = 0;
// Accessor methods to remote streams.
- virtual talk_base::scoped_refptr<StreamCollectionInterface>
+ virtual rtc::scoped_refptr<StreamCollectionInterface>
remote_streams() = 0;
// Add a new MediaStream to be sent on this PeerConnection.
@@ -222,14 +254,14 @@
// Returns pointer to the created DtmfSender on success.
// Otherwise returns NULL.
- virtual talk_base::scoped_refptr<DtmfSenderInterface> CreateDtmfSender(
+ virtual rtc::scoped_refptr<DtmfSenderInterface> CreateDtmfSender(
AudioTrackInterface* track) = 0;
virtual bool GetStats(StatsObserver* observer,
MediaStreamTrackInterface* track,
StatsOutputLevel level) = 0;
- virtual talk_base::scoped_refptr<DataChannelInterface> CreateDataChannel(
+ virtual rtc::scoped_refptr<DataChannelInterface> CreateDataChannel(
const std::string& label,
const DataChannelInit* config) = 0;
@@ -239,7 +271,13 @@
// Create a new offer.
// The CreateSessionDescriptionObserver callback will be called when done.
virtual void CreateOffer(CreateSessionDescriptionObserver* observer,
- const MediaConstraintsInterface* constraints) = 0;
+ const MediaConstraintsInterface* constraints) {}
+
+ // TODO(jiayl): remove the default impl and the old interface when chromium
+ // code is updated.
+ virtual void CreateOffer(CreateSessionDescriptionObserver* observer,
+ const RTCOfferAnswerOptions& options) {}
+
// Create an answer to an offer.
// The CreateSessionDescriptionObserver callback will be called when done.
virtual void CreateAnswer(CreateSessionDescriptionObserver* observer,
@@ -340,13 +378,13 @@
// Factory class used for creating cricket::PortAllocator that is used
// for ICE negotiation.
-class PortAllocatorFactoryInterface : public talk_base::RefCountInterface {
+class PortAllocatorFactoryInterface : public rtc::RefCountInterface {
public:
struct StunConfiguration {
StunConfiguration(const std::string& address, int port)
: server(address, port) {}
// STUN server address and port.
- talk_base::SocketAddress server;
+ rtc::SocketAddress server;
};
struct TurnConfiguration {
@@ -361,7 +399,7 @@
password(password),
transport_type(transport_type),
secure(secure) {}
- talk_base::SocketAddress server;
+ rtc::SocketAddress server;
std::string username;
std::string password;
std::string transport_type;
@@ -378,7 +416,7 @@
};
// Used to receive callbacks of DTLS identity requests.
-class DTLSIdentityRequestObserver : public talk_base::RefCountInterface {
+class DTLSIdentityRequestObserver : public rtc::RefCountInterface {
public:
virtual void OnFailure(int error) = 0;
virtual void OnSuccess(const std::string& der_cert,
@@ -427,7 +465,7 @@
// CreatePeerConnectionFactory method which accepts threads as input and use the
// CreatePeerConnection version that takes a PortAllocatorFactoryInterface as
// argument.
-class PeerConnectionFactoryInterface : public talk_base::RefCountInterface {
+class PeerConnectionFactoryInterface : public rtc::RefCountInterface {
public:
class Options {
public:
@@ -441,7 +479,7 @@
virtual void SetOptions(const Options& options) = 0;
- virtual talk_base::scoped_refptr<PeerConnectionInterface>
+ virtual rtc::scoped_refptr<PeerConnectionInterface>
CreatePeerConnection(
const PeerConnectionInterface::RTCConfiguration& configuration,
const MediaConstraintsInterface* constraints,
@@ -455,7 +493,7 @@
// and not IceServers. RTCConfiguration is made up of ice servers and
// ice transport type.
// http://dev.w3.org/2011/webrtc/editor/webrtc.html
- inline talk_base::scoped_refptr<PeerConnectionInterface>
+ inline rtc::scoped_refptr<PeerConnectionInterface>
CreatePeerConnection(
const PeerConnectionInterface::IceServers& configuration,
const MediaConstraintsInterface* constraints,
@@ -468,29 +506,29 @@
dtls_identity_service, observer);
}
- virtual talk_base::scoped_refptr<MediaStreamInterface>
+ virtual rtc::scoped_refptr<MediaStreamInterface>
CreateLocalMediaStream(const std::string& label) = 0;
// Creates a AudioSourceInterface.
// |constraints| decides audio processing settings but can be NULL.
- virtual talk_base::scoped_refptr<AudioSourceInterface> CreateAudioSource(
+ virtual rtc::scoped_refptr<AudioSourceInterface> CreateAudioSource(
const MediaConstraintsInterface* constraints) = 0;
// Creates a VideoSourceInterface. The new source take ownership of
// |capturer|. |constraints| decides video resolution and frame rate but can
// be NULL.
- virtual talk_base::scoped_refptr<VideoSourceInterface> CreateVideoSource(
+ virtual rtc::scoped_refptr<VideoSourceInterface> CreateVideoSource(
cricket::VideoCapturer* capturer,
const MediaConstraintsInterface* constraints) = 0;
// Creates a new local VideoTrack. The same |source| can be used in several
// tracks.
- virtual talk_base::scoped_refptr<VideoTrackInterface>
+ virtual rtc::scoped_refptr<VideoTrackInterface>
CreateVideoTrack(const std::string& label,
VideoSourceInterface* source) = 0;
// Creates an new AudioTrack. At the moment |source| can be NULL.
- virtual talk_base::scoped_refptr<AudioTrackInterface>
+ virtual rtc::scoped_refptr<AudioTrackInterface>
CreateAudioTrack(const std::string& label,
AudioSourceInterface* source) = 0;
@@ -499,7 +537,7 @@
// the ownerhip. If the operation fails, the file will be closed.
// TODO(grunell): Remove when Chromium has started to use AEC in each source.
// http://crbug.com/264611.
- virtual bool StartAecDump(talk_base::PlatformFile file) = 0;
+ virtual bool StartAecDump(rtc::PlatformFile file) = 0;
protected:
// Dtor and ctor protected as objects shouldn't be created or deleted via
@@ -509,16 +547,16 @@
};
// Create a new instance of PeerConnectionFactoryInterface.
-talk_base::scoped_refptr<PeerConnectionFactoryInterface>
+rtc::scoped_refptr<PeerConnectionFactoryInterface>
CreatePeerConnectionFactory();
// Create a new instance of PeerConnectionFactoryInterface.
// Ownership of |factory|, |default_adm|, and optionally |encoder_factory| and
// |decoder_factory| transferred to the returned factory.
-talk_base::scoped_refptr<PeerConnectionFactoryInterface>
+rtc::scoped_refptr<PeerConnectionFactoryInterface>
CreatePeerConnectionFactory(
- talk_base::Thread* worker_thread,
- talk_base::Thread* signaling_thread,
+ rtc::Thread* worker_thread,
+ rtc::Thread* signaling_thread,
AudioDeviceModule* default_adm,
cricket::WebRtcVideoEncoderFactory* encoder_factory,
cricket::WebRtcVideoDecoderFactory* decoder_factory);
diff --git a/app/webrtc/peerconnectioninterface_unittest.cc b/app/webrtc/peerconnectioninterface_unittest.cc
index 5c9b826..1eef82e 100644
--- a/app/webrtc/peerconnectioninterface_unittest.cc
+++ b/app/webrtc/peerconnectioninterface_unittest.cc
@@ -36,12 +36,12 @@
#include "talk/app/webrtc/test/mockpeerconnectionobservers.h"
#include "talk/app/webrtc/test/testsdpstrings.h"
#include "talk/app/webrtc/videosource.h"
-#include "talk/base/gunit.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/ssladapter.h"
-#include "talk/base/sslstreamadapter.h"
-#include "talk/base/stringutils.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/ssladapter.h"
+#include "webrtc/base/sslstreamadapter.h"
+#include "webrtc/base/stringutils.h"
+#include "webrtc/base/thread.h"
#include "talk/media/base/fakevideocapturer.h"
#include "talk/media/sctp/sctpdataengine.h"
#include "talk/session/media/mediasession.h"
@@ -66,8 +66,8 @@
return; \
}
-using talk_base::scoped_ptr;
-using talk_base::scoped_refptr;
+using rtc::scoped_ptr;
+using rtc::scoped_refptr;
using webrtc::AudioSourceInterface;
using webrtc::AudioTrackInterface;
using webrtc::DataBuffer;
@@ -229,15 +229,15 @@
class PeerConnectionInterfaceTest : public testing::Test {
protected:
virtual void SetUp() {
- talk_base::InitializeSSL(NULL);
+ rtc::InitializeSSL(NULL);
pc_factory_ = webrtc::CreatePeerConnectionFactory(
- talk_base::Thread::Current(), talk_base::Thread::Current(), NULL, NULL,
+ rtc::Thread::Current(), rtc::Thread::Current(), NULL, NULL,
NULL);
ASSERT_TRUE(pc_factory_.get() != NULL);
}
virtual void TearDown() {
- talk_base::CleanupSSL();
+ rtc::CleanupSSL();
}
void CreatePeerConnection() {
@@ -361,8 +361,8 @@
}
bool DoCreateOfferAnswer(SessionDescriptionInterface** desc, bool offer) {
- talk_base::scoped_refptr<MockCreateSessionDescriptionObserver>
- observer(new talk_base::RefCountedObject<
+ rtc::scoped_refptr<MockCreateSessionDescriptionObserver>
+ observer(new rtc::RefCountedObject<
MockCreateSessionDescriptionObserver>());
if (offer) {
pc_->CreateOffer(observer, NULL);
@@ -383,8 +383,8 @@
}
bool DoSetSessionDescription(SessionDescriptionInterface* desc, bool local) {
- talk_base::scoped_refptr<MockSetSessionDescriptionObserver>
- observer(new talk_base::RefCountedObject<
+ rtc::scoped_refptr<MockSetSessionDescriptionObserver>
+ observer(new rtc::RefCountedObject<
MockSetSessionDescriptionObserver>());
if (local) {
pc_->SetLocalDescription(observer, desc);
@@ -407,8 +407,8 @@
// It does not verify the values in the StatReports since a RTCP packet might
// be required.
bool DoGetStats(MediaStreamTrackInterface* track) {
- talk_base::scoped_refptr<MockStatsObserver> observer(
- new talk_base::RefCountedObject<MockStatsObserver>());
+ rtc::scoped_refptr<MockStatsObserver> observer(
+ new rtc::RefCountedObject<MockStatsObserver>());
if (!pc_->GetStats(
observer, track, PeerConnectionInterface::kStatsOutputLevelStandard))
return false;
@@ -438,7 +438,7 @@
}
void CreateOfferAsRemoteDescription() {
- talk_base::scoped_ptr<SessionDescriptionInterface> offer;
+ rtc::scoped_ptr<SessionDescriptionInterface> offer;
EXPECT_TRUE(DoCreateOffer(offer.use()));
std::string sdp;
EXPECT_TRUE(offer->ToString(&sdp));
@@ -490,7 +490,7 @@
}
void CreateOfferAsLocalDescription() {
- talk_base::scoped_ptr<SessionDescriptionInterface> offer;
+ rtc::scoped_ptr<SessionDescriptionInterface> offer;
ASSERT_TRUE(DoCreateOffer(offer.use()));
// TODO(perkj): Currently SetLocalDescription fails if any parameters in an
// audio codec change, even if the parameter has nothing to do with
@@ -772,7 +772,10 @@
}
// Test that we don't get statistics for an invalid track.
-TEST_F(PeerConnectionInterfaceTest, GetStatsForInvalidTrack) {
+// TODO(tommi): Fix this test. DoGetStats will return true
+// for the unknown track (since GetStats is async), but no
+// data is returned for the track.
+TEST_F(PeerConnectionInterfaceTest, DISABLED_GetStatsForInvalidTrack) {
InitiateCall();
scoped_refptr<AudioTrackInterface> unknown_audio_track(
pc_factory_->CreateAudioTrack("unknown track", NULL));
@@ -789,9 +792,9 @@
scoped_refptr<DataChannelInterface> data2 =
pc_->CreateDataChannel("test2", NULL);
ASSERT_TRUE(data1 != NULL);
- talk_base::scoped_ptr<MockDataChannelObserver> observer1(
+ rtc::scoped_ptr<MockDataChannelObserver> observer1(
new MockDataChannelObserver(data1));
- talk_base::scoped_ptr<MockDataChannelObserver> observer2(
+ rtc::scoped_ptr<MockDataChannelObserver> observer2(
new MockDataChannelObserver(data2));
EXPECT_EQ(DataChannelInterface::kConnecting, data1->state());
@@ -836,9 +839,9 @@
scoped_refptr<DataChannelInterface> data2 =
pc_->CreateDataChannel("test2", NULL);
ASSERT_TRUE(data1 != NULL);
- talk_base::scoped_ptr<MockDataChannelObserver> observer1(
+ rtc::scoped_ptr<MockDataChannelObserver> observer1(
new MockDataChannelObserver(data1));
- talk_base::scoped_ptr<MockDataChannelObserver> observer2(
+ rtc::scoped_ptr<MockDataChannelObserver> observer2(
new MockDataChannelObserver(data2));
EXPECT_EQ(DataChannelInterface::kConnecting, data1->state());
@@ -851,7 +854,7 @@
EXPECT_EQ(DataChannelInterface::kOpen, data1->state());
EXPECT_EQ(DataChannelInterface::kOpen, data2->state());
- talk_base::Buffer buffer("test", 4);
+ rtc::Buffer buffer("test", 4);
EXPECT_FALSE(data1->Send(DataBuffer(buffer, true)));
}
@@ -863,7 +866,7 @@
CreatePeerConnection(&constraints);
scoped_refptr<DataChannelInterface> data1 =
pc_->CreateDataChannel("test1", NULL);
- talk_base::scoped_ptr<MockDataChannelObserver> observer1(
+ rtc::scoped_ptr<MockDataChannelObserver> observer1(
new MockDataChannelObserver(data1));
CreateOfferReceiveAnswerWithoutSsrc();
@@ -894,7 +897,7 @@
std::string receive_label = "answer_channel";
std::string sdp;
EXPECT_TRUE(pc_->local_description()->ToString(&sdp));
- talk_base::replace_substrs(offer_label.c_str(), offer_label.length(),
+ rtc::replace_substrs(offer_label.c_str(), offer_label.length(),
receive_label.c_str(), receive_label.length(),
&sdp);
CreateAnswerAsRemoteDescription(sdp);
@@ -1045,9 +1048,9 @@
scoped_refptr<DataChannelInterface> data2 =
pc_->CreateDataChannel("test2", NULL);
ASSERT_TRUE(data1 != NULL);
- talk_base::scoped_ptr<MockDataChannelObserver> observer1(
+ rtc::scoped_ptr<MockDataChannelObserver> observer1(
new MockDataChannelObserver(data1));
- talk_base::scoped_ptr<MockDataChannelObserver> observer2(
+ rtc::scoped_ptr<MockDataChannelObserver> observer2(
new MockDataChannelObserver(data2));
CreateOfferReceiveAnswer();
@@ -1088,7 +1091,7 @@
// FireFox, use it as a remote session description, generate an answer and use
// the answer as a local description.
TEST_F(PeerConnectionInterfaceTest, ReceiveFireFoxOffer) {
- MAYBE_SKIP_TEST(talk_base::SSLStreamAdapter::HaveDtlsSrtp);
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
FakeConstraints constraints;
constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
true);
@@ -1185,7 +1188,7 @@
EXPECT_FALSE(pc_->AddStream(local_stream, NULL));
ASSERT_FALSE(local_stream->GetAudioTracks().empty());
- talk_base::scoped_refptr<webrtc::DtmfSenderInterface> dtmf_sender(
+ rtc::scoped_refptr<webrtc::DtmfSenderInterface> dtmf_sender(
pc_->CreateDtmfSender(local_stream->GetAudioTracks()[0]));
EXPECT_TRUE(NULL == dtmf_sender); // local stream has been removed.
@@ -1194,9 +1197,9 @@
EXPECT_TRUE(pc_->local_description() != NULL);
EXPECT_TRUE(pc_->remote_description() != NULL);
- talk_base::scoped_ptr<SessionDescriptionInterface> offer;
+ rtc::scoped_ptr<SessionDescriptionInterface> offer;
EXPECT_TRUE(DoCreateOffer(offer.use()));
- talk_base::scoped_ptr<SessionDescriptionInterface> answer;
+ rtc::scoped_ptr<SessionDescriptionInterface> answer;
EXPECT_TRUE(DoCreateAnswer(answer.use()));
std::string sdp;
diff --git a/app/webrtc/peerconnectionproxy.h b/app/webrtc/peerconnectionproxy.h
index 74e5012..ed26eb8 100644
--- a/app/webrtc/peerconnectionproxy.h
+++ b/app/webrtc/peerconnectionproxy.h
@@ -35,19 +35,19 @@
// Define proxy for PeerConnectionInterface.
BEGIN_PROXY_MAP(PeerConnection)
- PROXY_METHOD0(talk_base::scoped_refptr<StreamCollectionInterface>,
+ PROXY_METHOD0(rtc::scoped_refptr<StreamCollectionInterface>,
local_streams)
- PROXY_METHOD0(talk_base::scoped_refptr<StreamCollectionInterface>,
+ PROXY_METHOD0(rtc::scoped_refptr<StreamCollectionInterface>,
remote_streams)
PROXY_METHOD2(bool, AddStream, MediaStreamInterface*,
const MediaConstraintsInterface*)
PROXY_METHOD1(void, RemoveStream, MediaStreamInterface*)
- PROXY_METHOD1(talk_base::scoped_refptr<DtmfSenderInterface>,
+ PROXY_METHOD1(rtc::scoped_refptr<DtmfSenderInterface>,
CreateDtmfSender, AudioTrackInterface*)
PROXY_METHOD3(bool, GetStats, StatsObserver*,
MediaStreamTrackInterface*,
StatsOutputLevel)
- PROXY_METHOD2(talk_base::scoped_refptr<DataChannelInterface>,
+ PROXY_METHOD2(rtc::scoped_refptr<DataChannelInterface>,
CreateDataChannel, const std::string&, const DataChannelInit*)
PROXY_CONSTMETHOD0(const SessionDescriptionInterface*, local_description)
PROXY_CONSTMETHOD0(const SessionDescriptionInterface*, remote_description)
diff --git a/app/webrtc/portallocatorfactory.cc b/app/webrtc/portallocatorfactory.cc
index decd33c..9d040f9 100644
--- a/app/webrtc/portallocatorfactory.cc
+++ b/app/webrtc/portallocatorfactory.cc
@@ -27,27 +27,27 @@
#include "talk/app/webrtc/portallocatorfactory.h"
-#include "talk/base/logging.h"
-#include "talk/base/network.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/network.h"
+#include "webrtc/base/thread.h"
#include "talk/p2p/base/basicpacketsocketfactory.h"
#include "talk/p2p/client/basicportallocator.h"
namespace webrtc {
-using talk_base::scoped_ptr;
+using rtc::scoped_ptr;
-talk_base::scoped_refptr<PortAllocatorFactoryInterface>
+rtc::scoped_refptr<PortAllocatorFactoryInterface>
PortAllocatorFactory::Create(
- talk_base::Thread* worker_thread) {
- talk_base::RefCountedObject<PortAllocatorFactory>* allocator =
- new talk_base::RefCountedObject<PortAllocatorFactory>(worker_thread);
+ rtc::Thread* worker_thread) {
+ rtc::RefCountedObject<PortAllocatorFactory>* allocator =
+ new rtc::RefCountedObject<PortAllocatorFactory>(worker_thread);
return allocator;
}
-PortAllocatorFactory::PortAllocatorFactory(talk_base::Thread* worker_thread)
- : network_manager_(new talk_base::BasicNetworkManager()),
- socket_factory_(new talk_base::BasicPacketSocketFactory(worker_thread)) {
+PortAllocatorFactory::PortAllocatorFactory(rtc::Thread* worker_thread)
+ : network_manager_(new rtc::BasicNetworkManager()),
+ socket_factory_(new rtc::BasicPacketSocketFactory(worker_thread)) {
}
PortAllocatorFactory::~PortAllocatorFactory() {}
@@ -55,19 +55,15 @@
cricket::PortAllocator* PortAllocatorFactory::CreatePortAllocator(
const std::vector<StunConfiguration>& stun,
const std::vector<TurnConfiguration>& turn) {
- std::vector<talk_base::SocketAddress> stun_hosts;
+ cricket::ServerAddresses stun_hosts;
typedef std::vector<StunConfiguration>::const_iterator StunIt;
for (StunIt stun_it = stun.begin(); stun_it != stun.end(); ++stun_it) {
- stun_hosts.push_back(stun_it->server);
+ stun_hosts.insert(stun_it->server);
}
- talk_base::SocketAddress stun_addr;
- if (!stun_hosts.empty()) {
- stun_addr = stun_hosts.front();
- }
scoped_ptr<cricket::BasicPortAllocator> allocator(
new cricket::BasicPortAllocator(
- network_manager_.get(), socket_factory_.get(), stun_addr));
+ network_manager_.get(), socket_factory_.get(), stun_hosts));
for (size_t i = 0; i < turn.size(); ++i) {
cricket::RelayCredentials credentials(turn[i].username, turn[i].password);
@@ -77,6 +73,8 @@
relay_server.ports.push_back(cricket::ProtocolAddress(
turn[i].server, protocol, turn[i].secure));
relay_server.credentials = credentials;
+ // First in the list gets highest priority.
+ relay_server.priority = static_cast<int>(turn.size() - i - 1);
allocator->AddRelay(relay_server);
} else {
LOG(LS_WARNING) << "Ignoring TURN server " << turn[i].server << ". "
diff --git a/app/webrtc/portallocatorfactory.h b/app/webrtc/portallocatorfactory.h
index e30024c..c8890ae 100644
--- a/app/webrtc/portallocatorfactory.h
+++ b/app/webrtc/portallocatorfactory.h
@@ -34,13 +34,13 @@
#define TALK_APP_WEBRTC_PORTALLOCATORFACTORY_H_
#include "talk/app/webrtc/peerconnectioninterface.h"
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/scoped_ptr.h"
namespace cricket {
class PortAllocator;
}
-namespace talk_base {
+namespace rtc {
class BasicNetworkManager;
class BasicPacketSocketFactory;
}
@@ -49,20 +49,20 @@
class PortAllocatorFactory : public PortAllocatorFactoryInterface {
public:
- static talk_base::scoped_refptr<PortAllocatorFactoryInterface> Create(
- talk_base::Thread* worker_thread);
+ static rtc::scoped_refptr<PortAllocatorFactoryInterface> Create(
+ rtc::Thread* worker_thread);
virtual cricket::PortAllocator* CreatePortAllocator(
const std::vector<StunConfiguration>& stun,
const std::vector<TurnConfiguration>& turn);
protected:
- explicit PortAllocatorFactory(talk_base::Thread* worker_thread);
+ explicit PortAllocatorFactory(rtc::Thread* worker_thread);
~PortAllocatorFactory();
private:
- talk_base::scoped_ptr<talk_base::BasicNetworkManager> network_manager_;
- talk_base::scoped_ptr<talk_base::BasicPacketSocketFactory> socket_factory_;
+ rtc::scoped_ptr<rtc::BasicNetworkManager> network_manager_;
+ rtc::scoped_ptr<rtc::BasicPacketSocketFactory> socket_factory_;
};
} // namespace webrtc
diff --git a/app/webrtc/proxy.h b/app/webrtc/proxy.h
index 4db4bef..0c21ef9 100644
--- a/app/webrtc/proxy.h
+++ b/app/webrtc/proxy.h
@@ -31,7 +31,7 @@
//
// Example usage:
//
-// class TestInterface : public talk_base::RefCountInterface {
+// class TestInterface : public rtc::RefCountInterface {
// public:
// std::string FooA() = 0;
// std::string FooB(bool arg1) const = 0;
@@ -55,7 +55,7 @@
#ifndef TALK_APP_WEBRTC_PROXY_H_
#define TALK_APP_WEBRTC_PROXY_H_
-#include "talk/base/thread.h"
+#include "webrtc/base/thread.h"
namespace webrtc {
@@ -93,19 +93,19 @@
};
template <typename C, typename R>
-class MethodCall0 : public talk_base::Message,
- public talk_base::MessageHandler {
+class MethodCall0 : public rtc::Message,
+ public rtc::MessageHandler {
public:
typedef R (C::*Method)();
MethodCall0(C* c, Method m) : c_(c), m_(m) {}
- R Marshal(talk_base::Thread* t) {
+ R Marshal(rtc::Thread* t) {
t->Send(this, 0);
return r_.value();
}
private:
- void OnMessage(talk_base::Message*) { r_.Invoke(c_, m_);}
+ void OnMessage(rtc::Message*) { r_.Invoke(c_, m_);}
C* c_;
Method m_;
@@ -113,19 +113,19 @@
};
template <typename C, typename R>
-class ConstMethodCall0 : public talk_base::Message,
- public talk_base::MessageHandler {
+class ConstMethodCall0 : public rtc::Message,
+ public rtc::MessageHandler {
public:
typedef R (C::*Method)() const;
ConstMethodCall0(C* c, Method m) : c_(c), m_(m) {}
- R Marshal(talk_base::Thread* t) {
+ R Marshal(rtc::Thread* t) {
t->Send(this, 0);
return r_.value();
}
private:
- void OnMessage(talk_base::Message*) { r_.Invoke(c_, m_); }
+ void OnMessage(rtc::Message*) { r_.Invoke(c_, m_); }
C* c_;
Method m_;
@@ -133,19 +133,19 @@
};
template <typename C, typename R, typename T1>
-class MethodCall1 : public talk_base::Message,
- public talk_base::MessageHandler {
+class MethodCall1 : public rtc::Message,
+ public rtc::MessageHandler {
public:
typedef R (C::*Method)(T1 a1);
MethodCall1(C* c, Method m, T1 a1) : c_(c), m_(m), a1_(a1) {}
- R Marshal(talk_base::Thread* t) {
+ R Marshal(rtc::Thread* t) {
t->Send(this, 0);
return r_.value();
}
private:
- void OnMessage(talk_base::Message*) { r_.Invoke(c_, m_, a1_); }
+ void OnMessage(rtc::Message*) { r_.Invoke(c_, m_, a1_); }
C* c_;
Method m_;
@@ -154,19 +154,19 @@
};
template <typename C, typename R, typename T1>
-class ConstMethodCall1 : public talk_base::Message,
- public talk_base::MessageHandler {
+class ConstMethodCall1 : public rtc::Message,
+ public rtc::MessageHandler {
public:
typedef R (C::*Method)(T1 a1) const;
ConstMethodCall1(C* c, Method m, T1 a1) : c_(c), m_(m), a1_(a1) {}
- R Marshal(talk_base::Thread* t) {
+ R Marshal(rtc::Thread* t) {
t->Send(this, 0);
return r_.value();
}
private:
- void OnMessage(talk_base::Message*) { r_.Invoke(c_, m_, a1_); }
+ void OnMessage(rtc::Message*) { r_.Invoke(c_, m_, a1_); }
C* c_;
Method m_;
@@ -175,19 +175,19 @@
};
template <typename C, typename R, typename T1, typename T2>
-class MethodCall2 : public talk_base::Message,
- public talk_base::MessageHandler {
+class MethodCall2 : public rtc::Message,
+ public rtc::MessageHandler {
public:
typedef R (C::*Method)(T1 a1, T2 a2);
MethodCall2(C* c, Method m, T1 a1, T2 a2) : c_(c), m_(m), a1_(a1), a2_(a2) {}
- R Marshal(talk_base::Thread* t) {
+ R Marshal(rtc::Thread* t) {
t->Send(this, 0);
return r_.value();
}
private:
- void OnMessage(talk_base::Message*) { r_.Invoke(c_, m_, a1_, a2_); }
+ void OnMessage(rtc::Message*) { r_.Invoke(c_, m_, a1_, a2_); }
C* c_;
Method m_;
@@ -197,20 +197,20 @@
};
template <typename C, typename R, typename T1, typename T2, typename T3>
-class MethodCall3 : public talk_base::Message,
- public talk_base::MessageHandler {
+class MethodCall3 : public rtc::Message,
+ public rtc::MessageHandler {
public:
typedef R (C::*Method)(T1 a1, T2 a2, T3 a3);
MethodCall3(C* c, Method m, T1 a1, T2 a2, T3 a3)
: c_(c), m_(m), a1_(a1), a2_(a2), a3_(a3) {}
- R Marshal(talk_base::Thread* t) {
+ R Marshal(rtc::Thread* t) {
t->Send(this, 0);
return r_.value();
}
private:
- void OnMessage(talk_base::Message*) { r_.Invoke(c_, m_, a1_, a2_, a3_); }
+ void OnMessage(rtc::Message*) { r_.Invoke(c_, m_, a1_, a2_, a3_); }
C* c_;
Method m_;
@@ -224,7 +224,7 @@
class c##Proxy : public c##Interface {\
protected:\
typedef c##Interface C;\
- c##Proxy(talk_base::Thread* thread, C* c)\
+ c##Proxy(rtc::Thread* thread, C* c)\
: owner_thread_(thread), \
c_(c) {}\
~c##Proxy() {\
@@ -232,9 +232,9 @@
call.Marshal(owner_thread_);\
}\
public:\
- static talk_base::scoped_refptr<C> Create(talk_base::Thread* thread, \
+ static rtc::scoped_refptr<C> Create(rtc::Thread* thread, \
C* c) {\
- return new talk_base::RefCountedObject<c##Proxy>(thread, c);\
+ return new rtc::RefCountedObject<c##Proxy>(thread, c);\
}\
#define PROXY_METHOD0(r, method)\
@@ -278,8 +278,8 @@
void Release_s() {\
c_ = NULL;\
}\
- mutable talk_base::Thread* owner_thread_;\
- talk_base::scoped_refptr<C> c_;\
+ mutable rtc::Thread* owner_thread_;\
+ rtc::scoped_refptr<C> c_;\
};\
} // namespace webrtc
diff --git a/app/webrtc/proxy_unittest.cc b/app/webrtc/proxy_unittest.cc
index 71a583c..1cab484 100644
--- a/app/webrtc/proxy_unittest.cc
+++ b/app/webrtc/proxy_unittest.cc
@@ -29,10 +29,10 @@
#include <string>
-#include "talk/base/refcount.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/thread.h"
-#include "talk/base/gunit.h"
+#include "webrtc/base/refcount.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/thread.h"
+#include "webrtc/base/gunit.h"
#include "testing/base/public/gmock.h"
using ::testing::_;
@@ -44,7 +44,7 @@
namespace webrtc {
// Interface used for testing here.
-class FakeInterface : public talk_base::RefCountInterface {
+class FakeInterface : public rtc::RefCountInterface {
public:
virtual void VoidMethod0() = 0;
virtual std::string Method0() = 0;
@@ -70,8 +70,8 @@
// Implementation of the test interface.
class Fake : public FakeInterface {
public:
- static talk_base::scoped_refptr<Fake> Create() {
- return new talk_base::RefCountedObject<Fake>();
+ static rtc::scoped_refptr<Fake> Create() {
+ return new rtc::RefCountedObject<Fake>();
}
MOCK_METHOD0(VoidMethod0, void());
@@ -92,21 +92,21 @@
public:
// Checks that the functions is called on the |signaling_thread_|.
void CheckThread() {
- EXPECT_EQ(talk_base::Thread::Current(), signaling_thread_.get());
+ EXPECT_EQ(rtc::Thread::Current(), signaling_thread_.get());
}
protected:
virtual void SetUp() {
- signaling_thread_.reset(new talk_base::Thread());
+ signaling_thread_.reset(new rtc::Thread());
ASSERT_TRUE(signaling_thread_->Start());
fake_ = Fake::Create();
fake_proxy_ = FakeProxy::Create(signaling_thread_.get(), fake_.get());
}
protected:
- talk_base::scoped_ptr<talk_base::Thread> signaling_thread_;
- talk_base::scoped_refptr<FakeInterface> fake_proxy_;
- talk_base::scoped_refptr<Fake> fake_;
+ rtc::scoped_ptr<rtc::Thread> signaling_thread_;
+ rtc::scoped_refptr<FakeInterface> fake_proxy_;
+ rtc::scoped_refptr<Fake> fake_;
};
TEST_F(ProxyTest, VoidMethod0) {
diff --git a/app/webrtc/remoteaudiosource.cc b/app/webrtc/remoteaudiosource.cc
index 1c275c7..955dff0 100644
--- a/app/webrtc/remoteaudiosource.cc
+++ b/app/webrtc/remoteaudiosource.cc
@@ -30,12 +30,12 @@
#include <algorithm>
#include <functional>
-#include "talk/base/logging.h"
+#include "webrtc/base/logging.h"
namespace webrtc {
-talk_base::scoped_refptr<RemoteAudioSource> RemoteAudioSource::Create() {
- return new talk_base::RefCountedObject<RemoteAudioSource>();
+rtc::scoped_refptr<RemoteAudioSource> RemoteAudioSource::Create() {
+ return new rtc::RefCountedObject<RemoteAudioSource>();
}
RemoteAudioSource::RemoteAudioSource() {
diff --git a/app/webrtc/remoteaudiosource.h b/app/webrtc/remoteaudiosource.h
index ed24214..e805af6 100644
--- a/app/webrtc/remoteaudiosource.h
+++ b/app/webrtc/remoteaudiosource.h
@@ -41,7 +41,7 @@
class RemoteAudioSource : public Notifier<AudioSourceInterface> {
public:
// Creates an instance of RemoteAudioSource.
- static talk_base::scoped_refptr<RemoteAudioSource> Create();
+ static rtc::scoped_refptr<RemoteAudioSource> Create();
protected:
RemoteAudioSource();
diff --git a/app/webrtc/remotevideocapturer.cc b/app/webrtc/remotevideocapturer.cc
index 072c8d8..a76a530 100644
--- a/app/webrtc/remotevideocapturer.cc
+++ b/app/webrtc/remotevideocapturer.cc
@@ -27,7 +27,7 @@
#include "talk/app/webrtc/remotevideocapturer.h"
-#include "talk/base/logging.h"
+#include "webrtc/base/logging.h"
#include "talk/media/base/videoframe.h"
namespace webrtc {
diff --git a/app/webrtc/remotevideocapturer_unittest.cc b/app/webrtc/remotevideocapturer_unittest.cc
index 6813550..d66ff01 100644
--- a/app/webrtc/remotevideocapturer_unittest.cc
+++ b/app/webrtc/remotevideocapturer_unittest.cc
@@ -28,7 +28,7 @@
#include <string>
#include "talk/app/webrtc/remotevideocapturer.h"
-#include "talk/base/gunit.h"
+#include "webrtc/base/gunit.h"
#include "talk/media/webrtc/webrtcvideoframe.h"
using cricket::CaptureState;
diff --git a/app/webrtc/sctputils.cc b/app/webrtc/sctputils.cc
index dcc6ba6..988f468 100644
--- a/app/webrtc/sctputils.cc
+++ b/app/webrtc/sctputils.cc
@@ -27,9 +27,9 @@
#include "talk/app/webrtc/sctputils.h"
-#include "talk/base/buffer.h"
-#include "talk/base/bytebuffer.h"
-#include "talk/base/logging.h"
+#include "webrtc/base/buffer.h"
+#include "webrtc/base/bytebuffer.h"
+#include "webrtc/base/logging.h"
namespace webrtc {
@@ -48,13 +48,13 @@
DCOMCT_UNORDERED_PARTIAL_TIME = 0x82,
};
-bool ParseDataChannelOpenMessage(const talk_base::Buffer& payload,
+bool ParseDataChannelOpenMessage(const rtc::Buffer& payload,
std::string* label,
DataChannelInit* config) {
// Format defined at
// http://tools.ietf.org/html/draft-jesup-rtcweb-data-protocol-04
- talk_base::ByteBuffer buffer(payload.data(), payload.length());
+ rtc::ByteBuffer buffer(payload.data(), payload.length());
uint8 message_type;
if (!buffer.ReadUInt8(&message_type)) {
@@ -125,8 +125,8 @@
return true;
}
-bool ParseDataChannelOpenAckMessage(const talk_base::Buffer& payload) {
- talk_base::ByteBuffer buffer(payload.data(), payload.length());
+bool ParseDataChannelOpenAckMessage(const rtc::Buffer& payload) {
+ rtc::ByteBuffer buffer(payload.data(), payload.length());
uint8 message_type;
if (!buffer.ReadUInt8(&message_type)) {
@@ -143,7 +143,7 @@
bool WriteDataChannelOpenMessage(const std::string& label,
const DataChannelInit& config,
- talk_base::Buffer* payload) {
+ rtc::Buffer* payload) {
// Format defined at
// http://tools.ietf.org/html/draft-ietf-rtcweb-data-protocol-00#section-6.1
uint8 channel_type = 0;
@@ -171,9 +171,9 @@
}
}
- talk_base::ByteBuffer buffer(
+ rtc::ByteBuffer buffer(
NULL, 20 + label.length() + config.protocol.length(),
- talk_base::ByteBuffer::ORDER_NETWORK);
+ rtc::ByteBuffer::ORDER_NETWORK);
buffer.WriteUInt8(DATA_CHANNEL_OPEN_MESSAGE_TYPE);
buffer.WriteUInt8(channel_type);
buffer.WriteUInt16(priority);
@@ -186,8 +186,8 @@
return true;
}
-void WriteDataChannelOpenAckMessage(talk_base::Buffer* payload) {
- talk_base::ByteBuffer buffer(talk_base::ByteBuffer::ORDER_NETWORK);
+void WriteDataChannelOpenAckMessage(rtc::Buffer* payload) {
+ rtc::ByteBuffer buffer(rtc::ByteBuffer::ORDER_NETWORK);
buffer.WriteUInt8(DATA_CHANNEL_OPEN_ACK_MESSAGE_TYPE);
payload->SetData(buffer.Data(), buffer.Length());
}
diff --git a/app/webrtc/sctputils.h b/app/webrtc/sctputils.h
index d0b4e9c..ab1818b 100644
--- a/app/webrtc/sctputils.h
+++ b/app/webrtc/sctputils.h
@@ -32,24 +32,24 @@
#include "talk/app/webrtc/datachannelinterface.h"
-namespace talk_base {
+namespace rtc {
class Buffer;
-} // namespace talk_base
+} // namespace rtc
namespace webrtc {
struct DataChannelInit;
-bool ParseDataChannelOpenMessage(const talk_base::Buffer& payload,
+bool ParseDataChannelOpenMessage(const rtc::Buffer& payload,
std::string* label,
DataChannelInit* config);
-bool ParseDataChannelOpenAckMessage(const talk_base::Buffer& payload);
+bool ParseDataChannelOpenAckMessage(const rtc::Buffer& payload);
bool WriteDataChannelOpenMessage(const std::string& label,
const DataChannelInit& config,
- talk_base::Buffer* payload);
+ rtc::Buffer* payload);
-void WriteDataChannelOpenAckMessage(talk_base::Buffer* payload);
+void WriteDataChannelOpenAckMessage(rtc::Buffer* payload);
} // namespace webrtc
#endif // TALK_APP_WEBRTC_SCTPUTILS_H_
diff --git a/app/webrtc/sctputils_unittest.cc b/app/webrtc/sctputils_unittest.cc
index 6a139a0..ec2c850 100644
--- a/app/webrtc/sctputils_unittest.cc
+++ b/app/webrtc/sctputils_unittest.cc
@@ -25,13 +25,13 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/bytebuffer.h"
-#include "talk/base/gunit.h"
+#include "webrtc/base/bytebuffer.h"
+#include "webrtc/base/gunit.h"
#include "talk/app/webrtc/sctputils.h"
class SctpUtilsTest : public testing::Test {
public:
- void VerifyOpenMessageFormat(const talk_base::Buffer& packet,
+ void VerifyOpenMessageFormat(const rtc::Buffer& packet,
const std::string& label,
const webrtc::DataChannelInit& config) {
uint8 message_type;
@@ -41,7 +41,7 @@
uint16 label_length;
uint16 protocol_length;
- talk_base::ByteBuffer buffer(packet.data(), packet.length());
+ rtc::ByteBuffer buffer(packet.data(), packet.length());
ASSERT_TRUE(buffer.ReadUInt8(&message_type));
EXPECT_EQ(0x03, message_type);
@@ -84,7 +84,7 @@
std::string label = "abc";
config.protocol = "y";
- talk_base::Buffer packet;
+ rtc::Buffer packet;
ASSERT_TRUE(webrtc::WriteDataChannelOpenMessage(label, config, &packet));
VerifyOpenMessageFormat(packet, label, config);
@@ -108,7 +108,7 @@
config.maxRetransmitTime = 10;
config.protocol = "y";
- talk_base::Buffer packet;
+ rtc::Buffer packet;
ASSERT_TRUE(webrtc::WriteDataChannelOpenMessage(label, config, &packet));
VerifyOpenMessageFormat(packet, label, config);
@@ -131,7 +131,7 @@
config.maxRetransmits = 10;
config.protocol = "y";
- talk_base::Buffer packet;
+ rtc::Buffer packet;
ASSERT_TRUE(webrtc::WriteDataChannelOpenMessage(label, config, &packet));
VerifyOpenMessageFormat(packet, label, config);
@@ -149,11 +149,11 @@
}
TEST_F(SctpUtilsTest, WriteParseAckMessage) {
- talk_base::Buffer packet;
+ rtc::Buffer packet;
webrtc::WriteDataChannelOpenAckMessage(&packet);
uint8 message_type;
- talk_base::ByteBuffer buffer(packet.data(), packet.length());
+ rtc::ByteBuffer buffer(packet.data(), packet.length());
ASSERT_TRUE(buffer.ReadUInt8(&message_type));
EXPECT_EQ(0x02, message_type);
diff --git a/app/webrtc/statscollector.cc b/app/webrtc/statscollector.cc
index dd615ab..2b0b36a 100644
--- a/app/webrtc/statscollector.cc
+++ b/app/webrtc/statscollector.cc
@@ -30,9 +30,9 @@
#include <utility>
#include <vector>
-#include "talk/base/base64.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/timing.h"
+#include "webrtc/base/base64.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/timing.h"
#include "talk/session/media/channel.h"
namespace webrtc {
@@ -199,7 +199,7 @@
}
void StatsReport::AddValue(StatsReport::StatsValueName name, int64 value) {
- AddValue(name, talk_base::ToString<int64>(value));
+ AddValue(name, rtc::ToString<int64>(value));
}
template <typename T>
@@ -208,7 +208,7 @@
std::ostringstream oss;
oss << "[";
for (size_t i = 0; i < value.size(); ++i) {
- oss << talk_base::ToString<T>(value[i]);
+ oss << rtc::ToString<T>(value[i]);
if (i != value.size() - 1)
oss << ", ";
}
@@ -236,6 +236,32 @@
namespace {
typedef std::map<std::string, StatsReport> StatsMap;
+double GetTimeNow() {
+ return rtc::Timing::WallTimeNow() * rtc::kNumMillisecsPerSec;
+}
+
+bool GetTransportIdFromProxy(const cricket::ProxyTransportMap& map,
+ const std::string& proxy,
+ std::string* transport) {
+ // TODO(hta): Remove handling of empty proxy name once tests do not use it.
+ if (proxy.empty()) {
+ transport->clear();
+ return true;
+ }
+
+ cricket::ProxyTransportMap::const_iterator found = map.find(proxy);
+ if (found == map.end()) {
+ LOG(LS_ERROR) << "No transport ID mapping for " << proxy;
+ return false;
+ }
+
+ std::ostringstream ost;
+ // Component 1 is always used for RTP.
+ ost << "Channel-" << found->second << "-1";
+ *transport = ost.str();
+ return true;
+}
+
std::string StatsId(const std::string& type, const std::string& id) {
return type + "_" + id;
}
@@ -299,7 +325,7 @@
report->AddValue(StatsReport::kStatsValueNameCurrentDelayMs,
info.delay_estimate_ms);
report->AddValue(StatsReport::kStatsValueNameExpandRate,
- talk_base::ToString<float>(info.expand_rate));
+ rtc::ToString<float>(info.expand_rate));
report->AddValue(StatsReport::kStatsValueNamePacketsReceived,
info.packets_rcvd);
report->AddValue(StatsReport::kStatsValueNamePacketsLost,
@@ -334,7 +360,7 @@
info.jitter_ms);
report->AddValue(StatsReport::kStatsValueNameRtt, info.rtt_ms);
report->AddValue(StatsReport::kStatsValueNameEchoCancellationQualityMin,
- talk_base::ToString<float>(info.aec_quality_min));
+ rtc::ToString<float>(info.aec_quality_min));
report->AddValue(StatsReport::kStatsValueNameEchoDelayMedian,
info.echo_delay_median_ms);
report->AddValue(StatsReport::kStatsValueNameEchoDelayStdDev,
@@ -645,7 +671,7 @@
uint32 ssrc,
const std::string& transport_id,
TrackDirection direction) {
- const std::string ssrc_id = talk_base::ToString<uint32>(ssrc);
+ const std::string ssrc_id = rtc::ToString<uint32>(ssrc);
StatsMap::iterator it = reports_.find(StatsId(
StatsReport::kStatsReportTypeSsrc, ssrc_id, direction));
@@ -688,7 +714,7 @@
uint32 ssrc,
const std::string& transport_id,
TrackDirection direction) {
- const std::string ssrc_id = talk_base::ToString<uint32>(ssrc);
+ const std::string ssrc_id = rtc::ToString<uint32>(ssrc);
StatsMap::iterator it = reports_.find(StatsId(
StatsReport::kStatsReportTypeRemoteSsrc, ssrc_id, direction));
@@ -725,7 +751,7 @@
}
std::string StatsCollector::AddOneCertificateReport(
- const talk_base::SSLCertificate* cert, const std::string& issuer_id) {
+ const rtc::SSLCertificate* cert, const std::string& issuer_id) {
// TODO(bemasc): Move this computation to a helper class that caches these
// values to reduce CPU use in GetStats. This will require adding a fast
// SSLCertificate::Equals() method to detect certificate changes.
@@ -734,8 +760,8 @@
if (!cert->GetSignatureDigestAlgorithm(&digest_algorithm))
return std::string();
- talk_base::scoped_ptr<talk_base::SSLFingerprint> ssl_fingerprint(
- talk_base::SSLFingerprint::Create(digest_algorithm, cert));
+ rtc::scoped_ptr<rtc::SSLFingerprint> ssl_fingerprint(
+ rtc::SSLFingerprint::Create(digest_algorithm, cert));
// SSLFingerprint::Create can fail if the algorithm returned by
// SSLCertificate::GetSignatureDigestAlgorithm is not supported by the
@@ -746,10 +772,10 @@
std::string fingerprint = ssl_fingerprint->GetRfc4572Fingerprint();
- talk_base::Buffer der_buffer;
+ rtc::Buffer der_buffer;
cert->ToDER(&der_buffer);
std::string der_base64;
- talk_base::Base64::EncodeFromArray(
+ rtc::Base64::EncodeFromArray(
der_buffer.data(), der_buffer.length(), &der_base64);
StatsReport report;
@@ -767,7 +793,7 @@
}
std::string StatsCollector::AddCertificateReports(
- const talk_base::SSLCertificate* cert) {
+ const rtc::SSLCertificate* cert) {
// Produces a chain of StatsReports representing this certificate and the rest
// of its chain, and adds those reports to |reports_|. The return value is
// the id of the leaf report. The provided cert must be non-null, so at least
@@ -776,14 +802,14 @@
ASSERT(cert != NULL);
std::string issuer_id;
- talk_base::scoped_ptr<talk_base::SSLCertChain> chain;
+ rtc::scoped_ptr<rtc::SSLCertChain> chain;
if (cert->GetChain(chain.accept())) {
// This loop runs in reverse, i.e. from root to leaf, so that each
// certificate's issuer's report ID is known before the child certificate's
// report is generated. The root certificate does not have an issuer ID
// value.
for (ptrdiff_t i = chain->GetSize() - 1; i >= 0; --i) {
- const talk_base::SSLCertificate& cert_i = chain->Get(i);
+ const rtc::SSLCertificate& cert_i = chain->Get(i);
issuer_id = AddOneCertificateReport(&cert_i, issuer_id);
}
}
@@ -814,19 +840,27 @@
// Attempt to get a copy of the certificates from the transport and
// expose them in stats reports. All channels in a transport share the
// same local and remote certificates.
+ //
+ // Note that Transport::GetIdentity and Transport::GetRemoteCertificate
+ // invoke method calls on the worker thread and block this thread, but
+ // messages are still processed on this thread, which may blow way the
+ // existing transports. So we cannot reuse |transport| after these calls.
std::string local_cert_report_id, remote_cert_report_id;
+
cricket::Transport* transport =
session_->GetTransport(transport_iter->second.content_name);
- if (transport) {
- talk_base::scoped_ptr<talk_base::SSLIdentity> identity;
- if (transport->GetIdentity(identity.accept()))
- local_cert_report_id = AddCertificateReports(
- &(identity->certificate()));
-
- talk_base::scoped_ptr<talk_base::SSLCertificate> cert;
- if (transport->GetRemoteCertificate(cert.accept()))
- remote_cert_report_id = AddCertificateReports(cert.get());
+ rtc::scoped_ptr<rtc::SSLIdentity> identity;
+ if (transport && transport->GetIdentity(identity.accept())) {
+ local_cert_report_id =
+ AddCertificateReports(&(identity->certificate()));
}
+
+ transport = session_->GetTransport(transport_iter->second.content_name);
+ rtc::scoped_ptr<rtc::SSLCertificate> cert;
+ if (transport && transport->GetRemoteCertificate(cert.accept())) {
+ remote_cert_report_id = AddCertificateReports(cert.get());
+ }
+
for (cricket::TransportChannelStatsList::iterator channel_iter
= transport_iter->second.channel_stats.begin();
channel_iter != transport_iter->second.channel_stats.end();
@@ -902,7 +936,8 @@
return;
}
std::string transport_id;
- if (!GetTransportIdFromProxy(session_->voice_channel()->content_name(),
+ if (!GetTransportIdFromProxy(proxy_to_transport_,
+ session_->voice_channel()->content_name(),
&transport_id)) {
LOG(LS_ERROR) << "Failed to get transport name for proxy "
<< session_->voice_channel()->content_name();
@@ -929,7 +964,8 @@
return;
}
std::string transport_id;
- if (!GetTransportIdFromProxy(session_->video_channel()->content_name(),
+ if (!GetTransportIdFromProxy(proxy_to_transport_,
+ session_->video_channel()->content_name(),
&transport_id)) {
LOG(LS_ERROR) << "Failed to get transport name for proxy "
<< session_->video_channel()->content_name();
@@ -946,28 +982,6 @@
}
}
-double StatsCollector::GetTimeNow() {
- return talk_base::Timing::WallTimeNow() * talk_base::kNumMillisecsPerSec;
-}
-
-bool StatsCollector::GetTransportIdFromProxy(const std::string& proxy,
- std::string* transport) {
- // TODO(hta): Remove handling of empty proxy name once tests do not use it.
- if (proxy.empty()) {
- transport->clear();
- return true;
- }
- if (proxy_to_transport_.find(proxy) == proxy_to_transport_.end()) {
- LOG(LS_ERROR) << "No transport ID mapping for " << proxy;
- return false;
- }
- std::ostringstream ost;
- // Component 1 is always used for RTP.
- ost << "Channel-" << proxy_to_transport_[proxy] << "-1";
- *transport = ost.str();
- return true;
-}
-
StatsReport* StatsCollector::GetReport(const std::string& type,
const std::string& id,
TrackDirection direction) {
@@ -1004,7 +1018,7 @@
it != local_audio_tracks_.end(); ++it) {
AudioTrackInterface* track = it->first;
uint32 ssrc = it->second;
- std::string ssrc_id = talk_base::ToString<uint32>(ssrc);
+ std::string ssrc_id = rtc::ToString<uint32>(ssrc);
StatsReport* report = GetReport(StatsReport::kStatsReportTypeSsrc,
ssrc_id,
kSending);
@@ -1037,10 +1051,10 @@
int signal_level = 0;
if (track->GetSignalLevel(&signal_level)) {
report->ReplaceValue(StatsReport::kStatsValueNameAudioInputLevel,
- talk_base::ToString<int>(signal_level));
+ rtc::ToString<int>(signal_level));
}
- talk_base::scoped_refptr<AudioProcessorInterface> audio_processor(
+ rtc::scoped_refptr<AudioProcessorInterface> audio_processor(
track->GetAudioProcessor());
if (audio_processor.get() == NULL)
return;
@@ -1050,16 +1064,16 @@
report->ReplaceValue(StatsReport::kStatsValueNameTypingNoiseState,
stats.typing_noise_detected ? "true" : "false");
report->ReplaceValue(StatsReport::kStatsValueNameEchoReturnLoss,
- talk_base::ToString<int>(stats.echo_return_loss));
+ rtc::ToString<int>(stats.echo_return_loss));
report->ReplaceValue(
StatsReport::kStatsValueNameEchoReturnLossEnhancement,
- talk_base::ToString<int>(stats.echo_return_loss_enhancement));
+ rtc::ToString<int>(stats.echo_return_loss_enhancement));
report->ReplaceValue(StatsReport::kStatsValueNameEchoDelayMedian,
- talk_base::ToString<int>(stats.echo_delay_median_ms));
+ rtc::ToString<int>(stats.echo_delay_median_ms));
report->ReplaceValue(StatsReport::kStatsValueNameEchoCancellationQualityMin,
- talk_base::ToString<float>(stats.aec_quality_min));
+ rtc::ToString<float>(stats.aec_quality_min));
report->ReplaceValue(StatsReport::kStatsValueNameEchoDelayStdDev,
- talk_base::ToString<int>(stats.echo_delay_std_ms));
+ rtc::ToString<int>(stats.echo_delay_std_ms));
}
bool StatsCollector::GetTrackIdBySsrc(uint32 ssrc, std::string* track_id,
diff --git a/app/webrtc/statscollector.h b/app/webrtc/statscollector.h
index f51cee8..a039813 100644
--- a/app/webrtc/statscollector.h
+++ b/app/webrtc/statscollector.h
@@ -82,9 +82,6 @@
// Prepare an SSRC report for the given remote ssrc. Used internally.
StatsReport* PrepareRemoteReport(uint32 ssrc, const std::string& transport,
TrackDirection direction);
- // Extracts the ID of a Transport belonging to an SSRC. Used internally.
- bool GetTransportIdFromProxy(const std::string& proxy,
- std::string* transport_id);
// Method used by the unittest to force a update of stats since UpdateStats()
// that occur less than kMinGatherStatsPeriod number of ms apart will be
@@ -96,16 +93,15 @@
// Helper method for AddCertificateReports.
std::string AddOneCertificateReport(
- const talk_base::SSLCertificate* cert, const std::string& issuer_id);
+ const rtc::SSLCertificate* cert, const std::string& issuer_id);
// Adds a report for this certificate and every certificate in its chain, and
// returns the leaf certificate's report's ID.
- std::string AddCertificateReports(const talk_base::SSLCertificate* cert);
+ std::string AddCertificateReports(const rtc::SSLCertificate* cert);
void ExtractSessionInfo();
void ExtractVoiceInfo();
void ExtractVideoInfo(PeerConnectionInterface::StatsOutputLevel level);
- double GetTimeNow();
void BuildSsrcToTransportId();
webrtc::StatsReport* GetOrCreateReport(const std::string& type,
const std::string& id,
diff --git a/app/webrtc/statscollector_unittest.cc b/app/webrtc/statscollector_unittest.cc
index fc0ca0e..9441e2d 100644
--- a/app/webrtc/statscollector_unittest.cc
+++ b/app/webrtc/statscollector_unittest.cc
@@ -33,9 +33,9 @@
#include "talk/app/webrtc/mediastreaminterface.h"
#include "talk/app/webrtc/mediastreamtrack.h"
#include "talk/app/webrtc/videotrack.h"
-#include "talk/base/base64.h"
-#include "talk/base/fakesslidentity.h"
-#include "talk/base/gunit.h"
+#include "webrtc/base/base64.h"
+#include "webrtc/base/fakesslidentity.h"
+#include "webrtc/base/gunit.h"
#include "talk/media/base/fakemediaengine.h"
#include "talk/media/devices/fakedevicemanager.h"
#include "talk/p2p/base/fakesession.h"
@@ -75,8 +75,8 @@
class MockWebRtcSession : public webrtc::WebRtcSession {
public:
explicit MockWebRtcSession(cricket::ChannelManager* channel_manager)
- : WebRtcSession(channel_manager, talk_base::Thread::Current(),
- talk_base::Thread::Current(), NULL, NULL) {
+ : WebRtcSession(channel_manager, rtc::Thread::Current(),
+ rtc::Thread::Current(), NULL, NULL) {
}
MOCK_METHOD0(voice_channel, cricket::VoiceChannel*());
MOCK_METHOD0(video_channel, cricket::VideoChannel*());
@@ -126,7 +126,7 @@
public:
explicit FakeAudioTrack(const std::string& id)
: webrtc::MediaStreamTrack<webrtc::AudioTrackInterface>(id),
- processor_(new talk_base::RefCountedObject<FakeAudioProcessor>()) {}
+ processor_(new rtc::RefCountedObject<FakeAudioProcessor>()) {}
std::string kind() const OVERRIDE {
return "audio";
}
@@ -139,13 +139,13 @@
*level = 1;
return true;
}
- virtual talk_base::scoped_refptr<webrtc::AudioProcessorInterface>
+ virtual rtc::scoped_refptr<webrtc::AudioProcessorInterface>
GetAudioProcessor() OVERRIDE {
return processor_;
}
private:
- talk_base::scoped_refptr<FakeAudioProcessor> processor_;
+ rtc::scoped_refptr<FakeAudioProcessor> processor_;
};
bool GetValue(const StatsReport* report,
@@ -216,8 +216,8 @@
}
std::string DerToPem(const std::string& der) {
- return talk_base::SSLIdentity::DerToPem(
- talk_base::kPemTypeCertificate,
+ return rtc::SSLIdentity::DerToPem(
+ rtc::kPemTypeCertificate,
reinterpret_cast<const unsigned char*>(der.c_str()),
der.length());
}
@@ -241,8 +241,8 @@
std::string der_base64;
EXPECT_TRUE(GetValue(
report, StatsReport::kStatsValueNameDer, &der_base64));
- std::string der = talk_base::Base64::Decode(der_base64,
- talk_base::Base64::DO_STRICT);
+ std::string der = rtc::Base64::Decode(der_base64,
+ rtc::Base64::DO_STRICT);
EXPECT_EQ(ders[i], der);
std::string fingerprint_algorithm;
@@ -251,7 +251,7 @@
StatsReport::kStatsValueNameFingerprintAlgorithm,
&fingerprint_algorithm));
// The digest algorithm for a FakeSSLCertificate is always SHA-1.
- std::string sha_1_str = talk_base::DIGEST_SHA_1;
+ std::string sha_1_str = rtc::DIGEST_SHA_1;
EXPECT_EQ(sha_1_str, fingerprint_algorithm);
std::string dummy_fingerprint; // Value is not checked.
@@ -274,50 +274,50 @@
std::string value_in_report;
EXPECT_TRUE(GetValue(
report, StatsReport::kStatsValueNameAudioOutputLevel, &value_in_report));
- EXPECT_EQ(talk_base::ToString<int>(info.audio_level), value_in_report);
+ EXPECT_EQ(rtc::ToString<int>(info.audio_level), value_in_report);
EXPECT_TRUE(GetValue(
report, StatsReport::kStatsValueNameBytesReceived, &value_in_report));
- EXPECT_EQ(talk_base::ToString<int64>(info.bytes_rcvd), value_in_report);
+ EXPECT_EQ(rtc::ToString<int64>(info.bytes_rcvd), value_in_report);
EXPECT_TRUE(GetValue(
report, StatsReport::kStatsValueNameJitterReceived, &value_in_report));
- EXPECT_EQ(talk_base::ToString<int>(info.jitter_ms), value_in_report);
+ EXPECT_EQ(rtc::ToString<int>(info.jitter_ms), value_in_report);
EXPECT_TRUE(GetValue(
report, StatsReport::kStatsValueNameJitterBufferMs, &value_in_report));
- EXPECT_EQ(talk_base::ToString<int>(info.jitter_buffer_ms), value_in_report);
+ EXPECT_EQ(rtc::ToString<int>(info.jitter_buffer_ms), value_in_report);
EXPECT_TRUE(GetValue(
report, StatsReport::kStatsValueNamePreferredJitterBufferMs,
&value_in_report));
- EXPECT_EQ(talk_base::ToString<int>(info.jitter_buffer_preferred_ms),
+ EXPECT_EQ(rtc::ToString<int>(info.jitter_buffer_preferred_ms),
value_in_report);
EXPECT_TRUE(GetValue(
report, StatsReport::kStatsValueNameCurrentDelayMs, &value_in_report));
- EXPECT_EQ(talk_base::ToString<int>(info.delay_estimate_ms), value_in_report);
+ EXPECT_EQ(rtc::ToString<int>(info.delay_estimate_ms), value_in_report);
EXPECT_TRUE(GetValue(
report, StatsReport::kStatsValueNameExpandRate, &value_in_report));
- EXPECT_EQ(talk_base::ToString<float>(info.expand_rate), value_in_report);
+ EXPECT_EQ(rtc::ToString<float>(info.expand_rate), value_in_report);
EXPECT_TRUE(GetValue(
report, StatsReport::kStatsValueNamePacketsReceived, &value_in_report));
- EXPECT_EQ(talk_base::ToString<int>(info.packets_rcvd), value_in_report);
+ EXPECT_EQ(rtc::ToString<int>(info.packets_rcvd), value_in_report);
EXPECT_TRUE(GetValue(
report, StatsReport::kStatsValueNameDecodingCTSG, &value_in_report));
- EXPECT_EQ(talk_base::ToString<int>(info.decoding_calls_to_silence_generator),
+ EXPECT_EQ(rtc::ToString<int>(info.decoding_calls_to_silence_generator),
value_in_report);
EXPECT_TRUE(GetValue(
report, StatsReport::kStatsValueNameDecodingCTN, &value_in_report));
- EXPECT_EQ(talk_base::ToString<int>(info.decoding_calls_to_neteq),
+ EXPECT_EQ(rtc::ToString<int>(info.decoding_calls_to_neteq),
value_in_report);
EXPECT_TRUE(GetValue(
report, StatsReport::kStatsValueNameDecodingNormal, &value_in_report));
- EXPECT_EQ(talk_base::ToString<int>(info.decoding_normal), value_in_report);
+ EXPECT_EQ(rtc::ToString<int>(info.decoding_normal), value_in_report);
EXPECT_TRUE(GetValue(
report, StatsReport::kStatsValueNameDecodingPLC, &value_in_report));
- EXPECT_EQ(talk_base::ToString<int>(info.decoding_plc), value_in_report);
+ EXPECT_EQ(rtc::ToString<int>(info.decoding_plc), value_in_report);
EXPECT_TRUE(GetValue(
report, StatsReport::kStatsValueNameDecodingCNG, &value_in_report));
- EXPECT_EQ(talk_base::ToString<int>(info.decoding_cng), value_in_report);
+ EXPECT_EQ(rtc::ToString<int>(info.decoding_cng), value_in_report);
EXPECT_TRUE(GetValue(
report, StatsReport::kStatsValueNameDecodingPLCCNG, &value_in_report));
- EXPECT_EQ(talk_base::ToString<int>(info.decoding_plc_cng), value_in_report);
+ EXPECT_EQ(rtc::ToString<int>(info.decoding_plc_cng), value_in_report);
EXPECT_TRUE(GetValue(
report, StatsReport::kStatsValueNameCodecName, &value_in_report));
}
@@ -331,46 +331,46 @@
EXPECT_EQ(sinfo.codec_name, value_in_report);
EXPECT_TRUE(GetValue(
report, StatsReport::kStatsValueNameBytesSent, &value_in_report));
- EXPECT_EQ(talk_base::ToString<int64>(sinfo.bytes_sent), value_in_report);
+ EXPECT_EQ(rtc::ToString<int64>(sinfo.bytes_sent), value_in_report);
EXPECT_TRUE(GetValue(
report, StatsReport::kStatsValueNamePacketsSent, &value_in_report));
- EXPECT_EQ(talk_base::ToString<int>(sinfo.packets_sent), value_in_report);
+ EXPECT_EQ(rtc::ToString<int>(sinfo.packets_sent), value_in_report);
EXPECT_TRUE(GetValue(
report, StatsReport::kStatsValueNamePacketsLost, &value_in_report));
- EXPECT_EQ(talk_base::ToString<int>(sinfo.packets_lost), value_in_report);
+ EXPECT_EQ(rtc::ToString<int>(sinfo.packets_lost), value_in_report);
EXPECT_TRUE(GetValue(
report, StatsReport::kStatsValueNameRtt, &value_in_report));
- EXPECT_EQ(talk_base::ToString<int>(sinfo.rtt_ms), value_in_report);
+ EXPECT_EQ(rtc::ToString<int>(sinfo.rtt_ms), value_in_report);
EXPECT_TRUE(GetValue(
report, StatsReport::kStatsValueNameRtt, &value_in_report));
- EXPECT_EQ(talk_base::ToString<int>(sinfo.rtt_ms), value_in_report);
+ EXPECT_EQ(rtc::ToString<int>(sinfo.rtt_ms), value_in_report);
EXPECT_TRUE(GetValue(
report, StatsReport::kStatsValueNameJitterReceived, &value_in_report));
- EXPECT_EQ(talk_base::ToString<int>(sinfo.jitter_ms), value_in_report);
+ EXPECT_EQ(rtc::ToString<int>(sinfo.jitter_ms), value_in_report);
EXPECT_TRUE(GetValue(
report, StatsReport::kStatsValueNameEchoCancellationQualityMin,
&value_in_report));
- EXPECT_EQ(talk_base::ToString<float>(sinfo.aec_quality_min), value_in_report);
+ EXPECT_EQ(rtc::ToString<float>(sinfo.aec_quality_min), value_in_report);
EXPECT_TRUE(GetValue(
report, StatsReport::kStatsValueNameEchoDelayMedian, &value_in_report));
- EXPECT_EQ(talk_base::ToString<int>(sinfo.echo_delay_median_ms),
+ EXPECT_EQ(rtc::ToString<int>(sinfo.echo_delay_median_ms),
value_in_report);
EXPECT_TRUE(GetValue(
report, StatsReport::kStatsValueNameEchoDelayStdDev, &value_in_report));
- EXPECT_EQ(talk_base::ToString<int>(sinfo.echo_delay_std_ms),
+ EXPECT_EQ(rtc::ToString<int>(sinfo.echo_delay_std_ms),
value_in_report);
EXPECT_TRUE(GetValue(
report, StatsReport::kStatsValueNameEchoReturnLoss, &value_in_report));
- EXPECT_EQ(talk_base::ToString<int>(sinfo.echo_return_loss),
+ EXPECT_EQ(rtc::ToString<int>(sinfo.echo_return_loss),
value_in_report);
EXPECT_TRUE(GetValue(
report, StatsReport::kStatsValueNameEchoReturnLossEnhancement,
&value_in_report));
- EXPECT_EQ(talk_base::ToString<int>(sinfo.echo_return_loss_enhancement),
+ EXPECT_EQ(rtc::ToString<int>(sinfo.echo_return_loss_enhancement),
value_in_report);
EXPECT_TRUE(GetValue(
report, StatsReport::kStatsValueNameAudioInputLevel, &value_in_report));
- EXPECT_EQ(talk_base::ToString<int>(sinfo.audio_level), value_in_report);
+ EXPECT_EQ(rtc::ToString<int>(sinfo.audio_level), value_in_report);
EXPECT_TRUE(GetValue(
report, StatsReport::kStatsValueNameTypingNoiseState, &value_in_report));
std::string typing_detected = sinfo.typing_noise_detected ? "true" : "false";
@@ -437,7 +437,7 @@
channel_manager_(
new cricket::ChannelManager(media_engine_,
new cricket::FakeDeviceManager(),
- talk_base::Thread::Current())),
+ rtc::Thread::Current())),
session_(channel_manager_.get()) {
// By default, we ignore session GetStats calls.
EXPECT_CALL(session_, GetStats(_)).WillRepeatedly(Return(false));
@@ -481,7 +481,7 @@
if (stream_ == NULL)
stream_ = webrtc::MediaStream::Create("streamlabel");
- audio_track_ = new talk_base::RefCountedObject<FakeAudioTrack>(
+ audio_track_ = new rtc::RefCountedObject<FakeAudioTrack>(
kLocalTrackId);
stream_->AddTrack(audio_track_);
EXPECT_CALL(session_, GetLocalTrackIdBySsrc(kSsrcOfTrack, _))
@@ -493,7 +493,7 @@
if (stream_ == NULL)
stream_ = webrtc::MediaStream::Create("streamlabel");
- audio_track_ = new talk_base::RefCountedObject<FakeAudioTrack>(
+ audio_track_ = new rtc::RefCountedObject<FakeAudioTrack>(
kRemoteTrackId);
stream_->AddTrack(audio_track_);
EXPECT_CALL(session_, GetRemoteTrackIdBySsrc(kSsrcOfTrack, _))
@@ -546,7 +546,7 @@
EXPECT_EQ(audio_track->id(), track_id);
std::string ssrc_id = ExtractSsrcStatsValue(
*reports, StatsReport::kStatsValueNameSsrc);
- EXPECT_EQ(talk_base::ToString<uint32>(kSsrcOfTrack), ssrc_id);
+ EXPECT_EQ(rtc::ToString<uint32>(kSsrcOfTrack), ssrc_id);
// Verifies the values in the track report.
if (voice_sender_info) {
@@ -568,16 +568,16 @@
EXPECT_EQ(audio_track->id(), track_id);
ssrc_id = ExtractSsrcStatsValue(track_reports,
StatsReport::kStatsValueNameSsrc);
- EXPECT_EQ(talk_base::ToString<uint32>(kSsrcOfTrack), ssrc_id);
+ EXPECT_EQ(rtc::ToString<uint32>(kSsrcOfTrack), ssrc_id);
if (voice_sender_info)
VerifyVoiceSenderInfoReport(track_report, *voice_sender_info);
if (voice_receiver_info)
VerifyVoiceReceiverInfoReport(track_report, *voice_receiver_info);
}
- void TestCertificateReports(const talk_base::FakeSSLCertificate& local_cert,
+ void TestCertificateReports(const rtc::FakeSSLCertificate& local_cert,
const std::vector<std::string>& local_ders,
- const talk_base::FakeSSLCertificate& remote_cert,
+ const rtc::FakeSSLCertificate& remote_cert,
const std::vector<std::string>& remote_ders) {
webrtc::StatsCollector stats(&session_); // Implementation under test.
StatsReports reports; // returned values.
@@ -595,12 +595,12 @@
transport_stats;
// Fake certificates to report.
- talk_base::FakeSSLIdentity local_identity(local_cert);
- talk_base::scoped_ptr<talk_base::FakeSSLCertificate> remote_cert_copy(
+ rtc::FakeSSLIdentity local_identity(local_cert);
+ rtc::scoped_ptr<rtc::FakeSSLCertificate> remote_cert_copy(
remote_cert.GetReference());
// Fake transport object.
- talk_base::scoped_ptr<cricket::FakeTransport> transport(
+ rtc::scoped_ptr<cricket::FakeTransport> transport(
new cricket::FakeTransport(
session_.signaling_thread(),
session_.worker_thread(),
@@ -614,7 +614,7 @@
// Configure MockWebRtcSession
EXPECT_CALL(session_, GetTransport(transport_stats.content_name))
- .WillOnce(Return(transport.get()));
+ .WillRepeatedly(Return(transport.get()));
EXPECT_CALL(session_, GetStats(_))
.WillOnce(DoAll(SetArgPointee<0>(session_stats),
Return(true)));
@@ -655,19 +655,19 @@
}
cricket::FakeMediaEngine* media_engine_;
- talk_base::scoped_ptr<cricket::ChannelManager> channel_manager_;
+ rtc::scoped_ptr<cricket::ChannelManager> channel_manager_;
MockWebRtcSession session_;
cricket::SessionStats session_stats_;
- talk_base::scoped_refptr<webrtc::MediaStream> stream_;
- talk_base::scoped_refptr<webrtc::VideoTrack> track_;
- talk_base::scoped_refptr<FakeAudioTrack> audio_track_;
+ rtc::scoped_refptr<webrtc::MediaStream> stream_;
+ rtc::scoped_refptr<webrtc::VideoTrack> track_;
+ rtc::scoped_refptr<FakeAudioTrack> audio_track_;
};
// This test verifies that 64-bit counters are passed successfully.
TEST_F(StatsCollectorTest, BytesCounterHandles64Bits) {
webrtc::StatsCollector stats(&session_); // Implementation under test.
MockVideoMediaChannel* media_channel = new MockVideoMediaChannel();
- cricket::VideoChannel video_channel(talk_base::Thread::Current(),
+ cricket::VideoChannel video_channel(rtc::Thread::Current(),
media_engine_, media_channel, &session_, "", false, NULL);
StatsReports reports; // returned values.
cricket::VideoSenderInfo video_sender_info;
@@ -700,7 +700,7 @@
TEST_F(StatsCollectorTest, BandwidthEstimationInfoIsReported) {
webrtc::StatsCollector stats(&session_); // Implementation under test.
MockVideoMediaChannel* media_channel = new MockVideoMediaChannel();
- cricket::VideoChannel video_channel(talk_base::Thread::Current(),
+ cricket::VideoChannel video_channel(rtc::Thread::Current(),
media_engine_, media_channel, &session_, "", false, NULL);
StatsReports reports; // returned values.
cricket::VideoSenderInfo video_sender_info;
@@ -776,7 +776,7 @@
TEST_F(StatsCollectorTest, TrackObjectExistsWithoutUpdateStats) {
webrtc::StatsCollector stats(&session_); // Implementation under test.
MockVideoMediaChannel* media_channel = new MockVideoMediaChannel();
- cricket::VideoChannel video_channel(talk_base::Thread::Current(),
+ cricket::VideoChannel video_channel(rtc::Thread::Current(),
media_engine_, media_channel, &session_, "", false, NULL);
AddOutgoingVideoTrackStats();
stats.AddStream(stream_);
@@ -800,7 +800,7 @@
TEST_F(StatsCollectorTest, TrackAndSsrcObjectExistAfterUpdateSsrcStats) {
webrtc::StatsCollector stats(&session_); // Implementation under test.
MockVideoMediaChannel* media_channel = new MockVideoMediaChannel();
- cricket::VideoChannel video_channel(talk_base::Thread::Current(),
+ cricket::VideoChannel video_channel(rtc::Thread::Current(),
media_engine_, media_channel, &session_, "", false, NULL);
AddOutgoingVideoTrackStats();
stats.AddStream(stream_);
@@ -842,7 +842,7 @@
std::string ssrc_id = ExtractSsrcStatsValue(
reports, StatsReport::kStatsValueNameSsrc);
- EXPECT_EQ(talk_base::ToString<uint32>(kSsrcOfTrack), ssrc_id);
+ EXPECT_EQ(rtc::ToString<uint32>(kSsrcOfTrack), ssrc_id);
std::string track_id = ExtractSsrcStatsValue(
reports, StatsReport::kStatsValueNameTrackId);
@@ -855,11 +855,11 @@
webrtc::StatsCollector stats(&session_); // Implementation under test.
// Ignore unused callback (logspam).
EXPECT_CALL(session_, GetTransport(_))
- .WillOnce(Return(static_cast<cricket::Transport*>(NULL)));
+ .WillRepeatedly(Return(static_cast<cricket::Transport*>(NULL)));
MockVideoMediaChannel* media_channel = new MockVideoMediaChannel();
// The content_name known by the video channel.
const std::string kVcName("vcname");
- cricket::VideoChannel video_channel(talk_base::Thread::Current(),
+ cricket::VideoChannel video_channel(rtc::Thread::Current(),
media_engine_, media_channel, &session_, kVcName, false, NULL);
AddOutgoingVideoTrackStats();
stats.AddStream(stream_);
@@ -905,7 +905,7 @@
MockVideoMediaChannel* media_channel = new MockVideoMediaChannel();
// The content_name known by the video channel.
const std::string kVcName("vcname");
- cricket::VideoChannel video_channel(talk_base::Thread::Current(),
+ cricket::VideoChannel video_channel(rtc::Thread::Current(),
media_engine_, media_channel, &session_, kVcName, false, NULL);
AddOutgoingVideoTrackStats();
stats.AddStream(stream_);
@@ -927,11 +927,11 @@
webrtc::StatsCollector stats(&session_); // Implementation under test.
// Ignore unused callback (logspam).
EXPECT_CALL(session_, GetTransport(_))
- .WillOnce(Return(static_cast<cricket::Transport*>(NULL)));
+ .WillRepeatedly(Return(static_cast<cricket::Transport*>(NULL)));
MockVideoMediaChannel* media_channel = new MockVideoMediaChannel();
// The content_name known by the video channel.
const std::string kVcName("vcname");
- cricket::VideoChannel video_channel(talk_base::Thread::Current(),
+ cricket::VideoChannel video_channel(rtc::Thread::Current(),
media_engine_, media_channel, &session_, kVcName, false, NULL);
AddOutgoingVideoTrackStats();
stats.AddStream(stream_);
@@ -974,7 +974,7 @@
TEST_F(StatsCollectorTest, ReportsFromRemoteTrack) {
webrtc::StatsCollector stats(&session_); // Implementation under test.
MockVideoMediaChannel* media_channel = new MockVideoMediaChannel();
- cricket::VideoChannel video_channel(talk_base::Thread::Current(),
+ cricket::VideoChannel video_channel(rtc::Thread::Current(),
media_engine_, media_channel, &session_, "", false, NULL);
AddIncomingVideoTrackStats();
stats.AddStream(stream_);
@@ -1007,7 +1007,7 @@
std::string ssrc_id = ExtractSsrcStatsValue(
reports, StatsReport::kStatsValueNameSsrc);
- EXPECT_EQ(talk_base::ToString<uint32>(kSsrcOfTrack), ssrc_id);
+ EXPECT_EQ(rtc::ToString<uint32>(kSsrcOfTrack), ssrc_id);
std::string track_id = ExtractSsrcStatsValue(
reports, StatsReport::kStatsValueNameTrackId);
@@ -1024,7 +1024,7 @@
local_ders[2] = "some";
local_ders[3] = "der";
local_ders[4] = "values";
- talk_base::FakeSSLCertificate local_cert(DersToPems(local_ders));
+ rtc::FakeSSLCertificate local_cert(DersToPems(local_ders));
// Build remote certificate chain
std::vector<std::string> remote_ders(4);
@@ -1032,7 +1032,7 @@
remote_ders[1] = "non-";
remote_ders[2] = "intersecting";
remote_ders[3] = "set";
- talk_base::FakeSSLCertificate remote_cert(DersToPems(remote_ders));
+ rtc::FakeSSLCertificate remote_cert(DersToPems(remote_ders));
TestCertificateReports(local_cert, local_ders, remote_cert, remote_ders);
}
@@ -1042,11 +1042,11 @@
TEST_F(StatsCollectorTest, ChainlessCertificateReportsCreated) {
// Build local certificate.
std::string local_der = "This is the local der.";
- talk_base::FakeSSLCertificate local_cert(DerToPem(local_der));
+ rtc::FakeSSLCertificate local_cert(DerToPem(local_der));
// Build remote certificate.
std::string remote_der = "This is somebody else's der.";
- talk_base::FakeSSLCertificate remote_cert(DerToPem(remote_der));
+ rtc::FakeSSLCertificate remote_cert(DerToPem(remote_der));
TestCertificateReports(local_cert, std::vector<std::string>(1, local_der),
remote_cert, std::vector<std::string>(1, remote_der));
@@ -1072,7 +1072,7 @@
// Configure MockWebRtcSession
EXPECT_CALL(session_, GetTransport(transport_stats.content_name))
- .WillOnce(ReturnNull());
+ .WillRepeatedly(ReturnNull());
EXPECT_CALL(session_, GetStats(_))
.WillOnce(DoAll(SetArgPointee<0>(session_stats),
Return(true)));
@@ -1117,7 +1117,7 @@
transport_stats;
// Fake transport object.
- talk_base::scoped_ptr<cricket::FakeTransport> transport(
+ rtc::scoped_ptr<cricket::FakeTransport> transport(
new cricket::FakeTransport(
session_.signaling_thread(),
session_.worker_thread(),
@@ -1125,7 +1125,7 @@
// Configure MockWebRtcSession
EXPECT_CALL(session_, GetTransport(transport_stats.content_name))
- .WillOnce(Return(transport.get()));
+ .WillRepeatedly(Return(transport.get()));
EXPECT_CALL(session_, GetStats(_))
.WillOnce(DoAll(SetArgPointee<0>(session_stats),
Return(true)));
@@ -1155,11 +1155,11 @@
TEST_F(StatsCollectorTest, UnsupportedDigestIgnored) {
// Build a local certificate.
std::string local_der = "This is the local der.";
- talk_base::FakeSSLCertificate local_cert(DerToPem(local_der));
+ rtc::FakeSSLCertificate local_cert(DerToPem(local_der));
// Build a remote certificate with an unsupported digest algorithm.
std::string remote_der = "This is somebody else's der.";
- talk_base::FakeSSLCertificate remote_cert(DerToPem(remote_der));
+ rtc::FakeSSLCertificate remote_cert(DerToPem(remote_der));
remote_cert.set_digest_algorithm("foobar");
TestCertificateReports(local_cert, std::vector<std::string>(1, local_der),
@@ -1171,7 +1171,7 @@
TEST_F(StatsCollectorTest, StatsOutputLevelVerbose) {
webrtc::StatsCollector stats(&session_); // Implementation under test.
MockVideoMediaChannel* media_channel = new MockVideoMediaChannel();
- cricket::VideoChannel video_channel(talk_base::Thread::Current(),
+ cricket::VideoChannel video_channel(rtc::Thread::Current(),
media_engine_, media_channel, &session_, "", false, NULL);
cricket::VideoMediaInfo stats_read;
@@ -1217,12 +1217,12 @@
webrtc::StatsCollector stats(&session_); // Implementation under test.
// Ignore unused callback (logspam).
EXPECT_CALL(session_, GetTransport(_))
- .WillOnce(Return(static_cast<cricket::Transport*>(NULL)));
+ .WillRepeatedly(Return(static_cast<cricket::Transport*>(NULL)));
MockVoiceMediaChannel* media_channel = new MockVoiceMediaChannel();
// The content_name known by the voice channel.
const std::string kVcName("vcname");
- cricket::VoiceChannel voice_channel(talk_base::Thread::Current(),
+ cricket::VoiceChannel voice_channel(rtc::Thread::Current(),
media_engine_, media_channel, &session_, kVcName, false);
AddOutgoingAudioTrackStats();
stats.AddStream(stream_);
@@ -1250,11 +1250,11 @@
webrtc::StatsCollector stats(&session_); // Implementation under test.
// Ignore unused callback (logspam).
EXPECT_CALL(session_, GetTransport(_))
- .WillOnce(Return(static_cast<cricket::Transport*>(NULL)));
+ .WillRepeatedly(Return(static_cast<cricket::Transport*>(NULL)));
MockVoiceMediaChannel* media_channel = new MockVoiceMediaChannel();
// The content_name known by the voice channel.
const std::string kVcName("vcname");
- cricket::VoiceChannel voice_channel(talk_base::Thread::Current(),
+ cricket::VoiceChannel voice_channel(rtc::Thread::Current(),
media_engine_, media_channel, &session_, kVcName, false);
AddIncomingAudioTrackStats();
stats.AddStream(stream_);
@@ -1276,11 +1276,11 @@
webrtc::StatsCollector stats(&session_); // Implementation under test.
// Ignore unused callback (logspam).
EXPECT_CALL(session_, GetTransport(_))
- .WillOnce(Return(static_cast<cricket::Transport*>(NULL)));
+ .WillRepeatedly(Return(static_cast<cricket::Transport*>(NULL)));
MockVoiceMediaChannel* media_channel = new MockVoiceMediaChannel();
// The content_name known by the voice channel.
const std::string kVcName("vcname");
- cricket::VoiceChannel voice_channel(talk_base::Thread::Current(),
+ cricket::VoiceChannel voice_channel(rtc::Thread::Current(),
media_engine_, media_channel, &session_, kVcName, false);
AddOutgoingAudioTrackStats();
stats.AddStream(stream_);
@@ -1319,7 +1319,7 @@
EXPECT_EQ(kLocalTrackId, track_id);
std::string ssrc_id = ExtractSsrcStatsValue(
reports, StatsReport::kStatsValueNameSsrc);
- EXPECT_EQ(talk_base::ToString<uint32>(kSsrcOfTrack), ssrc_id);
+ EXPECT_EQ(rtc::ToString<uint32>(kSsrcOfTrack), ssrc_id);
// Verifies the values in the track report, no value will be changed by the
// AudioTrackInterface::GetSignalValue() and
@@ -1333,11 +1333,11 @@
webrtc::StatsCollector stats(&session_); // Implementation under test.
// Ignore unused callback (logspam).
EXPECT_CALL(session_, GetTransport(_))
- .WillOnce(Return(static_cast<cricket::Transport*>(NULL)));
+ .WillRepeatedly(Return(static_cast<cricket::Transport*>(NULL)));
MockVoiceMediaChannel* media_channel = new MockVoiceMediaChannel();
// The content_name known by the voice channel.
const std::string kVcName("vcname");
- cricket::VoiceChannel voice_channel(talk_base::Thread::Current(),
+ cricket::VoiceChannel voice_channel(rtc::Thread::Current(),
media_engine_, media_channel, &session_, kVcName, false);
// Create a local stream with a local audio track and adds it to the stats.
@@ -1346,10 +1346,10 @@
stats.AddLocalAudioTrack(audio_track_.get(), kSsrcOfTrack);
// Create a remote stream with a remote audio track and adds it to the stats.
- talk_base::scoped_refptr<webrtc::MediaStream> remote_stream(
+ rtc::scoped_refptr<webrtc::MediaStream> remote_stream(
webrtc::MediaStream::Create("remotestreamlabel"));
- talk_base::scoped_refptr<FakeAudioTrack> remote_track(
- new talk_base::RefCountedObject<FakeAudioTrack>(kRemoteTrackId));
+ rtc::scoped_refptr<FakeAudioTrack> remote_track(
+ new rtc::RefCountedObject<FakeAudioTrack>(kRemoteTrackId));
EXPECT_CALL(session_, GetRemoteTrackIdBySsrc(kSsrcOfTrack, _))
.WillOnce(DoAll(SetArgPointee<1>(kRemoteTrackId), Return(true)));
remote_stream->AddTrack(remote_track);
@@ -1418,7 +1418,7 @@
MockVoiceMediaChannel* media_channel = new MockVoiceMediaChannel();
// The content_name known by the voice channel.
const std::string kVcName("vcname");
- cricket::VoiceChannel voice_channel(talk_base::Thread::Current(),
+ cricket::VoiceChannel voice_channel(rtc::Thread::Current(),
media_engine_, media_channel, &session_, kVcName, false);
// Create a local stream with a local audio track and adds it to the stats.
@@ -1441,8 +1441,8 @@
// Create a new audio track and adds it to the stream and stats.
static const std::string kNewTrackId = "new_track_id";
- talk_base::scoped_refptr<FakeAudioTrack> new_audio_track(
- new talk_base::RefCountedObject<FakeAudioTrack>(kNewTrackId));
+ rtc::scoped_refptr<FakeAudioTrack> new_audio_track(
+ new rtc::RefCountedObject<FakeAudioTrack>(kNewTrackId));
EXPECT_CALL(session_, GetLocalTrackIdBySsrc(kSsrcOfTrack, _))
.WillOnce(DoAll(SetArgPointee<1>(kNewTrackId), Return(true)));
stream_->AddTrack(new_audio_track);
diff --git a/app/webrtc/statstypes.h b/app/webrtc/statstypes.h
index 828b9f5..2b1317a 100644
--- a/app/webrtc/statstypes.h
+++ b/app/webrtc/statstypes.h
@@ -34,8 +34,8 @@
#include <string>
#include <vector>
-#include "talk/base/basictypes.h"
-#include "talk/base/stringencode.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/stringencode.h"
namespace webrtc {
diff --git a/app/webrtc/streamcollection.h b/app/webrtc/streamcollection.h
index 7796b42..0db59a3 100644
--- a/app/webrtc/streamcollection.h
+++ b/app/webrtc/streamcollection.h
@@ -38,16 +38,16 @@
// Implementation of StreamCollection.
class StreamCollection : public StreamCollectionInterface {
public:
- static talk_base::scoped_refptr<StreamCollection> Create() {
- talk_base::RefCountedObject<StreamCollection>* implementation =
- new talk_base::RefCountedObject<StreamCollection>();
+ static rtc::scoped_refptr<StreamCollection> Create() {
+ rtc::RefCountedObject<StreamCollection>* implementation =
+ new rtc::RefCountedObject<StreamCollection>();
return implementation;
}
- static talk_base::scoped_refptr<StreamCollection> Create(
+ static rtc::scoped_refptr<StreamCollection> Create(
StreamCollection* streams) {
- talk_base::RefCountedObject<StreamCollection>* implementation =
- new talk_base::RefCountedObject<StreamCollection>(streams);
+ rtc::RefCountedObject<StreamCollection>* implementation =
+ new rtc::RefCountedObject<StreamCollection>(streams);
return implementation;
}
@@ -115,7 +115,7 @@
explicit StreamCollection(StreamCollection* original)
: media_streams_(original->media_streams_) {
}
- typedef std::vector<talk_base::scoped_refptr<MediaStreamInterface> >
+ typedef std::vector<rtc::scoped_refptr<MediaStreamInterface> >
StreamVector;
StreamVector media_streams_;
};
diff --git a/app/webrtc/test/fakeaudiocapturemodule.cc b/app/webrtc/test/fakeaudiocapturemodule.cc
index ec155cb..ff45f14 100644
--- a/app/webrtc/test/fakeaudiocapturemodule.cc
+++ b/app/webrtc/test/fakeaudiocapturemodule.cc
@@ -27,10 +27,10 @@
#include "talk/app/webrtc/test/fakeaudiocapturemodule.h"
-#include "talk/base/common.h"
-#include "talk/base/refcount.h"
-#include "talk/base/thread.h"
-#include "talk/base/timeutils.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/refcount.h"
+#include "webrtc/base/thread.h"
+#include "webrtc/base/timeutils.h"
// Audio sample value that is high enough that it doesn't occur naturally when
// frames are being faked. E.g. NetEq will not generate this large sample value
@@ -58,7 +58,7 @@
};
FakeAudioCaptureModule::FakeAudioCaptureModule(
- talk_base::Thread* process_thread)
+ rtc::Thread* process_thread)
: last_process_time_ms_(0),
audio_callback_(NULL),
recording_(false),
@@ -77,12 +77,12 @@
process_thread_->Send(this, MSG_STOP_PROCESS);
}
-talk_base::scoped_refptr<FakeAudioCaptureModule> FakeAudioCaptureModule::Create(
- talk_base::Thread* process_thread) {
+rtc::scoped_refptr<FakeAudioCaptureModule> FakeAudioCaptureModule::Create(
+ rtc::Thread* process_thread) {
if (process_thread == NULL) return NULL;
- talk_base::scoped_refptr<FakeAudioCaptureModule> capture_module(
- new talk_base::RefCountedObject<FakeAudioCaptureModule>(process_thread));
+ rtc::scoped_refptr<FakeAudioCaptureModule> capture_module(
+ new rtc::RefCountedObject<FakeAudioCaptureModule>(process_thread));
if (!capture_module->Initialize()) {
return NULL;
}
@@ -90,7 +90,7 @@
}
int FakeAudioCaptureModule::frames_received() const {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
return frames_received_;
}
@@ -102,7 +102,7 @@
}
int32_t FakeAudioCaptureModule::TimeUntilNextProcess() {
- const uint32 current_time = talk_base::Time();
+ const uint32 current_time = rtc::Time();
if (current_time < last_process_time_ms_) {
// TODO: wraparound could be handled more gracefully.
return 0;
@@ -115,7 +115,7 @@
}
int32_t FakeAudioCaptureModule::Process() {
- last_process_time_ms_ = talk_base::Time();
+ last_process_time_ms_ = rtc::Time();
return 0;
}
@@ -144,7 +144,7 @@
int32_t FakeAudioCaptureModule::RegisterAudioCallback(
webrtc::AudioTransport* audio_callback) {
- talk_base::CritScope cs(&crit_callback_);
+ rtc::CritScope cs(&crit_callback_);
audio_callback_ = audio_callback;
return 0;
}
@@ -249,7 +249,7 @@
return -1;
}
{
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
playing_ = true;
}
bool start = true;
@@ -260,7 +260,7 @@
int32_t FakeAudioCaptureModule::StopPlayout() {
bool start = false;
{
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
playing_ = false;
start = ShouldStartProcessing();
}
@@ -269,7 +269,7 @@
}
bool FakeAudioCaptureModule::Playing() const {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
return playing_;
}
@@ -278,7 +278,7 @@
return -1;
}
{
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
recording_ = true;
}
bool start = true;
@@ -289,7 +289,7 @@
int32_t FakeAudioCaptureModule::StopRecording() {
bool start = false;
{
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
recording_ = false;
start = ShouldStartProcessing();
}
@@ -298,7 +298,7 @@
}
bool FakeAudioCaptureModule::Recording() const {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
return recording_;
}
@@ -397,13 +397,13 @@
}
int32_t FakeAudioCaptureModule::SetMicrophoneVolume(uint32_t volume) {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
current_mic_level_ = volume;
return 0;
}
int32_t FakeAudioCaptureModule::MicrophoneVolume(uint32_t* volume) const {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
*volume = current_mic_level_;
return 0;
}
@@ -617,7 +617,7 @@
return 0;
}
-void FakeAudioCaptureModule::OnMessage(talk_base::Message* msg) {
+void FakeAudioCaptureModule::OnMessage(rtc::Message* msg) {
switch (msg->message_id) {
case MSG_START_PROCESS:
StartProcessP();
@@ -641,7 +641,7 @@
// sent to it. Note that the audio processing pipeline will likely distort the
// original signal.
SetSendBuffer(kHighSampleValue);
- last_process_time_ms_ = talk_base::Time();
+ last_process_time_ms_ = rtc::Time();
return true;
}
@@ -681,7 +681,7 @@
}
void FakeAudioCaptureModule::StartProcessP() {
- ASSERT(talk_base::Thread::Current() == process_thread_);
+ ASSERT(rtc::Thread::Current() == process_thread_);
if (started_) {
// Already started.
return;
@@ -690,16 +690,16 @@
}
void FakeAudioCaptureModule::ProcessFrameP() {
- ASSERT(talk_base::Thread::Current() == process_thread_);
+ ASSERT(rtc::Thread::Current() == process_thread_);
if (!started_) {
- next_frame_time_ = talk_base::Time();
+ next_frame_time_ = rtc::Time();
started_ = true;
}
bool playing;
bool recording;
{
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
playing = playing_;
recording = recording_;
}
@@ -713,16 +713,16 @@
}
next_frame_time_ += kTimePerFrameMs;
- const uint32 current_time = talk_base::Time();
+ const uint32 current_time = rtc::Time();
const uint32 wait_time = (next_frame_time_ > current_time) ?
next_frame_time_ - current_time : 0;
process_thread_->PostDelayed(wait_time, this, MSG_RUN_PROCESS);
}
void FakeAudioCaptureModule::ReceiveFrameP() {
- ASSERT(talk_base::Thread::Current() == process_thread_);
+ ASSERT(rtc::Thread::Current() == process_thread_);
{
- talk_base::CritScope cs(&crit_callback_);
+ rtc::CritScope cs(&crit_callback_);
if (!audio_callback_) {
return;
}
@@ -753,14 +753,14 @@
// has been received from the remote side (i.e. faked frames are not being
// pulled).
if (CheckRecBuffer(kHighSampleValue)) {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
++frames_received_;
}
}
void FakeAudioCaptureModule::SendFrameP() {
- ASSERT(talk_base::Thread::Current() == process_thread_);
- talk_base::CritScope cs(&crit_callback_);
+ ASSERT(rtc::Thread::Current() == process_thread_);
+ rtc::CritScope cs(&crit_callback_);
if (!audio_callback_) {
return;
}
@@ -780,7 +780,7 @@
}
void FakeAudioCaptureModule::StopProcessP() {
- ASSERT(talk_base::Thread::Current() == process_thread_);
+ ASSERT(rtc::Thread::Current() == process_thread_);
started_ = false;
process_thread_->Clear(this);
}
diff --git a/app/webrtc/test/fakeaudiocapturemodule.h b/app/webrtc/test/fakeaudiocapturemodule.h
index 2267902..aec3e5e 100644
--- a/app/webrtc/test/fakeaudiocapturemodule.h
+++ b/app/webrtc/test/fakeaudiocapturemodule.h
@@ -37,22 +37,22 @@
#ifndef TALK_APP_WEBRTC_TEST_FAKEAUDIOCAPTUREMODULE_H_
#define TALK_APP_WEBRTC_TEST_FAKEAUDIOCAPTUREMODULE_H_
-#include "talk/base/basictypes.h"
-#include "talk/base/criticalsection.h"
-#include "talk/base/messagehandler.h"
-#include "talk/base/scoped_ref_ptr.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/criticalsection.h"
+#include "webrtc/base/messagehandler.h"
+#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/common_types.h"
#include "webrtc/modules/audio_device/include/audio_device.h"
-namespace talk_base {
+namespace rtc {
class Thread;
-} // namespace talk_base
+} // namespace rtc
class FakeAudioCaptureModule
: public webrtc::AudioDeviceModule,
- public talk_base::MessageHandler {
+ public rtc::MessageHandler {
public:
typedef uint16 Sample;
@@ -64,8 +64,8 @@
// Creates a FakeAudioCaptureModule or returns NULL on failure.
// |process_thread| is used to push and pull audio frames to and from the
// returned instance. Note: ownership of |process_thread| is not handed over.
- static talk_base::scoped_refptr<FakeAudioCaptureModule> Create(
- talk_base::Thread* process_thread);
+ static rtc::scoped_refptr<FakeAudioCaptureModule> Create(
+ rtc::Thread* process_thread);
// Returns the number of frames that have been successfully pulled by the
// instance. Note that correctly detecting success can only be done if the
@@ -201,8 +201,8 @@
virtual int32_t GetLoudspeakerStatus(bool* enabled) const;
// End of functions inherited from webrtc::AudioDeviceModule.
- // The following function is inherited from talk_base::MessageHandler.
- virtual void OnMessage(talk_base::Message* msg);
+ // The following function is inherited from rtc::MessageHandler.
+ virtual void OnMessage(rtc::Message* msg);
protected:
// The constructor is protected because the class needs to be created as a
@@ -210,7 +210,7 @@
// exposed in which case the burden of proper instantiation would be put on
// the creator of a FakeAudioCaptureModule instance. To create an instance of
// this class use the Create(..) API.
- explicit FakeAudioCaptureModule(talk_base::Thread* process_thread);
+ explicit FakeAudioCaptureModule(rtc::Thread* process_thread);
// The destructor is protected because it is reference counted and should not
// be deleted directly.
virtual ~FakeAudioCaptureModule();
@@ -271,7 +271,7 @@
uint32 next_frame_time_;
// User provided thread context.
- talk_base::Thread* process_thread_;
+ rtc::Thread* process_thread_;
// Buffer for storing samples received from the webrtc::AudioTransport.
char rec_buffer_[kNumberSamples * kNumberBytesPerSample];
@@ -285,10 +285,10 @@
// Protects variables that are accessed from process_thread_ and
// the main thread.
- mutable talk_base::CriticalSection crit_;
+ mutable rtc::CriticalSection crit_;
// Protects |audio_callback_| that is accessed from process_thread_ and
// the main thread.
- talk_base::CriticalSection crit_callback_;
+ rtc::CriticalSection crit_callback_;
};
#endif // TALK_APP_WEBRTC_TEST_FAKEAUDIOCAPTUREMODULE_H_
diff --git a/app/webrtc/test/fakeaudiocapturemodule_unittest.cc b/app/webrtc/test/fakeaudiocapturemodule_unittest.cc
index bdd70f6..9e63c1c 100644
--- a/app/webrtc/test/fakeaudiocapturemodule_unittest.cc
+++ b/app/webrtc/test/fakeaudiocapturemodule_unittest.cc
@@ -29,9 +29,9 @@
#include <algorithm>
-#include "talk/base/gunit.h"
-#include "talk/base/scoped_ref_ptr.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/scoped_ref_ptr.h"
+#include "webrtc/base/thread.h"
using std::min;
@@ -49,7 +49,7 @@
virtual void SetUp() {
fake_audio_capture_module_ = FakeAudioCaptureModule::Create(
- talk_base::Thread::Current());
+ rtc::Thread::Current());
EXPECT_TRUE(fake_audio_capture_module_.get() != NULL);
}
@@ -109,7 +109,7 @@
int push_iterations() const { return push_iterations_; }
int pull_iterations() const { return pull_iterations_; }
- talk_base::scoped_refptr<FakeAudioCaptureModule> fake_audio_capture_module_;
+ rtc::scoped_refptr<FakeAudioCaptureModule> fake_audio_capture_module_;
private:
bool RecordedDataReceived() const {
diff --git a/app/webrtc/test/fakeconstraints.h b/app/webrtc/test/fakeconstraints.h
index b23007e..f1b7f77 100644
--- a/app/webrtc/test/fakeconstraints.h
+++ b/app/webrtc/test/fakeconstraints.h
@@ -32,7 +32,7 @@
#include <vector>
#include "talk/app/webrtc/mediaconstraintsinterface.h"
-#include "talk/base/stringencode.h"
+#include "webrtc/base/stringencode.h"
namespace webrtc {
@@ -51,7 +51,7 @@
template <class T>
void AddMandatory(const std::string& key, const T& value) {
- mandatory_.push_back(Constraint(key, talk_base::ToString<T>(value)));
+ mandatory_.push_back(Constraint(key, rtc::ToString<T>(value)));
}
template <class T>
@@ -66,12 +66,12 @@
}
}
}
- mandatory_.push_back(Constraint(key, talk_base::ToString<T>(value)));
+ mandatory_.push_back(Constraint(key, rtc::ToString<T>(value)));
}
template <class T>
void AddOptional(const std::string& key, const T& value) {
- optional_.push_back(Constraint(key, talk_base::ToString<T>(value)));
+ optional_.push_back(Constraint(key, rtc::ToString<T>(value)));
}
void SetMandatoryMinAspectRatio(double ratio) {
diff --git a/app/webrtc/test/fakedatachannelprovider.h b/app/webrtc/test/fakedatachannelprovider.h
index 053b3ac..2e71f94 100644
--- a/app/webrtc/test/fakedatachannelprovider.h
+++ b/app/webrtc/test/fakedatachannelprovider.h
@@ -37,7 +37,7 @@
virtual ~FakeDataChannelProvider() {}
virtual bool SendData(const cricket::SendDataParams& params,
- const talk_base::Buffer& payload,
+ const rtc::Buffer& payload,
cricket::SendDataResult* result) OVERRIDE {
ASSERT(ready_to_send_ && transport_available_);
if (send_blocked_) {
@@ -45,7 +45,7 @@
return false;
}
- if (transport_error_) {
+ if (transport_error_ || payload.length() == 0) {
*result = cricket::SDR_ERROR;
return false;
}
diff --git a/app/webrtc/test/fakedtlsidentityservice.h b/app/webrtc/test/fakedtlsidentityservice.h
index 0c1a2a0..57ffcf6 100644
--- a/app/webrtc/test/fakedtlsidentityservice.h
+++ b/app/webrtc/test/fakedtlsidentityservice.h
@@ -65,7 +65,7 @@
using webrtc::DTLSIdentityRequestObserver;
class FakeIdentityService : public webrtc::DTLSIdentityServiceInterface,
- public talk_base::MessageHandler {
+ public rtc::MessageHandler {
public:
struct Request {
Request(const std::string& common_name,
@@ -73,9 +73,9 @@
: common_name(common_name), observer(observer) {}
std::string common_name;
- talk_base::scoped_refptr<DTLSIdentityRequestObserver> observer;
+ rtc::scoped_refptr<DTLSIdentityRequestObserver> observer;
};
- typedef talk_base::TypedMessageData<Request> MessageData;
+ typedef rtc::TypedMessageData<Request> MessageData;
FakeIdentityService() : should_fail_(false) {}
@@ -89,9 +89,9 @@
DTLSIdentityRequestObserver* observer) {
MessageData* msg = new MessageData(Request(common_name, observer));
if (should_fail_) {
- talk_base::Thread::Current()->Post(this, MSG_FAILURE, msg);
+ rtc::Thread::Current()->Post(this, MSG_FAILURE, msg);
} else {
- talk_base::Thread::Current()->Post(this, MSG_SUCCESS, msg);
+ rtc::Thread::Current()->Post(this, MSG_SUCCESS, msg);
}
return true;
}
@@ -102,8 +102,8 @@
MSG_FAILURE,
};
- // talk_base::MessageHandler implementation.
- void OnMessage(talk_base::Message* msg) {
+ // rtc::MessageHandler implementation.
+ void OnMessage(rtc::Message* msg) {
FakeIdentityService::MessageData* message_data =
static_cast<FakeIdentityService::MessageData*>(msg->pdata);
DTLSIdentityRequestObserver* observer = message_data->data().observer.get();
@@ -125,8 +125,8 @@
const std::string& common_name,
std::string* der_cert,
std::string* der_key) {
- talk_base::SSLIdentity::PemToDer("CERTIFICATE", kCERT_PEM, der_cert);
- talk_base::SSLIdentity::PemToDer("RSA PRIVATE KEY",
+ rtc::SSLIdentity::PemToDer("CERTIFICATE", kCERT_PEM, der_cert);
+ rtc::SSLIdentity::PemToDer("RSA PRIVATE KEY",
kRSA_PRIVATE_KEY_PEM,
der_key);
}
diff --git a/app/webrtc/test/fakemediastreamsignaling.h b/app/webrtc/test/fakemediastreamsignaling.h
index c7b30aa..bd12549 100644
--- a/app/webrtc/test/fakemediastreamsignaling.h
+++ b/app/webrtc/test/fakemediastreamsignaling.h
@@ -45,7 +45,7 @@
public webrtc::MediaStreamSignalingObserver {
public:
explicit FakeMediaStreamSignaling(cricket::ChannelManager* channel_manager) :
- webrtc::MediaStreamSignaling(talk_base::Thread::Current(), this,
+ webrtc::MediaStreamSignaling(rtc::Thread::Current(), this,
channel_manager) {
}
@@ -133,21 +133,21 @@
}
private:
- talk_base::scoped_refptr<webrtc::MediaStreamInterface> CreateStream(
+ rtc::scoped_refptr<webrtc::MediaStreamInterface> CreateStream(
const std::string& stream_label,
const std::string& audio_track_id,
const std::string& video_track_id) {
- talk_base::scoped_refptr<webrtc::MediaStreamInterface> stream(
+ rtc::scoped_refptr<webrtc::MediaStreamInterface> stream(
webrtc::MediaStream::Create(stream_label));
if (!audio_track_id.empty()) {
- talk_base::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
+ rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
webrtc::AudioTrack::Create(audio_track_id, NULL));
stream->AddTrack(audio_track);
}
if (!video_track_id.empty()) {
- talk_base::scoped_refptr<webrtc::VideoTrackInterface> video_track(
+ rtc::scoped_refptr<webrtc::VideoTrackInterface> video_track(
webrtc::VideoTrack::Create(video_track_id, NULL));
stream->AddTrack(video_track);
}
diff --git a/app/webrtc/test/fakeperiodicvideocapturer.h b/app/webrtc/test/fakeperiodicvideocapturer.h
index 7f70ae2..3538840 100644
--- a/app/webrtc/test/fakeperiodicvideocapturer.h
+++ b/app/webrtc/test/fakeperiodicvideocapturer.h
@@ -31,7 +31,7 @@
#ifndef TALK_APP_WEBRTC_TEST_FAKEPERIODICVIDEOCAPTURER_H_
#define TALK_APP_WEBRTC_TEST_FAKEPERIODICVIDEOCAPTURER_H_
-#include "talk/base/thread.h"
+#include "webrtc/base/thread.h"
#include "talk/media/base/fakevideocapturer.h"
namespace webrtc {
@@ -56,20 +56,20 @@
virtual cricket::CaptureState Start(const cricket::VideoFormat& format) {
cricket::CaptureState state = FakeVideoCapturer::Start(format);
if (state != cricket::CS_FAILED) {
- talk_base::Thread::Current()->Post(this, MSG_CREATEFRAME);
+ rtc::Thread::Current()->Post(this, MSG_CREATEFRAME);
}
return state;
}
virtual void Stop() {
- talk_base::Thread::Current()->Clear(this);
+ rtc::Thread::Current()->Clear(this);
}
// Inherited from MesageHandler.
- virtual void OnMessage(talk_base::Message* msg) {
+ virtual void OnMessage(rtc::Message* msg) {
if (msg->message_id == MSG_CREATEFRAME) {
if (IsRunning()) {
CaptureFrame();
- talk_base::Thread::Current()->PostDelayed(static_cast<int>(
- GetCaptureFormat()->interval / talk_base::kNumNanosecsPerMillisec),
+ rtc::Thread::Current()->PostDelayed(static_cast<int>(
+ GetCaptureFormat()->interval / rtc::kNumNanosecsPerMillisec),
this, MSG_CREATEFRAME);
}
} else {
diff --git a/app/webrtc/test/fakevideotrackrenderer.h b/app/webrtc/test/fakevideotrackrenderer.h
index 0030a0c..5cb67a3 100644
--- a/app/webrtc/test/fakevideotrackrenderer.h
+++ b/app/webrtc/test/fakevideotrackrenderer.h
@@ -62,7 +62,7 @@
private:
cricket::FakeVideoRenderer fake_renderer_;
- talk_base::scoped_refptr<VideoTrackInterface> video_track_;
+ rtc::scoped_refptr<VideoTrackInterface> video_track_;
};
} // namespace webrtc
diff --git a/app/webrtc/test/mockpeerconnectionobservers.h b/app/webrtc/test/mockpeerconnectionobservers.h
index 3ae2162..884c7a8 100644
--- a/app/webrtc/test/mockpeerconnectionobservers.h
+++ b/app/webrtc/test/mockpeerconnectionobservers.h
@@ -61,7 +61,7 @@
private:
bool called_;
bool result_;
- talk_base::scoped_ptr<SessionDescriptionInterface> desc_;
+ rtc::scoped_ptr<SessionDescriptionInterface> desc_;
};
class MockSetSessionDescriptionObserver
@@ -109,7 +109,7 @@
size_t received_message_count() const { return received_message_count_; }
private:
- talk_base::scoped_refptr<webrtc::DataChannelInterface> channel_;
+ rtc::scoped_refptr<webrtc::DataChannelInterface> channel_;
DataChannelInterface::DataState state_;
std::string last_message_;
size_t received_message_count_;
@@ -159,7 +159,7 @@
reports_[i].values.begin();
for (; it != reports_[i].values.end(); ++it) {
if (it->name == name) {
- return talk_base::FromString<int>(it->value);
+ return rtc::FromString<int>(it->value);
}
}
}
diff --git a/app/webrtc/test/peerconnectiontestwrapper.cc b/app/webrtc/test/peerconnectiontestwrapper.cc
index be70969..8a4f45c 100644
--- a/app/webrtc/test/peerconnectiontestwrapper.cc
+++ b/app/webrtc/test/peerconnectiontestwrapper.cc
@@ -31,7 +31,7 @@
#include "talk/app/webrtc/test/mockpeerconnectionobservers.h"
#include "talk/app/webrtc/test/peerconnectiontestwrapper.h"
#include "talk/app/webrtc/videosourceinterface.h"
-#include "talk/base/gunit.h"
+#include "webrtc/base/gunit.h"
static const char kStreamLabelBase[] = "stream_label";
static const char kVideoTrackLabelBase[] = "video_track";
@@ -83,7 +83,7 @@
}
peer_connection_factory_ = webrtc::CreatePeerConnectionFactory(
- talk_base::Thread::Current(), talk_base::Thread::Current(),
+ rtc::Thread::Current(), rtc::Thread::Current(),
fake_audio_capture_module_, NULL, NULL);
if (!peer_connection_factory_) {
return false;
@@ -95,7 +95,7 @@
ice_server.uri = "stun:stun.l.google.com:19302";
ice_servers.push_back(ice_server);
FakeIdentityService* dtls_service =
- talk_base::SSLStreamAdapter::HaveDtlsSrtp() ?
+ rtc::SSLStreamAdapter::HaveDtlsSrtp() ?
new FakeIdentityService() : NULL;
peer_connection_ = peer_connection_factory_->CreatePeerConnection(
ice_servers, constraints, allocator_factory_.get(), dtls_service, this);
@@ -103,7 +103,7 @@
return peer_connection_.get() != NULL;
}
-talk_base::scoped_refptr<webrtc::DataChannelInterface>
+rtc::scoped_refptr<webrtc::DataChannelInterface>
PeerConnectionTestWrapper::CreateDataChannel(
const std::string& label,
const webrtc::DataChannelInit& init) {
@@ -136,7 +136,7 @@
void PeerConnectionTestWrapper::OnSuccess(SessionDescriptionInterface* desc) {
// This callback should take the ownership of |desc|.
- talk_base::scoped_ptr<SessionDescriptionInterface> owned_desc(desc);
+ rtc::scoped_ptr<SessionDescriptionInterface> owned_desc(desc);
std::string sdp;
EXPECT_TRUE(desc->ToString(&sdp));
@@ -179,8 +179,8 @@
LOG(LS_INFO) << "PeerConnectionTestWrapper " << name_
<< ": SetLocalDescription " << type << " " << sdp;
- talk_base::scoped_refptr<MockSetSessionDescriptionObserver>
- observer(new talk_base::RefCountedObject<
+ rtc::scoped_refptr<MockSetSessionDescriptionObserver>
+ observer(new rtc::RefCountedObject<
MockSetSessionDescriptionObserver>());
peer_connection_->SetLocalDescription(
observer, webrtc::CreateSessionDescription(type, sdp, NULL));
@@ -191,8 +191,8 @@
LOG(LS_INFO) << "PeerConnectionTestWrapper " << name_
<< ": SetRemoteDescription " << type << " " << sdp;
- talk_base::scoped_refptr<MockSetSessionDescriptionObserver>
- observer(new talk_base::RefCountedObject<
+ rtc::scoped_refptr<MockSetSessionDescriptionObserver>
+ observer(new rtc::RefCountedObject<
MockSetSessionDescriptionObserver>());
peer_connection_->SetRemoteDescription(
observer, webrtc::CreateSessionDescription(type, sdp, NULL));
@@ -201,7 +201,7 @@
void PeerConnectionTestWrapper::AddIceCandidate(const std::string& sdp_mid,
int sdp_mline_index,
const std::string& candidate) {
- talk_base::scoped_ptr<webrtc::IceCandidateInterface> owned_candidate(
+ rtc::scoped_ptr<webrtc::IceCandidateInterface> owned_candidate(
webrtc::CreateIceCandidate(sdp_mid, sdp_mline_index, candidate, NULL));
EXPECT_TRUE(peer_connection_->AddIceCandidate(owned_candidate.get()));
}
@@ -252,19 +252,19 @@
void PeerConnectionTestWrapper::GetAndAddUserMedia(
bool audio, const webrtc::FakeConstraints& audio_constraints,
bool video, const webrtc::FakeConstraints& video_constraints) {
- talk_base::scoped_refptr<webrtc::MediaStreamInterface> stream =
+ rtc::scoped_refptr<webrtc::MediaStreamInterface> stream =
GetUserMedia(audio, audio_constraints, video, video_constraints);
EXPECT_TRUE(peer_connection_->AddStream(stream, NULL));
}
-talk_base::scoped_refptr<webrtc::MediaStreamInterface>
+rtc::scoped_refptr<webrtc::MediaStreamInterface>
PeerConnectionTestWrapper::GetUserMedia(
bool audio, const webrtc::FakeConstraints& audio_constraints,
bool video, const webrtc::FakeConstraints& video_constraints) {
std::string label = kStreamLabelBase +
- talk_base::ToString<int>(
+ rtc::ToString<int>(
static_cast<int>(peer_connection_->local_streams()->count()));
- talk_base::scoped_refptr<webrtc::MediaStreamInterface> stream =
+ rtc::scoped_refptr<webrtc::MediaStreamInterface> stream =
peer_connection_factory_->CreateLocalMediaStream(label);
if (audio) {
@@ -272,9 +272,9 @@
// Disable highpass filter so that we can get all the test audio frames.
constraints.AddMandatory(
MediaConstraintsInterface::kHighpassFilter, false);
- talk_base::scoped_refptr<webrtc::AudioSourceInterface> source =
+ rtc::scoped_refptr<webrtc::AudioSourceInterface> source =
peer_connection_factory_->CreateAudioSource(&constraints);
- talk_base::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
+ rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
peer_connection_factory_->CreateAudioTrack(kAudioTrackLabelBase,
source));
stream->AddTrack(audio_track);
@@ -285,11 +285,11 @@
FakeConstraints constraints = video_constraints;
constraints.SetMandatoryMaxFrameRate(10);
- talk_base::scoped_refptr<webrtc::VideoSourceInterface> source =
+ rtc::scoped_refptr<webrtc::VideoSourceInterface> source =
peer_connection_factory_->CreateVideoSource(
new webrtc::FakePeriodicVideoCapturer(), &constraints);
std::string videotrack_label = label + kVideoTrackLabelBase;
- talk_base::scoped_refptr<webrtc::VideoTrackInterface> video_track(
+ rtc::scoped_refptr<webrtc::VideoTrackInterface> video_track(
peer_connection_factory_->CreateVideoTrack(videotrack_label, source));
stream->AddTrack(video_track);
diff --git a/app/webrtc/test/peerconnectiontestwrapper.h b/app/webrtc/test/peerconnectiontestwrapper.h
index 05e9b62..f3477ce 100644
--- a/app/webrtc/test/peerconnectiontestwrapper.h
+++ b/app/webrtc/test/peerconnectiontestwrapper.h
@@ -32,8 +32,8 @@
#include "talk/app/webrtc/test/fakeaudiocapturemodule.h"
#include "talk/app/webrtc/test/fakeconstraints.h"
#include "talk/app/webrtc/test/fakevideotrackrenderer.h"
-#include "talk/base/sigslot.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/thread.h"
namespace webrtc {
class PortAllocatorFactoryInterface;
@@ -52,7 +52,7 @@
bool CreatePc(const webrtc::MediaConstraintsInterface* constraints);
- talk_base::scoped_refptr<webrtc::DataChannelInterface> CreateDataChannel(
+ rtc::scoped_refptr<webrtc::DataChannelInterface> CreateDataChannel(
const std::string& label,
const webrtc::DataChannelInit& init);
@@ -106,19 +106,19 @@
bool CheckForConnection();
bool CheckForAudio();
bool CheckForVideo();
- talk_base::scoped_refptr<webrtc::MediaStreamInterface> GetUserMedia(
+ rtc::scoped_refptr<webrtc::MediaStreamInterface> GetUserMedia(
bool audio, const webrtc::FakeConstraints& audio_constraints,
bool video, const webrtc::FakeConstraints& video_constraints);
std::string name_;
- talk_base::Thread audio_thread_;
- talk_base::scoped_refptr<webrtc::PortAllocatorFactoryInterface>
+ rtc::Thread audio_thread_;
+ rtc::scoped_refptr<webrtc::PortAllocatorFactoryInterface>
allocator_factory_;
- talk_base::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_;
- talk_base::scoped_refptr<webrtc::PeerConnectionFactoryInterface>
+ rtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_;
+ rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface>
peer_connection_factory_;
- talk_base::scoped_refptr<FakeAudioCaptureModule> fake_audio_capture_module_;
- talk_base::scoped_ptr<webrtc::FakeVideoTrackRenderer> renderer_;
+ rtc::scoped_refptr<FakeAudioCaptureModule> fake_audio_capture_module_;
+ rtc::scoped_ptr<webrtc::FakeVideoTrackRenderer> renderer_;
};
#endif // TALK_APP_WEBRTC_TEST_PEERCONNECTIONTESTWRAPPER_H_
diff --git a/app/webrtc/videosource.cc b/app/webrtc/videosource.cc
index eb4ab97..8770e6d 100644
--- a/app/webrtc/videosource.cc
+++ b/app/webrtc/videosource.cc
@@ -93,10 +93,10 @@
const MediaConstraintsInterface::Constraint& constraint,
cricket::VideoFormat* format_upper_limit) {
if (constraint.key == MediaConstraintsInterface::kMaxWidth) {
- int value = talk_base::FromString<int>(constraint.value);
+ int value = rtc::FromString<int>(constraint.value);
SetUpperLimit(value, &(format_upper_limit->width));
} else if (constraint.key == MediaConstraintsInterface::kMaxHeight) {
- int value = talk_base::FromString<int>(constraint.value);
+ int value = rtc::FromString<int>(constraint.value);
SetUpperLimit(value, &(format_upper_limit->height));
}
}
@@ -131,22 +131,22 @@
*format_out = format_in;
if (constraint.key == MediaConstraintsInterface::kMinWidth) {
- int value = talk_base::FromString<int>(constraint.value);
+ int value = rtc::FromString<int>(constraint.value);
return (value <= format_in.width);
} else if (constraint.key == MediaConstraintsInterface::kMaxWidth) {
- int value = talk_base::FromString<int>(constraint.value);
+ int value = rtc::FromString<int>(constraint.value);
return (value >= format_in.width);
} else if (constraint.key == MediaConstraintsInterface::kMinHeight) {
- int value = talk_base::FromString<int>(constraint.value);
+ int value = rtc::FromString<int>(constraint.value);
return (value <= format_in.height);
} else if (constraint.key == MediaConstraintsInterface::kMaxHeight) {
- int value = talk_base::FromString<int>(constraint.value);
+ int value = rtc::FromString<int>(constraint.value);
return (value >= format_in.height);
} else if (constraint.key == MediaConstraintsInterface::kMinFrameRate) {
- int value = talk_base::FromString<int>(constraint.value);
+ int value = rtc::FromString<int>(constraint.value);
return (value <= cricket::VideoFormat::IntervalToFps(format_in.interval));
} else if (constraint.key == MediaConstraintsInterface::kMaxFrameRate) {
- int value = talk_base::FromString<int>(constraint.value);
+ int value = rtc::FromString<int>(constraint.value);
if (value == 0) {
if (mandatory) {
// TODO(ronghuawu): Convert the constraint value to float when sub-1fps
@@ -163,7 +163,7 @@
return false;
}
} else if (constraint.key == MediaConstraintsInterface::kMinAspectRatio) {
- double value = talk_base::FromString<double>(constraint.value);
+ double value = rtc::FromString<double>(constraint.value);
// The aspect ratio in |constraint.value| has been converted to a string and
// back to a double, so it may have a rounding error.
// E.g if the value 1/3 is converted to a string, the string will not have
@@ -173,7 +173,7 @@
double ratio = static_cast<double>(format_in.width) / format_in.height;
return (value <= ratio + kRoundingTruncation);
} else if (constraint.key == MediaConstraintsInterface::kMaxAspectRatio) {
- double value = talk_base::FromString<double>(constraint.value);
+ double value = rtc::FromString<double>(constraint.value);
double ratio = static_cast<double>(format_in.width) / format_in.height;
// Subtract 0.0005 to avoid rounding problems. Same as above.
const double kRoundingTruncation = 0.0005;
@@ -337,14 +337,14 @@
namespace webrtc {
-talk_base::scoped_refptr<VideoSource> VideoSource::Create(
+rtc::scoped_refptr<VideoSource> VideoSource::Create(
cricket::ChannelManager* channel_manager,
cricket::VideoCapturer* capturer,
const webrtc::MediaConstraintsInterface* constraints) {
ASSERT(channel_manager != NULL);
ASSERT(capturer != NULL);
- talk_base::scoped_refptr<VideoSource> source(
- new talk_base::RefCountedObject<VideoSource>(channel_manager,
+ rtc::scoped_refptr<VideoSource> source(
+ new rtc::RefCountedObject<VideoSource>(channel_manager,
capturer));
source->Initialize(constraints);
return source;
diff --git a/app/webrtc/videosource.h b/app/webrtc/videosource.h
index f58b479..e690a5d 100644
--- a/app/webrtc/videosource.h
+++ b/app/webrtc/videosource.h
@@ -32,8 +32,8 @@
#include "talk/app/webrtc/notifier.h"
#include "talk/app/webrtc/videosourceinterface.h"
#include "talk/app/webrtc/videotrackrenderers.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/sigslot.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/sigslot.h"
#include "talk/media/base/videocapturer.h"
#include "talk/media/base/videocommon.h"
@@ -61,7 +61,7 @@
// VideoSource take ownership of |capturer|.
// |constraints| can be NULL and in that case the camera is opened using a
// default resolution.
- static talk_base::scoped_refptr<VideoSource> Create(
+ static rtc::scoped_refptr<VideoSource> Create(
cricket::ChannelManager* channel_manager,
cricket::VideoCapturer* capturer,
const webrtc::MediaConstraintsInterface* constraints);
@@ -90,8 +90,8 @@
void SetState(SourceState new_state);
cricket::ChannelManager* channel_manager_;
- talk_base::scoped_ptr<cricket::VideoCapturer> video_capturer_;
- talk_base::scoped_ptr<cricket::VideoRenderer> frame_input_;
+ rtc::scoped_ptr<cricket::VideoCapturer> video_capturer_;
+ rtc::scoped_ptr<cricket::VideoRenderer> frame_input_;
cricket::VideoFormat format_;
cricket::VideoOptions options_;
diff --git a/app/webrtc/videosource_unittest.cc b/app/webrtc/videosource_unittest.cc
index 4381176..38b4afa 100644
--- a/app/webrtc/videosource_unittest.cc
+++ b/app/webrtc/videosource_unittest.cc
@@ -31,7 +31,7 @@
#include "talk/app/webrtc/test/fakeconstraints.h"
#include "talk/app/webrtc/remotevideocapturer.h"
#include "talk/app/webrtc/videosource.h"
-#include "talk/base/gunit.h"
+#include "webrtc/base/gunit.h"
#include "talk/media/base/fakemediaengine.h"
#include "talk/media/base/fakevideorenderer.h"
#include "talk/media/devices/fakedevicemanager.h"
@@ -121,7 +121,7 @@
private:
MediaSourceInterface::SourceState state_;
- talk_base::scoped_refptr<VideoSourceInterface> source_;
+ rtc::scoped_refptr<VideoSourceInterface> source_;
};
class VideoSourceTest : public testing::Test {
@@ -131,7 +131,7 @@
capturer_(capturer_cleanup_.get()),
channel_manager_(new cricket::ChannelManager(
new cricket::FakeMediaEngine(),
- new cricket::FakeDeviceManager(), talk_base::Thread::Current())) {
+ new cricket::FakeDeviceManager(), rtc::Thread::Current())) {
}
void SetUp() {
@@ -157,12 +157,12 @@
source_->AddSink(&renderer_);
}
- talk_base::scoped_ptr<TestVideoCapturer> capturer_cleanup_;
+ rtc::scoped_ptr<TestVideoCapturer> capturer_cleanup_;
TestVideoCapturer* capturer_;
cricket::FakeVideoRenderer renderer_;
- talk_base::scoped_ptr<cricket::ChannelManager> channel_manager_;
- talk_base::scoped_ptr<StateObserver> state_observer_;
- talk_base::scoped_refptr<VideoSource> source_;
+ rtc::scoped_ptr<cricket::ChannelManager> channel_manager_;
+ rtc::scoped_ptr<StateObserver> state_observer_;
+ rtc::scoped_refptr<VideoSource> source_;
};
diff --git a/app/webrtc/videotrack.cc b/app/webrtc/videotrack.cc
index 7ab7815..8c244a6 100644
--- a/app/webrtc/videotrack.cc
+++ b/app/webrtc/videotrack.cc
@@ -64,10 +64,10 @@
return MediaStreamTrack<VideoTrackInterface>::set_enabled(enable);
}
-talk_base::scoped_refptr<VideoTrack> VideoTrack::Create(
+rtc::scoped_refptr<VideoTrack> VideoTrack::Create(
const std::string& id, VideoSourceInterface* source) {
- talk_base::RefCountedObject<VideoTrack>* track =
- new talk_base::RefCountedObject<VideoTrack>(id, source);
+ rtc::RefCountedObject<VideoTrack>* track =
+ new rtc::RefCountedObject<VideoTrack>(id, source);
return track;
}
diff --git a/app/webrtc/videotrack.h b/app/webrtc/videotrack.h
index acd1b75..40a38f2 100644
--- a/app/webrtc/videotrack.h
+++ b/app/webrtc/videotrack.h
@@ -33,13 +33,13 @@
#include "talk/app/webrtc/mediastreamtrack.h"
#include "talk/app/webrtc/videosourceinterface.h"
#include "talk/app/webrtc/videotrackrenderers.h"
-#include "talk/base/scoped_ref_ptr.h"
+#include "webrtc/base/scoped_ref_ptr.h"
namespace webrtc {
class VideoTrack : public MediaStreamTrack<VideoTrackInterface> {
public:
- static talk_base::scoped_refptr<VideoTrack> Create(
+ static rtc::scoped_refptr<VideoTrack> Create(
const std::string& label, VideoSourceInterface* source);
virtual void AddRenderer(VideoRendererInterface* renderer);
@@ -56,7 +56,7 @@
private:
VideoTrackRenderers renderers_;
- talk_base::scoped_refptr<VideoSourceInterface> video_source_;
+ rtc::scoped_refptr<VideoSourceInterface> video_source_;
};
} // namespace webrtc
diff --git a/app/webrtc/videotrack_unittest.cc b/app/webrtc/videotrack_unittest.cc
index 4a30293..57b883d 100644
--- a/app/webrtc/videotrack_unittest.cc
+++ b/app/webrtc/videotrack_unittest.cc
@@ -31,8 +31,8 @@
#include "talk/app/webrtc/remotevideocapturer.h"
#include "talk/app/webrtc/videosource.h"
#include "talk/app/webrtc/videotrack.h"
-#include "talk/base/gunit.h"
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/media/base/fakemediaengine.h"
#include "talk/media/devices/fakedevicemanager.h"
#include "talk/media/webrtc/webrtcvideoframe.h"
@@ -48,19 +48,19 @@
TEST(VideoTrack, RenderVideo) {
static const char kVideoTrackId[] = "track_id";
- talk_base::scoped_ptr<cricket::ChannelManager> channel_manager_;
+ rtc::scoped_ptr<cricket::ChannelManager> channel_manager_;
channel_manager_.reset(
new cricket::ChannelManager(new cricket::FakeMediaEngine(),
new cricket::FakeDeviceManager(),
- talk_base::Thread::Current()));
+ rtc::Thread::Current()));
ASSERT_TRUE(channel_manager_->Init());
- talk_base::scoped_refptr<VideoTrackInterface> video_track(
+ rtc::scoped_refptr<VideoTrackInterface> video_track(
VideoTrack::Create(kVideoTrackId,
VideoSource::Create(channel_manager_.get(),
new webrtc::RemoteVideoCapturer(),
NULL)));
// FakeVideoTrackRenderer register itself to |video_track|
- talk_base::scoped_ptr<FakeVideoTrackRenderer> renderer_1(
+ rtc::scoped_ptr<FakeVideoTrackRenderer> renderer_1(
new FakeVideoTrackRenderer(video_track.get()));
cricket::VideoRenderer* render_input = video_track->GetSource()->FrameInput();
@@ -76,7 +76,7 @@
EXPECT_EQ(123, renderer_1->height());
// FakeVideoTrackRenderer register itself to |video_track|
- talk_base::scoped_ptr<FakeVideoTrackRenderer> renderer_2(
+ rtc::scoped_ptr<FakeVideoTrackRenderer> renderer_2(
new FakeVideoTrackRenderer(video_track.get()));
render_input->RenderFrame(&frame);
diff --git a/app/webrtc/videotrackrenderers.cc b/app/webrtc/videotrackrenderers.cc
index b0e0c1f..75ce2be 100644
--- a/app/webrtc/videotrackrenderers.cc
+++ b/app/webrtc/videotrackrenderers.cc
@@ -38,7 +38,7 @@
}
void VideoTrackRenderers::AddRenderer(VideoRendererInterface* renderer) {
- talk_base::CritScope cs(&critical_section_);
+ rtc::CritScope cs(&critical_section_);
std::vector<RenderObserver>::iterator it = renderers_.begin();
for (; it != renderers_.end(); ++it) {
if (it->renderer_ == renderer)
@@ -48,7 +48,7 @@
}
void VideoTrackRenderers::RemoveRenderer(VideoRendererInterface* renderer) {
- talk_base::CritScope cs(&critical_section_);
+ rtc::CritScope cs(&critical_section_);
std::vector<RenderObserver>::iterator it = renderers_.begin();
for (; it != renderers_.end(); ++it) {
if (it->renderer_ == renderer) {
@@ -59,12 +59,12 @@
}
void VideoTrackRenderers::SetEnabled(bool enable) {
- talk_base::CritScope cs(&critical_section_);
+ rtc::CritScope cs(&critical_section_);
enabled_ = enable;
}
bool VideoTrackRenderers::SetSize(int width, int height, int reserved) {
- talk_base::CritScope cs(&critical_section_);
+ rtc::CritScope cs(&critical_section_);
width_ = width;
height_ = height;
std::vector<RenderObserver>::iterator it = renderers_.begin();
@@ -76,7 +76,7 @@
}
bool VideoTrackRenderers::RenderFrame(const cricket::VideoFrame* frame) {
- talk_base::CritScope cs(&critical_section_);
+ rtc::CritScope cs(&critical_section_);
if (!enabled_) {
return true;
}
diff --git a/app/webrtc/videotrackrenderers.h b/app/webrtc/videotrackrenderers.h
index 4bcf6a3..a6ba094 100644
--- a/app/webrtc/videotrackrenderers.h
+++ b/app/webrtc/videotrackrenderers.h
@@ -31,7 +31,7 @@
#include <vector>
#include "talk/app/webrtc/mediastreaminterface.h"
-#include "talk/base/criticalsection.h"
+#include "webrtc/base/criticalsection.h"
#include "talk/media/base/videorenderer.h"
namespace webrtc {
@@ -69,7 +69,7 @@
bool enabled_;
std::vector<RenderObserver> renderers_;
- talk_base::CriticalSection critical_section_; // Protects the above variables
+ rtc::CriticalSection critical_section_; // Protects the above variables
};
} // namespace webrtc
diff --git a/app/webrtc/webrtcsdp.cc b/app/webrtc/webrtcsdp.cc
index 412825e..4f774a7 100644
--- a/app/webrtc/webrtcsdp.cc
+++ b/app/webrtc/webrtcsdp.cc
@@ -35,10 +35,10 @@
#include "talk/app/webrtc/jsepicecandidate.h"
#include "talk/app/webrtc/jsepsessiondescription.h"
-#include "talk/base/common.h"
-#include "talk/base/logging.h"
-#include "talk/base/messagedigest.h"
-#include "talk/base/stringutils.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/messagedigest.h"
+#include "webrtc/base/stringutils.h"
#include "talk/media/base/codec.h"
#include "talk/media/base/constants.h"
#include "talk/media/base/cryptoparams.h"
@@ -83,7 +83,7 @@
using cricket::TransportDescription;
using cricket::TransportInfo;
using cricket::VideoContentDescription;
-using talk_base::SocketAddress;
+using rtc::SocketAddress;
typedef std::vector<RtpHeaderExtension> RtpHeaderExtensions;
@@ -216,7 +216,7 @@
: msid_identifier(kDefaultMsid),
// TODO(ronghuawu): What should we do if the appdata doesn't appear?
// Create random string (which will be used as track label later)?
- msid_appdata(talk_base::CreateRandomString(8)) {
+ msid_appdata(rtc::CreateRandomString(8)) {
}
uint32 ssrc_id;
std::string cname;
@@ -231,15 +231,12 @@
typedef std::vector<SsrcInfo> SsrcInfoVec;
typedef std::vector<SsrcGroup> SsrcGroupVec;
-// Serializes the passed in SessionDescription to a SDP string.
-// desc - The SessionDescription object to be serialized.
-static std::string SdpSerializeSessionDescription(
- const JsepSessionDescription& jdesc);
template <class T>
static void AddFmtpLine(const T& codec, std::string* message);
static void BuildMediaDescription(const ContentInfo* content_info,
const TransportInfo* transport_info,
const MediaType media_type,
+ const std::vector<Candidate>& candidates,
std::string* message);
static void BuildSctpContentAttributes(std::string* message, int sctp_port);
static void BuildRtpContentAttributes(
@@ -317,7 +314,7 @@
RtpHeaderExtension* extmap,
SdpParseError* error);
static bool ParseFingerprintAttribute(const std::string& line,
- talk_base::SSLFingerprint** fingerprint,
+ rtc::SSLFingerprint** fingerprint,
SdpParseError* error);
static bool ParseDtlsSetup(const std::string& line,
cricket::ConnectionRole* role,
@@ -594,7 +591,7 @@
const std::string& s,
T* t,
SdpParseError* error) {
- if (!talk_base::FromString(s, t)) {
+ if (!rtc::FromString(s, t)) {
std::ostringstream description;
description << "Invalid value: " << s << ".";
return ParseFailed(line, description.str(), error);
@@ -712,22 +709,21 @@
return true;
}
-// Update the media default destination.
+// Update |mline|'s default destination and append a c line after it.
static void UpdateMediaDefaultDestination(
- const std::vector<Candidate>& candidates, std::string* mline) {
+ const std::vector<Candidate>& candidates,
+ const std::string mline,
+ std::string* message) {
+ std::string new_lines;
+ AddLine(mline, &new_lines);
// RFC 4566
// m=<media> <port> <proto> <fmt> ...
std::vector<std::string> fields;
- talk_base::split(*mline, kSdpDelimiterSpace, &fields);
+ rtc::split(mline, kSdpDelimiterSpace, &fields);
if (fields.size() < 3) {
return;
}
- bool is_rtp =
- fields[2].empty() ||
- talk_base::starts_with(fields[2].data(),
- cricket::kMediaProtocolRtpPrefix);
-
std::ostringstream os;
std::string rtp_port, rtp_ip;
if (GetDefaultDestination(candidates, ICE_CANDIDATE_COMPONENT_RTP,
@@ -742,39 +738,43 @@
// Update the port in the m line.
// If this is a m-line with port equal to 0, we don't change it.
if (fields[1] != kMediaPortRejected) {
- mline->replace(fields[0].size() + 1,
- fields[1].size(),
- rtp_port);
+ new_lines.replace(fields[0].size() + 1,
+ fields[1].size(),
+ rtp_port);
}
// Add the c line.
// RFC 4566
// c=<nettype> <addrtype> <connection-address>
InitLine(kLineTypeConnection, kConnectionNettype, &os);
os << " " << kConnectionAddrtype << " " << rtp_ip;
- AddLine(os.str(), mline);
+ AddLine(os.str(), &new_lines);
}
+ message->append(new_lines);
+}
- if (is_rtp) {
- std::string rtcp_port, rtcp_ip;
- if (GetDefaultDestination(candidates, ICE_CANDIDATE_COMPONENT_RTCP,
- &rtcp_port, &rtcp_ip)) {
- // Found default RTCP candidate.
- // RFC 5245
- // If the agent is utilizing RTCP, it MUST encode the RTCP candidate
- // using the a=rtcp attribute as defined in RFC 3605.
+// Gets "a=rtcp" line if found default RTCP candidate from |candidates|.
+static std::string GetRtcpLine(const std::vector<Candidate>& candidates) {
+ std::string rtcp_line, rtcp_port, rtcp_ip;
+ if (GetDefaultDestination(candidates, ICE_CANDIDATE_COMPONENT_RTCP,
+ &rtcp_port, &rtcp_ip)) {
+ // Found default RTCP candidate.
+ // RFC 5245
+ // If the agent is utilizing RTCP, it MUST encode the RTCP candidate
+ // using the a=rtcp attribute as defined in RFC 3605.
- // RFC 3605
- // rtcp-attribute = "a=rtcp:" port [nettype space addrtype space
- // connection-address] CRLF
- InitAttrLine(kAttributeRtcp, &os);
- os << kSdpDelimiterColon
- << rtcp_port << " "
- << kConnectionNettype << " "
- << kConnectionAddrtype << " "
- << rtcp_ip;
- AddLine(os.str(), mline);
- }
+ // RFC 3605
+ // rtcp-attribute = "a=rtcp:" port [nettype space addrtype space
+ // connection-address] CRLF
+ std::ostringstream os;
+ InitAttrLine(kAttributeRtcp, &os);
+ os << kSdpDelimiterColon
+ << rtcp_port << " "
+ << kConnectionNettype << " "
+ << kConnectionAddrtype << " "
+ << rtcp_ip;
+ rtcp_line = os.str();
}
+ return rtcp_line;
}
// Get candidates according to the mline index from SessionDescriptionInterface.
@@ -792,36 +792,6 @@
}
std::string SdpSerialize(const JsepSessionDescription& jdesc) {
- std::string sdp = SdpSerializeSessionDescription(jdesc);
-
- std::string sdp_with_candidates;
- size_t pos = 0;
- std::string line;
- int mline_index = -1;
- while (GetLine(sdp, &pos, &line)) {
- if (IsLineType(line, kLineTypeMedia)) {
- ++mline_index;
- std::vector<Candidate> candidates;
- GetCandidatesByMindex(jdesc, mline_index, &candidates);
- // Media line may append other lines inside the
- // UpdateMediaDefaultDestination call, so add the kLineBreak here first.
- line.append(kLineBreak);
- UpdateMediaDefaultDestination(candidates, &line);
- sdp_with_candidates.append(line);
- // Build the a=candidate lines.
- BuildCandidate(candidates, &sdp_with_candidates);
- } else {
- // Copy old line to new sdp without change.
- AddLine(line, &sdp_with_candidates);
- }
- }
- sdp = sdp_with_candidates;
-
- return sdp;
-}
-
-std::string SdpSerializeSessionDescription(
- const JsepSessionDescription& jdesc) {
const cricket::SessionDescription* desc = jdesc.description();
if (!desc) {
return "";
@@ -868,40 +838,36 @@
// MediaStream semantics
InitAttrLine(kAttributeMsidSemantics, &os);
os << kSdpDelimiterColon << " " << kMediaStreamSemantic;
+
std::set<std::string> media_stream_labels;
const ContentInfo* audio_content = GetFirstAudioContent(desc);
if (audio_content)
GetMediaStreamLabels(audio_content, &media_stream_labels);
+
const ContentInfo* video_content = GetFirstVideoContent(desc);
if (video_content)
GetMediaStreamLabels(video_content, &media_stream_labels);
+
for (std::set<std::string>::const_iterator it =
media_stream_labels.begin(); it != media_stream_labels.end(); ++it) {
os << " " << *it;
}
AddLine(os.str(), &message);
- if (audio_content) {
- BuildMediaDescription(audio_content,
- desc->GetTransportInfoByName(audio_content->name),
- cricket::MEDIA_TYPE_AUDIO, &message);
+ // Preserve the order of the media contents.
+ int mline_index = -1;
+ for (cricket::ContentInfos::const_iterator it = desc->contents().begin();
+ it != desc->contents().end(); ++it) {
+ const MediaContentDescription* mdesc =
+ static_cast<const MediaContentDescription*>(it->description);
+ std::vector<Candidate> candidates;
+ GetCandidatesByMindex(jdesc, ++mline_index, &candidates);
+ BuildMediaDescription(&*it,
+ desc->GetTransportInfoByName(it->name),
+ mdesc->type(),
+ candidates,
+ &message);
}
-
-
- if (video_content) {
- BuildMediaDescription(video_content,
- desc->GetTransportInfoByName(video_content->name),
- cricket::MEDIA_TYPE_VIDEO, &message);
- }
-
- const ContentInfo* data_content = GetFirstDataContent(desc);
- if (data_content) {
- BuildMediaDescription(data_content,
- desc->GetTransportInfoByName(data_content->name),
- cricket::MEDIA_TYPE_DATA, &message);
- }
-
-
return message;
}
@@ -1007,7 +973,7 @@
}
std::vector<std::string> fields;
- talk_base::split(first_line.substr(start_pos),
+ rtc::split(first_line.substr(start_pos),
kSdpDelimiterSpace, &fields);
// RFC 5245
// a=candidate:<foundation> <component-id> <transport> <priority>
@@ -1119,7 +1085,7 @@
return false;
}
std::vector<std::string> fields;
- talk_base::split(ice_options, kSdpDelimiterSpace, &fields);
+ rtc::split(ice_options, kSdpDelimiterSpace, &fields);
for (size_t i = 0; i < fields.size(); ++i) {
transport_options->push_back(fields[i]);
}
@@ -1131,7 +1097,7 @@
// RFC 5285
// a=extmap:<value>["/"<direction>] <URI> <extensionattributes>
std::vector<std::string> fields;
- talk_base::split(line.substr(kLinePrefixLength),
+ rtc::split(line.substr(kLinePrefixLength),
kSdpDelimiterSpace, &fields);
const size_t expected_min_fields = 2;
if (fields.size() < expected_min_fields) {
@@ -1144,7 +1110,7 @@
return false;
}
std::vector<std::string> sub_fields;
- talk_base::split(value_direction, kSdpDelimiterSlash, &sub_fields);
+ rtc::split(value_direction, kSdpDelimiterSlash, &sub_fields);
int value = 0;
if (!GetValueFromString(line, sub_fields[0], &value, error)) {
return false;
@@ -1157,6 +1123,7 @@
void BuildMediaDescription(const ContentInfo* content_info,
const TransportInfo* transport_info,
const MediaType media_type,
+ const std::vector<Candidate>& candidates,
std::string* message) {
ASSERT(message != NULL);
if (content_info == NULL || message == NULL) {
@@ -1196,7 +1163,7 @@
video_desc->codecs().begin();
it != video_desc->codecs().end(); ++it) {
fmt.append(" ");
- fmt.append(talk_base::ToString<int>(it->id));
+ fmt.append(rtc::ToString<int>(it->id));
}
} else if (media_type == cricket::MEDIA_TYPE_AUDIO) {
const AudioContentDescription* audio_desc =
@@ -1205,7 +1172,7 @@
audio_desc->codecs().begin();
it != audio_desc->codecs().end(); ++it) {
fmt.append(" ");
- fmt.append(talk_base::ToString<int>(it->id));
+ fmt.append(rtc::ToString<int>(it->id));
}
} else if (media_type == cricket::MEDIA_TYPE_DATA) {
const DataContentDescription* data_desc =
@@ -1222,13 +1189,13 @@
}
}
- fmt.append(talk_base::ToString<int>(sctp_port));
+ fmt.append(rtc::ToString<int>(sctp_port));
} else {
for (std::vector<cricket::DataCodec>::const_iterator it =
data_desc->codecs().begin();
it != data_desc->codecs().end(); ++it) {
fmt.append(" ");
- fmt.append(talk_base::ToString<int>(it->id));
+ fmt.append(rtc::ToString<int>(it->id));
}
}
}
@@ -1246,12 +1213,46 @@
const std::string port = content_info->rejected ?
kMediaPortRejected : kDefaultPort;
- talk_base::SSLFingerprint* fp = (transport_info) ?
+ rtc::SSLFingerprint* fp = (transport_info) ?
transport_info->description.identity_fingerprint.get() : NULL;
+ // Add the m and c lines.
InitLine(kLineTypeMedia, type, &os);
os << " " << port << " " << media_desc->protocol() << fmt;
- AddLine(os.str(), message);
+ std::string mline = os.str();
+ UpdateMediaDefaultDestination(candidates, mline, message);
+
+ // RFC 4566
+ // b=AS:<bandwidth>
+ // We should always use the default bandwidth for RTP-based data
+ // channels. Don't allow SDP to set the bandwidth, because that
+ // would give JS the opportunity to "break the Internet".
+ // TODO(pthatcher): But we need to temporarily allow the SDP to control
+ // this for backwards-compatibility. Once we don't need that any
+ // more, remove this.
+ bool support_dc_sdp_bandwidth_temporarily = true;
+ if (media_desc->bandwidth() >= 1000 &&
+ (media_type != cricket::MEDIA_TYPE_DATA ||
+ support_dc_sdp_bandwidth_temporarily)) {
+ InitLine(kLineTypeSessionBandwidth, kApplicationSpecificMaximum, &os);
+ os << kSdpDelimiterColon << (media_desc->bandwidth() / 1000);
+ AddLine(os.str(), message);
+ }
+
+ // Add the a=rtcp line.
+ bool is_rtp =
+ media_desc->protocol().empty() ||
+ rtc::starts_with(media_desc->protocol().data(),
+ cricket::kMediaProtocolRtpPrefix);
+ if (is_rtp) {
+ std::string rtcp_line = GetRtcpLine(candidates);
+ if (!rtcp_line.empty()) {
+ AddLine(rtcp_line, message);
+ }
+ }
+
+ // Build the a=candidate lines.
+ BuildCandidate(candidates, message);
// Use the transport_info to build the media level ice-ufrag and ice-pwd.
if (transport_info) {
@@ -1363,23 +1364,6 @@
}
AddLine(os.str(), message);
- // RFC 4566
- // b=AS:<bandwidth>
- // We should always use the default bandwidth for RTP-based data
- // channels. Don't allow SDP to set the bandwidth, because that
- // would give JS the opportunity to "break the Internet".
- // TODO(pthatcher): But we need to temporarily allow the SDP to control
- // this for backwards-compatibility. Once we don't need that any
- // more, remove this.
- bool support_dc_sdp_bandwidth_temporarily = true;
- if (media_desc->bandwidth() >= 1000 &&
- (media_type != cricket::MEDIA_TYPE_DATA ||
- support_dc_sdp_bandwidth_temporarily)) {
- InitLine(kLineTypeSessionBandwidth, kApplicationSpecificMaximum, &os);
- os << kSdpDelimiterColon << (media_desc->bandwidth() / 1000);
- AddLine(os.str(), message);
- }
-
// RFC 5761
// a=rtcp-mux
if (media_desc->rtcp_mux()) {
@@ -1436,7 +1420,7 @@
std::vector<uint32>::const_iterator ssrc =
track->ssrc_groups[i].ssrcs.begin();
for (; ssrc != track->ssrc_groups[i].ssrcs.end(); ++ssrc) {
- os << kSdpDelimiterSpace << talk_base::ToString<uint32>(*ssrc);
+ os << kSdpDelimiterSpace << rtc::ToString<uint32>(*ssrc);
}
AddLine(os.str(), message);
}
@@ -1588,7 +1572,7 @@
if (found == params.end()) {
return false;
}
- if (!talk_base::FromString(found->second, value)) {
+ if (!rtc::FromString(found->second, value)) {
return false;
}
return true;
@@ -1768,7 +1752,7 @@
std::string(), error);
}
std::vector<std::string> fields;
- talk_base::split(line.substr(kLinePrefixLength),
+ rtc::split(line.substr(kLinePrefixLength),
kSdpDelimiterSpace, &fields);
const size_t expected_fields = 6;
if (fields.size() != expected_fields) {
@@ -1871,7 +1855,7 @@
"Can't have multiple fingerprint attributes at the same level.",
error);
}
- talk_base::SSLFingerprint* fingerprint = NULL;
+ rtc::SSLFingerprint* fingerprint = NULL;
if (!ParseFingerprintAttribute(line, &fingerprint, error)) {
return false;
}
@@ -1906,7 +1890,7 @@
// RFC 5888 and draft-holmberg-mmusic-sdp-bundle-negotiation-00
// a=group:BUNDLE video voice
std::vector<std::string> fields;
- talk_base::split(line.substr(kLinePrefixLength),
+ rtc::split(line.substr(kLinePrefixLength),
kSdpDelimiterSpace, &fields);
std::string semantics;
if (!GetValue(fields[0], kAttributeGroup, &semantics, error)) {
@@ -1921,7 +1905,7 @@
}
static bool ParseFingerprintAttribute(const std::string& line,
- talk_base::SSLFingerprint** fingerprint,
+ rtc::SSLFingerprint** fingerprint,
SdpParseError* error) {
if (!IsLineType(line, kLineTypeAttributes) ||
!HasAttribute(line, kAttributeFingerprint)) {
@@ -1930,7 +1914,7 @@
}
std::vector<std::string> fields;
- talk_base::split(line.substr(kLinePrefixLength),
+ rtc::split(line.substr(kLinePrefixLength),
kSdpDelimiterSpace, &fields);
const size_t expected_fields = 2;
if (fields.size() != expected_fields) {
@@ -1949,7 +1933,7 @@
::tolower);
// The second field is the digest value. De-hexify it.
- *fingerprint = talk_base::SSLFingerprint::CreateFromRfc4572(
+ *fingerprint = rtc::SSLFingerprint::CreateFromRfc4572(
algorithm, fields[1]);
if (!*fingerprint) {
return ParseFailed(line,
@@ -1966,7 +1950,7 @@
// setup-attr = "a=setup:" role
// role = "active" / "passive" / "actpass" / "holdconn"
std::vector<std::string> fields;
- talk_base::split(line.substr(kLinePrefixLength), kSdpDelimiterColon, &fields);
+ rtc::split(line.substr(kLinePrefixLength), kSdpDelimiterColon, &fields);
const size_t expected_fields = 2;
if (fields.size() != expected_fields) {
return ParseFailedExpectFieldNum(line, expected_fields, error);
@@ -2111,7 +2095,7 @@
++mline_index;
std::vector<std::string> fields;
- talk_base::split(line.substr(kLinePrefixLength),
+ rtc::split(line.substr(kLinePrefixLength),
kSdpDelimiterSpace, &fields);
const size_t expected_min_fields = 4;
if (fields.size() < expected_min_fields) {
@@ -2155,7 +2139,7 @@
session_td.identity_fingerprint.get(),
Candidates());
- talk_base::scoped_ptr<MediaContentDescription> content;
+ rtc::scoped_ptr<MediaContentDescription> content;
std::string content_name;
if (HasAttribute(line, kMediaTypeVideo)) {
content.reset(ParseContentDescription<VideoContentDescription>(
@@ -2439,7 +2423,7 @@
bool is_rtp =
protocol.empty() ||
- talk_base::starts_with(protocol.data(),
+ rtc::starts_with(protocol.data(),
cricket::kMediaProtocolRtpPrefix);
// Loop until the next m line
@@ -2509,7 +2493,7 @@
return false;
}
} else if (HasAttribute(line, kAttributeFingerprint)) {
- talk_base::SSLFingerprint* fingerprint = NULL;
+ rtc::SSLFingerprint* fingerprint = NULL;
if (!ParseFingerprintAttribute(line, &fingerprint, error)) {
return false;
@@ -2722,7 +2706,7 @@
// draft-alvestrand-mmusic-msid-00
// "msid:" identifier [ " " appdata ]
std::vector<std::string> fields;
- talk_base::split(value, kSdpDelimiterSpace, &fields);
+ rtc::split(value, kSdpDelimiterSpace, &fields);
if (fields.size() < 1 || fields.size() > 2) {
return ParseFailed(line,
"Expected format \"msid:<identifier>[ <appdata>]\".",
@@ -2751,7 +2735,7 @@
// RFC 5576
// a=ssrc-group:<semantics> <ssrc-id> ...
std::vector<std::string> fields;
- talk_base::split(line.substr(kLinePrefixLength),
+ rtc::split(line.substr(kLinePrefixLength),
kSdpDelimiterSpace, &fields);
const size_t expected_min_fields = 2;
if (fields.size() < expected_min_fields) {
@@ -2777,7 +2761,7 @@
MediaContentDescription* media_desc,
SdpParseError* error) {
std::vector<std::string> fields;
- talk_base::split(line.substr(kLinePrefixLength),
+ rtc::split(line.substr(kLinePrefixLength),
kSdpDelimiterSpace, &fields);
// RFC 4568
// a=crypto:<tag> <crypto-suite> <key-params> [<session-params>]
@@ -2844,7 +2828,7 @@
MediaContentDescription* media_desc,
SdpParseError* error) {
std::vector<std::string> fields;
- talk_base::split(line.substr(kLinePrefixLength),
+ rtc::split(line.substr(kLinePrefixLength),
kSdpDelimiterSpace, &fields);
// RFC 4566
// a=rtpmap:<payload type> <encoding name>/<clock rate>[/<encodingparameters>]
@@ -2873,7 +2857,7 @@
}
const std::string encoder = fields[1];
std::vector<std::string> codec_params;
- talk_base::split(encoder, '/', &codec_params);
+ rtc::split(encoder, '/', &codec_params);
// <encoding name>/<clock rate>[/<encodingparameters>]
// 2 mandatory fields
if (codec_params.size() < 2 || codec_params.size() > 3) {
@@ -2961,7 +2945,7 @@
return true;
}
std::vector<std::string> fields;
- talk_base::split(line.substr(kLinePrefixLength),
+ rtc::split(line.substr(kLinePrefixLength),
kSdpDelimiterSpace, &fields);
// RFC 5576
@@ -3016,7 +3000,7 @@
return true;
}
std::vector<std::string> rtcp_fb_fields;
- talk_base::split(line.c_str(), kSdpDelimiterSpace, &rtcp_fb_fields);
+ rtc::split(line.c_str(), kSdpDelimiterSpace, &rtcp_fb_fields);
if (rtcp_fb_fields.size() < 2) {
return ParseFailedGetValue(line, kAttributeRtcpFb, error);
}
diff --git a/app/webrtc/webrtcsdp_unittest.cc b/app/webrtc/webrtcsdp_unittest.cc
index e28599f..e018034 100644
--- a/app/webrtc/webrtcsdp_unittest.cc
+++ b/app/webrtc/webrtcsdp_unittest.cc
@@ -31,13 +31,13 @@
#include "talk/app/webrtc/jsepsessiondescription.h"
#include "talk/app/webrtc/webrtcsdp.h"
-#include "talk/base/gunit.h"
-#include "talk/base/logging.h"
-#include "talk/base/messagedigest.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/sslfingerprint.h"
-#include "talk/base/stringencode.h"
-#include "talk/base/stringutils.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/messagedigest.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/sslfingerprint.h"
+#include "webrtc/base/stringencode.h"
+#include "webrtc/base/stringutils.h"
#include "talk/media/base/constants.h"
#include "talk/p2p/base/constants.h"
#include "talk/session/media/mediasession.h"
@@ -390,14 +390,14 @@
const std::string& newlines,
std::string* message) {
const std::string tmp = line + newlines;
- talk_base::replace_substrs(line.c_str(), line.length(),
+ rtc::replace_substrs(line.c_str(), line.length(),
tmp.c_str(), tmp.length(), message);
}
static void Replace(const std::string& line,
const std::string& newlines,
std::string* message) {
- talk_base::replace_substrs(line.c_str(), line.length(),
+ rtc::replace_substrs(line.c_str(), line.length(),
newlines.c_str(), newlines.length(), message);
}
@@ -474,7 +474,7 @@
desc_.AddContent(kAudioContentName, NS_JINGLE_RTP, audio_desc_);
// VideoContentDescription
- talk_base::scoped_ptr<VideoContentDescription> video(
+ rtc::scoped_ptr<VideoContentDescription> video(
new VideoContentDescription());
video_desc_ = video.get();
StreamParams video_stream1;
@@ -526,7 +526,7 @@
// v4 host
int port = 1234;
- talk_base::SocketAddress address("192.168.1.5", port++);
+ rtc::SocketAddress address("192.168.1.5", port++);
Candidate candidate1(
"", ICE_CANDIDATE_COMPONENT_RTP, "udp", address, kCandidatePriority,
"", "", LOCAL_PORT_TYPE,
@@ -548,7 +548,7 @@
"", kCandidateGeneration, kCandidateFoundation1);
// v6 host
- talk_base::SocketAddress v6_address("::1", port++);
+ rtc::SocketAddress v6_address("::1", port++);
cricket::Candidate candidate5(
"", cricket::ICE_CANDIDATE_COMPONENT_RTP,
"udp", v6_address, kCandidatePriority,
@@ -575,8 +575,8 @@
// stun
int port_stun = 2345;
- talk_base::SocketAddress address_stun("74.125.127.126", port_stun++);
- talk_base::SocketAddress rel_address_stun("192.168.1.5", port_stun++);
+ rtc::SocketAddress address_stun("74.125.127.126", port_stun++);
+ rtc::SocketAddress rel_address_stun("192.168.1.5", port_stun++);
cricket::Candidate candidate9
("", cricket::ICE_CANDIDATE_COMPONENT_RTP,
"udp", address_stun, kCandidatePriority,
@@ -595,7 +595,7 @@
// relay
int port_relay = 3456;
- talk_base::SocketAddress address_relay("74.125.224.39", port_relay++);
+ rtc::SocketAddress address_relay("74.125.224.39", port_relay++);
cricket::Candidate candidate11(
"", cricket::ICE_CANDIDATE_COMPONENT_RTCP,
"udp", address_relay, kCandidatePriority,
@@ -865,9 +865,9 @@
const char ice_ufragx[] = "a=xice-ufrag";
const char ice_pwd[] = "a=ice-pwd";
const char ice_pwdx[] = "a=xice-pwd";
- talk_base::replace_substrs(ice_ufrag, strlen(ice_ufrag),
+ rtc::replace_substrs(ice_ufrag, strlen(ice_ufrag),
ice_ufragx, strlen(ice_ufragx), sdp);
- talk_base::replace_substrs(ice_pwd, strlen(ice_pwd),
+ rtc::replace_substrs(ice_pwd, strlen(ice_pwd),
ice_pwdx, strlen(ice_pwdx), sdp);
return true;
}
@@ -917,7 +917,7 @@
void AddFingerprint() {
desc_.RemoveTransportInfoByName(kAudioContentName);
desc_.RemoveTransportInfoByName(kVideoContentName);
- talk_base::SSLFingerprint fingerprint(talk_base::DIGEST_SHA_1,
+ rtc::SSLFingerprint fingerprint(rtc::DIGEST_SHA_1,
kIdentityDigest,
sizeof(kIdentityDigest));
EXPECT_TRUE(desc_.AddTransportInfo(
@@ -1001,7 +1001,7 @@
}
void AddSctpDataChannel() {
- talk_base::scoped_ptr<DataContentDescription> data(
+ rtc::scoped_ptr<DataContentDescription> data(
new DataContentDescription());
data_desc_ = data.get();
data_desc_->set_protocol(cricket::kMediaProtocolDtlsSctp);
@@ -1018,7 +1018,7 @@
}
void AddRtpDataChannel() {
- talk_base::scoped_ptr<DataContentDescription> data(
+ rtc::scoped_ptr<DataContentDescription> data(
new DataContentDescription());
data_desc_ = data.get();
@@ -1119,7 +1119,7 @@
const std::string& name, int expected_value) {
cricket::CodecParameterMap::const_iterator found = params.find(name);
ASSERT_TRUE(found != params.end());
- EXPECT_EQ(found->second, talk_base::ToString<int>(expected_value));
+ EXPECT_EQ(found->second, rtc::ToString<int>(expected_value));
}
void TestDeserializeCodecParams(const CodecParams& params,
@@ -1287,7 +1287,7 @@
VideoContentDescription* video_desc_;
DataContentDescription* data_desc_;
Candidates candidates_;
- talk_base::scoped_ptr<IceCandidateInterface> jcandidate_;
+ rtc::scoped_ptr<IceCandidateInterface> jcandidate_;
JsepSessionDescription jdesc_;
};
@@ -1408,10 +1408,10 @@
jdesc_.session_version()));
std::string message = webrtc::SdpSerialize(jdesc_);
std::string sdp_with_bandwidth = kSdpFullString;
- InjectAfter("a=mid:video_content_name\r\na=sendrecv\r\n",
+ InjectAfter("c=IN IP4 74.125.224.39\r\n",
"b=AS:100\r\n",
&sdp_with_bandwidth);
- InjectAfter("a=mid:audio_content_name\r\na=sendrecv\r\n",
+ InjectAfter("c=IN IP4 74.125.127.126\r\n",
"b=AS:50\r\n",
&sdp_with_bandwidth);
EXPECT_EQ(sdp_with_bandwidth, message);
@@ -1509,10 +1509,10 @@
char default_portstr[16];
char new_portstr[16];
- talk_base::sprintfn(default_portstr, sizeof(default_portstr), "%d",
+ rtc::sprintfn(default_portstr, sizeof(default_portstr), "%d",
kDefaultSctpPort);
- talk_base::sprintfn(new_portstr, sizeof(new_portstr), "%d", kNewPort);
- talk_base::replace_substrs(default_portstr, strlen(default_portstr),
+ rtc::sprintfn(new_portstr, sizeof(new_portstr), "%d", kNewPort);
+ rtc::replace_substrs(default_portstr, strlen(default_portstr),
new_portstr, strlen(new_portstr),
&expected_sdp);
@@ -1535,7 +1535,7 @@
// TODO(pthatcher): We need to temporarily allow the SDP to control
// this for backwards-compatibility. Once we don't need that any
// more, remove this.
- InjectAfter("a=mid:data_content_name\r\na=sendrecv\r\n",
+ InjectAfter("m=application 1 RTP/SAVPF 101\r\nc=IN IP4 0.0.0.0\r\n",
"b=AS:100\r\n",
&expected_sdp);
EXPECT_EQ(expected_sdp, message);
@@ -1946,9 +1946,9 @@
const uint16 kUnusualSctpPort = 9556;
char default_portstr[16];
char unusual_portstr[16];
- talk_base::sprintfn(default_portstr, sizeof(default_portstr), "%d",
+ rtc::sprintfn(default_portstr, sizeof(default_portstr), "%d",
kDefaultSctpPort);
- talk_base::sprintfn(unusual_portstr, sizeof(unusual_portstr), "%d",
+ rtc::sprintfn(unusual_portstr, sizeof(unusual_portstr), "%d",
kUnusualSctpPort);
// First setup the expected JsepSessionDescription.
@@ -1970,7 +1970,7 @@
// Then get the deserialized JsepSessionDescription.
std::string sdp_with_data = kSdpString;
sdp_with_data.append(kSdpSctpDataChannelString);
- talk_base::replace_substrs(default_portstr, strlen(default_portstr),
+ rtc::replace_substrs(default_portstr, strlen(default_portstr),
unusual_portstr, strlen(unusual_portstr),
&sdp_with_data);
JsepSessionDescription jdesc_output(kDummyString);
diff --git a/app/webrtc/webrtcsession.cc b/app/webrtc/webrtcsession.cc
index 9c27be5..3add7e1 100644
--- a/app/webrtc/webrtcsession.cc
+++ b/app/webrtc/webrtcsession.cc
@@ -38,10 +38,10 @@
#include "talk/app/webrtc/mediastreamsignaling.h"
#include "talk/app/webrtc/peerconnectioninterface.h"
#include "talk/app/webrtc/webrtcsessiondescriptionfactory.h"
-#include "talk/base/helpers.h"
-#include "talk/base/logging.h"
-#include "talk/base/stringencode.h"
-#include "talk/base/stringutils.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/stringencode.h"
+#include "webrtc/base/stringutils.h"
#include "talk/media/base/constants.h"
#include "talk/media/base/videocapturer.h"
#include "talk/session/media/channel.h"
@@ -381,7 +381,7 @@
std::string string_value;
T value;
if (constraints->GetOptional().FindFirst(key, &string_value)) {
- if (talk_base::FromString(string_value, &value)) {
+ if (rtc::FromString(string_value, &value)) {
option->Set(value);
}
}
@@ -447,12 +447,12 @@
WebRtcSession::WebRtcSession(
cricket::ChannelManager* channel_manager,
- talk_base::Thread* signaling_thread,
- talk_base::Thread* worker_thread,
+ rtc::Thread* signaling_thread,
+ rtc::Thread* worker_thread,
cricket::PortAllocator* port_allocator,
MediaStreamSignaling* mediastream_signaling)
: cricket::BaseSession(signaling_thread, worker_thread, port_allocator,
- talk_base::ToString(talk_base::CreateRandomId64() &
+ rtc::ToString(rtc::CreateRandomId64() &
LLONG_MAX),
cricket::NS_JINGLE_RTP, false),
// RFC 3264: The numeric value of the session id and version in the
@@ -548,14 +548,6 @@
video_options_.suspend_below_min_bitrate.Set(value);
}
- if (FindConstraint(
- constraints,
- MediaConstraintsInterface::kSkipEncodingUnusedStreams,
- &value,
- NULL)) {
- video_options_.skip_encoding_unused_streams.Set(value);
- }
-
SetOptionFromOptionalConstraint(constraints,
MediaConstraintsInterface::kScreencastMinBitrate,
&video_options_.screencast_min_bitrate);
@@ -681,7 +673,7 @@
return webrtc_session_desc_factory_->SdesPolicy();
}
-bool WebRtcSession::GetSslRole(talk_base::SSLRole* role) {
+bool WebRtcSession::GetSslRole(rtc::SSLRole* role) {
if (local_description() == NULL || remote_description() == NULL) {
LOG(LS_INFO) << "Local and Remote descriptions must be applied to get "
<< "SSL Role of the session.";
@@ -701,9 +693,10 @@
return false;
}
-void WebRtcSession::CreateOffer(CreateSessionDescriptionObserver* observer,
- const MediaConstraintsInterface* constraints) {
- webrtc_session_desc_factory_->CreateOffer(observer, constraints);
+void WebRtcSession::CreateOffer(
+ CreateSessionDescriptionObserver* observer,
+ const PeerConnectionInterface::RTCOfferAnswerOptions& options) {
+ webrtc_session_desc_factory_->CreateOffer(observer, options);
}
void WebRtcSession::CreateAnswer(CreateSessionDescriptionObserver* observer,
@@ -714,7 +707,7 @@
bool WebRtcSession::SetLocalDescription(SessionDescriptionInterface* desc,
std::string* err_desc) {
// Takes the ownership of |desc| regardless of the result.
- talk_base::scoped_ptr<SessionDescriptionInterface> desc_temp(desc);
+ rtc::scoped_ptr<SessionDescriptionInterface> desc_temp(desc);
// Validate SDP.
if (!ValidateSessionDescription(desc, cricket::CS_LOCAL, err_desc)) {
@@ -759,7 +752,7 @@
// local session description.
mediastream_signaling_->OnLocalDescriptionChanged(local_desc_.get());
- talk_base::SSLRole role;
+ rtc::SSLRole role;
if (data_channel_type_ == cricket::DCT_SCTP && GetSslRole(&role)) {
mediastream_signaling_->OnDtlsRoleReadyForSctp(role);
}
@@ -772,7 +765,7 @@
bool WebRtcSession::SetRemoteDescription(SessionDescriptionInterface* desc,
std::string* err_desc) {
// Takes the ownership of |desc| regardless of the result.
- talk_base::scoped_ptr<SessionDescriptionInterface> desc_temp(desc);
+ rtc::scoped_ptr<SessionDescriptionInterface> desc_temp(desc);
// Validate SDP.
if (!ValidateSessionDescription(desc, cricket::CS_REMOTE, err_desc)) {
@@ -815,7 +808,7 @@
desc);
remote_desc_.reset(desc_temp.release());
- talk_base::SSLRole role;
+ rtc::SSLRole role;
if (data_channel_type_ == cricket::DCT_SCTP && GetSslRole(&role)) {
mediastream_signaling_->OnDtlsRoleReadyForSctp(role);
}
@@ -892,36 +885,16 @@
return false;
}
- cricket::TransportProxy* transport_proxy = NULL;
- if (remote_description()) {
- size_t mediacontent_index =
- static_cast<size_t>(candidate->sdp_mline_index());
- size_t remote_content_size =
- BaseSession::remote_description()->contents().size();
- if (mediacontent_index >= remote_content_size) {
- LOG(LS_ERROR)
- << "ProcessIceMessage: Invalid candidate media index.";
- return false;
+ bool valid = false;
+ if (!ReadyToUseRemoteCandidate(candidate, NULL, &valid)) {
+ if (valid) {
+ LOG(LS_INFO) << "ProcessIceMessage: Candidate saved";
+ saved_candidates_.push_back(
+ new JsepIceCandidate(candidate->sdp_mid(),
+ candidate->sdp_mline_index(),
+ candidate->candidate()));
}
-
- cricket::ContentInfo content =
- BaseSession::remote_description()->contents()[mediacontent_index];
- transport_proxy = GetTransportProxy(content.name);
- }
-
- // We need to check the local/remote description for the Transport instead of
- // the session, because a new Transport added during renegotiation may have
- // them unset while the session has them set from the previou negotiation. Not
- // doing so may trigger the auto generation of transport description and mess
- // up DTLS identity information, ICE credential, etc.
- if (!transport_proxy || !(transport_proxy->local_description_set() &&
- transport_proxy->remote_description_set())) {
- LOG(LS_INFO) << "ProcessIceMessage: Local/Remote description not set "
- << "on the Transport, save the candidate for later use.";
- saved_candidates_.push_back(
- new JsepIceCandidate(candidate->sdp_mid(), candidate->sdp_mline_index(),
- candidate->candidate()));
- return true;
+ return valid;
}
// Add this candidate to the remote session description.
@@ -1110,7 +1083,7 @@
}
bool WebRtcSession::SendData(const cricket::SendDataParams& params,
- const talk_base::Buffer& payload,
+ const rtc::Buffer& payload,
cricket::SendDataResult* result) {
if (!data_channel_.get()) {
LOG(LS_ERROR) << "SendData called when data_channel_ is NULL.";
@@ -1165,7 +1138,7 @@
return data_channel_.get() && data_channel_->ready_to_send_data();
}
-talk_base::scoped_refptr<DataChannel> WebRtcSession::CreateDataChannel(
+rtc::scoped_refptr<DataChannel> WebRtcSession::CreateDataChannel(
const std::string& label,
const InternalDataChannelInit* config) {
if (state() == STATE_RECEIVEDTERMINATE) {
@@ -1179,7 +1152,7 @@
config ? (*config) : InternalDataChannelInit();
if (data_channel_type_ == cricket::DCT_SCTP) {
if (new_config.id < 0) {
- talk_base::SSLRole role;
+ rtc::SSLRole role;
if (GetSslRole(&role) &&
!mediastream_signaling_->AllocateSctpSid(role, &new_config.id)) {
LOG(LS_ERROR) << "No id can be allocated for the SCTP data channel.";
@@ -1192,7 +1165,7 @@
}
}
- talk_base::scoped_refptr<DataChannel> channel(DataChannel::Create(
+ rtc::scoped_refptr<DataChannel> channel(DataChannel::Create(
this, data_channel_type_, label, new_config));
if (channel && !mediastream_signaling_->AddDataChannel(channel))
return NULL;
@@ -1212,7 +1185,7 @@
ice_restart_latch_->Reset();
}
-void WebRtcSession::OnIdentityReady(talk_base::SSLIdentity* identity) {
+void WebRtcSession::OnIdentityReady(rtc::SSLIdentity* identity) {
SetIdentity(identity);
}
@@ -1386,10 +1359,24 @@
if (!remote_desc)
return true;
bool ret = true;
+
for (size_t m = 0; m < remote_desc->number_of_mediasections(); ++m) {
const IceCandidateCollection* candidates = remote_desc->candidates(m);
for (size_t n = 0; n < candidates->count(); ++n) {
- ret = UseCandidate(candidates->at(n));
+ const IceCandidateInterface* candidate = candidates->at(n);
+ bool valid = false;
+ if (!ReadyToUseRemoteCandidate(candidate, remote_desc, &valid)) {
+ if (valid) {
+ LOG(LS_INFO) << "UseCandidatesInSessionDescription: Candidate saved.";
+ saved_candidates_.push_back(
+ new JsepIceCandidate(candidate->sdp_mid(),
+ candidate->sdp_mline_index(),
+ candidate->candidate()));
+ }
+ continue;
+ }
+
+ ret = UseCandidate(candidate);
if (!ret)
break;
}
@@ -1565,7 +1552,7 @@
void WebRtcSession::OnDataChannelMessageReceived(
cricket::DataChannel* channel,
const cricket::ReceiveDataParams& params,
- const talk_base::Buffer& payload) {
+ const rtc::Buffer& payload) {
ASSERT(data_channel_type_ == cricket::DCT_SCTP);
if (params.type == cricket::DMT_CONTROL &&
mediastream_signaling_->IsSctpSidAvailable(params.ssrc)) {
@@ -1696,4 +1683,42 @@
return desc.str();
}
+// We need to check the local/remote description for the Transport instead of
+// the session, because a new Transport added during renegotiation may have
+// them unset while the session has them set from the previous negotiation.
+// Not doing so may trigger the auto generation of transport description and
+// mess up DTLS identity information, ICE credential, etc.
+bool WebRtcSession::ReadyToUseRemoteCandidate(
+ const IceCandidateInterface* candidate,
+ const SessionDescriptionInterface* remote_desc,
+ bool* valid) {
+ *valid = true;;
+ cricket::TransportProxy* transport_proxy = NULL;
+
+ const SessionDescriptionInterface* current_remote_desc =
+ remote_desc ? remote_desc : remote_description();
+
+ if (!current_remote_desc)
+ return false;
+
+ size_t mediacontent_index =
+ static_cast<size_t>(candidate->sdp_mline_index());
+ size_t remote_content_size =
+ current_remote_desc->description()->contents().size();
+ if (mediacontent_index >= remote_content_size) {
+ LOG(LS_ERROR)
+ << "ReadyToUseRemoteCandidate: Invalid candidate media index.";
+
+ *valid = false;
+ return false;
+ }
+
+ cricket::ContentInfo content =
+ current_remote_desc->description()->contents()[mediacontent_index];
+ transport_proxy = GetTransportProxy(content.name);
+
+ return transport_proxy && transport_proxy->local_description_set() &&
+ transport_proxy->remote_description_set();
+}
+
} // namespace webrtc
diff --git a/app/webrtc/webrtcsession.h b/app/webrtc/webrtcsession.h
index 3ffea8f..f5de979 100644
--- a/app/webrtc/webrtcsession.h
+++ b/app/webrtc/webrtcsession.h
@@ -35,8 +35,8 @@
#include "talk/app/webrtc/mediastreamprovider.h"
#include "talk/app/webrtc/datachannel.h"
#include "talk/app/webrtc/statstypes.h"
-#include "talk/base/sigslot.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/thread.h"
#include "talk/media/base/mediachannel.h"
#include "talk/p2p/base/session.h"
#include "talk/session/media/mediasession.h"
@@ -106,8 +106,8 @@
public DataChannelProviderInterface {
public:
WebRtcSession(cricket::ChannelManager* channel_manager,
- talk_base::Thread* signaling_thread,
- talk_base::Thread* worker_thread,
+ rtc::Thread* signaling_thread,
+ rtc::Thread* worker_thread,
cricket::PortAllocator* port_allocator,
MediaStreamSignaling* mediastream_signaling);
virtual ~WebRtcSession();
@@ -138,14 +138,15 @@
cricket::SecurePolicy SdesPolicy() const;
// Get current ssl role from transport.
- bool GetSslRole(talk_base::SSLRole* role);
+ bool GetSslRole(rtc::SSLRole* role);
// Generic error message callback from WebRtcSession.
// TODO - It may be necessary to supply error code as well.
sigslot::signal0<> SignalError;
- void CreateOffer(CreateSessionDescriptionObserver* observer,
- const MediaConstraintsInterface* constraints);
+ void CreateOffer(
+ CreateSessionDescriptionObserver* observer,
+ const PeerConnectionInterface::RTCOfferAnswerOptions& options);
void CreateAnswer(CreateSessionDescriptionObserver* observer,
const MediaConstraintsInterface* constraints);
// The ownership of |desc| will be transferred after this call.
@@ -195,7 +196,7 @@
// Implements DataChannelProviderInterface.
virtual bool SendData(const cricket::SendDataParams& params,
- const talk_base::Buffer& payload,
+ const rtc::Buffer& payload,
cricket::SendDataResult* result) OVERRIDE;
virtual bool ConnectDataChannel(DataChannel* webrtc_data_channel) OVERRIDE;
virtual void DisconnectDataChannel(DataChannel* webrtc_data_channel) OVERRIDE;
@@ -204,7 +205,7 @@
virtual bool ReadyToSendData() const OVERRIDE;
// Implements DataChannelFactory.
- talk_base::scoped_refptr<DataChannel> CreateDataChannel(
+ rtc::scoped_refptr<DataChannel> CreateDataChannel(
const std::string& label,
const InternalDataChannelInit* config) OVERRIDE;
@@ -216,7 +217,7 @@
// Called when an SSLIdentity is generated or retrieved by
// WebRTCSessionDescriptionFactory. Should happen before setLocalDescription.
- void OnIdentityReady(talk_base::SSLIdentity* identity);
+ void OnIdentityReady(rtc::SSLIdentity* identity);
// For unit test.
bool waiting_for_identity() const;
@@ -289,7 +290,7 @@
// messages.
void OnDataChannelMessageReceived(cricket::DataChannel* channel,
const cricket::ReceiveDataParams& params,
- const talk_base::Buffer& payload);
+ const rtc::Buffer& payload);
std::string BadStateErrMsg(State state);
void SetIceConnectionState(PeerConnectionInterface::IceConnectionState state);
@@ -309,17 +310,25 @@
bool ValidateDtlsSetupAttribute(const cricket::SessionDescription* desc,
Action action);
+ // Returns true if we are ready to push down the remote candidate.
+ // |remote_desc| is the new remote description, or NULL if the current remote
+ // description should be used. Output |valid| is true if the candidate media
+ // index is valid.
+ bool ReadyToUseRemoteCandidate(const IceCandidateInterface* candidate,
+ const SessionDescriptionInterface* remote_desc,
+ bool* valid);
+
std::string GetSessionErrorMsg();
- talk_base::scoped_ptr<cricket::VoiceChannel> voice_channel_;
- talk_base::scoped_ptr<cricket::VideoChannel> video_channel_;
- talk_base::scoped_ptr<cricket::DataChannel> data_channel_;
+ rtc::scoped_ptr<cricket::VoiceChannel> voice_channel_;
+ rtc::scoped_ptr<cricket::VideoChannel> video_channel_;
+ rtc::scoped_ptr<cricket::DataChannel> data_channel_;
cricket::ChannelManager* channel_manager_;
MediaStreamSignaling* mediastream_signaling_;
IceObserver* ice_observer_;
PeerConnectionInterface::IceConnectionState ice_connection_state_;
- talk_base::scoped_ptr<SessionDescriptionInterface> local_desc_;
- talk_base::scoped_ptr<SessionDescriptionInterface> remote_desc_;
+ rtc::scoped_ptr<SessionDescriptionInterface> local_desc_;
+ rtc::scoped_ptr<SessionDescriptionInterface> remote_desc_;
// Candidates that arrived before the remote description was set.
std::vector<IceCandidateInterface*> saved_candidates_;
// If the remote peer is using a older version of implementation.
@@ -333,9 +342,9 @@
// 2. If constraint kEnableRtpDataChannels is true, RTP is allowed (DCT_RTP);
// 3. If both 1&2 are false, data channel is not allowed (DCT_NONE).
cricket::DataChannelType data_channel_type_;
- talk_base::scoped_ptr<IceRestartAnswerLatch> ice_restart_latch_;
+ rtc::scoped_ptr<IceRestartAnswerLatch> ice_restart_latch_;
- talk_base::scoped_ptr<WebRtcSessionDescriptionFactory>
+ rtc::scoped_ptr<WebRtcSessionDescriptionFactory>
webrtc_session_desc_factory_;
sigslot::signal0<> SignalVoiceChannelDestroyed;
diff --git a/app/webrtc/webrtcsession_unittest.cc b/app/webrtc/webrtcsession_unittest.cc
index 956f8a6..b5e1dda 100644
--- a/app/webrtc/webrtcsession_unittest.cc
+++ b/app/webrtc/webrtcsession_unittest.cc
@@ -36,17 +36,17 @@
#include "talk/app/webrtc/test/fakemediastreamsignaling.h"
#include "talk/app/webrtc/webrtcsession.h"
#include "talk/app/webrtc/webrtcsessiondescriptionfactory.h"
-#include "talk/base/fakenetwork.h"
-#include "talk/base/firewallsocketserver.h"
-#include "talk/base/gunit.h"
-#include "talk/base/logging.h"
-#include "talk/base/network.h"
-#include "talk/base/physicalsocketserver.h"
-#include "talk/base/ssladapter.h"
-#include "talk/base/sslstreamadapter.h"
-#include "talk/base/stringutils.h"
-#include "talk/base/thread.h"
-#include "talk/base/virtualsocketserver.h"
+#include "webrtc/base/fakenetwork.h"
+#include "webrtc/base/firewallsocketserver.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/network.h"
+#include "webrtc/base/physicalsocketserver.h"
+#include "webrtc/base/ssladapter.h"
+#include "webrtc/base/sslstreamadapter.h"
+#include "webrtc/base/stringutils.h"
+#include "webrtc/base/thread.h"
+#include "webrtc/base/virtualsocketserver.h"
#include "talk/media/base/fakemediaengine.h"
#include "talk/media/base/fakevideorenderer.h"
#include "talk/media/base/mediachannel.h"
@@ -71,9 +71,9 @@
using cricket::NS_GINGLE_P2P;
using cricket::NS_JINGLE_ICE_UDP;
using cricket::TransportInfo;
-using talk_base::SocketAddress;
-using talk_base::scoped_ptr;
-using talk_base::Thread;
+using rtc::SocketAddress;
+using rtc::scoped_ptr;
+using rtc::Thread;
using webrtc::CreateSessionDescription;
using webrtc::CreateSessionDescriptionObserver;
using webrtc::CreateSessionDescriptionRequest;
@@ -99,6 +99,8 @@
using webrtc::kSessionError;
using webrtc::kSessionErrorDesc;
+typedef PeerConnectionInterface::RTCOfferAnswerOptions RTCOfferAnswerOptions;
+
static const int kClientAddrPort = 0;
static const char kClientAddrHost1[] = "11.11.11.11";
static const char kClientAddrHost2[] = "22.22.22.22";
@@ -133,7 +135,7 @@
const std::string& newlines,
std::string* message) {
const std::string tmp = line + newlines;
- talk_base::replace_substrs(line.c_str(), line.length(),
+ rtc::replace_substrs(line.c_str(), line.length(),
tmp.c_str(), tmp.length(), message);
}
@@ -203,8 +205,8 @@
class WebRtcSessionForTest : public webrtc::WebRtcSession {
public:
WebRtcSessionForTest(cricket::ChannelManager* cmgr,
- talk_base::Thread* signaling_thread,
- talk_base::Thread* worker_thread,
+ rtc::Thread* signaling_thread,
+ rtc::Thread* worker_thread,
cricket::PortAllocator* port_allocator,
webrtc::IceObserver* ice_observer,
webrtc::MediaStreamSignaling* mediastream_signaling)
@@ -223,7 +225,7 @@
};
class WebRtcSessionCreateSDPObserverForTest
- : public talk_base::RefCountedObject<CreateSessionDescriptionObserver> {
+ : public rtc::RefCountedObject<CreateSessionDescriptionObserver> {
public:
enum State {
kInit,
@@ -253,7 +255,7 @@
~WebRtcSessionCreateSDPObserverForTest() {}
private:
- talk_base::scoped_ptr<SessionDescriptionInterface> description_;
+ rtc::scoped_ptr<SessionDescriptionInterface> description_;
State state_;
};
@@ -294,24 +296,28 @@
device_manager_(new cricket::FakeDeviceManager()),
channel_manager_(new cricket::ChannelManager(
media_engine_, data_engine_, device_manager_,
- new cricket::CaptureManager(), talk_base::Thread::Current())),
+ new cricket::CaptureManager(), rtc::Thread::Current())),
tdesc_factory_(new cricket::TransportDescriptionFactory()),
desc_factory_(new cricket::MediaSessionDescriptionFactory(
channel_manager_.get(), tdesc_factory_.get())),
- pss_(new talk_base::PhysicalSocketServer),
- vss_(new talk_base::VirtualSocketServer(pss_.get())),
- fss_(new talk_base::FirewallSocketServer(vss_.get())),
+ pss_(new rtc::PhysicalSocketServer),
+ vss_(new rtc::VirtualSocketServer(pss_.get())),
+ fss_(new rtc::FirewallSocketServer(vss_.get())),
ss_scope_(fss_.get()),
- stun_socket_addr_(talk_base::SocketAddress(kStunAddrHost,
+ stun_socket_addr_(rtc::SocketAddress(kStunAddrHost,
cricket::STUN_SERVER_PORT)),
stun_server_(Thread::Current(), stun_socket_addr_),
turn_server_(Thread::Current(), kTurnUdpIntAddr, kTurnUdpExtAddr),
- allocator_(new cricket::BasicPortAllocator(
- &network_manager_, stun_socket_addr_,
- SocketAddress(), SocketAddress(), SocketAddress())),
mediastream_signaling_(channel_manager_.get()),
ice_type_(PeerConnectionInterface::kAll) {
tdesc_factory_->set_protocol(cricket::ICEPROTO_HYBRID);
+
+ cricket::ServerAddresses stun_servers;
+ stun_servers.insert(stun_socket_addr_);
+ allocator_.reset(new cricket::BasicPortAllocator(
+ &network_manager_,
+ stun_servers,
+ SocketAddress(), SocketAddress(), SocketAddress()));
allocator_->set_flags(cricket::PORTALLOCATOR_DISABLE_TCP |
cricket::PORTALLOCATOR_DISABLE_RELAY |
cricket::PORTALLOCATOR_ENABLE_BUNDLE);
@@ -321,11 +327,11 @@
}
static void SetUpTestCase() {
- talk_base::InitializeSSL();
+ rtc::InitializeSSL();
}
static void TearDownTestCase() {
- talk_base::CleanupSSL();
+ rtc::CleanupSSL();
}
void AddInterface(const SocketAddress& addr) {
@@ -339,8 +345,8 @@
void Init(DTLSIdentityServiceInterface* identity_service) {
ASSERT_TRUE(session_.get() == NULL);
session_.reset(new WebRtcSessionForTest(
- channel_manager_.get(), talk_base::Thread::Current(),
- talk_base::Thread::Current(), allocator_.get(),
+ channel_manager_.get(), rtc::Thread::Current(),
+ rtc::Thread::Current(), allocator_.get(),
&observer_,
&mediastream_signaling_));
@@ -374,18 +380,26 @@
// Call mediastream_signaling_.UseOptionsWithStreamX() before this function
// to decide which streams to create.
void InitiateCall() {
- SessionDescriptionInterface* offer = CreateOffer(NULL);
+ SessionDescriptionInterface* offer = CreateOffer();
SetLocalDescriptionWithoutError(offer);
EXPECT_TRUE_WAIT(PeerConnectionInterface::kIceGatheringNew !=
observer_.ice_gathering_state_,
kIceCandidatesTimeout);
}
+ SessionDescriptionInterface* CreateOffer() {
+ PeerConnectionInterface::RTCOfferAnswerOptions options;
+ options.offer_to_receive_audio =
+ RTCOfferAnswerOptions::kOfferToReceiveMediaTrue;
+
+ return CreateOffer(options);
+ }
+
SessionDescriptionInterface* CreateOffer(
- const webrtc::MediaConstraintsInterface* constraints) {
- talk_base::scoped_refptr<WebRtcSessionCreateSDPObserverForTest>
+ const PeerConnectionInterface::RTCOfferAnswerOptions& options) {
+ rtc::scoped_refptr<WebRtcSessionCreateSDPObserverForTest>
observer = new WebRtcSessionCreateSDPObserverForTest();
- session_->CreateOffer(observer, constraints);
+ session_->CreateOffer(observer, options);
EXPECT_TRUE_WAIT(
observer->state() != WebRtcSessionCreateSDPObserverForTest::kInit,
2000);
@@ -394,7 +408,7 @@
SessionDescriptionInterface* CreateAnswer(
const webrtc::MediaConstraintsInterface* constraints) {
- talk_base::scoped_refptr<WebRtcSessionCreateSDPObserverForTest> observer
+ rtc::scoped_refptr<WebRtcSessionCreateSDPObserverForTest> observer
= new WebRtcSessionCreateSDPObserverForTest();
session_->CreateAnswer(observer, constraints);
EXPECT_TRUE_WAIT(
@@ -478,8 +492,8 @@
void SetFactoryDtlsSrtp() {
desc_factory_->set_secure(cricket::SEC_DISABLED);
std::string identity_name = "WebRTC" +
- talk_base::ToString(talk_base::CreateRandomId());
- identity_.reset(talk_base::SSLIdentity::Generate(identity_name));
+ rtc::ToString(rtc::CreateRandomId());
+ identity_.reset(rtc::SSLIdentity::Generate(identity_name));
tdesc_factory_->set_identity(identity_.get());
tdesc_factory_->set_secure(cricket::SEC_REQUIRED);
}
@@ -567,10 +581,10 @@
+ "\r\n";
std::string pwd_line = "a=ice-pwd:" + transport_desc->ice_pwd
+ "\r\n";
- talk_base::replace_substrs(ufrag_line.c_str(), ufrag_line.length(),
+ rtc::replace_substrs(ufrag_line.c_str(), ufrag_line.length(),
"", 0,
sdp);
- talk_base::replace_substrs(pwd_line.c_str(), pwd_line.length(),
+ rtc::replace_substrs(pwd_line.c_str(), pwd_line.length(),
"", 0,
sdp);
}
@@ -596,10 +610,10 @@
+ "\r\n";
std::string mod_ufrag = "a=ice-ufrag:" + modified_ice_ufrag + "\r\n";
std::string mod_pwd = "a=ice-pwd:" + modified_ice_pwd + "\r\n";
- talk_base::replace_substrs(ufrag_line.c_str(), ufrag_line.length(),
+ rtc::replace_substrs(ufrag_line.c_str(), ufrag_line.length(),
mod_ufrag.c_str(), mod_ufrag.length(),
sdp);
- talk_base::replace_substrs(pwd_line.c_str(), pwd_line.length(),
+ rtc::replace_substrs(pwd_line.c_str(), pwd_line.length(),
mod_pwd.c_str(), mod_pwd.length(),
sdp);
}
@@ -698,7 +712,7 @@
options.has_video = true;
options.bundle_enabled = true;
- talk_base::scoped_ptr<SessionDescriptionInterface> temp_offer(
+ rtc::scoped_ptr<SessionDescriptionInterface> temp_offer(
CreateRemoteOffer(options, cricket::SEC_ENABLED));
*nodtls_answer =
@@ -719,7 +733,7 @@
cricket::SecurePolicy secure_policy,
const std::string& session_version,
const SessionDescriptionInterface* current_desc) {
- std::string session_id = talk_base::ToString(talk_base::CreateRandomId64());
+ std::string session_id = rtc::ToString(rtc::CreateRandomId64());
const cricket::SessionDescription* cricket_desc = NULL;
if (current_desc) {
cricket_desc = current_desc->description();
@@ -769,10 +783,10 @@
// SessionDescription from the mutated string.
const char* default_port_str = "5000";
char new_port_str[16];
- talk_base::sprintfn(new_port_str, sizeof(new_port_str), "%d", new_port);
+ rtc::sprintfn(new_port_str, sizeof(new_port_str), "%d", new_port);
std::string offer_str;
offer_basis->ToString(&offer_str);
- talk_base::replace_substrs(default_port_str, strlen(default_port_str),
+ rtc::replace_substrs(default_port_str, strlen(default_port_str),
new_port_str, strlen(new_port_str),
&offer_str);
JsepSessionDescription* offer = new JsepSessionDescription(
@@ -796,7 +810,7 @@
cricket::SecurePolicy policy) {
desc_factory_->set_secure(policy);
const std::string session_id =
- talk_base::ToString(talk_base::CreateRandomId64());
+ rtc::ToString(rtc::CreateRandomId64());
JsepSessionDescription* answer(
new JsepSessionDescription(JsepSessionDescription::kAnswer));
if (!answer->Initialize(desc_factory_->CreateAnswer(offer->description(),
@@ -826,17 +840,19 @@
}
void TestSessionCandidatesWithBundleRtcpMux(bool bundle, bool rtcp_mux) {
- AddInterface(talk_base::SocketAddress(kClientAddrHost1, kClientAddrPort));
+ AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
Init(NULL);
mediastream_signaling_.SendAudioVideoStream1();
- FakeConstraints constraints;
- constraints.SetMandatoryUseRtpMux(bundle);
- SessionDescriptionInterface* offer = CreateOffer(&constraints);
+
+ PeerConnectionInterface::RTCOfferAnswerOptions options;
+ options.use_rtp_mux = bundle;
+
+ SessionDescriptionInterface* offer = CreateOffer(options);
// SetLocalDescription and SetRemoteDescriptions takes ownership of offer
// and answer.
SetLocalDescriptionWithoutError(offer);
- talk_base::scoped_ptr<SessionDescriptionInterface> answer(
+ rtc::scoped_ptr<SessionDescriptionInterface> answer(
CreateRemoteAnswer(session_->local_description()));
std::string sdp;
EXPECT_TRUE(answer->ToString(&sdp));
@@ -849,7 +865,7 @@
// Disable rtcp-mux from the answer
const std::string kRtcpMux = "a=rtcp-mux";
const std::string kXRtcpMux = "a=xrtcp-mux";
- talk_base::replace_substrs(kRtcpMux.c_str(), kRtcpMux.length(),
+ rtc::replace_substrs(kRtcpMux.c_str(), kRtcpMux.length(),
kXRtcpMux.c_str(), kXRtcpMux.length(),
&sdp);
}
@@ -898,10 +914,10 @@
// -> Failed.
// The Gathering state should go: New -> Gathering -> Completed.
void TestLoopbackCall() {
- AddInterface(talk_base::SocketAddress(kClientAddrHost1, kClientAddrPort));
+ AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
Init(NULL);
mediastream_signaling_.SendAudioVideoStream1();
- SessionDescriptionInterface* offer = CreateOffer(NULL);
+ SessionDescriptionInterface* offer = CreateOffer();
EXPECT_EQ(PeerConnectionInterface::kIceGatheringNew,
observer_.ice_gathering_state_);
@@ -935,9 +951,9 @@
// Adding firewall rule to block ping requests, which should cause
// transport channel failure.
fss_->AddRule(false,
- talk_base::FP_ANY,
- talk_base::FD_ANY,
- talk_base::SocketAddress(kClientAddrHost1, kClientAddrPort));
+ rtc::FP_ANY,
+ rtc::FD_ANY,
+ rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionDisconnected,
observer_.ice_connection_state_,
kIceCandidatesTimeout);
@@ -956,9 +972,9 @@
// wait for the Port to timeout.
int port_timeout = 30000;
fss_->AddRule(false,
- talk_base::FP_ANY,
- talk_base::FD_ANY,
- talk_base::SocketAddress(kClientAddrHost1, kClientAddrPort));
+ rtc::FP_ANY,
+ rtc::FD_ANY,
+ rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionFailed,
observer_.ice_connection_state_,
kIceCandidatesTimeout + port_timeout);
@@ -1001,7 +1017,7 @@
webrtc::InternalDataChannelInit dci;
dci.reliable = false;
session_->CreateDataChannel("datachannel", &dci);
- SessionDescriptionInterface* offer = CreateOffer(NULL);
+ SessionDescriptionInterface* offer = CreateOffer();
SetLocalDescriptionWithoutError(offer);
}
@@ -1017,13 +1033,14 @@
SetRemoteDescriptionWithoutError(offer.release());
}
+ PeerConnectionInterface::RTCOfferAnswerOptions options;
const int kNumber = 3;
- talk_base::scoped_refptr<WebRtcSessionCreateSDPObserverForTest>
+ rtc::scoped_refptr<WebRtcSessionCreateSDPObserverForTest>
observers[kNumber];
for (int i = 0; i < kNumber; ++i) {
observers[i] = new WebRtcSessionCreateSDPObserverForTest();
if (type == CreateSessionDescriptionRequest::kOffer) {
- session_->CreateOffer(observers[i], NULL);
+ session_->CreateOffer(observers[i], options);
} else {
session_->CreateAnswer(observers[i], NULL);
}
@@ -1046,23 +1063,23 @@
cricket::FakeMediaEngine* media_engine_;
cricket::FakeDataEngine* data_engine_;
cricket::FakeDeviceManager* device_manager_;
- talk_base::scoped_ptr<cricket::ChannelManager> channel_manager_;
- talk_base::scoped_ptr<cricket::TransportDescriptionFactory> tdesc_factory_;
- talk_base::scoped_ptr<talk_base::SSLIdentity> identity_;
- talk_base::scoped_ptr<cricket::MediaSessionDescriptionFactory> desc_factory_;
- talk_base::scoped_ptr<talk_base::PhysicalSocketServer> pss_;
- talk_base::scoped_ptr<talk_base::VirtualSocketServer> vss_;
- talk_base::scoped_ptr<talk_base::FirewallSocketServer> fss_;
- talk_base::SocketServerScope ss_scope_;
- talk_base::SocketAddress stun_socket_addr_;
+ rtc::scoped_ptr<cricket::ChannelManager> channel_manager_;
+ rtc::scoped_ptr<cricket::TransportDescriptionFactory> tdesc_factory_;
+ rtc::scoped_ptr<rtc::SSLIdentity> identity_;
+ rtc::scoped_ptr<cricket::MediaSessionDescriptionFactory> desc_factory_;
+ rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_;
+ rtc::scoped_ptr<rtc::VirtualSocketServer> vss_;
+ rtc::scoped_ptr<rtc::FirewallSocketServer> fss_;
+ rtc::SocketServerScope ss_scope_;
+ rtc::SocketAddress stun_socket_addr_;
cricket::TestStunServer stun_server_;
cricket::TestTurnServer turn_server_;
- talk_base::FakeNetworkManager network_manager_;
- talk_base::scoped_ptr<cricket::BasicPortAllocator> allocator_;
+ rtc::FakeNetworkManager network_manager_;
+ rtc::scoped_ptr<cricket::BasicPortAllocator> allocator_;
PeerConnectionFactoryInterface::Options options_;
- talk_base::scoped_ptr<FakeConstraints> constraints_;
+ rtc::scoped_ptr<FakeConstraints> constraints_;
FakeMediaStreamSignaling mediastream_signaling_;
- talk_base::scoped_ptr<WebRtcSessionForTest> session_;
+ rtc::scoped_ptr<WebRtcSessionForTest> session_;
MockIceObserver observer_;
cricket::FakeVideoMediaChannel* video_channel_;
cricket::FakeVoiceMediaChannel* voice_channel_;
@@ -1096,8 +1113,8 @@
}
TEST_F(WebRtcSessionTest, TestMultihomeCandidates) {
- AddInterface(talk_base::SocketAddress(kClientAddrHost1, kClientAddrPort));
- AddInterface(talk_base::SocketAddress(kClientAddrHost2, kClientAddrPort));
+ AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
+ AddInterface(rtc::SocketAddress(kClientAddrHost2, kClientAddrPort));
Init(NULL);
mediastream_signaling_.SendAudioVideoStream1();
InitiateCall();
@@ -1107,12 +1124,12 @@
}
TEST_F(WebRtcSessionTest, TestStunError) {
- AddInterface(talk_base::SocketAddress(kClientAddrHost1, kClientAddrPort));
- AddInterface(talk_base::SocketAddress(kClientAddrHost2, kClientAddrPort));
+ AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
+ AddInterface(rtc::SocketAddress(kClientAddrHost2, kClientAddrPort));
fss_->AddRule(false,
- talk_base::FP_UDP,
- talk_base::FD_ANY,
- talk_base::SocketAddress(kClientAddrHost1, kClientAddrPort));
+ rtc::FP_UDP,
+ rtc::FD_ANY,
+ rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
Init(NULL);
mediastream_signaling_.SendAudioVideoStream1();
InitiateCall();
@@ -1136,7 +1153,7 @@
TEST_F(WebRtcSessionTest, TestCreateSdesOfferReceiveSdesAnswer) {
Init(NULL);
mediastream_signaling_.SendAudioVideoStream1();
- SessionDescriptionInterface* offer = CreateOffer(NULL);
+ SessionDescriptionInterface* offer = CreateOffer();
const std::string session_id_orig = offer->session_id();
const std::string session_version_orig = offer->session_version();
SetLocalDescriptionWithoutError(offer);
@@ -1162,13 +1179,13 @@
// Create new offer without send streams.
mediastream_signaling_.SendNothing();
- offer = CreateOffer(NULL);
+ offer = CreateOffer();
// Verify the session id is the same and the session version is
// increased.
EXPECT_EQ(session_id_orig, offer->session_id());
- EXPECT_LT(talk_base::FromString<uint64>(session_version_orig),
- talk_base::FromString<uint64>(offer->session_version()));
+ EXPECT_LT(rtc::FromString<uint64>(session_version_orig),
+ rtc::FromString<uint64>(offer->session_version()));
SetLocalDescriptionWithoutError(offer);
@@ -1191,7 +1208,7 @@
TEST_F(WebRtcSessionTest, TestReceiveSdesOfferCreateSdesAnswer) {
Init(NULL);
mediastream_signaling_.SendAudioVideoStream2();
- SessionDescriptionInterface* offer = CreateOffer(NULL);
+ SessionDescriptionInterface* offer = CreateOffer();
VerifyCryptoParams(offer->description());
SetRemoteDescriptionWithoutError(offer);
@@ -1218,7 +1235,7 @@
EXPECT_TRUE(kAudioTrack1 == voice_channel_->send_streams()[0].id);
mediastream_signaling_.SendAudioVideoStream1And2();
- offer = CreateOffer(NULL);
+ offer = CreateOffer();
SetRemoteDescriptionWithoutError(offer);
// Answer by turning off all send streams.
@@ -1228,8 +1245,8 @@
// Verify the session id is the same and the session version is
// increased.
EXPECT_EQ(session_id_orig, answer->session_id());
- EXPECT_LT(talk_base::FromString<uint64>(session_version_orig),
- talk_base::FromString<uint64>(answer->session_version()));
+ EXPECT_LT(rtc::FromString<uint64>(session_version_orig),
+ rtc::FromString<uint64>(answer->session_version()));
SetLocalDescriptionWithoutError(answer);
ASSERT_EQ(2u, video_channel_->recv_streams().size());
@@ -1248,12 +1265,12 @@
Init(NULL);
media_engine_->set_fail_create_channel(true);
- SessionDescriptionInterface* offer = CreateOffer(NULL);
+ SessionDescriptionInterface* offer = CreateOffer();
ASSERT_TRUE(offer != NULL);
// SetRemoteDescription and SetLocalDescription will take the ownership of
// the offer.
SetRemoteDescriptionOfferExpectError(kCreateChannelFailed, offer);
- offer = CreateOffer(NULL);
+ offer = CreateOffer();
ASSERT_TRUE(offer != NULL);
SetLocalDescriptionOfferExpectError(kCreateChannelFailed, offer);
}
@@ -1335,7 +1352,7 @@
// Test that we accept an offer with a DTLS fingerprint when DTLS is on
// and that we return an answer with a DTLS fingerprint.
TEST_F(WebRtcSessionTest, TestReceiveDtlsOfferCreateDtlsAnswer) {
- MAYBE_SKIP_TEST(talk_base::SSLStreamAdapter::HaveDtlsSrtp);
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
mediastream_signaling_.SendAudioVideoStream1();
InitWithDtls();
SetFactoryDtlsSrtp();
@@ -1364,13 +1381,13 @@
// Test that we set a local offer with a DTLS fingerprint when DTLS is on
// and then we accept a remote answer with a DTLS fingerprint successfully.
TEST_F(WebRtcSessionTest, TestCreateDtlsOfferReceiveDtlsAnswer) {
- MAYBE_SKIP_TEST(talk_base::SSLStreamAdapter::HaveDtlsSrtp);
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
mediastream_signaling_.SendAudioVideoStream1();
InitWithDtls();
SetFactoryDtlsSrtp();
// Verify that we get a crypto fingerprint in the answer.
- SessionDescriptionInterface* offer = CreateOffer(NULL);
+ SessionDescriptionInterface* offer = CreateOffer();
ASSERT_TRUE(offer != NULL);
VerifyFingerprintStatus(offer->description(), true);
// Check that we don't have an a=crypto line in the offer.
@@ -1394,7 +1411,7 @@
// Test that if we support DTLS and the other side didn't offer a fingerprint,
// we will fail to set the remote description.
TEST_F(WebRtcSessionTest, TestReceiveNonDtlsOfferWhenDtlsOn) {
- MAYBE_SKIP_TEST(talk_base::SSLStreamAdapter::HaveDtlsSrtp);
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
InitWithDtls();
cricket::MediaSessionOptions options;
options.has_video = true;
@@ -1418,7 +1435,7 @@
// Test that we return a failure when applying a local answer that doesn't have
// a DTLS fingerprint when DTLS is required.
TEST_F(WebRtcSessionTest, TestSetLocalNonDtlsAnswerWhenDtlsOn) {
- MAYBE_SKIP_TEST(talk_base::SSLStreamAdapter::HaveDtlsSrtp);
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
InitWithDtls();
SessionDescriptionInterface* offer = NULL;
SessionDescriptionInterface* answer = NULL;
@@ -1434,9 +1451,9 @@
// Test that we return a failure when applying a remote answer that doesn't have
// a DTLS fingerprint when DTLS is required.
TEST_F(WebRtcSessionTest, TestSetRemoteNonDtlsAnswerWhenDtlsOn) {
- MAYBE_SKIP_TEST(talk_base::SSLStreamAdapter::HaveDtlsSrtp);
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
InitWithDtls();
- SessionDescriptionInterface* offer = CreateOffer(NULL);
+ SessionDescriptionInterface* offer = CreateOffer();
cricket::MediaSessionOptions options;
options.has_video = true;
JsepSessionDescription* answer =
@@ -1457,7 +1474,7 @@
InitWithDtls();
// Verify that we get a crypto fingerprint in the answer.
- SessionDescriptionInterface* offer = CreateOffer(NULL);
+ SessionDescriptionInterface* offer = CreateOffer();
ASSERT_TRUE(offer != NULL);
VerifyFingerprintStatus(offer->description(), false);
// Check that we don't have an a=crypto line in the offer.
@@ -1510,11 +1527,11 @@
Init(NULL);
mediastream_signaling_.SendNothing();
// SetLocalDescription take ownership of offer.
- SessionDescriptionInterface* offer = CreateOffer(NULL);
+ SessionDescriptionInterface* offer = CreateOffer();
SetLocalDescriptionWithoutError(offer);
// SetLocalDescription take ownership of offer.
- SessionDescriptionInterface* offer2 = CreateOffer(NULL);
+ SessionDescriptionInterface* offer2 = CreateOffer();
SetLocalDescriptionWithoutError(offer2);
}
@@ -1522,19 +1539,19 @@
Init(NULL);
mediastream_signaling_.SendNothing();
// SetLocalDescription take ownership of offer.
- SessionDescriptionInterface* offer = CreateOffer(NULL);
+ SessionDescriptionInterface* offer = CreateOffer();
SetRemoteDescriptionWithoutError(offer);
- SessionDescriptionInterface* offer2 = CreateOffer(NULL);
+ SessionDescriptionInterface* offer2 = CreateOffer();
SetRemoteDescriptionWithoutError(offer2);
}
TEST_F(WebRtcSessionTest, TestSetLocalAndRemoteOffer) {
Init(NULL);
mediastream_signaling_.SendNothing();
- SessionDescriptionInterface* offer = CreateOffer(NULL);
+ SessionDescriptionInterface* offer = CreateOffer();
SetLocalDescriptionWithoutError(offer);
- offer = CreateOffer(NULL);
+ offer = CreateOffer();
SetRemoteDescriptionOfferExpectError(
"Called in wrong state: STATE_SENTINITIATE", offer);
}
@@ -1542,9 +1559,9 @@
TEST_F(WebRtcSessionTest, TestSetRemoteAndLocalOffer) {
Init(NULL);
mediastream_signaling_.SendNothing();
- SessionDescriptionInterface* offer = CreateOffer(NULL);
+ SessionDescriptionInterface* offer = CreateOffer();
SetRemoteDescriptionWithoutError(offer);
- offer = CreateOffer(NULL);
+ offer = CreateOffer();
SetLocalDescriptionOfferExpectError(
"Called in wrong state: STATE_RECEIVEDINITIATE", offer);
}
@@ -1575,7 +1592,7 @@
TEST_F(WebRtcSessionTest, TestSetRemotePrAnswer) {
Init(NULL);
mediastream_signaling_.SendNothing();
- SessionDescriptionInterface* offer = CreateOffer(NULL);
+ SessionDescriptionInterface* offer = CreateOffer();
SetLocalDescriptionExpectState(offer, BaseSession::STATE_SENTINITIATE);
JsepSessionDescription* pranswer =
@@ -1602,8 +1619,8 @@
TEST_F(WebRtcSessionTest, TestSetLocalAnswerWithoutOffer) {
Init(NULL);
mediastream_signaling_.SendNothing();
- talk_base::scoped_ptr<SessionDescriptionInterface> offer(
- CreateOffer(NULL));
+ rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
+
SessionDescriptionInterface* answer =
CreateRemoteAnswer(offer.get());
SetLocalDescriptionAnswerExpectError("Called in wrong state: STATE_INIT",
@@ -1613,8 +1630,8 @@
TEST_F(WebRtcSessionTest, TestSetRemoteAnswerWithoutOffer) {
Init(NULL);
mediastream_signaling_.SendNothing();
- talk_base::scoped_ptr<SessionDescriptionInterface> offer(
- CreateOffer(NULL));
+ rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
+
SessionDescriptionInterface* answer =
CreateRemoteAnswer(offer.get());
SetRemoteDescriptionAnswerExpectError(
@@ -1632,7 +1649,7 @@
// Fail since we have not set a offer description.
EXPECT_FALSE(session_->ProcessIceMessage(&ice_candidate1));
- SessionDescriptionInterface* offer = CreateOffer(NULL);
+ SessionDescriptionInterface* offer = CreateOffer();
SetLocalDescriptionWithoutError(offer);
// Candidate should be allowed to add before remote description.
EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate1));
@@ -1723,7 +1740,7 @@
// Test that local candidates are added to the local session description and
// that they are retained if the local session description is changed.
TEST_F(WebRtcSessionTest, TestLocalCandidatesAddedToSessionDescription) {
- AddInterface(talk_base::SocketAddress(kClientAddrHost1, kClientAddrPort));
+ AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
Init(NULL);
mediastream_signaling_.SendAudioVideoStream1();
CreateAndSetRemoteOfferAndLocalAnswer();
@@ -1766,7 +1783,7 @@
JsepIceCandidate ice_candidate(kMediaContentName0, kMediaContentIndex0,
candidate1);
mediastream_signaling_.SendAudioVideoStream1();
- SessionDescriptionInterface* offer = CreateOffer(NULL);
+ SessionDescriptionInterface* offer = CreateOffer();
EXPECT_TRUE(offer->AddCandidate(&ice_candidate));
SetRemoteDescriptionWithoutError(offer);
@@ -1787,7 +1804,7 @@
// Test that offers and answers contains ice candidates when Ice candidates have
// been gathered.
TEST_F(WebRtcSessionTest, TestSetLocalAndRemoteDescriptionWithCandidates) {
- AddInterface(talk_base::SocketAddress(kClientAddrHost1, kClientAddrPort));
+ AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
Init(NULL);
mediastream_signaling_.SendAudioVideoStream1();
// Ice is started but candidates are not provided until SetLocalDescription
@@ -1801,8 +1818,8 @@
EXPECT_TRUE_WAIT(0u < observer_.mline_1_candidates_.size(),
kIceCandidatesTimeout);
- talk_base::scoped_ptr<SessionDescriptionInterface> local_offer(
- CreateOffer(NULL));
+ rtc::scoped_ptr<SessionDescriptionInterface> local_offer(CreateOffer());
+
ASSERT_TRUE(local_offer->candidates(kMediaContentIndex0) != NULL);
EXPECT_LT(0u, local_offer->candidates(kMediaContentIndex0)->count());
ASSERT_TRUE(local_offer->candidates(kMediaContentIndex1) != NULL);
@@ -1823,8 +1840,7 @@
TEST_F(WebRtcSessionTest, TestChannelCreationsWithContentNames) {
Init(NULL);
mediastream_signaling_.SendAudioVideoStream1();
- talk_base::scoped_ptr<SessionDescriptionInterface> offer(
- CreateOffer(NULL));
+ rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
// CreateOffer creates session description with the content names "audio" and
// "video". Goal is to modify these content names and verify transport channel
@@ -1838,12 +1854,12 @@
const std::string kVideoMidReplaceStr = "a=mid:video_content_name";
// Replacing |audio| with |audio_content_name|.
- talk_base::replace_substrs(kAudioMid.c_str(), kAudioMid.length(),
+ rtc::replace_substrs(kAudioMid.c_str(), kAudioMid.length(),
kAudioMidReplaceStr.c_str(),
kAudioMidReplaceStr.length(),
&sdp);
// Replacing |video| with |video_content_name|.
- talk_base::replace_substrs(kVideoMid.c_str(), kVideoMid.length(),
+ rtc::replace_substrs(kVideoMid.c_str(), kVideoMid.length(),
kVideoMidReplaceStr.c_str(),
kVideoMidReplaceStr.length(),
&sdp);
@@ -1867,8 +1883,8 @@
// the send streams when no constraints have been set.
TEST_F(WebRtcSessionTest, CreateOfferWithoutConstraintsOrStreams) {
Init(NULL);
- talk_base::scoped_ptr<SessionDescriptionInterface> offer(
- CreateOffer(NULL));
+ rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
+
ASSERT_TRUE(offer != NULL);
const cricket::ContentInfo* content =
cricket::GetFirstAudioContent(offer->description());
@@ -1883,8 +1899,8 @@
Init(NULL);
// Test Audio only offer.
mediastream_signaling_.UseOptionsAudioOnly();
- talk_base::scoped_ptr<SessionDescriptionInterface> offer(
- CreateOffer(NULL));
+ rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
+
const cricket::ContentInfo* content =
cricket::GetFirstAudioContent(offer->description());
EXPECT_TRUE(content != NULL);
@@ -1893,7 +1909,7 @@
// Test Audio / Video offer.
mediastream_signaling_.SendAudioVideoStream1();
- offer.reset(CreateOffer(NULL));
+ offer.reset(CreateOffer());
content = cricket::GetFirstAudioContent(offer->description());
EXPECT_TRUE(content != NULL);
content = cricket::GetFirstVideoContent(offer->description());
@@ -1904,12 +1920,13 @@
// kOfferToReceiveVideo and kOfferToReceiveAudio constraints are set to false.
TEST_F(WebRtcSessionTest, CreateOfferWithConstraintsWithoutStreams) {
Init(NULL);
- webrtc::FakeConstraints constraints_no_receive;
- constraints_no_receive.SetMandatoryReceiveAudio(false);
- constraints_no_receive.SetMandatoryReceiveVideo(false);
+ PeerConnectionInterface::RTCOfferAnswerOptions options;
+ options.offer_to_receive_audio = 0;
+ options.offer_to_receive_video = 0;
- talk_base::scoped_ptr<SessionDescriptionInterface> offer(
- CreateOffer(&constraints_no_receive));
+ rtc::scoped_ptr<SessionDescriptionInterface> offer(
+ CreateOffer(options));
+
ASSERT_TRUE(offer != NULL);
const cricket::ContentInfo* content =
cricket::GetFirstAudioContent(offer->description());
@@ -1922,10 +1939,12 @@
// kOfferToReceiveAudio constraints are set to true.
TEST_F(WebRtcSessionTest, CreateAudioOnlyOfferWithConstraints) {
Init(NULL);
- webrtc::FakeConstraints constraints_audio_only;
- constraints_audio_only.SetMandatoryReceiveAudio(true);
- talk_base::scoped_ptr<SessionDescriptionInterface> offer(
- CreateOffer(&constraints_audio_only));
+ PeerConnectionInterface::RTCOfferAnswerOptions options;
+ options.offer_to_receive_audio =
+ RTCOfferAnswerOptions::kOfferToReceiveMediaTrue;
+
+ rtc::scoped_ptr<SessionDescriptionInterface> offer(
+ CreateOffer(options));
const cricket::ContentInfo* content =
cricket::GetFirstAudioContent(offer->description());
@@ -1939,11 +1958,15 @@
TEST_F(WebRtcSessionTest, CreateOfferWithConstraints) {
Init(NULL);
// Test Audio / Video offer.
- webrtc::FakeConstraints constraints_audio_video;
- constraints_audio_video.SetMandatoryReceiveAudio(true);
- constraints_audio_video.SetMandatoryReceiveVideo(true);
- talk_base::scoped_ptr<SessionDescriptionInterface> offer(
- CreateOffer(&constraints_audio_video));
+ PeerConnectionInterface::RTCOfferAnswerOptions options;
+ options.offer_to_receive_audio =
+ RTCOfferAnswerOptions::kOfferToReceiveMediaTrue;
+ options.offer_to_receive_video =
+ RTCOfferAnswerOptions::kOfferToReceiveMediaTrue;
+
+ rtc::scoped_ptr<SessionDescriptionInterface> offer(
+ CreateOffer(options));
+
const cricket::ContentInfo* content =
cricket::GetFirstAudioContent(offer->description());
@@ -1959,7 +1982,7 @@
// an offer.
TEST_F(WebRtcSessionTest, CreateAnswerWithoutAnOffer) {
Init(NULL);
- SessionDescriptionInterface* offer = CreateOffer(NULL);
+ SessionDescriptionInterface* offer = CreateOffer();
SetLocalDescriptionWithoutError(offer);
SessionDescriptionInterface* answer = CreateRemoteAnswer(offer);
SetRemoteDescriptionWithoutError(answer);
@@ -1971,9 +1994,9 @@
TEST_F(WebRtcSessionTest, CreateAnswerWithoutConstraintsOrStreams) {
Init(NULL);
// Create a remote offer with audio and video content.
- talk_base::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer());
+ rtc::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer());
SetRemoteDescriptionWithoutError(offer.release());
- talk_base::scoped_ptr<SessionDescriptionInterface> answer(
+ rtc::scoped_ptr<SessionDescriptionInterface> answer(
CreateAnswer(NULL));
const cricket::ContentInfo* content =
cricket::GetFirstAudioContent(answer->description());
@@ -1993,13 +2016,13 @@
cricket::MediaSessionOptions options;
options.has_audio = true;
options.has_video = false;
- talk_base::scoped_ptr<JsepSessionDescription> offer(
+ rtc::scoped_ptr<JsepSessionDescription> offer(
CreateRemoteOffer(options));
ASSERT_TRUE(cricket::GetFirstVideoContent(offer->description()) == NULL);
ASSERT_TRUE(cricket::GetFirstAudioContent(offer->description()) != NULL);
SetRemoteDescriptionWithoutError(offer.release());
- talk_base::scoped_ptr<SessionDescriptionInterface> answer(
+ rtc::scoped_ptr<SessionDescriptionInterface> answer(
CreateAnswer(NULL));
const cricket::ContentInfo* content =
cricket::GetFirstAudioContent(answer->description());
@@ -2014,11 +2037,11 @@
TEST_F(WebRtcSessionTest, CreateAnswerWithoutConstraints) {
Init(NULL);
// Create a remote offer with audio and video content.
- talk_base::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer());
+ rtc::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer());
SetRemoteDescriptionWithoutError(offer.release());
// Test with a stream with tracks.
mediastream_signaling_.SendAudioVideoStream1();
- talk_base::scoped_ptr<SessionDescriptionInterface> answer(
+ rtc::scoped_ptr<SessionDescriptionInterface> answer(
CreateAnswer(NULL));
const cricket::ContentInfo* content =
cricket::GetFirstAudioContent(answer->description());
@@ -2035,14 +2058,14 @@
TEST_F(WebRtcSessionTest, CreateAnswerWithConstraintsWithoutStreams) {
Init(NULL);
// Create a remote offer with audio and video content.
- talk_base::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer());
+ rtc::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer());
SetRemoteDescriptionWithoutError(offer.release());
webrtc::FakeConstraints constraints_no_receive;
constraints_no_receive.SetMandatoryReceiveAudio(false);
constraints_no_receive.SetMandatoryReceiveVideo(false);
- talk_base::scoped_ptr<SessionDescriptionInterface> answer(
+ rtc::scoped_ptr<SessionDescriptionInterface> answer(
CreateAnswer(&constraints_no_receive));
const cricket::ContentInfo* content =
cricket::GetFirstAudioContent(answer->description());
@@ -2059,7 +2082,7 @@
TEST_F(WebRtcSessionTest, CreateAnswerWithConstraints) {
Init(NULL);
// Create a remote offer with audio and video content.
- talk_base::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer());
+ rtc::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer());
SetRemoteDescriptionWithoutError(offer.release());
webrtc::FakeConstraints constraints_no_receive;
@@ -2068,7 +2091,7 @@
// Test with a stream with tracks.
mediastream_signaling_.SendAudioVideoStream1();
- talk_base::scoped_ptr<SessionDescriptionInterface> answer(
+ rtc::scoped_ptr<SessionDescriptionInterface> answer(
CreateAnswer(&constraints_no_receive));
// TODO(perkj): Should the direction be set to SEND_ONLY?
@@ -2086,10 +2109,14 @@
TEST_F(WebRtcSessionTest, CreateOfferWithoutCNCodecs) {
AddCNCodecs();
Init(NULL);
- webrtc::FakeConstraints constraints;
- constraints.SetOptionalVAD(false);
- talk_base::scoped_ptr<SessionDescriptionInterface> offer(
- CreateOffer(&constraints));
+ PeerConnectionInterface::RTCOfferAnswerOptions options;
+ options.offer_to_receive_audio =
+ RTCOfferAnswerOptions::kOfferToReceiveMediaTrue;
+ options.voice_activity_detection = false;
+
+ rtc::scoped_ptr<SessionDescriptionInterface> offer(
+ CreateOffer(options));
+
const cricket::ContentInfo* content =
cricket::GetFirstAudioContent(offer->description());
EXPECT_TRUE(content != NULL);
@@ -2100,12 +2127,12 @@
AddCNCodecs();
Init(NULL);
// Create a remote offer with audio and video content.
- talk_base::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer());
+ rtc::scoped_ptr<JsepSessionDescription> offer(CreateRemoteOffer());
SetRemoteDescriptionWithoutError(offer.release());
webrtc::FakeConstraints constraints;
constraints.SetOptionalVAD(false);
- talk_base::scoped_ptr<SessionDescriptionInterface> answer(
+ rtc::scoped_ptr<SessionDescriptionInterface> answer(
CreateAnswer(&constraints));
const cricket::ContentInfo* content =
cricket::GetFirstAudioContent(answer->description());
@@ -2121,7 +2148,7 @@
EXPECT_TRUE(media_engine_->GetVoiceChannel(0) == NULL);
mediastream_signaling_.SendAudioVideoStream1();
- SessionDescriptionInterface* offer = CreateOffer(NULL);
+ SessionDescriptionInterface* offer = CreateOffer();
cricket::MediaSessionOptions options;
options.has_video = false;
@@ -2178,7 +2205,7 @@
EXPECT_TRUE(media_engine_->GetVideoChannel(0) == NULL);
EXPECT_TRUE(media_engine_->GetVoiceChannel(0) == NULL);
mediastream_signaling_.SendAudioVideoStream1();
- SessionDescriptionInterface* offer = CreateOffer(NULL);
+ SessionDescriptionInterface* offer = CreateOffer();
cricket::MediaSessionOptions options;
options.has_audio = false;
@@ -2229,8 +2256,7 @@
TEST_F(WebRtcSessionTest, VerifyCryptoParamsInSDP) {
Init(NULL);
mediastream_signaling_.SendAudioVideoStream1();
- scoped_ptr<SessionDescriptionInterface> offer(
- CreateOffer(NULL));
+ scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
VerifyCryptoParams(offer->description());
SetRemoteDescriptionWithoutError(offer.release());
scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer(NULL));
@@ -2241,8 +2267,7 @@
options_.disable_encryption = true;
Init(NULL);
mediastream_signaling_.SendAudioVideoStream1();
- scoped_ptr<SessionDescriptionInterface> offer(
- CreateOffer(NULL));
+ scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
VerifyNoCryptoParams(offer->description(), false);
}
@@ -2261,7 +2286,8 @@
TEST_F(WebRtcSessionTest, TestSetLocalDescriptionWithoutIce) {
Init(NULL);
mediastream_signaling_.SendAudioVideoStream1();
- talk_base::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer(NULL));
+ rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
+
std::string sdp;
RemoveIceUfragPwdLines(offer.get(), &sdp);
SessionDescriptionInterface* modified_offer =
@@ -2273,7 +2299,7 @@
// no a=ice-ufrag and a=ice-pwd lines are present in the SDP.
TEST_F(WebRtcSessionTest, TestSetRemoteDescriptionWithoutIce) {
Init(NULL);
- talk_base::scoped_ptr<SessionDescriptionInterface> offer(CreateRemoteOffer());
+ rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateRemoteOffer());
std::string sdp;
RemoveIceUfragPwdLines(offer.get(), &sdp);
SessionDescriptionInterface* modified_offer =
@@ -2287,7 +2313,8 @@
Init(NULL);
tdesc_factory_->set_protocol(cricket::ICEPROTO_RFC5245);
mediastream_signaling_.SendAudioVideoStream1();
- talk_base::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer(NULL));
+ rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
+
std::string sdp;
// Modifying ice ufrag and pwd in local offer with strings smaller than the
// recommended values of 4 and 22 bytes respectively.
@@ -2311,7 +2338,7 @@
TEST_F(WebRtcSessionTest, TestSetRemoteDescriptionInvalidIceCredentials) {
Init(NULL);
tdesc_factory_->set_protocol(cricket::ICEPROTO_RFC5245);
- talk_base::scoped_ptr<SessionDescriptionInterface> offer(CreateRemoteOffer());
+ rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateRemoteOffer());
std::string sdp;
// Modifying ice ufrag and pwd in remote offer with strings smaller than the
// recommended values of 4 and 22 bytes respectively.
@@ -2336,8 +2363,8 @@
Init(NULL);
EXPECT_TRUE((cricket::PORTALLOCATOR_ENABLE_BUNDLE &
allocator_->flags()) == cricket::PORTALLOCATOR_ENABLE_BUNDLE);
- talk_base::scoped_ptr<SessionDescriptionInterface> offer(
- CreateOffer(NULL));
+ rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
+
cricket::SessionDescription* offer_copy =
offer->description()->Copy();
offer_copy->RemoveGroupByName(cricket::GROUP_TYPE_BUNDLE);
@@ -2354,12 +2381,15 @@
mediastream_signaling_.SendAudioVideoStream1();
EXPECT_TRUE((cricket::PORTALLOCATOR_ENABLE_BUNDLE &
allocator_->flags()) == cricket::PORTALLOCATOR_ENABLE_BUNDLE);
- FakeConstraints constraints;
- constraints.SetMandatoryUseRtpMux(true);
- SessionDescriptionInterface* offer = CreateOffer(&constraints);
+
+ PeerConnectionInterface::RTCOfferAnswerOptions options;
+ options.use_rtp_mux = true;
+
+ SessionDescriptionInterface* offer = CreateOffer(options);
+
SetLocalDescriptionWithoutError(offer);
mediastream_signaling_.SendAudioVideoStream2();
- talk_base::scoped_ptr<SessionDescriptionInterface> answer(
+ rtc::scoped_ptr<SessionDescriptionInterface> answer(
CreateRemoteAnswer(session_->local_description()));
cricket::SessionDescription* answer_copy = answer->description()->Copy();
answer_copy->RemoveGroupByName(cricket::GROUP_TYPE_BUNDLE);
@@ -2392,15 +2422,17 @@
mediastream_signaling_.SendAudioVideoStream1();
EXPECT_TRUE((cricket::PORTALLOCATOR_ENABLE_BUNDLE &
allocator_->flags()) == cricket::PORTALLOCATOR_ENABLE_BUNDLE);
- FakeConstraints constraints;
- constraints.SetMandatoryUseRtpMux(true);
- SessionDescriptionInterface* offer = CreateOffer(&constraints);
+
+ PeerConnectionInterface::RTCOfferAnswerOptions options;
+ options.use_rtp_mux = true;
+
+ SessionDescriptionInterface* offer = CreateOffer(options);
std::string offer_str;
offer->ToString(&offer_str);
// Disable rtcp-mux
const std::string rtcp_mux = "rtcp-mux";
const std::string xrtcp_mux = "xrtcp-mux";
- talk_base::replace_substrs(rtcp_mux.c_str(), rtcp_mux.length(),
+ rtc::replace_substrs(rtcp_mux.c_str(), rtcp_mux.length(),
xrtcp_mux.c_str(), xrtcp_mux.length(),
&offer_str);
JsepSessionDescription *local_offer =
@@ -2427,7 +2459,7 @@
EXPECT_TRUE(channel->GetOutputScaling(receive_ssrc, &left_vol, &right_vol));
EXPECT_EQ(1, left_vol);
EXPECT_EQ(1, right_vol);
- talk_base::scoped_ptr<FakeAudioRenderer> renderer(new FakeAudioRenderer());
+ rtc::scoped_ptr<FakeAudioRenderer> renderer(new FakeAudioRenderer());
session_->SetAudioPlayout(receive_ssrc, false, renderer.get());
EXPECT_TRUE(channel->GetOutputScaling(receive_ssrc, &left_vol, &right_vol));
EXPECT_EQ(0, left_vol);
@@ -2453,7 +2485,7 @@
cricket::AudioOptions options;
options.echo_cancellation.Set(true);
- talk_base::scoped_ptr<FakeAudioRenderer> renderer(new FakeAudioRenderer());
+ rtc::scoped_ptr<FakeAudioRenderer> renderer(new FakeAudioRenderer());
session_->SetAudioSend(send_ssrc, false, options, renderer.get());
EXPECT_TRUE(channel->IsStreamMuted(send_ssrc));
EXPECT_FALSE(channel->options().echo_cancellation.IsSet());
@@ -2479,7 +2511,7 @@
ASSERT_EQ(1u, channel->send_streams().size());
uint32 send_ssrc = channel->send_streams()[0].first_ssrc();
- talk_base::scoped_ptr<FakeAudioRenderer> renderer(new FakeAudioRenderer());
+ rtc::scoped_ptr<FakeAudioRenderer> renderer(new FakeAudioRenderer());
cricket::AudioOptions options;
session_->SetAudioSend(send_ssrc, true, options, renderer.get());
EXPECT_TRUE(renderer->sink() != NULL);
@@ -2564,7 +2596,7 @@
TEST_F(WebRtcSessionTest, TestInitiatorFlagAsOriginator) {
Init(NULL);
EXPECT_FALSE(session_->initiator());
- SessionDescriptionInterface* offer = CreateOffer(NULL);
+ SessionDescriptionInterface* offer = CreateOffer();
SessionDescriptionInterface* answer = CreateRemoteAnswer(offer);
SetLocalDescriptionWithoutError(offer);
EXPECT_TRUE(session_->initiator());
@@ -2590,8 +2622,8 @@
TEST_F(WebRtcSessionTest, TestInitiatorGIceInAnswer) {
Init(NULL);
mediastream_signaling_.SendAudioVideoStream1();
- SessionDescriptionInterface* offer = CreateOffer(NULL);
- talk_base::scoped_ptr<SessionDescriptionInterface> answer(
+ SessionDescriptionInterface* offer = CreateOffer();
+ rtc::scoped_ptr<SessionDescriptionInterface> answer(
CreateRemoteAnswer(offer));
SetLocalDescriptionWithoutError(offer);
std::string sdp;
@@ -2612,7 +2644,7 @@
TEST_F(WebRtcSessionTest, TestInitiatorIceInAnswer) {
Init(NULL);
mediastream_signaling_.SendAudioVideoStream1();
- SessionDescriptionInterface* offer = CreateOffer(NULL);
+ SessionDescriptionInterface* offer = CreateOffer();
SessionDescriptionInterface* answer = CreateRemoteAnswer(offer);
SetLocalDescriptionWithoutError(offer);
@@ -2626,9 +2658,9 @@
TEST_F(WebRtcSessionTest, TestReceiverGIceInOffer) {
Init(NULL);
mediastream_signaling_.SendAudioVideoStream1();
- SessionDescriptionInterface* offer = CreateOffer(NULL);
+ SessionDescriptionInterface* offer = CreateOffer();
SetRemoteDescriptionWithoutError(offer);
- talk_base::scoped_ptr<SessionDescriptionInterface> answer(
+ rtc::scoped_ptr<SessionDescriptionInterface> answer(
CreateAnswer(NULL));
std::string sdp;
EXPECT_TRUE(answer->ToString(&sdp));
@@ -2648,7 +2680,7 @@
TEST_F(WebRtcSessionTest, TestReceiverIceInOffer) {
Init(NULL);
mediastream_signaling_.SendAudioVideoStream1();
- SessionDescriptionInterface* offer = CreateOffer(NULL);
+ SessionDescriptionInterface* offer = CreateOffer();
SetRemoteDescriptionWithoutError(offer);
SessionDescriptionInterface* answer = CreateAnswer(NULL);
SetLocalDescriptionWithoutError(answer);
@@ -2661,14 +2693,14 @@
TEST_F(WebRtcSessionTest, TestIceOfferGIceOnlyAnswer) {
Init(NULL);
mediastream_signaling_.SendAudioVideoStream1();
- talk_base::scoped_ptr<SessionDescriptionInterface> offer(
- CreateOffer(NULL));
+ rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
+
std::string offer_str;
offer->ToString(&offer_str);
// Disable google-ice
const std::string gice_option = "google-ice";
const std::string xgoogle_xice = "xgoogle-xice";
- talk_base::replace_substrs(gice_option.c_str(), gice_option.length(),
+ rtc::replace_substrs(gice_option.c_str(), gice_option.length(),
xgoogle_xice.c_str(), xgoogle_xice.length(),
&offer_str);
JsepSessionDescription *ice_only_offer =
@@ -2693,9 +2725,9 @@
TEST_F(WebRtcSessionTest, TestIncorrectMLinesInRemoteAnswer) {
Init(NULL);
mediastream_signaling_.SendAudioVideoStream1();
- SessionDescriptionInterface* offer = CreateOffer(NULL);
+ SessionDescriptionInterface* offer = CreateOffer();
SetLocalDescriptionWithoutError(offer);
- talk_base::scoped_ptr<SessionDescriptionInterface> answer(
+ rtc::scoped_ptr<SessionDescriptionInterface> answer(
CreateRemoteAnswer(session_->local_description()));
cricket::SessionDescription* answer_copy = answer->description()->Copy();
@@ -2713,7 +2745,7 @@
EXPECT_TRUE(answer->ToString(&sdp));
const std::string kAudioMid = "a=mid:audio";
const std::string kAudioMidReplaceStr = "a=mid:audio_content_name";
- talk_base::replace_substrs(kAudioMid.c_str(), kAudioMid.length(),
+ rtc::replace_substrs(kAudioMid.c_str(), kAudioMid.length(),
kAudioMidReplaceStr.c_str(),
kAudioMidReplaceStr.length(),
&sdp);
@@ -2725,7 +2757,7 @@
EXPECT_TRUE(answer->ToString(&sdp));
const std::string kAudioMline = "m=audio";
const std::string kAudioMlineReplaceStr = "m=video";
- talk_base::replace_substrs(kAudioMline.c_str(), kAudioMline.length(),
+ rtc::replace_substrs(kAudioMline.c_str(), kAudioMline.length(),
kAudioMlineReplaceStr.c_str(),
kAudioMlineReplaceStr.length(),
&sdp);
@@ -2778,7 +2810,7 @@
ASSERT_TRUE(session_->GetTransportProxy("video") != NULL);
// Pump for 1 second and verify that no candidates are generated.
- talk_base::Thread::Current()->ProcessMessages(1000);
+ rtc::Thread::Current()->ProcessMessages(1000);
EXPECT_TRUE(observer_.mline_0_candidates_.empty());
EXPECT_TRUE(observer_.mline_1_candidates_.empty());
@@ -2794,8 +2826,7 @@
TEST_F(WebRtcSessionTest, TestCryptoAfterSetLocalDescription) {
Init(NULL);
mediastream_signaling_.SendAudioVideoStream1();
- talk_base::scoped_ptr<SessionDescriptionInterface> offer(
- CreateOffer(NULL));
+ rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
// Making sure SetLocalDescription correctly sets crypto value in
// SessionDescription object after de-serialization of sdp string. The value
@@ -2814,8 +2845,7 @@
options_.disable_encryption = true;
Init(NULL);
mediastream_signaling_.SendAudioVideoStream1();
- talk_base::scoped_ptr<SessionDescriptionInterface> offer(
- CreateOffer(NULL));
+ rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
// Making sure SetLocalDescription correctly sets crypto value in
// SessionDescription object after de-serialization of sdp string. The value
@@ -2836,22 +2866,22 @@
cricket::MediaSessionOptions options;
options.has_audio = true;
options.has_video = true;
- talk_base::scoped_ptr<JsepSessionDescription> offer(
+ rtc::scoped_ptr<JsepSessionDescription> offer(
CreateRemoteOffer(options));
SetRemoteDescriptionWithoutError(offer.release());
mediastream_signaling_.SendAudioVideoStream1();
- talk_base::scoped_ptr<SessionDescriptionInterface> answer(
+ rtc::scoped_ptr<SessionDescriptionInterface> answer(
CreateAnswer(NULL));
SetLocalDescriptionWithoutError(answer.release());
// Receive an offer with new ufrag and password.
options.transport_options.ice_restart = true;
- talk_base::scoped_ptr<JsepSessionDescription> updated_offer1(
+ rtc::scoped_ptr<JsepSessionDescription> updated_offer1(
CreateRemoteOffer(options, session_->remote_description()));
SetRemoteDescriptionWithoutError(updated_offer1.release());
- talk_base::scoped_ptr<SessionDescriptionInterface> updated_answer1(
+ rtc::scoped_ptr<SessionDescriptionInterface> updated_answer1(
CreateAnswer(NULL));
CompareIceUfragAndPassword(updated_answer1->description(),
@@ -2868,22 +2898,22 @@
cricket::MediaSessionOptions options;
options.has_audio = true;
options.has_video = true;
- talk_base::scoped_ptr<JsepSessionDescription> offer(
+ rtc::scoped_ptr<JsepSessionDescription> offer(
CreateRemoteOffer(options));
SetRemoteDescriptionWithoutError(offer.release());
mediastream_signaling_.SendAudioVideoStream1();
- talk_base::scoped_ptr<SessionDescriptionInterface> answer(
+ rtc::scoped_ptr<SessionDescriptionInterface> answer(
CreateAnswer(NULL));
SetLocalDescriptionWithoutError(answer.release());
// Receive an offer without changed ufrag or password.
options.transport_options.ice_restart = false;
- talk_base::scoped_ptr<JsepSessionDescription> updated_offer2(
+ rtc::scoped_ptr<JsepSessionDescription> updated_offer2(
CreateRemoteOffer(options, session_->remote_description()));
SetRemoteDescriptionWithoutError(updated_offer2.release());
- talk_base::scoped_ptr<SessionDescriptionInterface> updated_answer2(
+ rtc::scoped_ptr<SessionDescriptionInterface> updated_answer2(
CreateAnswer(NULL));
CompareIceUfragAndPassword(updated_answer2->description(),
@@ -2896,7 +2926,7 @@
TEST_F(WebRtcSessionTest, TestSessionContentError) {
Init(NULL);
mediastream_signaling_.SendAudioVideoStream1();
- SessionDescriptionInterface* offer = CreateOffer(NULL);
+ SessionDescriptionInterface* offer = CreateOffer();
const std::string session_id_orig = offer->session_id();
const std::string session_version_orig = offer->session_version();
SetLocalDescriptionWithoutError(offer);
@@ -2963,7 +2993,7 @@
}
TEST_F(WebRtcSessionTest, TestRtpDataChannelConstraintTakesPrecedence) {
- MAYBE_SKIP_TEST(talk_base::SSLStreamAdapter::HaveDtlsSrtp);
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
constraints_.reset(new FakeConstraints());
constraints_->AddOptional(
@@ -2977,17 +3007,17 @@
}
TEST_F(WebRtcSessionTest, TestCreateOfferWithSctpEnabledWithoutStreams) {
- MAYBE_SKIP_TEST(talk_base::SSLStreamAdapter::HaveDtlsSrtp);
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
InitWithDtls();
- talk_base::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer(NULL));
+ rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
EXPECT_TRUE(offer->description()->GetContentByName("data") == NULL);
EXPECT_TRUE(offer->description()->GetTransportInfoByName("data") == NULL);
}
TEST_F(WebRtcSessionTest, TestCreateAnswerWithSctpInOfferAndNoStreams) {
- MAYBE_SKIP_TEST(talk_base::SSLStreamAdapter::HaveDtlsSrtp);
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
SetFactoryDtlsSrtp();
InitWithDtls();
@@ -2999,7 +3029,7 @@
SetRemoteDescriptionWithoutError(offer);
// Verifies the answer contains SCTP.
- talk_base::scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer(NULL));
+ rtc::scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer(NULL));
EXPECT_TRUE(answer != NULL);
EXPECT_TRUE(answer->description()->GetContentByName("data") != NULL);
EXPECT_TRUE(answer->description()->GetTransportInfoByName("data") != NULL);
@@ -3016,7 +3046,7 @@
}
TEST_F(WebRtcSessionTest, TestSctpDataChannelWithDtls) {
- MAYBE_SKIP_TEST(talk_base::SSLStreamAdapter::HaveDtlsSrtp);
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
InitWithDtls();
@@ -3025,7 +3055,7 @@
}
TEST_F(WebRtcSessionTest, TestDisableSctpDataChannels) {
- MAYBE_SKIP_TEST(talk_base::SSLStreamAdapter::HaveDtlsSrtp);
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
options_.disable_sctp_data_channels = true;
InitWithDtls();
@@ -3034,7 +3064,7 @@
}
TEST_F(WebRtcSessionTest, TestSctpDataChannelSendPortParsing) {
- MAYBE_SKIP_TEST(talk_base::SSLStreamAdapter::HaveDtlsSrtp);
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
const int new_send_port = 9998;
const int new_recv_port = 7775;
@@ -3064,7 +3094,7 @@
webrtc::InternalDataChannelInit dci;
dci.reliable = true;
EXPECT_EQ(cricket::DCT_SCTP, data_engine_->last_channel_type());
- talk_base::scoped_refptr<webrtc::DataChannel> dc =
+ rtc::scoped_refptr<webrtc::DataChannel> dc =
session_->CreateDataChannel("datachannel", &dci);
cricket::FakeDataMediaChannel* ch = data_engine_->GetChannel(0);
@@ -3090,12 +3120,13 @@
// Verifies that CreateOffer succeeds when CreateOffer is called before async
// identity generation is finished.
TEST_F(WebRtcSessionTest, TestCreateOfferBeforeIdentityRequestReturnSuccess) {
- MAYBE_SKIP_TEST(talk_base::SSLStreamAdapter::HaveDtlsSrtp);
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
InitWithDtls();
EXPECT_TRUE(session_->waiting_for_identity());
mediastream_signaling_.SendAudioVideoStream1();
- talk_base::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer(NULL));
+ rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
+
EXPECT_TRUE(offer != NULL);
VerifyNoCryptoParams(offer->description(), true);
VerifyFingerprintStatus(offer->description(), true);
@@ -3104,7 +3135,7 @@
// Verifies that CreateAnswer succeeds when CreateOffer is called before async
// identity generation is finished.
TEST_F(WebRtcSessionTest, TestCreateAnswerBeforeIdentityRequestReturnSuccess) {
- MAYBE_SKIP_TEST(talk_base::SSLStreamAdapter::HaveDtlsSrtp);
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
InitWithDtls();
SetFactoryDtlsSrtp();
@@ -3115,7 +3146,7 @@
ASSERT_TRUE(offer.get() != NULL);
SetRemoteDescriptionWithoutError(offer.release());
- talk_base::scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer(NULL));
+ rtc::scoped_ptr<SessionDescriptionInterface> answer(CreateAnswer(NULL));
EXPECT_TRUE(answer != NULL);
VerifyNoCryptoParams(answer->description(), true);
VerifyFingerprintStatus(answer->description(), true);
@@ -3124,22 +3155,24 @@
// Verifies that CreateOffer succeeds when CreateOffer is called after async
// identity generation is finished.
TEST_F(WebRtcSessionTest, TestCreateOfferAfterIdentityRequestReturnSuccess) {
- MAYBE_SKIP_TEST(talk_base::SSLStreamAdapter::HaveDtlsSrtp);
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
InitWithDtls();
EXPECT_TRUE_WAIT(!session_->waiting_for_identity(), 1000);
- talk_base::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer(NULL));
+
+ rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
EXPECT_TRUE(offer != NULL);
}
// Verifies that CreateOffer fails when CreateOffer is called after async
// identity generation fails.
TEST_F(WebRtcSessionTest, TestCreateOfferAfterIdentityRequestReturnFailure) {
- MAYBE_SKIP_TEST(talk_base::SSLStreamAdapter::HaveDtlsSrtp);
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
InitWithDtls(true);
EXPECT_TRUE_WAIT(!session_->waiting_for_identity(), 1000);
- talk_base::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer(NULL));
+
+ rtc::scoped_ptr<SessionDescriptionInterface> offer(CreateOffer());
EXPECT_TRUE(offer == NULL);
}
@@ -3147,7 +3180,7 @@
// before async identity generation is finished.
TEST_F(WebRtcSessionTest,
TestMultipleCreateOfferBeforeIdentityRequestReturnSuccess) {
- MAYBE_SKIP_TEST(talk_base::SSLStreamAdapter::HaveDtlsSrtp);
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
VerifyMultipleAsyncCreateDescription(
true, CreateSessionDescriptionRequest::kOffer);
}
@@ -3156,7 +3189,7 @@
// before async identity generation fails.
TEST_F(WebRtcSessionTest,
TestMultipleCreateOfferBeforeIdentityRequestReturnFailure) {
- MAYBE_SKIP_TEST(talk_base::SSLStreamAdapter::HaveDtlsSrtp);
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
VerifyMultipleAsyncCreateDescription(
false, CreateSessionDescriptionRequest::kOffer);
}
@@ -3165,7 +3198,7 @@
// before async identity generation is finished.
TEST_F(WebRtcSessionTest,
TestMultipleCreateAnswerBeforeIdentityRequestReturnSuccess) {
- MAYBE_SKIP_TEST(talk_base::SSLStreamAdapter::HaveDtlsSrtp);
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
VerifyMultipleAsyncCreateDescription(
true, CreateSessionDescriptionRequest::kAnswer);
}
@@ -3174,7 +3207,7 @@
// before async identity generation fails.
TEST_F(WebRtcSessionTest,
TestMultipleCreateAnswerBeforeIdentityRequestReturnFailure) {
- MAYBE_SKIP_TEST(talk_base::SSLStreamAdapter::HaveDtlsSrtp);
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
VerifyMultipleAsyncCreateDescription(
false, CreateSessionDescriptionRequest::kAnswer);
}
@@ -3194,8 +3227,8 @@
ASSERT_TRUE(audio != NULL);
ASSERT_TRUE(audio->description.identity_fingerprint.get() == NULL);
audio->description.identity_fingerprint.reset(
- talk_base::SSLFingerprint::CreateFromRfc4572(
- talk_base::DIGEST_SHA_256, kFakeDtlsFingerprint));
+ rtc::SSLFingerprint::CreateFromRfc4572(
+ rtc::DIGEST_SHA_256, kFakeDtlsFingerprint));
SetRemoteDescriptionOfferExpectError(kSdpWithoutSdesCrypto,
offer);
}
@@ -3207,7 +3240,7 @@
webrtc::MediaConstraintsInterface::kEnableDscp, true);
Init(NULL);
mediastream_signaling_.SendAudioVideoStream1();
- SessionDescriptionInterface* offer = CreateOffer(NULL);
+ SessionDescriptionInterface* offer = CreateOffer();
SetLocalDescriptionWithoutError(offer);
@@ -3233,7 +3266,7 @@
true);
Init(NULL);
mediastream_signaling_.SendAudioVideoStream1();
- SessionDescriptionInterface* offer = CreateOffer(NULL);
+ SessionDescriptionInterface* offer = CreateOffer();
SetLocalDescriptionWithoutError(offer);
@@ -3246,6 +3279,66 @@
video_options.suspend_below_min_bitrate.GetWithDefaultIfUnset(false));
}
+// Tests that we can renegotiate new media content with ICE candidates in the
+// new remote SDP.
+TEST_F(WebRtcSessionTest, TestRenegotiateNewMediaWithCandidatesInSdp) {
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
+ InitWithDtls();
+ SetFactoryDtlsSrtp();
+
+ mediastream_signaling_.UseOptionsAudioOnly();
+ SessionDescriptionInterface* offer = CreateOffer();
+ SetLocalDescriptionWithoutError(offer);
+
+ SessionDescriptionInterface* answer = CreateRemoteAnswer(offer);
+ SetRemoteDescriptionWithoutError(answer);
+
+ cricket::MediaSessionOptions options;
+ options.has_video = true;
+ offer = CreateRemoteOffer(options, cricket::SEC_DISABLED);
+
+ cricket::Candidate candidate1;
+ candidate1.set_address(rtc::SocketAddress("1.1.1.1", 5000));
+ candidate1.set_component(1);
+ JsepIceCandidate ice_candidate(kMediaContentName1, kMediaContentIndex1,
+ candidate1);
+ EXPECT_TRUE(offer->AddCandidate(&ice_candidate));
+ SetRemoteDescriptionWithoutError(offer);
+
+ answer = CreateAnswer(NULL);
+ SetLocalDescriptionWithoutError(answer);
+}
+
+// Tests that we can renegotiate new media content with ICE candidates separated
+// from the remote SDP.
+TEST_F(WebRtcSessionTest, TestRenegotiateNewMediaWithCandidatesSeparated) {
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
+ InitWithDtls();
+ SetFactoryDtlsSrtp();
+
+ mediastream_signaling_.UseOptionsAudioOnly();
+ SessionDescriptionInterface* offer = CreateOffer();
+ SetLocalDescriptionWithoutError(offer);
+
+ SessionDescriptionInterface* answer = CreateRemoteAnswer(offer);
+ SetRemoteDescriptionWithoutError(answer);
+
+ cricket::MediaSessionOptions options;
+ options.has_video = true;
+ offer = CreateRemoteOffer(options, cricket::SEC_DISABLED);
+ SetRemoteDescriptionWithoutError(offer);
+
+ cricket::Candidate candidate1;
+ candidate1.set_address(rtc::SocketAddress("1.1.1.1", 5000));
+ candidate1.set_component(1);
+ JsepIceCandidate ice_candidate(kMediaContentName1, kMediaContentIndex1,
+ candidate1);
+ EXPECT_TRUE(session_->ProcessIceMessage(&ice_candidate));
+
+ answer = CreateAnswer(NULL);
+ SetLocalDescriptionWithoutError(answer);
+}
+
// TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test
// currently fails because upon disconnection and reconnection OnIceComplete is
// called more than once without returning to IceGatheringGathering.
diff --git a/app/webrtc/webrtcsessiondescriptionfactory.cc b/app/webrtc/webrtcsessiondescriptionfactory.cc
index 25d8fc9..7930330 100644
--- a/app/webrtc/webrtcsessiondescriptionfactory.cc
+++ b/app/webrtc/webrtcsessiondescriptionfactory.cc
@@ -72,15 +72,15 @@
MSG_GENERATE_IDENTITY,
};
-struct CreateSessionDescriptionMsg : public talk_base::MessageData {
+struct CreateSessionDescriptionMsg : public rtc::MessageData {
explicit CreateSessionDescriptionMsg(
webrtc::CreateSessionDescriptionObserver* observer)
: observer(observer) {
}
- talk_base::scoped_refptr<webrtc::CreateSessionDescriptionObserver> observer;
+ rtc::scoped_refptr<webrtc::CreateSessionDescriptionObserver> observer;
std::string error;
- talk_base::scoped_ptr<webrtc::SessionDescriptionInterface> description;
+ rtc::scoped_ptr<webrtc::SessionDescriptionInterface> description;
};
} // namespace
@@ -104,7 +104,7 @@
}
WebRtcSessionDescriptionFactory::WebRtcSessionDescriptionFactory(
- talk_base::Thread* signaling_thread,
+ rtc::Thread* signaling_thread,
cricket::ChannelManager* channel_manager,
MediaStreamSignaling* mediastream_signaling,
DTLSIdentityServiceInterface* dtls_identity_service,
@@ -136,7 +136,7 @@
if (identity_service_.get()) {
identity_request_observer_ =
- new talk_base::RefCountedObject<WebRtcIdentityRequestObserver>();
+ new rtc::RefCountedObject<WebRtcIdentityRequestObserver>();
identity_request_observer_->SignalRequestFailed.connect(
this, &WebRtcSessionDescriptionFactory::OnIdentityRequestFailed);
@@ -166,8 +166,9 @@
void WebRtcSessionDescriptionFactory::CreateOffer(
CreateSessionDescriptionObserver* observer,
- const MediaConstraintsInterface* constraints) {
- cricket::MediaSessionOptions options;
+ const PeerConnectionInterface::RTCOfferAnswerOptions& options) {
+ cricket::MediaSessionOptions session_options;
+
std::string error = "CreateOffer";
if (identity_request_state_ == IDENTITY_FAILED) {
error += kFailedDueToIdentityFailed;
@@ -176,14 +177,15 @@
return;
}
- if (!mediastream_signaling_->GetOptionsForOffer(constraints, &options)) {
- error += " called with invalid constraints.";
+ if (!mediastream_signaling_->GetOptionsForOffer(options,
+ &session_options)) {
+ error += " called with invalid options.";
LOG(LS_ERROR) << error;
PostCreateSessionDescriptionFailed(observer, error);
return;
}
- if (!ValidStreams(options.streams)) {
+ if (!ValidStreams(session_options.streams)) {
error += " called with invalid media streams.";
LOG(LS_ERROR) << error;
PostCreateSessionDescriptionFailed(observer, error);
@@ -192,11 +194,11 @@
if (data_channel_type_ == cricket::DCT_SCTP &&
mediastream_signaling_->HasDataChannels()) {
- options.data_channel_type = cricket::DCT_SCTP;
+ session_options.data_channel_type = cricket::DCT_SCTP;
}
CreateSessionDescriptionRequest request(
- CreateSessionDescriptionRequest::kOffer, observer, options);
+ CreateSessionDescriptionRequest::kOffer, observer, session_options);
if (identity_request_state_ == IDENTITY_WAITING) {
create_session_description_requests_.push(request);
} else {
@@ -270,7 +272,7 @@
return session_desc_factory_.secure();
}
-void WebRtcSessionDescriptionFactory::OnMessage(talk_base::Message* msg) {
+void WebRtcSessionDescriptionFactory::OnMessage(rtc::Message* msg) {
switch (msg->message_id) {
case MSG_CREATE_SESSIONDESCRIPTION_SUCCESS: {
CreateSessionDescriptionMsg* param =
@@ -288,7 +290,7 @@
}
case MSG_GENERATE_IDENTITY: {
LOG(LS_INFO) << "Generating identity.";
- SetIdentity(talk_base::SSLIdentity::Generate(kWebRTCIdentityName));
+ SetIdentity(rtc::SSLIdentity::Generate(kWebRTCIdentityName));
break;
}
default:
@@ -316,7 +318,7 @@
JsepSessionDescription* offer(new JsepSessionDescription(
JsepSessionDescription::kOffer));
if (!offer->Initialize(desc, session_id_,
- talk_base::ToString(session_version_++))) {
+ rtc::ToString(session_version_++))) {
delete offer;
PostCreateSessionDescriptionFailed(request.observer,
"Failed to initialize the offer.");
@@ -339,10 +341,10 @@
request.options.transport_options.ice_restart = session_->IceRestartPending();
// We should pass current ssl role to the transport description factory, if
// there is already an existing ongoing session.
- talk_base::SSLRole ssl_role;
+ rtc::SSLRole ssl_role;
if (session_->GetSslRole(&ssl_role)) {
request.options.transport_options.prefer_passive_role =
- (talk_base::SSL_SERVER == ssl_role);
+ (rtc::SSL_SERVER == ssl_role);
}
cricket::SessionDescription* desc(session_desc_factory_.CreateAnswer(
@@ -360,7 +362,7 @@
JsepSessionDescription* answer(new JsepSessionDescription(
JsepSessionDescription::kAnswer));
if (!answer->Initialize(desc, session_id_,
- talk_base::ToString(session_version_++))) {
+ rtc::ToString(session_version_++))) {
delete answer;
PostCreateSessionDescriptionFailed(request.observer,
"Failed to initialize the answer.");
@@ -416,22 +418,22 @@
ASSERT(signaling_thread_->IsCurrent());
LOG(LS_VERBOSE) << "Identity is successfully generated.";
- std::string pem_cert = talk_base::SSLIdentity::DerToPem(
- talk_base::kPemTypeCertificate,
+ std::string pem_cert = rtc::SSLIdentity::DerToPem(
+ rtc::kPemTypeCertificate,
reinterpret_cast<const unsigned char*>(der_cert.data()),
der_cert.length());
- std::string pem_key = talk_base::SSLIdentity::DerToPem(
- talk_base::kPemTypeRsaPrivateKey,
+ std::string pem_key = rtc::SSLIdentity::DerToPem(
+ rtc::kPemTypeRsaPrivateKey,
reinterpret_cast<const unsigned char*>(der_private_key.data()),
der_private_key.length());
- talk_base::SSLIdentity* identity =
- talk_base::SSLIdentity::FromPEMStrings(pem_key, pem_cert);
+ rtc::SSLIdentity* identity =
+ rtc::SSLIdentity::FromPEMStrings(pem_key, pem_cert);
SetIdentity(identity);
}
void WebRtcSessionDescriptionFactory::SetIdentity(
- talk_base::SSLIdentity* identity) {
+ rtc::SSLIdentity* identity) {
identity_request_state_ = IDENTITY_SUCCEEDED;
SignalIdentityReady(identity);
diff --git a/app/webrtc/webrtcsessiondescriptionfactory.h b/app/webrtc/webrtcsessiondescriptionfactory.h
index cad0c65..f94d35a 100644
--- a/app/webrtc/webrtcsessiondescriptionfactory.h
+++ b/app/webrtc/webrtcsessiondescriptionfactory.h
@@ -29,7 +29,7 @@
#define TALK_APP_WEBRTC_WEBRTCSESSIONDESCRIPTIONFACTORY_H_
#include "talk/app/webrtc/peerconnectioninterface.h"
-#include "talk/base/messagehandler.h"
+#include "webrtc/base/messagehandler.h"
#include "talk/p2p/base/transportdescriptionfactory.h"
#include "talk/session/media/mediasession.h"
@@ -77,7 +77,7 @@
options(options) {}
Type type;
- talk_base::scoped_refptr<CreateSessionDescriptionObserver> observer;
+ rtc::scoped_refptr<CreateSessionDescriptionObserver> observer;
cricket::MediaSessionOptions options;
};
@@ -86,11 +86,11 @@
// It queues the create offer/answer request until the DTLS identity
// request has completed, i.e. when OnIdentityRequestFailed or OnIdentityReady
// is called.
-class WebRtcSessionDescriptionFactory : public talk_base::MessageHandler,
+class WebRtcSessionDescriptionFactory : public rtc::MessageHandler,
public sigslot::has_slots<> {
public:
WebRtcSessionDescriptionFactory(
- talk_base::Thread* signaling_thread,
+ rtc::Thread* signaling_thread,
cricket::ChannelManager* channel_manager,
MediaStreamSignaling* mediastream_signaling,
DTLSIdentityServiceInterface* dtls_identity_service,
@@ -107,7 +107,7 @@
void CreateOffer(
CreateSessionDescriptionObserver* observer,
- const MediaConstraintsInterface* constraints);
+ const PeerConnectionInterface::RTCOfferAnswerOptions& options);
void CreateAnswer(
CreateSessionDescriptionObserver* observer,
const MediaConstraintsInterface* constraints);
@@ -115,7 +115,7 @@
void SetSdesPolicy(cricket::SecurePolicy secure_policy);
cricket::SecurePolicy SdesPolicy() const;
- sigslot::signal1<talk_base::SSLIdentity*> SignalIdentityReady;
+ sigslot::signal1<rtc::SSLIdentity*> SignalIdentityReady;
// For testing.
bool waiting_for_identity() const {
@@ -131,7 +131,7 @@
};
// MessageHandler implementation.
- virtual void OnMessage(talk_base::Message* msg);
+ virtual void OnMessage(rtc::Message* msg);
void InternalCreateOffer(CreateSessionDescriptionRequest request);
void InternalCreateAnswer(CreateSessionDescriptionRequest request);
@@ -145,17 +145,17 @@
void OnIdentityRequestFailed(int error);
void OnIdentityReady(const std::string& der_cert,
const std::string& der_private_key);
- void SetIdentity(talk_base::SSLIdentity* identity);
+ void SetIdentity(rtc::SSLIdentity* identity);
std::queue<CreateSessionDescriptionRequest>
create_session_description_requests_;
- talk_base::Thread* signaling_thread_;
+ rtc::Thread* signaling_thread_;
MediaStreamSignaling* mediastream_signaling_;
cricket::TransportDescriptionFactory transport_desc_factory_;
cricket::MediaSessionDescriptionFactory session_desc_factory_;
uint64 session_version_;
- talk_base::scoped_ptr<DTLSIdentityServiceInterface> identity_service_;
- talk_base::scoped_refptr<WebRtcIdentityRequestObserver>
+ rtc::scoped_ptr<DTLSIdentityServiceInterface> identity_service_;
+ rtc::scoped_refptr<WebRtcIdentityRequestObserver>
identity_request_observer_;
WebRtcSession* session_;
std::string session_id_;
diff --git a/base/fakesslidentity.h b/base/fakesslidentity.h
index fbe5e64..5864dcc 100644
--- a/base/fakesslidentity.h
+++ b/base/fakesslidentity.h
@@ -82,6 +82,7 @@
std::vector<SSLCertificate*> new_certs(certs_.size());
std::transform(certs_.begin(), certs_.end(), new_certs.begin(), DupCert);
*chain = new SSLCertChain(new_certs);
+ std::for_each(new_certs.begin(), new_certs.end(), DeleteCert);
return true;
}
@@ -89,6 +90,7 @@
static FakeSSLCertificate* DupCert(FakeSSLCertificate cert) {
return cert.GetReference();
}
+ static void DeleteCert(SSLCertificate* cert) { delete cert; }
std::string data_;
std::vector<FakeSSLCertificate> certs_;
std::string digest_algorithm_;
diff --git a/base/httpcommon.cc b/base/httpcommon.cc
index ec7ffd2..05af9c2 100644
--- a/base/httpcommon.cc
+++ b/base/httpcommon.cc
@@ -60,9 +60,9 @@
bool find_string(size_t& index, const std::string& needle,
const char* const haystack[], size_t max_index) {
for (index=0; index<max_index; ++index) {
- if (_stricmp(needle.c_str(), haystack[index]) == 0) {
- return true;
- }
+ if (_stricmp(needle.c_str(), haystack[index]) == 0) {
+ return true;
+ }
}
return false;
}
@@ -451,9 +451,9 @@
if (combine == HC_YES) {
it->second.append(",");
it->second.append(value);
- }
+ }
return;
- }
+ }
}
headers_.insert(HeaderMap::value_type(name, value));
}
@@ -1007,7 +1007,9 @@
}
CredHandle cred;
- ret = AcquireCredentialsHandleA(0, want_negotiate ? NEGOSSP_NAME_A : NTLMSP_NAME_A, SECPKG_CRED_OUTBOUND, 0, pauth_id, 0, 0, &cred, &lifetime);
+ ret = AcquireCredentialsHandleA(
+ 0, const_cast<char*>(want_negotiate ? NEGOSSP_NAME_A : NTLMSP_NAME_A),
+ SECPKG_CRED_OUTBOUND, 0, pauth_id, 0, 0, &cred, &lifetime);
//LOG(INFO) << "$$$ AcquireCredentialsHandle @ " << TimeSince(now);
if (ret != SEC_E_OK) {
LOG(LS_ERROR) << "AcquireCredentialsHandle error: "
diff --git a/base/schanneladapter.cc b/base/schanneladapter.cc
index a376328..3d24b64 100644
--- a/base/schanneladapter.cc
+++ b/base/schanneladapter.cc
@@ -149,8 +149,9 @@
//sc_cred.dwMinimumCipherStrength = 128; // Note: use system default
sc_cred.dwFlags = SCH_CRED_NO_DEFAULT_CREDS | SCH_CRED_AUTO_CRED_VALIDATION;
- ret = AcquireCredentialsHandle(NULL, UNISP_NAME, SECPKG_CRED_OUTBOUND, NULL,
- &sc_cred, NULL, NULL, &impl_->cred, NULL);
+ ret = AcquireCredentialsHandle(NULL, const_cast<LPTSTR>(UNISP_NAME),
+ SECPKG_CRED_OUTBOUND, NULL, &sc_cred, NULL,
+ NULL, &impl_->cred, NULL);
if (ret != SEC_E_OK) {
LOG(LS_ERROR) << "AcquireCredentialsHandle error: "
<< ErrorName(ret, SECURITY_ERRORS);
diff --git a/base/thread.cc b/base/thread.cc
index 87e4fff..3acd9a8 100644
--- a/base/thread.cc
+++ b/base/thread.cc
@@ -142,6 +142,16 @@
Runnable* runnable;
};
+Thread::ScopedDisallowBlockingCalls::ScopedDisallowBlockingCalls()
+ : thread_(Thread::Current()),
+ previous_state_(thread_->SetAllowBlockingCalls(false)) {
+}
+
+Thread::ScopedDisallowBlockingCalls::~ScopedDisallowBlockingCalls() {
+ ASSERT(thread_->IsCurrent());
+ thread_->SetAllowBlockingCalls(previous_state_);
+}
+
Thread::Thread(SocketServer* ss)
: MessageQueue(ss),
priority_(PRIORITY_NORMAL),
@@ -150,7 +160,8 @@
thread_(NULL),
thread_id_(0),
#endif
- owned_(true) {
+ owned_(true),
+ blocking_calls_allowed_(true) {
SetName("Thread", this); // default name
}
@@ -160,6 +171,8 @@
}
bool Thread::SleepMs(int milliseconds) {
+ AssertBlockingIsAllowedOnCurrentThread();
+
#ifdef WIN32
::Sleep(milliseconds);
return true;
@@ -293,6 +306,8 @@
}
void Thread::Join() {
+ AssertBlockingIsAllowedOnCurrentThread();
+
if (running()) {
ASSERT(!IsCurrent());
#if defined(WIN32)
@@ -308,6 +323,21 @@
}
}
+bool Thread::SetAllowBlockingCalls(bool allow) {
+ ASSERT(IsCurrent());
+ bool previous = blocking_calls_allowed_;
+ blocking_calls_allowed_ = allow;
+ return previous;
+}
+
+// static
+void Thread::AssertBlockingIsAllowedOnCurrentThread() {
+#ifdef _DEBUG
+ Thread* current = Thread::Current();
+ ASSERT(!current || current->blocking_calls_allowed_);
+#endif
+}
+
#ifdef WIN32
// As seen on MSDN.
// http://msdn.microsoft.com/en-us/library/xcb2z8hs(VS.71).aspx
@@ -374,6 +404,8 @@
}
void Thread::Send(MessageHandler *phandler, uint32 id, MessageData *pdata) {
+ AssertBlockingIsAllowedOnCurrentThread();
+
if (fStop_)
return;
diff --git a/base/thread.h b/base/thread.h
index 4cbf721..d1e8495 100644
--- a/base/thread.h
+++ b/base/thread.h
@@ -125,6 +125,19 @@
static Thread* Current();
+ // Used to catch performance regressions. Use this to disallow blocking calls
+ // (Invoke) for a given scope. If a synchronous call is made while this is in
+ // effect, an assert will be triggered.
+ // Note that this is a single threaded class.
+ class ScopedDisallowBlockingCalls {
+ public:
+ ScopedDisallowBlockingCalls();
+ ~ScopedDisallowBlockingCalls();
+ private:
+ Thread* const thread_;
+ const bool previous_state_;
+ };
+
bool IsCurrent() const {
return Current() == this;
}
@@ -165,8 +178,11 @@
// Uses Send() internally, which blocks the current thread until execution
// is complete.
// Ex: bool result = thread.Invoke<bool>(&MyFunctionReturningBool);
+ // NOTE: This function can only be called when synchronous calls are allowed.
+ // See ScopedDisallowBlockingCalls for details.
template <class ReturnT, class FunctorT>
ReturnT Invoke(const FunctorT& functor) {
+ AssertBlockingIsAllowedOnCurrentThread();
FunctorMessageHandler<ReturnT, FunctorT> handler(functor);
Send(&handler);
return handler.result();
@@ -219,16 +235,19 @@
// question to guarantee that the returned value remains true for the duration
// of whatever code is conditionally executing because of the return value!
bool RunningForTest() { return running(); }
- // This is a legacy call-site that probably doesn't need to exist in the first
- // place.
- // TODO(fischman): delete once the ASSERT added in channelmanager.cc sticks
- // for a month (ETA 2014/06/22).
- bool RunningForChannelManager() { return running(); }
protected:
// Blocks the calling thread until this thread has terminated.
void Join();
+ // Sets the per-thread allow-blocking-calls flag and returns the previous
+ // value.
+ bool SetAllowBlockingCalls(bool allow);
+
+ static void AssertBlockingIsAllowedOnCurrentThread();
+
+ friend class ScopedDisallowBlockingCalls;
+
private:
static void *PreRun(void *pv);
@@ -255,6 +274,7 @@
#endif
bool owned_;
+ bool blocking_calls_allowed_; // By default set to |true|.
friend class ThreadManager;
diff --git a/build/common.gypi b/build/common.gypi
index 31ce66f..5e24c1b 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -67,6 +67,7 @@
'FEATURE_ENABLE_PSTN',
# TODO(eric): enable HAVE_NSS_SSL_H and SSL_USE_NSS once they are ready.
# 'HAVE_NSS_SSL_H=1',
+ 'HAVE_SCTP',
'HAVE_SRTP',
'HAVE_WEBRTC_VIDEO',
'HAVE_WEBRTC_VOICE',
@@ -83,6 +84,7 @@
['OS=="linux"', {
'defines': [
'LINUX',
+ 'WEBRTC_LINUX',
],
'conditions': [
['clang==1', {
@@ -101,15 +103,25 @@
['OS=="mac"', {
'defines': [
'OSX',
+ 'WEBRTC_MAC',
+ ],
+ }],
+ ['OS=="win"', {
+ 'defines': [
+ 'WEBRTC_WIN',
+ ],
+ 'msvs_disabled_warnings': [
+ # https://code.google.com/p/chromium/issues/detail?id=372451#c20
+ # Warning 4702 ("Unreachable code") should be re-enabled once
+ # users are updated to VS2013 Update 2.
+ 4702,
],
}],
['OS=="ios"', {
'defines': [
'IOS',
- ],
- }, {
- 'defines': [
- 'HAVE_SCTP',
+ 'WEBRTC_MAC',
+ 'WEBRTC_IOS',
],
}],
['OS=="ios" or (OS=="mac" and target_arch!="ia32")', {
@@ -131,6 +143,7 @@
'defines': [
'HASH_NAMESPACE=__gnu_cxx',
'POSIX',
+ 'WEBRTC_POSIX',
'DISABLE_DYNAMIC_CAST',
# The POSIX standard says we have to define this.
'_REENTRANT',
diff --git a/examples/call/call_main.cc b/examples/call/call_main.cc
index 33d5385..b6168b3 100644
--- a/examples/call/call_main.cc
+++ b/examples/call/call_main.cc
@@ -33,15 +33,15 @@
#include <iostream>
#include <vector>
-#include "talk/base/flags.h"
-#include "talk/base/logging.h"
+#include "webrtc/base/flags.h"
+#include "webrtc/base/logging.h"
#ifdef OSX
-#include "talk/base/maccocoasocketserver.h"
+#include "webrtc/base/maccocoasocketserver.h"
#endif
-#include "talk/base/pathutils.h"
-#include "talk/base/ssladapter.h"
-#include "talk/base/stream.h"
-#include "talk/base/win32socketserver.h"
+#include "webrtc/base/pathutils.h"
+#include "webrtc/base/ssladapter.h"
+#include "webrtc/base/stream.h"
+#include "webrtc/base/win32socketserver.h"
#include "talk/examples/call/callclient.h"
#include "talk/examples/call/console.h"
#include "talk/examples/call/mediaenginefactory.h"
@@ -257,9 +257,9 @@
"Enable roster messages printed in console.");
// parse options
- FlagList::SetFlagsFromCommandLine(&argc, argv, true);
+ rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true);
if (FLAG_help) {
- FlagList::Print(NULL, false);
+ rtc::FlagList::Print(NULL, false);
return 0;
}
@@ -283,19 +283,19 @@
bool render = FLAG_render;
std::string data_channel = FLAG_datachannel;
bool multisession_enabled = FLAG_multisession;
- talk_base::SSLIdentity* ssl_identity = NULL;
+ rtc::SSLIdentity* ssl_identity = NULL;
bool show_roster_messages = FLAG_roster;
// Set up debugging.
if (debug) {
- talk_base::LogMessage::LogToDebug(talk_base::LS_VERBOSE);
+ rtc::LogMessage::LogToDebug(rtc::LS_VERBOSE);
}
if (!log.empty()) {
- talk_base::StreamInterface* stream =
- talk_base::Filesystem::OpenFile(log, "a");
+ rtc::StreamInterface* stream =
+ rtc::Filesystem::OpenFile(log, "a");
if (stream) {
- talk_base::LogMessage::LogToStream(stream, talk_base::LS_VERBOSE);
+ rtc::LogMessage::LogToStream(stream, rtc::LS_VERBOSE);
} else {
Print(("Cannot open debug log " + log + "\n").c_str());
return 1;
@@ -307,12 +307,12 @@
}
// Set up the crypto subsystem.
- talk_base::InitializeSSL();
+ rtc::InitializeSSL();
// Parse username and password, if present.
buzz::Jid jid;
std::string username;
- talk_base::InsecureCryptStringImpl pass;
+ rtc::InsecureCryptStringImpl pass;
if (argc > 1) {
username = argv[1];
if (argc > 2) {
@@ -364,7 +364,7 @@
xcs.set_use_tls(buzz::TLS_DISABLED);
xcs.set_test_server_domain("google.com");
}
- xcs.set_pass(talk_base::CryptString(pass));
+ xcs.set_pass(rtc::CryptString(pass));
if (!oauth_token.empty()) {
xcs.set_auth_token(buzz::AUTH_MECHANISM_OAUTH2, oauth_token);
}
@@ -381,7 +381,7 @@
port = atoi(server.substr(colon + 1).c_str());
}
- xcs.set_server(talk_base::SocketAddress(host, port));
+ xcs.set_server(rtc::SocketAddress(host, port));
// Decide on the signaling and crypto settings.
cricket::SignalingProtocol signaling_protocol = cricket::PROTOCOL_HYBRID;
@@ -428,7 +428,7 @@
return 1;
}
if (dtls_policy != cricket::SEC_DISABLED) {
- ssl_identity = talk_base::SSLIdentity::Generate(jid.Str());
+ ssl_identity = rtc::SSLIdentity::Generate(jid.Str());
if (!ssl_identity) {
Print("Failed to generate identity for DTLS.\n");
return 1;
@@ -441,13 +441,13 @@
#if WIN32
// Need to pump messages on our main thread on Windows.
- talk_base::Win32Thread w32_thread;
- talk_base::ThreadManager::Instance()->SetCurrentThread(&w32_thread);
+ rtc::Win32Thread w32_thread;
+ rtc::ThreadManager::Instance()->SetCurrentThread(&w32_thread);
#endif
- talk_base::Thread* main_thread = talk_base::Thread::Current();
+ rtc::Thread* main_thread = rtc::Thread::Current();
#ifdef OSX
- talk_base::MacCocoaSocketServer ss;
- talk_base::SocketServerScope ss_scope(&ss);
+ rtc::MacCocoaSocketServer ss;
+ rtc::SocketServerScope ss_scope(&ss);
#endif
buzz::XmppPump pump;
diff --git a/examples/call/call_unittest.cc b/examples/call/call_unittest.cc
index d95f1dd..524726d 100644
--- a/examples/call/call_unittest.cc
+++ b/examples/call/call_unittest.cc
@@ -27,11 +27,11 @@
// Main function for all unit tests in talk/examples/call
-#include "talk/base/logging.h"
+#include "webrtc/base/logging.h"
#include "testing/base/public/gunit.h"
int main(int argc, char **argv) {
- talk_base::LogMessage::LogToDebug(talk_base::LogMessage::NO_LOGGING);
+ rtc::LogMessage::LogToDebug(rtc::LogMessage::NO_LOGGING);
testing::ParseGUnitFlags(&argc, argv);
return RUN_ALL_TESTS();
}
diff --git a/examples/call/callclient.cc b/examples/call/callclient.cc
index 849455e..7d1cd80 100644
--- a/examples/call/callclient.cc
+++ b/examples/call/callclient.cc
@@ -29,14 +29,14 @@
#include <string>
-#include "talk/base/helpers.h"
-#include "talk/base/logging.h"
-#include "talk/base/network.h"
-#include "talk/base/socketaddress.h"
-#include "talk/base/stringencode.h"
-#include "talk/base/stringutils.h"
-#include "talk/base/thread.h"
-#include "talk/base/windowpickerfactory.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/network.h"
+#include "webrtc/base/socketaddress.h"
+#include "webrtc/base/stringencode.h"
+#include "webrtc/base/stringutils.h"
+#include "webrtc/base/thread.h"
+#include "webrtc/base/windowpickerfactory.h"
#include "talk/examples/call/console.h"
#include "talk/examples/call/friendinvitesendtask.h"
#include "talk/examples/call/muc.h"
@@ -94,7 +94,7 @@
int GetInt(const std::vector<std::string>& words, size_t index, int def) {
int val;
- if (words.size() > index && talk_base::FromString(words[index], &val)) {
+ if (words.size() > index && rtc::FromString(words[index], &val)) {
return val;
} else {
return def;
@@ -251,7 +251,7 @@
console_->PrintLine("Can't screencast twice. Unscreencast first.");
} else {
std::string streamid = "screencast";
- screencast_ssrc_ = talk_base::CreateRandomId();
+ screencast_ssrc_ = rtc::CreateRandomId();
int fps = GetInt(words, 1, 5); // Default to 5 fps.
cricket::ScreencastId screencastid;
@@ -478,7 +478,7 @@
}
void CallClient::InitMedia() {
- worker_thread_ = new talk_base::Thread();
+ worker_thread_ = new rtc::Thread();
// The worker thread must be started here since initialization of
// the ChannelManager will generate messages that need to be
// dispatched by it.
@@ -486,13 +486,15 @@
// TODO: It looks like we are leaking many objects. E.g.
// |network_manager_| is never deleted.
- network_manager_ = new talk_base::BasicNetworkManager();
+ network_manager_ = new rtc::BasicNetworkManager();
// TODO: Decide if the relay address should be specified here.
- talk_base::SocketAddress stun_addr("stun.l.google.com", 19302);
+ rtc::SocketAddress stun_addr("stun.l.google.com", 19302);
+ cricket::ServerAddresses stun_servers;
+ stun_servers.insert(stun_addr);
port_allocator_ = new cricket::BasicPortAllocator(
- network_manager_, stun_addr, talk_base::SocketAddress(),
- talk_base::SocketAddress(), talk_base::SocketAddress());
+ network_manager_, stun_servers, rtc::SocketAddress(),
+ rtc::SocketAddress(), rtc::SocketAddress());
if (portallocator_flags_ != 0) {
port_allocator_->set_flags(portallocator_flags_);
@@ -683,7 +685,7 @@
void CallClient::StartXmppPing() {
buzz::PingTask* ping = new buzz::PingTask(
- xmpp_client_, talk_base::Thread::Current(),
+ xmpp_client_, rtc::Thread::Current(),
kPingPeriodMillis, kPingTimeoutMillis);
ping->SignalTimeout.connect(this, &CallClient::OnPingTimeout);
ping->Start();
@@ -739,7 +741,7 @@
void CallClient::SendChat(const std::string& to, const std::string msg) {
buzz::XmlElement* stanza = new buzz::XmlElement(buzz::QN_MESSAGE);
stanza->AddAttr(buzz::QN_TO, to);
- stanza->AddAttr(buzz::QN_ID, talk_base::CreateRandomString(16));
+ stanza->AddAttr(buzz::QN_ID, rtc::CreateRandomString(16));
stanza->AddAttr(buzz::QN_TYPE, "chat");
buzz::XmlElement* body = new buzz::XmlElement(buzz::QN_BODY);
body->SetBodyText(msg);
@@ -779,7 +781,7 @@
cricket::SendDataParams params;
params.ssrc = stream.first_ssrc();
- talk_base::Buffer payload(text.data(), text.length());
+ rtc::Buffer payload(text.data(), text.length());
cricket::SendDataResult result;
bool sent = call_->SendData(session, params, payload, &result);
if (!sent) {
@@ -854,7 +856,7 @@
void CallClient::OnDataReceived(cricket::Call*,
const cricket::ReceiveDataParams& params,
- const talk_base::Buffer& payload) {
+ const rtc::Buffer& payload) {
// TODO(mylesj): Support receiving data on sessions other than the first.
cricket::Session* session = GetFirstSession();
if (!session)
@@ -1104,7 +1106,7 @@
}
void CallClient::Quit() {
- talk_base::Thread::Current()->Quit();
+ rtc::Thread::Current()->Quit();
}
void CallClient::SetNick(const std::string& muc_nick) {
@@ -1562,7 +1564,7 @@
}
}
- talk_base::sprintfn(guid_room,
+ rtc::sprintfn(guid_room,
ARRAY_SIZE(guid_room),
"private-chat-%s@%s",
guid,
@@ -1572,19 +1574,19 @@
bool CallClient::SelectFirstDesktopScreencastId(
cricket::ScreencastId* screencastid) {
- if (!talk_base::WindowPickerFactory::IsSupported()) {
+ if (!rtc::WindowPickerFactory::IsSupported()) {
LOG(LS_WARNING) << "Window picker not suported on this OS.";
return false;
}
- talk_base::WindowPicker* picker =
- talk_base::WindowPickerFactory::CreateWindowPicker();
+ rtc::WindowPicker* picker =
+ rtc::WindowPickerFactory::CreateWindowPicker();
if (!picker) {
LOG(LS_WARNING) << "Could not create a window picker.";
return false;
}
- talk_base::DesktopDescriptionList desktops;
+ rtc::DesktopDescriptionList desktops;
if (!picker->GetDesktopList(&desktops) || desktops.empty()) {
LOG(LS_WARNING) << "Could not get a list of desktops.";
return false;
diff --git a/examples/call/callclient.h b/examples/call/callclient.h
index 39a5b11..f25b9f5 100644
--- a/examples/call/callclient.h
+++ b/examples/call/callclient.h
@@ -32,8 +32,8 @@
#include <string>
#include <vector>
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/sslidentity.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/sslidentity.h"
#include "talk/examples/call/console.h"
#include "talk/media/base/mediachannel.h"
#include "talk/p2p/base/session.h"
@@ -62,10 +62,10 @@
struct MucRoomInfo;
} // namespace buzz
-namespace talk_base {
+namespace rtc {
class Thread;
class NetworkManager;
-} // namespace talk_base
+} // namespace rtc
namespace cricket {
class PortAllocator;
@@ -166,7 +166,7 @@
sdes_policy_ = sdes_policy;
dtls_policy_ = dtls_policy;
}
- void SetSslIdentity(talk_base::SSLIdentity* identity) {
+ void SetSslIdentity(rtc::SSLIdentity* identity) {
ssl_identity_.reset(identity);
}
@@ -242,7 +242,7 @@
const buzz::XmlElement* stanza);
void OnDataReceived(cricket::Call*,
const cricket::ReceiveDataParams& params,
- const talk_base::Buffer& payload);
+ const rtc::Buffer& payload);
buzz::Jid GenerateRandomMucJid();
// Depending on |enable|, render (or don't) all the streams in |session|.
@@ -303,8 +303,8 @@
Console *console_;
buzz::XmppClient* xmpp_client_;
- talk_base::Thread* worker_thread_;
- talk_base::NetworkManager* network_manager_;
+ rtc::Thread* worker_thread_;
+ rtc::NetworkManager* network_manager_;
cricket::PortAllocator* port_allocator_;
cricket::SessionManager* session_manager_;
cricket::SessionManagerTask* session_manager_task_;
@@ -343,7 +343,7 @@
cricket::TransportProtocol transport_protocol_;
cricket::SecurePolicy sdes_policy_;
cricket::SecurePolicy dtls_policy_;
- talk_base::scoped_ptr<talk_base::SSLIdentity> ssl_identity_;
+ rtc::scoped_ptr<rtc::SSLIdentity> ssl_identity_;
std::string last_sent_to_;
bool show_roster_messages_;
diff --git a/examples/call/callclient_unittest.cc b/examples/call/callclient_unittest.cc
index b0e9d89..6268917 100644
--- a/examples/call/callclient_unittest.cc
+++ b/examples/call/callclient_unittest.cc
@@ -27,7 +27,7 @@
// Unit tests for CallClient
-#include "talk/base/gunit.h"
+#include "webrtc/base/gunit.h"
#include "talk/examples/call/callclient.h"
#include "talk/media/base/filemediaengine.h"
#include "talk/media/base/mediaengine.h"
diff --git a/examples/call/console.cc b/examples/call/console.cc
index 647601e..e3ed4f8 100644
--- a/examples/call/console.cc
+++ b/examples/call/console.cc
@@ -35,9 +35,9 @@
#include <unistd.h>
#endif // POSIX
-#include "talk/base/logging.h"
-#include "talk/base/messagequeue.h"
-#include "talk/base/stringutils.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/messagequeue.h"
+#include "webrtc/base/stringutils.h"
#include "talk/examples/call/console.h"
#include "talk/examples/call/callclient.h"
@@ -45,7 +45,7 @@
static void DoNothing(int unused) {}
#endif
-Console::Console(talk_base::Thread *thread, CallClient *client) :
+Console::Console(rtc::Thread *thread, CallClient *client) :
client_(client),
client_thread_(thread),
stopped_(false) {}
@@ -64,7 +64,7 @@
LOG(LS_WARNING) << "Already started";
return;
}
- console_thread_.reset(new talk_base::Thread());
+ console_thread_.reset(new rtc::Thread());
console_thread_->Start();
console_thread_->Post(this, MSG_START);
}
@@ -140,11 +140,11 @@
char input_buffer[128];
while (fgets(input_buffer, sizeof(input_buffer), stdin) != NULL) {
client_thread_->Post(this, MSG_INPUT,
- new talk_base::TypedMessageData<std::string>(input_buffer));
+ new rtc::TypedMessageData<std::string>(input_buffer));
}
}
-void Console::OnMessage(talk_base::Message *msg) {
+void Console::OnMessage(rtc::Message *msg) {
switch (msg->message_id) {
case MSG_START:
#ifdef POSIX
@@ -161,8 +161,8 @@
RunConsole();
break;
case MSG_INPUT:
- talk_base::TypedMessageData<std::string> *data =
- static_cast<talk_base::TypedMessageData<std::string>*>(msg->pdata);
+ rtc::TypedMessageData<std::string> *data =
+ static_cast<rtc::TypedMessageData<std::string>*>(msg->pdata);
client_->ParseLine(data->data());
break;
}
diff --git a/examples/call/console.h b/examples/call/console.h
index f0f36e3..00b35a0 100644
--- a/examples/call/console.h
+++ b/examples/call/console.h
@@ -30,15 +30,15 @@
#include <stdio.h>
-#include "talk/base/thread.h"
-#include "talk/base/messagequeue.h"
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/thread.h"
+#include "webrtc/base/messagequeue.h"
+#include "webrtc/base/scoped_ptr.h"
class CallClient;
-class Console : public talk_base::MessageHandler {
+class Console : public rtc::MessageHandler {
public:
- Console(talk_base::Thread *thread, CallClient *client);
+ Console(rtc::Thread *thread, CallClient *client);
~Console();
// Starts reading lines from the console and giving them to the CallClient.
@@ -46,7 +46,7 @@
// Stops reading lines. Cannot be restarted.
void Stop();
- virtual void OnMessage(talk_base::Message *msg);
+ virtual void OnMessage(rtc::Message *msg);
void PrintLine(const char* format, ...);
@@ -62,8 +62,8 @@
void ParseLine(std::string &str);
CallClient *client_;
- talk_base::Thread *client_thread_;
- talk_base::scoped_ptr<talk_base::Thread> console_thread_;
+ rtc::Thread *client_thread_;
+ rtc::scoped_ptr<rtc::Thread> console_thread_;
bool stopped_;
};
diff --git a/examples/call/mediaenginefactory.cc b/examples/call/mediaenginefactory.cc
index 983345d..472a880 100644
--- a/examples/call/mediaenginefactory.cc
+++ b/examples/call/mediaenginefactory.cc
@@ -27,7 +27,7 @@
#include "talk/examples/call/mediaenginefactory.h"
-#include "talk/base/stringutils.h"
+#include "webrtc/base/stringutils.h"
#include "talk/media/base/fakemediaengine.h"
#include "talk/media/base/filemediaengine.h"
#include "talk/media/base/mediaengine.h"
diff --git a/examples/call/mucinviterecvtask.h b/examples/call/mucinviterecvtask.h
index 24f05e0..4ec06d0 100644
--- a/examples/call/mucinviterecvtask.h
+++ b/examples/call/mucinviterecvtask.h
@@ -30,7 +30,7 @@
#include <vector>
-#include "talk/base/sigslot.h"
+#include "webrtc/base/sigslot.h"
#include "talk/xmpp/xmppengine.h"
#include "talk/xmpp/xmpptask.h"
diff --git a/examples/call/presencepushtask.cc b/examples/call/presencepushtask.cc
index af02b1f..31ccc32 100644
--- a/examples/call/presencepushtask.cc
+++ b/examples/call/presencepushtask.cc
@@ -27,7 +27,7 @@
#include "talk/examples/call/presencepushtask.h"
-#include "talk/base/stringencode.h"
+#include "webrtc/base/stringencode.h"
#include "talk/examples/call/muc.h"
#include "talk/xmpp/constants.h"
@@ -153,7 +153,7 @@
const XmlElement * priority = stanza->FirstNamed(QN_PRIORITY);
if (priority != NULL) {
int pri;
- if (talk_base::FromString(priority->BodyText(), &pri)) {
+ if (rtc::FromString(priority->BodyText(), &pri)) {
s->set_priority(pri);
}
}
diff --git a/examples/call/presencepushtask.h b/examples/call/presencepushtask.h
index 9cd1b42..5a080d3 100644
--- a/examples/call/presencepushtask.h
+++ b/examples/call/presencepushtask.h
@@ -33,7 +33,7 @@
#include "talk/xmpp/xmppengine.h"
#include "talk/xmpp/xmpptask.h"
#include "talk/xmpp/presencestatus.h"
-#include "talk/base/sigslot.h"
+#include "webrtc/base/sigslot.h"
#include "talk/examples/call/callclient.h"
namespace buzz {
diff --git a/examples/login/login_main.cc b/examples/login/login_main.cc
index 5c5d1d7..55243aa 100644
--- a/examples/login/login_main.cc
+++ b/examples/login/login_main.cc
@@ -29,7 +29,7 @@
#include <iostream>
-#include "talk/base/thread.h"
+#include "webrtc/base/thread.h"
#include "talk/xmpp/constants.h"
#include "talk/xmpp/xmppclientsettings.h"
#include "talk/xmpp/xmppengine.h"
@@ -54,7 +54,7 @@
xcs.set_use_tls(buzz::TLS_DISABLED);
xcs.set_auth_token(buzz::AUTH_MECHANISM_OAUTH2,
auth_token.c_str());
- xcs.set_server(talk_base::SocketAddress("talk.google.com", 5222));
+ xcs.set_server(rtc::SocketAddress("talk.google.com", 5222));
thread.Login(xcs);
// Use main thread for console input
diff --git a/examples/peerconnection/client/conductor.cc b/examples/peerconnection/client/conductor.cc
index bbab3d0..64026c5 100644
--- a/examples/peerconnection/client/conductor.cc
+++ b/examples/peerconnection/client/conductor.cc
@@ -30,9 +30,9 @@
#include <utility>
#include "talk/app/webrtc/videosourceinterface.h"
-#include "talk/base/common.h"
-#include "talk/base/json.h"
-#include "talk/base/logging.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/json.h"
+#include "webrtc/base/logging.h"
#include "talk/examples/peerconnection/client/defaults.h"
#include "talk/media/devices/devicemanager.h"
@@ -50,7 +50,7 @@
public:
static DummySetSessionDescriptionObserver* Create() {
return
- new talk_base::RefCountedObject<DummySetSessionDescriptionObserver>();
+ new rtc::RefCountedObject<DummySetSessionDescriptionObserver>();
}
virtual void OnSuccess() {
LOG(INFO) << __FUNCTION__;
@@ -272,7 +272,7 @@
LOG(WARNING) << "Can't parse received message.";
return;
}
- talk_base::scoped_ptr<webrtc::IceCandidateInterface> candidate(
+ rtc::scoped_ptr<webrtc::IceCandidateInterface> candidate(
webrtc::CreateIceCandidate(sdp_mid, sdp_mlineindex, sdp));
if (!candidate.get()) {
LOG(WARNING) << "Can't parse received candidate message.";
@@ -332,7 +332,7 @@
}
cricket::VideoCapturer* Conductor::OpenVideoCaptureDevice() {
- talk_base::scoped_ptr<cricket::DeviceManagerInterface> dev_manager(
+ rtc::scoped_ptr<cricket::DeviceManagerInterface> dev_manager(
cricket::DeviceManagerFactory::Create());
if (!dev_manager->Init()) {
LOG(LS_ERROR) << "Can't create device manager";
@@ -357,18 +357,18 @@
if (active_streams_.find(kStreamLabel) != active_streams_.end())
return; // Already added.
- talk_base::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
+ rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
peer_connection_factory_->CreateAudioTrack(
kAudioLabel, peer_connection_factory_->CreateAudioSource(NULL)));
- talk_base::scoped_refptr<webrtc::VideoTrackInterface> video_track(
+ rtc::scoped_refptr<webrtc::VideoTrackInterface> video_track(
peer_connection_factory_->CreateVideoTrack(
kVideoLabel,
peer_connection_factory_->CreateVideoSource(OpenVideoCaptureDevice(),
NULL)));
main_wnd_->StartLocalRenderer(video_track);
- talk_base::scoped_refptr<webrtc::MediaStreamInterface> stream =
+ rtc::scoped_refptr<webrtc::MediaStreamInterface> stream =
peer_connection_factory_->CreateLocalMediaStream(kStreamLabel);
stream->AddTrack(audio_track);
@@ -377,7 +377,7 @@
LOG(LS_ERROR) << "Adding stream to PeerConnection failed";
}
typedef std::pair<std::string,
- talk_base::scoped_refptr<webrtc::MediaStreamInterface> >
+ rtc::scoped_refptr<webrtc::MediaStreamInterface> >
MediaStreamPair;
active_streams_.insert(MediaStreamPair(stream->label(), stream));
main_wnd_->SwitchToStreamingUI();
diff --git a/examples/peerconnection/client/conductor.h b/examples/peerconnection/client/conductor.h
index f9fb393..93b0779 100644
--- a/examples/peerconnection/client/conductor.h
+++ b/examples/peerconnection/client/conductor.h
@@ -38,7 +38,7 @@
#include "talk/examples/peerconnection/client/peer_connection_client.h"
#include "talk/app/webrtc/mediastreaminterface.h"
#include "talk/app/webrtc/peerconnectioninterface.h"
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/scoped_ptr.h"
namespace webrtc {
class VideoCaptureModule;
@@ -130,13 +130,13 @@
void SendMessage(const std::string& json_object);
int peer_id_;
- talk_base::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_;
- talk_base::scoped_refptr<webrtc::PeerConnectionFactoryInterface>
+ rtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_;
+ rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface>
peer_connection_factory_;
PeerConnectionClient* client_;
MainWindow* main_wnd_;
std::deque<std::string*> pending_messages_;
- std::map<std::string, talk_base::scoped_refptr<webrtc::MediaStreamInterface> >
+ std::map<std::string, rtc::scoped_refptr<webrtc::MediaStreamInterface> >
active_streams_;
std::string server_;
};
diff --git a/examples/peerconnection/client/defaults.cc b/examples/peerconnection/client/defaults.cc
index 40f3dd1..15252c6 100644
--- a/examples/peerconnection/client/defaults.cc
+++ b/examples/peerconnection/client/defaults.cc
@@ -36,7 +36,7 @@
#include <unistd.h>
#endif
-#include "talk/base/common.h"
+#include "webrtc/base/common.h"
const char kAudioLabel[] = "audio_label";
const char kVideoLabel[] = "video_label";
diff --git a/examples/peerconnection/client/defaults.h b/examples/peerconnection/client/defaults.h
index f646149..5834f34 100644
--- a/examples/peerconnection/client/defaults.h
+++ b/examples/peerconnection/client/defaults.h
@@ -31,7 +31,7 @@
#include <string>
-#include "talk/base/basictypes.h"
+#include "webrtc/base/basictypes.h"
extern const char kAudioLabel[];
extern const char kVideoLabel[];
diff --git a/examples/peerconnection/client/flagdefs.h b/examples/peerconnection/client/flagdefs.h
index c135bbb..3d3edca 100644
--- a/examples/peerconnection/client/flagdefs.h
+++ b/examples/peerconnection/client/flagdefs.h
@@ -29,7 +29,7 @@
#define TALK_EXAMPLES_PEERCONNECTION_CLIENT_FLAGDEFS_H_
#pragma once
-#include "talk/base/flags.h"
+#include "webrtc/base/flags.h"
extern const uint16 kDefaultServerPort; // From defaults.[h|cc]
diff --git a/examples/peerconnection/client/linux/main.cc b/examples/peerconnection/client/linux/main.cc
index 4ef81cd..67fd33d 100644
--- a/examples/peerconnection/client/linux/main.cc
+++ b/examples/peerconnection/client/linux/main.cc
@@ -32,12 +32,12 @@
#include "talk/examples/peerconnection/client/linux/main_wnd.h"
#include "talk/examples/peerconnection/client/peer_connection_client.h"
-#include "talk/base/ssladapter.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/ssladapter.h"
+#include "webrtc/base/thread.h"
-class CustomSocketServer : public talk_base::PhysicalSocketServer {
+class CustomSocketServer : public rtc::PhysicalSocketServer {
public:
- CustomSocketServer(talk_base::Thread* thread, GtkMainWnd* wnd)
+ CustomSocketServer(rtc::Thread* thread, GtkMainWnd* wnd)
: thread_(thread), wnd_(wnd), conductor_(NULL), client_(NULL) {}
virtual ~CustomSocketServer() {}
@@ -58,12 +58,12 @@
client_ != NULL && !client_->is_connected()) {
thread_->Quit();
}
- return talk_base::PhysicalSocketServer::Wait(0/*cms == -1 ? 1 : cms*/,
+ return rtc::PhysicalSocketServer::Wait(0/*cms == -1 ? 1 : cms*/,
process_io);
}
protected:
- talk_base::Thread* thread_;
+ rtc::Thread* thread_;
GtkMainWnd* wnd_;
Conductor* conductor_;
PeerConnectionClient* client_;
@@ -74,9 +74,9 @@
g_type_init();
g_thread_init(NULL);
- FlagList::SetFlagsFromCommandLine(&argc, argv, true);
+ rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true);
if (FLAG_help) {
- FlagList::Print(NULL, false);
+ rtc::FlagList::Print(NULL, false);
return 0;
}
@@ -90,16 +90,16 @@
GtkMainWnd wnd(FLAG_server, FLAG_port, FLAG_autoconnect, FLAG_autocall);
wnd.Create();
- talk_base::AutoThread auto_thread;
- talk_base::Thread* thread = talk_base::Thread::Current();
+ rtc::AutoThread auto_thread;
+ rtc::Thread* thread = rtc::Thread::Current();
CustomSocketServer socket_server(thread, &wnd);
thread->set_socketserver(&socket_server);
- talk_base::InitializeSSL();
+ rtc::InitializeSSL();
// Must be constructed after we set the socketserver.
PeerConnectionClient client;
- talk_base::scoped_refptr<Conductor> conductor(
- new talk_base::RefCountedObject<Conductor>(&client, &wnd));
+ rtc::scoped_refptr<Conductor> conductor(
+ new rtc::RefCountedObject<Conductor>(&client, &wnd));
socket_server.set_client(&client);
socket_server.set_conductor(conductor);
@@ -113,7 +113,7 @@
//while (gtk_events_pending()) {
// gtk_main_iteration();
//}
- talk_base::CleanupSSL();
+ rtc::CleanupSSL();
return 0;
}
diff --git a/examples/peerconnection/client/linux/main_wnd.cc b/examples/peerconnection/client/linux/main_wnd.cc
index 0a2e1f6..55f3649 100644
--- a/examples/peerconnection/client/linux/main_wnd.cc
+++ b/examples/peerconnection/client/linux/main_wnd.cc
@@ -33,11 +33,11 @@
#include <stddef.h>
#include "talk/examples/peerconnection/client/defaults.h"
-#include "talk/base/common.h"
-#include "talk/base/logging.h"
-#include "talk/base/stringutils.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/stringutils.h"
-using talk_base::sprintfn;
+using rtc::sprintfn;
namespace {
diff --git a/examples/peerconnection/client/linux/main_wnd.h b/examples/peerconnection/client/linux/main_wnd.h
index 5a44640..6e45333 100644
--- a/examples/peerconnection/client/linux/main_wnd.h
+++ b/examples/peerconnection/client/linux/main_wnd.h
@@ -110,11 +110,11 @@
}
protected:
- talk_base::scoped_ptr<uint8[]> image_;
+ rtc::scoped_ptr<uint8[]> image_;
int width_;
int height_;
GtkMainWnd* main_wnd_;
- talk_base::scoped_refptr<webrtc::VideoTrackInterface> rendered_track_;
+ rtc::scoped_refptr<webrtc::VideoTrackInterface> rendered_track_;
};
protected:
@@ -129,9 +129,9 @@
std::string port_;
bool autoconnect_;
bool autocall_;
- talk_base::scoped_ptr<VideoRenderer> local_renderer_;
- talk_base::scoped_ptr<VideoRenderer> remote_renderer_;
- talk_base::scoped_ptr<uint8> draw_buffer_;
+ rtc::scoped_ptr<VideoRenderer> local_renderer_;
+ rtc::scoped_ptr<VideoRenderer> remote_renderer_;
+ rtc::scoped_ptr<uint8> draw_buffer_;
int draw_buffer_size_;
};
diff --git a/examples/peerconnection/client/main.cc b/examples/peerconnection/client/main.cc
index 765dfaa..34fadfa 100644
--- a/examples/peerconnection/client/main.cc
+++ b/examples/peerconnection/client/main.cc
@@ -29,24 +29,24 @@
#include "talk/examples/peerconnection/client/flagdefs.h"
#include "talk/examples/peerconnection/client/main_wnd.h"
#include "talk/examples/peerconnection/client/peer_connection_client.h"
-#include "talk/base/ssladapter.h"
-#include "talk/base/win32socketinit.h"
-#include "talk/base/win32socketserver.h"
+#include "webrtc/base/ssladapter.h"
+#include "webrtc/base/win32socketinit.h"
+#include "webrtc/base/win32socketserver.h"
int PASCAL wWinMain(HINSTANCE instance, HINSTANCE prev_instance,
wchar_t* cmd_line, int cmd_show) {
- talk_base::EnsureWinsockInit();
- talk_base::Win32Thread w32_thread;
- talk_base::ThreadManager::Instance()->SetCurrentThread(&w32_thread);
+ rtc::EnsureWinsockInit();
+ rtc::Win32Thread w32_thread;
+ rtc::ThreadManager::Instance()->SetCurrentThread(&w32_thread);
- WindowsCommandLineArguments win_args;
+ rtc::WindowsCommandLineArguments win_args;
int argc = win_args.argc();
char **argv = win_args.argv();
- FlagList::SetFlagsFromCommandLine(&argc, argv, true);
+ rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true);
if (FLAG_help) {
- FlagList::Print(NULL, false);
+ rtc::FlagList::Print(NULL, false);
return 0;
}
@@ -63,10 +63,10 @@
return -1;
}
- talk_base::InitializeSSL();
+ rtc::InitializeSSL();
PeerConnectionClient client;
- talk_base::scoped_refptr<Conductor> conductor(
- new talk_base::RefCountedObject<Conductor>(&client, &wnd));
+ rtc::scoped_refptr<Conductor> conductor(
+ new rtc::RefCountedObject<Conductor>(&client, &wnd));
// Main loop.
MSG msg;
@@ -88,6 +88,6 @@
}
}
- talk_base::CleanupSSL();
+ rtc::CleanupSSL();
return 0;
}
diff --git a/examples/peerconnection/client/main_wnd.cc b/examples/peerconnection/client/main_wnd.cc
index cef1da7..2296c42 100644
--- a/examples/peerconnection/client/main_wnd.cc
+++ b/examples/peerconnection/client/main_wnd.cc
@@ -29,14 +29,14 @@
#include <math.h>
-#include "talk/base/common.h"
-#include "talk/base/logging.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/logging.h"
#include "talk/examples/peerconnection/client/defaults.h"
ATOM MainWnd::wnd_class_ = 0;
const wchar_t MainWnd::kClassName[] = L"WebRTC_MainWnd";
-using talk_base::sprintfn;
+using rtc::sprintfn;
namespace {
diff --git a/examples/peerconnection/client/main_wnd.h b/examples/peerconnection/client/main_wnd.h
index 77da9f6..e87153a 100644
--- a/examples/peerconnection/client/main_wnd.h
+++ b/examples/peerconnection/client/main_wnd.h
@@ -33,7 +33,7 @@
#include <string>
#include "talk/app/webrtc/mediastreaminterface.h"
-#include "talk/base/win32.h"
+#include "webrtc/base/win32.h"
#include "talk/examples/peerconnection/client/peer_connection_client.h"
#include "talk/media/base/mediachannel.h"
#include "talk/media/base/videocommon.h"
@@ -147,9 +147,9 @@
HWND wnd_;
BITMAPINFO bmi_;
- talk_base::scoped_ptr<uint8[]> image_;
+ rtc::scoped_ptr<uint8[]> image_;
CRITICAL_SECTION buffer_lock_;
- talk_base::scoped_refptr<webrtc::VideoTrackInterface> rendered_track_;
+ rtc::scoped_refptr<webrtc::VideoTrackInterface> rendered_track_;
};
// A little helper class to make sure we always to proper locking and
@@ -192,8 +192,8 @@
void HandleTabbing();
private:
- talk_base::scoped_ptr<VideoRenderer> local_renderer_;
- talk_base::scoped_ptr<VideoRenderer> remote_renderer_;
+ rtc::scoped_ptr<VideoRenderer> local_renderer_;
+ rtc::scoped_ptr<VideoRenderer> remote_renderer_;
UI ui_;
HWND wnd_;
DWORD ui_thread_id_;
diff --git a/examples/peerconnection/client/peer_connection_client.cc b/examples/peerconnection/client/peer_connection_client.cc
index 9cdaedc..e5bef05 100644
--- a/examples/peerconnection/client/peer_connection_client.cc
+++ b/examples/peerconnection/client/peer_connection_client.cc
@@ -28,16 +28,16 @@
#include "talk/examples/peerconnection/client/peer_connection_client.h"
#include "talk/examples/peerconnection/client/defaults.h"
-#include "talk/base/common.h"
-#include "talk/base/nethelpers.h"
-#include "talk/base/logging.h"
-#include "talk/base/stringutils.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/nethelpers.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/stringutils.h"
#ifdef WIN32
-#include "talk/base/win32socketserver.h"
+#include "webrtc/base/win32socketserver.h"
#endif
-using talk_base::sprintfn;
+using rtc::sprintfn;
namespace {
@@ -46,13 +46,13 @@
// Delay between server connection retries, in milliseconds
const int kReconnectDelay = 2000;
-talk_base::AsyncSocket* CreateClientSocket(int family) {
+rtc::AsyncSocket* CreateClientSocket(int family) {
#ifdef WIN32
- talk_base::Win32Socket* sock = new talk_base::Win32Socket();
+ rtc::Win32Socket* sock = new rtc::Win32Socket();
sock->CreateT(family, SOCK_STREAM);
return sock;
#elif defined(POSIX)
- talk_base::Thread* thread = talk_base::Thread::Current();
+ rtc::Thread* thread = rtc::Thread::Current();
ASSERT(thread != NULL);
return thread->socketserver()->CreateAsyncSocket(family, SOCK_STREAM);
#else
@@ -133,7 +133,7 @@
if (server_address_.IsUnresolved()) {
state_ = RESOLVING;
- resolver_ = new talk_base::AsyncResolver();
+ resolver_ = new rtc::AsyncResolver();
resolver_->SignalDone.connect(this, &PeerConnectionClient::OnResolveResult);
resolver_->Start(server_address_);
} else {
@@ -142,7 +142,7 @@
}
void PeerConnectionClient::OnResolveResult(
- talk_base::AsyncResolverInterface* resolver) {
+ rtc::AsyncResolverInterface* resolver) {
if (resolver_->GetError() != 0) {
callback_->OnServerConnectionFailure();
resolver_->Destroy(false);
@@ -176,7 +176,7 @@
return false;
ASSERT(is_connected());
- ASSERT(control_socket_->GetState() == talk_base::Socket::CS_CLOSED);
+ ASSERT(control_socket_->GetState() == rtc::Socket::CS_CLOSED);
if (!is_connected() || peer_id == -1)
return false;
@@ -198,17 +198,17 @@
bool PeerConnectionClient::IsSendingMessage() {
return state_ == CONNECTED &&
- control_socket_->GetState() != talk_base::Socket::CS_CLOSED;
+ control_socket_->GetState() != rtc::Socket::CS_CLOSED;
}
bool PeerConnectionClient::SignOut() {
if (state_ == NOT_CONNECTED || state_ == SIGNING_OUT)
return true;
- if (hanging_get_->GetState() != talk_base::Socket::CS_CLOSED)
+ if (hanging_get_->GetState() != rtc::Socket::CS_CLOSED)
hanging_get_->Close();
- if (control_socket_->GetState() == talk_base::Socket::CS_CLOSED) {
+ if (control_socket_->GetState() == rtc::Socket::CS_CLOSED) {
state_ = SIGNING_OUT;
if (my_id_ != -1) {
@@ -242,7 +242,7 @@
}
bool PeerConnectionClient::ConnectControlSocket() {
- ASSERT(control_socket_->GetState() == talk_base::Socket::CS_CLOSED);
+ ASSERT(control_socket_->GetState() == rtc::Socket::CS_CLOSED);
int err = control_socket_->Connect(server_address_);
if (err == SOCKET_ERROR) {
Close();
@@ -251,22 +251,22 @@
return true;
}
-void PeerConnectionClient::OnConnect(talk_base::AsyncSocket* socket) {
+void PeerConnectionClient::OnConnect(rtc::AsyncSocket* socket) {
ASSERT(!onconnect_data_.empty());
size_t sent = socket->Send(onconnect_data_.c_str(), onconnect_data_.length());
ASSERT(sent == onconnect_data_.length());
- UNUSED(sent);
+ RTC_UNUSED(sent);
onconnect_data_.clear();
}
-void PeerConnectionClient::OnHangingGetConnect(talk_base::AsyncSocket* socket) {
+void PeerConnectionClient::OnHangingGetConnect(rtc::AsyncSocket* socket) {
char buffer[1024];
sprintfn(buffer, sizeof(buffer),
"GET /wait?peer_id=%i HTTP/1.0\r\n\r\n", my_id_);
int len = static_cast<int>(strlen(buffer));
int sent = socket->Send(buffer, len);
ASSERT(sent == len);
- UNUSED2(sent, len);
+ RTC_UNUSED2(sent, len);
}
void PeerConnectionClient::OnMessageFromPeer(int peer_id,
@@ -308,7 +308,7 @@
return false;
}
-bool PeerConnectionClient::ReadIntoBuffer(talk_base::AsyncSocket* socket,
+bool PeerConnectionClient::ReadIntoBuffer(rtc::AsyncSocket* socket,
std::string* data,
size_t* content_length) {
char buffer[0xffff];
@@ -346,7 +346,7 @@
return ret;
}
-void PeerConnectionClient::OnRead(talk_base::AsyncSocket* socket) {
+void PeerConnectionClient::OnRead(rtc::AsyncSocket* socket) {
size_t content_length = 0;
if (ReadIntoBuffer(socket, &control_data_, &content_length)) {
size_t peer_id = 0, eoh = 0;
@@ -390,14 +390,14 @@
control_data_.clear();
if (state_ == SIGNING_IN) {
- ASSERT(hanging_get_->GetState() == talk_base::Socket::CS_CLOSED);
+ ASSERT(hanging_get_->GetState() == rtc::Socket::CS_CLOSED);
state_ = CONNECTED;
hanging_get_->Connect(server_address_);
}
}
}
-void PeerConnectionClient::OnHangingGetRead(talk_base::AsyncSocket* socket) {
+void PeerConnectionClient::OnHangingGetRead(rtc::AsyncSocket* socket) {
LOG(INFO) << __FUNCTION__;
size_t content_length = 0;
if (ReadIntoBuffer(socket, ¬ification_data_, &content_length)) {
@@ -434,7 +434,7 @@
notification_data_.clear();
}
- if (hanging_get_->GetState() == talk_base::Socket::CS_CLOSED &&
+ if (hanging_get_->GetState() == rtc::Socket::CS_CLOSED &&
state_ == CONNECTED) {
hanging_get_->Connect(server_address_);
}
@@ -496,7 +496,7 @@
return true;
}
-void PeerConnectionClient::OnClose(talk_base::AsyncSocket* socket, int err) {
+void PeerConnectionClient::OnClose(rtc::AsyncSocket* socket, int err) {
LOG(INFO) << __FUNCTION__;
socket->Close();
@@ -517,7 +517,7 @@
} else {
if (socket == control_socket_.get()) {
LOG(WARNING) << "Connection refused; retrying in 2 seconds";
- talk_base::Thread::Current()->PostDelayed(kReconnectDelay, this, 0);
+ rtc::Thread::Current()->PostDelayed(kReconnectDelay, this, 0);
} else {
Close();
callback_->OnDisconnected();
@@ -525,7 +525,7 @@
}
}
-void PeerConnectionClient::OnMessage(talk_base::Message* msg) {
+void PeerConnectionClient::OnMessage(rtc::Message* msg) {
// ignore msg; there is currently only one supported message ("retry")
DoConnect();
}
diff --git a/examples/peerconnection/client/peer_connection_client.h b/examples/peerconnection/client/peer_connection_client.h
index 43fee34..3187895 100644
--- a/examples/peerconnection/client/peer_connection_client.h
+++ b/examples/peerconnection/client/peer_connection_client.h
@@ -32,11 +32,11 @@
#include <map>
#include <string>
-#include "talk/base/nethelpers.h"
-#include "talk/base/signalthread.h"
-#include "talk/base/sigslot.h"
-#include "talk/base/physicalsocketserver.h"
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/nethelpers.h"
+#include "webrtc/base/signalthread.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/physicalsocketserver.h"
+#include "webrtc/base/scoped_ptr.h"
typedef std::map<int, std::string> Peers;
@@ -54,7 +54,7 @@
};
class PeerConnectionClient : public sigslot::has_slots<>,
- public talk_base::MessageHandler {
+ public rtc::MessageHandler {
public:
enum State {
NOT_CONNECTED,
@@ -84,15 +84,15 @@
bool SignOut();
// implements the MessageHandler interface
- void OnMessage(talk_base::Message* msg);
+ void OnMessage(rtc::Message* msg);
protected:
void DoConnect();
void Close();
void InitSocketSignals();
bool ConnectControlSocket();
- void OnConnect(talk_base::AsyncSocket* socket);
- void OnHangingGetConnect(talk_base::AsyncSocket* socket);
+ void OnConnect(rtc::AsyncSocket* socket);
+ void OnHangingGetConnect(rtc::AsyncSocket* socket);
void OnMessageFromPeer(int peer_id, const std::string& message);
// Quick and dirty support for parsing HTTP header values.
@@ -103,12 +103,12 @@
const char* header_pattern, std::string* value);
// Returns true if the whole response has been read.
- bool ReadIntoBuffer(talk_base::AsyncSocket* socket, std::string* data,
+ bool ReadIntoBuffer(rtc::AsyncSocket* socket, std::string* data,
size_t* content_length);
- void OnRead(talk_base::AsyncSocket* socket);
+ void OnRead(rtc::AsyncSocket* socket);
- void OnHangingGetRead(talk_base::AsyncSocket* socket);
+ void OnHangingGetRead(rtc::AsyncSocket* socket);
// Parses a single line entry in the form "<name>,<id>,<connected>"
bool ParseEntry(const std::string& entry, std::string* name, int* id,
@@ -119,15 +119,15 @@
bool ParseServerResponse(const std::string& response, size_t content_length,
size_t* peer_id, size_t* eoh);
- void OnClose(talk_base::AsyncSocket* socket, int err);
+ void OnClose(rtc::AsyncSocket* socket, int err);
- void OnResolveResult(talk_base::AsyncResolverInterface* resolver);
+ void OnResolveResult(rtc::AsyncResolverInterface* resolver);
PeerConnectionClientObserver* callback_;
- talk_base::SocketAddress server_address_;
- talk_base::AsyncResolver* resolver_;
- talk_base::scoped_ptr<talk_base::AsyncSocket> control_socket_;
- talk_base::scoped_ptr<talk_base::AsyncSocket> hanging_get_;
+ rtc::SocketAddress server_address_;
+ rtc::AsyncResolver* resolver_;
+ rtc::scoped_ptr<rtc::AsyncSocket> control_socket_;
+ rtc::scoped_ptr<rtc::AsyncSocket> hanging_get_;
std::string onconnect_data_;
std::string control_data_;
std::string notification_data_;
diff --git a/examples/peerconnection/server/main.cc b/examples/peerconnection/server/main.cc
index 40ede93..9be3bbe 100644
--- a/examples/peerconnection/server/main.cc
+++ b/examples/peerconnection/server/main.cc
@@ -31,7 +31,7 @@
#include <vector>
-#include "talk/base/flags.h"
+#include "webrtc/base/flags.h"
#include "talk/examples/peerconnection/server/data_socket.h"
#include "talk/examples/peerconnection/server/peer_channel.h"
#include "talk/examples/peerconnection/server/utils.h"
@@ -67,9 +67,9 @@
}
int main(int argc, char** argv) {
- FlagList::SetFlagsFromCommandLine(&argc, argv, true);
+ rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true);
if (FLAG_help) {
- FlagList::Print(NULL, false);
+ rtc::FlagList::Print(NULL, false);
return 0;
}
diff --git a/examples/peerconnection/server/peer_channel.cc b/examples/peerconnection/server/peer_channel.cc
index 2603465..15e7acb 100644
--- a/examples/peerconnection/server/peer_channel.cc
+++ b/examples/peerconnection/server/peer_channel.cc
@@ -59,6 +59,8 @@
kMessage,
};
+const size_t kMaxNameLength = 512;
+
//
// ChannelMember
//
@@ -72,8 +74,11 @@
assert(socket->method() == DataSocket::GET);
assert(socket->PathEquals("/sign_in"));
name_ = socket->request_arguments(); // TODO: urldecode
- if (!name_.length())
+ if (name_.empty())
name_ = "peer_" + int2str(id_);
+ else if (name_.length() > kMaxNameLength)
+ name_.resize(kMaxNameLength);
+
std::replace(name_.begin(), name_.end(), ',', '_');
}
@@ -100,8 +105,9 @@
return true;
}
-// Returns a string in the form "name,id\n".
+// Returns a string in the form "name,id,connected\n".
std::string ChannelMember::GetEntry() const {
+ assert(name_.length() <= kMaxNameLength);
char entry[1024] = {0};
sprintf(entry, "%s,%i,%i\n", name_.c_str(), id_, connected_); // NOLINT
return entry;
@@ -169,7 +175,6 @@
}
}
-
//
// PeerChannel
//
diff --git a/examples/relayserver/relayserver_main.cc b/examples/relayserver/relayserver_main.cc
index 11e8a5b..d9dde66 100644
--- a/examples/relayserver/relayserver_main.cc
+++ b/examples/relayserver/relayserver_main.cc
@@ -27,8 +27,8 @@
#include <iostream> // NOLINT
-#include "talk/base/thread.h"
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/thread.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/p2p/base/relayserver.h"
int main(int argc, char **argv) {
@@ -38,30 +38,30 @@
return 1;
}
- talk_base::SocketAddress int_addr;
+ rtc::SocketAddress int_addr;
if (!int_addr.FromString(argv[1])) {
std::cerr << "Unable to parse IP address: " << argv[1];
return 1;
}
- talk_base::SocketAddress ext_addr;
+ rtc::SocketAddress ext_addr;
if (!ext_addr.FromString(argv[2])) {
std::cerr << "Unable to parse IP address: " << argv[2];
return 1;
}
- talk_base::Thread *pthMain = talk_base::Thread::Current();
+ rtc::Thread *pthMain = rtc::Thread::Current();
- talk_base::scoped_ptr<talk_base::AsyncUDPSocket> int_socket(
- talk_base::AsyncUDPSocket::Create(pthMain->socketserver(), int_addr));
+ rtc::scoped_ptr<rtc::AsyncUDPSocket> int_socket(
+ rtc::AsyncUDPSocket::Create(pthMain->socketserver(), int_addr));
if (!int_socket) {
std::cerr << "Failed to create a UDP socket bound at"
<< int_addr.ToString() << std::endl;
return 1;
}
- talk_base::scoped_ptr<talk_base::AsyncUDPSocket> ext_socket(
- talk_base::AsyncUDPSocket::Create(pthMain->socketserver(), ext_addr));
+ rtc::scoped_ptr<rtc::AsyncUDPSocket> ext_socket(
+ rtc::AsyncUDPSocket::Create(pthMain->socketserver(), ext_addr));
if (!ext_socket) {
std::cerr << "Failed to create a UDP socket bound at"
<< ext_addr.ToString() << std::endl;
diff --git a/examples/stunserver/stunserver_main.cc b/examples/stunserver/stunserver_main.cc
index 4467944..3ac2ea6 100644
--- a/examples/stunserver/stunserver_main.cc
+++ b/examples/stunserver/stunserver_main.cc
@@ -31,7 +31,7 @@
#include <iostream>
-#include "talk/base/thread.h"
+#include "webrtc/base/thread.h"
#include "talk/p2p/base/stunserver.h"
using namespace cricket;
@@ -42,16 +42,16 @@
return 1;
}
- talk_base::SocketAddress server_addr;
+ rtc::SocketAddress server_addr;
if (!server_addr.FromString(argv[1])) {
std::cerr << "Unable to parse IP address: " << argv[1];
return 1;
}
- talk_base::Thread *pthMain = talk_base::Thread::Current();
+ rtc::Thread *pthMain = rtc::Thread::Current();
- talk_base::AsyncUDPSocket* server_socket =
- talk_base::AsyncUDPSocket::Create(pthMain->socketserver(), server_addr);
+ rtc::AsyncUDPSocket* server_socket =
+ rtc::AsyncUDPSocket::Create(pthMain->socketserver(), server_addr);
if (!server_socket) {
std::cerr << "Failed to create a UDP socket" << std::endl;
return 1;
diff --git a/examples/turnserver/turnserver_main.cc b/examples/turnserver/turnserver_main.cc
index d40fede..a32f42c 100644
--- a/examples/turnserver/turnserver_main.cc
+++ b/examples/turnserver/turnserver_main.cc
@@ -27,10 +27,10 @@
#include <iostream> // NOLINT
-#include "talk/base/asyncudpsocket.h"
-#include "talk/base/optionsfile.h"
-#include "talk/base/thread.h"
-#include "talk/base/stringencode.h"
+#include "webrtc/base/asyncudpsocket.h"
+#include "webrtc/base/optionsfile.h"
+#include "webrtc/base/thread.h"
+#include "webrtc/base/stringencode.h"
#include "talk/p2p/base/basicpacketsocketfactory.h"
#include "talk/p2p/base/turnserver.h"
@@ -49,13 +49,13 @@
bool ret = file_.GetStringValue(username, &hex);
if (ret) {
char buf[32];
- size_t len = talk_base::hex_decode(buf, sizeof(buf), hex);
+ size_t len = rtc::hex_decode(buf, sizeof(buf), hex);
*key = std::string(buf, len);
}
return ret;
}
private:
- talk_base::OptionsFile file_;
+ rtc::OptionsFile file_;
};
int main(int argc, char **argv) {
@@ -65,21 +65,21 @@
return 1;
}
- talk_base::SocketAddress int_addr;
+ rtc::SocketAddress int_addr;
if (!int_addr.FromString(argv[1])) {
std::cerr << "Unable to parse IP address: " << argv[1] << std::endl;
return 1;
}
- talk_base::IPAddress ext_addr;
+ rtc::IPAddress ext_addr;
if (!IPFromString(argv[2], &ext_addr)) {
std::cerr << "Unable to parse IP address: " << argv[2] << std::endl;
return 1;
}
- talk_base::Thread* main = talk_base::Thread::Current();
- talk_base::AsyncUDPSocket* int_socket =
- talk_base::AsyncUDPSocket::Create(main->socketserver(), int_addr);
+ rtc::Thread* main = rtc::Thread::Current();
+ rtc::AsyncUDPSocket* int_socket =
+ rtc::AsyncUDPSocket::Create(main->socketserver(), int_addr);
if (!int_socket) {
std::cerr << "Failed to create a UDP socket bound at"
<< int_addr.ToString() << std::endl;
@@ -92,8 +92,8 @@
server.set_software(kSoftware);
server.set_auth_hook(&auth);
server.AddInternalSocket(int_socket, cricket::PROTO_UDP);
- server.SetExternalSocketFactory(new talk_base::BasicPacketSocketFactory(),
- talk_base::SocketAddress(ext_addr, 0));
+ server.SetExternalSocketFactory(new rtc::BasicPacketSocketFactory(),
+ rtc::SocketAddress(ext_addr, 0));
std::cout << "Listening internally at " << int_addr.ToString() << std::endl;
diff --git a/libjingle.gyp b/libjingle.gyp
index 2182561..8ad4c11 100755
--- a/libjingle.gyp
+++ b/libjingle.gyp
@@ -110,6 +110,7 @@
'android_java_files': [
'app/webrtc/java/android/org/webrtc/VideoRendererGui.java',
'app/webrtc/java/src/org/webrtc/MediaCodecVideoEncoder.java',
+ 'app/webrtc/java/src/org/webrtc/MediaCodecVideoDecoder.java',
'<(webrtc_modules_dir)/audio_device/android/java/src/org/webrtc/voiceengine/AudioManagerAndroid.java',
'<(webrtc_modules_dir)/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java',
'<(webrtc_modules_dir)/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureDeviceInfoAndroid.java',
@@ -302,216 +303,13 @@
'dependencies': [
'<(DEPTH)/third_party/expat/expat.gyp:expat',
'<(DEPTH)/third_party/jsoncpp/jsoncpp.gyp:jsoncpp',
+ '<(webrtc_root)/base/base.gyp:webrtc_base',
],
'export_dependent_settings': [
'<(DEPTH)/third_party/expat/expat.gyp:expat',
'<(DEPTH)/third_party/jsoncpp/jsoncpp.gyp:jsoncpp',
],
'sources': [
- 'base/asyncfile.cc',
- 'base/asyncfile.h',
- 'base/asynchttprequest.cc',
- 'base/asynchttprequest.h',
- 'base/asyncinvoker.cc',
- 'base/asyncinvoker.h',
- 'base/asyncpacketsocket.h',
- 'base/asyncresolverinterface.h',
- 'base/asyncsocket.cc',
- 'base/asyncsocket.h',
- 'base/asynctcpsocket.cc',
- 'base/asynctcpsocket.h',
- 'base/asyncudpsocket.cc',
- 'base/asyncudpsocket.h',
- 'base/atomicops.h',
- 'base/autodetectproxy.cc',
- 'base/autodetectproxy.h',
- 'base/bandwidthsmoother.cc',
- 'base/bandwidthsmoother.h',
- 'base/base64.cc',
- 'base/base64.h',
- 'base/basicdefs.h',
- 'base/basictypes.h',
- 'base/bind.h',
- 'base/buffer.h',
- 'base/bytebuffer.cc',
- 'base/bytebuffer.h',
- 'base/byteorder.h',
- 'base/callback.h',
- 'base/checks.cc',
- 'base/checks.h',
- 'base/common.cc',
- 'base/common.h',
- 'base/constructormagic.h',
- 'base/cpumonitor.cc',
- 'base/cpumonitor.h',
- 'base/crc32.cc',
- 'base/crc32.h',
- 'base/criticalsection.h',
- 'base/cryptstring.h',
- 'base/diskcache.cc',
- 'base/diskcache.h',
- 'base/event.cc',
- 'base/event.h',
- 'base/filelock.cc',
- 'base/filelock.h',
- 'base/fileutils.cc',
- 'base/fileutils.h',
- 'base/fileutils_mock.h',
- 'base/firewallsocketserver.cc',
- 'base/firewallsocketserver.h',
- 'base/flags.cc',
- 'base/flags.h',
- 'base/gunit_prod.h',
- 'base/helpers.cc',
- 'base/helpers.h',
- 'base/httpbase.cc',
- 'base/httpbase.h',
- 'base/httpclient.cc',
- 'base/httpclient.h',
- 'base/httpcommon-inl.h',
- 'base/httpcommon.cc',
- 'base/httpcommon.h',
- 'base/httprequest.cc',
- 'base/httprequest.h',
- 'base/httpserver.cc',
- 'base/httpserver.h',
- 'base/ifaddrs-android.cc',
- 'base/ifaddrs-android.h',
- 'base/ipaddress.cc',
- 'base/ipaddress.h',
- 'base/json.cc',
- 'base/json.h',
- 'base/linked_ptr.h',
- 'base/linuxfdwalk.h',
- 'base/logging.cc',
- 'base/logging.h',
- 'base/maccocoathreadhelper.h',
- 'base/maccocoathreadhelper.mm',
- 'base/mathutils.h',
- 'base/md5.cc',
- 'base/md5.h',
- 'base/md5digest.h',
- 'base/messagedigest.cc',
- 'base/messagedigest.h',
- 'base/messagehandler.cc',
- 'base/messagehandler.h',
- 'base/messagequeue.cc',
- 'base/messagequeue.h',
- 'base/multipart.cc',
- 'base/multipart.h',
- 'base/natserver.cc',
- 'base/natserver.h',
- 'base/natsocketfactory.cc',
- 'base/natsocketfactory.h',
- 'base/nattypes.cc',
- 'base/nattypes.h',
- 'base/nethelpers.cc',
- 'base/nethelpers.h',
- 'base/network.cc',
- 'base/network.h',
- 'base/nssidentity.cc',
- 'base/nssidentity.h',
- 'base/nssstreamadapter.cc',
- 'base/nssstreamadapter.h',
- 'base/nullsocketserver.h',
- 'base/optionsfile.cc',
- 'base/optionsfile.h',
- 'base/pathutils.cc',
- 'base/pathutils.h',
- 'base/physicalsocketserver.cc',
- 'base/physicalsocketserver.h',
- 'base/profiler.cc',
- 'base/profiler.h',
- 'base/proxydetect.cc',
- 'base/proxydetect.h',
- 'base/proxyinfo.cc',
- 'base/proxyinfo.h',
- 'base/proxyserver.cc',
- 'base/proxyserver.h',
- 'base/ratelimiter.cc',
- 'base/ratelimiter.h',
- 'base/ratetracker.cc',
- 'base/ratetracker.h',
- 'base/refcount.h',
- 'base/referencecountedsingletonfactory.h',
- 'base/rollingaccumulator.h',
- 'base/scoped_autorelease_pool.h',
- 'base/scoped_ptr.h',
- 'base/scoped_ref_ptr.h',
- 'base/scopedptrcollection.h',
- 'base/sec_buffer.h',
- 'base/sha1.cc',
- 'base/sha1.h',
- 'base/sha1digest.h',
- 'base/sharedexclusivelock.cc',
- 'base/sharedexclusivelock.h',
- 'base/signalthread.cc',
- 'base/signalthread.h',
- 'base/sigslot.h',
- 'base/sigslotrepeater.h',
- 'base/socket.h',
- 'base/socketadapters.cc',
- 'base/socketadapters.h',
- 'base/socketaddress.cc',
- 'base/socketaddress.h',
- 'base/socketaddresspair.cc',
- 'base/socketaddresspair.h',
- 'base/socketfactory.h',
- 'base/socketpool.cc',
- 'base/socketpool.h',
- 'base/socketserver.h',
- 'base/socketstream.cc',
- 'base/socketstream.h',
- 'base/ssladapter.cc',
- 'base/ssladapter.h',
- 'base/sslconfig.h',
- 'base/sslfingerprint.cc',
- 'base/sslfingerprint.h',
- 'base/sslidentity.cc',
- 'base/sslidentity.h',
- 'base/sslroots.h',
- 'base/sslsocketfactory.cc',
- 'base/sslsocketfactory.h',
- 'base/sslstreamadapter.cc',
- 'base/sslstreamadapter.h',
- 'base/sslstreamadapterhelper.cc',
- 'base/sslstreamadapterhelper.h',
- 'base/stream.cc',
- 'base/stream.h',
- 'base/stringdigest.h',
- 'base/stringencode.cc',
- 'base/stringencode.h',
- 'base/stringutils.cc',
- 'base/stringutils.h',
- 'base/systeminfo.cc',
- 'base/systeminfo.h',
- 'base/task.cc',
- 'base/task.h',
- 'base/taskparent.cc',
- 'base/taskparent.h',
- 'base/taskrunner.cc',
- 'base/taskrunner.h',
- 'base/testclient.cc',
- 'base/testclient.h',
- 'base/thread.cc',
- 'base/thread.h',
- 'base/timeutils.cc',
- 'base/timeutils.h',
- 'base/timing.cc',
- 'base/timing.h',
- 'base/transformadapter.cc',
- 'base/transformadapter.h',
- 'base/urlencode.cc',
- 'base/urlencode.h',
- 'base/versionparsing.cc',
- 'base/versionparsing.h',
- 'base/virtualsocketserver.cc',
- 'base/virtualsocketserver.h',
- 'base/window.h',
- 'base/windowpicker.h',
- 'base/windowpickerfactory.h',
- 'base/worker.cc',
- 'base/worker.h',
'xmllite/qname.cc',
'xmllite/qname.h',
'xmllite/xmlbuilder.cc',
@@ -600,183 +398,6 @@
'xmpp/xmppthread.cc',
'xmpp/xmppthread.h',
],
- 'conditions': [
- ['OS=="android"', {
- 'sources': [
- 'base/ifaddrs-android.cc',
- ],
- 'link_settings': {
- 'libraries': [
- '-llog',
- '-lGLESv2',
- ],
- },
- }],
- ['OS=="linux" or OS=="android"', {
- 'sources': [
- 'base/linux.cc',
- 'base/linux.h',
- ],
- }],
- ['OS=="linux"', {
- 'sources': [
- 'base/dbus.cc',
- 'base/dbus.h',
- 'base/libdbusglibsymboltable.cc',
- 'base/libdbusglibsymboltable.h',
- 'base/linuxfdwalk.c',
- 'base/linuxwindowpicker.cc',
- 'base/linuxwindowpicker.h',
- ],
- 'link_settings': {
- 'libraries': [
- '-lcrypto',
- '-ldl',
- '-lrt',
- '-lXext',
- '-lX11',
- '-lXcomposite',
- '-lXrender',
- '<!@(<(pkg-config) --libs-only-l nss | sed -e "s/-lssl3//")',
- ],
- },
- 'cflags': [
- '<!@(<(pkg-config) --cflags nss)',
- ],
- 'ldflags': [
- '<!@(<(pkg-config) --libs-only-L --libs-only-other nss)',
- ],
- }],
- ['OS=="mac"', {
- 'sources': [
- 'base/macasyncsocket.cc',
- 'base/macasyncsocket.h',
- 'base/maccocoasocketserver.h',
- 'base/maccocoasocketserver.mm',
- 'base/macconversion.cc',
- 'base/macconversion.h',
- 'base/macsocketserver.cc',
- 'base/macsocketserver.h',
- 'base/macutils.cc',
- 'base/macutils.h',
- 'base/macwindowpicker.cc',
- 'base/macwindowpicker.h',
- 'base/scoped_autorelease_pool.mm',
- ],
- 'link_settings': {
- 'libraries': [
- '$(SDKROOT)/usr/lib/libcrypto.dylib',
- '$(SDKROOT)/usr/lib/libssl.dylib',
- ],
- },
- 'all_dependent_settings': {
- 'link_settings': {
- 'xcode_settings': {
- 'OTHER_LDFLAGS': [
- '-framework Cocoa',
- '-framework Foundation',
- '-framework IOKit',
- '-framework Security',
- '-framework SystemConfiguration',
- ],
- },
- },
- },
- 'conditions': [
- ['target_arch=="ia32"', {
- 'all_dependent_settings': {
- 'link_settings': {
- 'xcode_settings': {
- 'OTHER_LDFLAGS': [
- '-framework Carbon',
- ],
- },
- },
- },
- }],
- ],
- }],
- ['OS=="ios"', {
- 'sources': [
- 'base/iosfilesystem.mm',
- 'base/scoped_autorelease_pool.mm',
- ],
- 'dependencies': [
- '<(DEPTH)/net/third_party/nss/ssl.gyp:libssl',
- ],
- 'all_dependent_settings': {
- 'xcode_settings': {
- 'OTHER_LDFLAGS': [
- '-framework Foundation',
- '-framework Security',
- '-framework SystemConfiguration',
- '-framework UIKit',
- ],
- },
- },
- }],
- ['OS=="win"', {
- 'sources': [
- 'base/diskcache_win32.cc',
- 'base/diskcache_win32.h',
- 'base/schanneladapter.cc',
- 'base/schanneladapter.h',
- 'base/win32.cc',
- 'base/win32.h',
- 'base/win32filesystem.cc',
- 'base/win32filesystem.h',
- 'base/win32regkey.cc',
- 'base/win32regkey.h',
- 'base/win32securityerrors.cc',
- 'base/win32socketinit.cc',
- 'base/win32socketinit.h',
- 'base/win32socketserver.cc',
- 'base/win32socketserver.h',
- 'base/win32window.cc',
- 'base/win32window.h',
- 'base/win32windowpicker.cc',
- 'base/win32windowpicker.h',
- 'base/winfirewall.cc',
- 'base/winfirewall.h',
- 'base/winping.cc',
- 'base/winping.h',
- ],
- 'link_settings': {
- 'libraries': [
- '-lcrypt32.lib',
- '-liphlpapi.lib',
- '-lsecur32.lib',
- ],
- },
- # Suppress warnings about WIN32_LEAN_AND_MEAN.
- 'msvs_disabled_warnings': [4005],
- }],
- ['os_posix==1', {
- 'sources': [
- 'base/latebindingsymboltable.cc',
- 'base/latebindingsymboltable.h',
- 'base/posix.cc',
- 'base/posix.h',
- 'base/unixfilesystem.cc',
- 'base/unixfilesystem.h',
- ],
- 'conditions': [
- ['OS!="ios"', {
- 'sources': [
- 'base/openssl.h',
- 'base/openssladapter.cc',
- 'base/openssladapter.h',
- 'base/openssldigest.cc',
- 'base/openssldigest.h',
- 'base/opensslidentity.cc',
- 'base/opensslidentity.h',
- 'base/opensslstreamadapter.cc',
- 'base/opensslstreamadapter.h',
- ],
- }],
- ],
- }],
- ], # conditions
}, # target libjingle
{
'target_name': 'libjingle_sound',
@@ -1021,13 +642,6 @@
# libjpeg which pulls in libyuv which currently disabled.
'../third_party/libyuv/include',
],
- 'dependencies!': [
- '<(DEPTH)/third_party/usrsctp/usrsctp.gyp:usrsctplib',
- ],
- 'sources!': [
- 'media/sctp/sctpdataengine.cc',
- 'media/sctp/sctpdataengine.h',
- ],
}],
['OS=="android"', {
'sources': [
diff --git a/libjingle_examples.gyp b/libjingle_examples.gyp
index f69c5dc..3e31f50 100755
--- a/libjingle_examples.gyp
+++ b/libjingle_examples.gyp
@@ -172,6 +172,7 @@
'dependencies': [
'<(DEPTH)/third_party/jsoncpp/jsoncpp.gyp:jsoncpp',
'libjingle.gyp:libjingle_peerconnection',
+ '<@(libjingle_tests_additional_deps)',
],
'conditions': [
# TODO(ronghuawu): Move these files to a win/ directory then they
diff --git a/libjingle_tests.gyp b/libjingle_tests.gyp
index 3c8df7e..9a00fed 100755
--- a/libjingle_tests.gyp
+++ b/libjingle_tests.gyp
@@ -29,58 +29,25 @@
'includes': ['build/common.gypi'],
'targets': [
{
- # TODO(ronghuawu): Use gtest.gyp from chromium.
- 'target_name': 'gunit',
- 'type': 'static_library',
- 'sources': [
- '<(DEPTH)/testing/gtest/src/gtest-all.cc',
- ],
- 'include_dirs': [
- '<(DEPTH)/testing/gtest/include',
- '<(DEPTH)/testing/gtest',
- ],
- 'defines': ['_VARIADIC_MAX=10'],
- 'direct_dependent_settings': {
- 'defines': [
- '_VARIADIC_MAX=10',
- ],
- 'include_dirs': [
- '<(DEPTH)/testing/gtest/include',
- ],
- },
- 'conditions': [
- ['OS=="android"', {
- 'include_dirs': [
- '<(android_ndk_include)',
- ]
- }],
- ],
- }, # target gunit
- {
'target_name': 'libjingle_unittest_main',
'type': 'static_library',
'dependencies': [
'<(DEPTH)/third_party/libyuv/libyuv.gyp:libyuv',
- 'gunit',
+ '<(webrtc_root)/base/base_tests.gyp:webrtc_base_tests_utils',
'<@(libjingle_tests_additional_deps)',
],
'direct_dependent_settings': {
'include_dirs': [
'<(DEPTH)/third_party/libyuv/include',
+ '<(DEPTH)/testing/gtest/include',
+ '<(DEPTH)/testing/gtest',
],
},
+ 'include_dirs': [
+ '<(DEPTH)/testing/gtest/include',
+ '<(DEPTH)/testing/gtest',
+ ],
'sources': [
- 'base/unittest_main.cc',
- # Also use this as a convenient dumping ground for misc files that are
- # included by multiple targets below.
- 'base/fakecpumonitor.h',
- 'base/fakenetwork.h',
- 'base/fakesslidentity.h',
- 'base/faketaskrunner.h',
- 'base/gunit.h',
- 'base/testbase64.h',
- 'base/testechoserver.h',
- 'base/win32toolhelp.h',
'media/base/fakecapturemanager.h',
'media/base/fakemediaengine.h',
'media/base/fakemediaprocessor.h',
@@ -107,73 +74,12 @@
'type': 'executable',
'includes': [ 'build/ios_tests.gypi', ],
'dependencies': [
- 'gunit',
+ '<(webrtc_root)/base/base.gyp:webrtc_base',
+ '<(webrtc_root)/base/base_tests.gyp:webrtc_base_tests_utils',
'libjingle.gyp:libjingle',
'libjingle_unittest_main',
],
'sources': [
- 'base/asynchttprequest_unittest.cc',
- 'base/atomicops_unittest.cc',
- 'base/autodetectproxy_unittest.cc',
- 'base/bandwidthsmoother_unittest.cc',
- 'base/base64_unittest.cc',
- 'base/basictypes_unittest.cc',
- 'base/bind_unittest.cc',
- 'base/buffer_unittest.cc',
- 'base/bytebuffer_unittest.cc',
- 'base/byteorder_unittest.cc',
- 'base/callback_unittest.cc',
- 'base/cpumonitor_unittest.cc',
- 'base/crc32_unittest.cc',
- 'base/criticalsection_unittest.cc',
- 'base/event_unittest.cc',
- 'base/filelock_unittest.cc',
- 'base/fileutils_unittest.cc',
- 'base/helpers_unittest.cc',
- 'base/httpbase_unittest.cc',
- 'base/httpcommon_unittest.cc',
- 'base/httpserver_unittest.cc',
- 'base/ipaddress_unittest.cc',
- 'base/logging_unittest.cc',
- 'base/md5digest_unittest.cc',
- 'base/messagedigest_unittest.cc',
- 'base/messagequeue_unittest.cc',
- 'base/multipart_unittest.cc',
- 'base/nat_unittest.cc',
- 'base/network_unittest.cc',
- 'base/nullsocketserver_unittest.cc',
- 'base/optionsfile_unittest.cc',
- 'base/pathutils_unittest.cc',
- 'base/physicalsocketserver_unittest.cc',
- 'base/profiler_unittest.cc',
- 'base/proxy_unittest.cc',
- 'base/proxydetect_unittest.cc',
- 'base/ratelimiter_unittest.cc',
- 'base/ratetracker_unittest.cc',
- 'base/referencecountedsingletonfactory_unittest.cc',
- 'base/rollingaccumulator_unittest.cc',
- 'base/scopedptrcollection_unittest.cc',
- 'base/sha1digest_unittest.cc',
- 'base/sharedexclusivelock_unittest.cc',
- 'base/signalthread_unittest.cc',
- 'base/sigslot_unittest.cc',
- 'base/socket_unittest.cc',
- 'base/socket_unittest.h',
- 'base/socketaddress_unittest.cc',
- 'base/stream_unittest.cc',
- 'base/stringencode_unittest.cc',
- 'base/stringutils_unittest.cc',
- # TODO(ronghuawu): Reenable this test.
- # 'base/systeminfo_unittest.cc',
- 'base/task_unittest.cc',
- 'base/testclient_unittest.cc',
- 'base/thread_unittest.cc',
- 'base/timeutils_unittest.cc',
- 'base/urlencode_unittest.cc',
- 'base/versionparsing_unittest.cc',
- 'base/virtualsocket_unittest.cc',
- # TODO(ronghuawu): Reenable this test.
- # 'base/windowpicker_unittest.cc',
'xmllite/qname_unittest.cc',
'xmllite/xmlbuilder_unittest.cc',
'xmllite/xmlelement_unittest.cc',
@@ -196,54 +102,12 @@
'xmpp/xmpplogintask_unittest.cc',
'xmpp/xmppstanzaparser_unittest.cc',
], # sources
- 'conditions': [
- ['OS=="linux"', {
- 'sources': [
- 'base/latebindingsymboltable_unittest.cc',
- # TODO(ronghuawu): Reenable this test.
- # 'base/linux_unittest.cc',
- 'base/linuxfdwalk_unittest.cc',
- ],
- }],
- ['OS=="win"', {
- 'sources': [
- 'base/win32_unittest.cc',
- 'base/win32regkey_unittest.cc',
- 'base/win32socketserver_unittest.cc',
- 'base/win32toolhelp_unittest.cc',
- 'base/win32window_unittest.cc',
- 'base/win32windowpicker_unittest.cc',
- 'base/winfirewall_unittest.cc',
- ],
- 'sources!': [
- # TODO(ronghuawu): Fix TestUdpReadyToSendIPv6 on windows bot
- # then reenable these tests.
- 'base/physicalsocketserver_unittest.cc',
- 'base/socket_unittest.cc',
- 'base/win32socketserver_unittest.cc',
- 'base/win32windowpicker_unittest.cc',
- ],
- }],
- ['OS=="mac"', {
- 'sources': [
- 'base/macsocketserver_unittest.cc',
- 'base/macutils_unittest.cc',
- 'base/macwindowpicker_unittest.cc',
- ],
- }],
- ['os_posix==1', {
- 'sources': [
- 'base/sslidentity_unittest.cc',
- 'base/sslstreamadapter_unittest.cc',
- ],
- }],
- ], # conditions
}, # target libjingle_unittest
{
'target_name': 'libjingle_sound_unittest',
'type': 'executable',
'dependencies': [
- 'gunit',
+ '<(webrtc_root)/base/base_tests.gyp:webrtc_base_tests_utils',
'libjingle.gyp:libjingle_sound',
'libjingle_unittest_main',
],
@@ -255,7 +119,7 @@
'target_name': 'libjingle_media_unittest',
'type': 'executable',
'dependencies': [
- 'gunit',
+ '<(webrtc_root)/base/base_tests.gyp:webrtc_base_tests_utils',
'libjingle.gyp:libjingle_media',
'libjingle_unittest_main',
],
@@ -281,6 +145,7 @@
'media/base/rtpdataengine_unittest.cc',
'media/base/rtpdump_unittest.cc',
'media/base/rtputils_unittest.cc',
+ 'media/base/streamparams_unittest.cc',
'media/base/testutils.cc',
'media/base/testutils.h',
'media/base/videocapturer_unittest.cc',
@@ -328,7 +193,7 @@
'type': 'executable',
'dependencies': [
'<(DEPTH)/third_party/libsrtp/libsrtp.gyp:libsrtp',
- 'gunit',
+ '<(webrtc_root)/base/base_tests.gyp:webrtc_base_tests_utils',
'libjingle.gyp:libjingle',
'libjingle.gyp:libjingle_p2p',
'libjingle_unittest_main',
@@ -355,6 +220,7 @@
'p2p/base/testturnserver.h',
'p2p/base/transport_unittest.cc',
'p2p/base/transportdescriptionfactory_unittest.cc',
+ 'p2p/base/turnport_unittest.cc',
'p2p/client/connectivitychecker_unittest.cc',
'p2p/client/fakeportallocator.h',
'p2p/client/portallocator_unittest.cc',
@@ -386,7 +252,7 @@
'type': 'executable',
'dependencies': [
'<(DEPTH)/testing/gmock.gyp:gmock',
- 'gunit',
+ '<(webrtc_root)/base/base_tests.gyp:webrtc_base_tests_utils',
'libjingle.gyp:libjingle',
'libjingle.gyp:libjingle_p2p',
'libjingle.gyp:libjingle_peerconnection',
@@ -519,7 +385,7 @@
'type': 'executable',
'includes': [ 'build/ios_tests.gypi', ],
'dependencies': [
- 'gunit',
+ '<(webrtc_root)/base/base_tests.gyp:webrtc_base_tests_utils',
'libjingle.gyp:libjingle_peerconnection_objc',
],
'sources': [
diff --git a/media/base/capturemanager.cc b/media/base/capturemanager.cc
index 85bfa54..e6fb9f0 100644
--- a/media/base/capturemanager.cc
+++ b/media/base/capturemanager.cc
@@ -29,7 +29,7 @@
#include <algorithm>
-#include "talk/base/logging.h"
+#include "webrtc/base/logging.h"
#include "talk/media/base/videocapturer.h"
#include "talk/media/base/videoprocessor.h"
#include "talk/media/base/videorenderer.h"
@@ -64,7 +64,7 @@
explicit VideoCapturerState(CaptureRenderAdapter* adapter);
- talk_base::scoped_ptr<CaptureRenderAdapter> adapter_;
+ rtc::scoped_ptr<CaptureRenderAdapter> adapter_;
int start_count_;
CaptureFormats capture_formats_;
diff --git a/media/base/capturemanager.h b/media/base/capturemanager.h
index 5226e7b..211516d 100644
--- a/media/base/capturemanager.h
+++ b/media/base/capturemanager.h
@@ -46,7 +46,7 @@
#include <map>
#include <vector>
-#include "talk/base/sigslotrepeater.h"
+#include "webrtc/base/sigslotrepeater.h"
#include "talk/media/base/capturerenderadapter.h"
#include "talk/media/base/videocommon.h"
diff --git a/media/base/capturemanager_unittest.cc b/media/base/capturemanager_unittest.cc
index 8025e56..cff9cae 100644
--- a/media/base/capturemanager_unittest.cc
+++ b/media/base/capturemanager_unittest.cc
@@ -27,8 +27,8 @@
#include "talk/media/base/capturemanager.h"
-#include "talk/base/gunit.h"
-#include "talk/base/sigslot.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/sigslot.h"
#include "talk/media/base/fakemediaprocessor.h"
#include "talk/media/base/fakevideocapturer.h"
#include "talk/media/base/fakevideorenderer.h"
diff --git a/media/base/capturerenderadapter.cc b/media/base/capturerenderadapter.cc
index a281e66..010cc06 100644
--- a/media/base/capturerenderadapter.cc
+++ b/media/base/capturerenderadapter.cc
@@ -27,7 +27,7 @@
#include "talk/media/base/capturerenderadapter.h"
-#include "talk/base/logging.h"
+#include "webrtc/base/logging.h"
#include "talk/media/base/videocapturer.h"
#include "talk/media/base/videoprocessor.h"
#include "talk/media/base/videorenderer.h"
@@ -66,7 +66,7 @@
if (!video_renderer) {
return false;
}
- talk_base::CritScope cs(&capture_crit_);
+ rtc::CritScope cs(&capture_crit_);
if (IsRendererRegistered(*video_renderer)) {
return false;
}
@@ -78,7 +78,7 @@
if (!video_renderer) {
return false;
}
- talk_base::CritScope cs(&capture_crit_);
+ rtc::CritScope cs(&capture_crit_);
for (VideoRenderers::iterator iter = video_renderers_.begin();
iter != video_renderers_.end(); ++iter) {
if (video_renderer == iter->renderer) {
@@ -97,7 +97,7 @@
void CaptureRenderAdapter::OnVideoFrame(VideoCapturer* capturer,
const VideoFrame* video_frame) {
- talk_base::CritScope cs(&capture_crit_);
+ rtc::CritScope cs(&capture_crit_);
if (video_renderers_.empty()) {
return;
}
diff --git a/media/base/capturerenderadapter.h b/media/base/capturerenderadapter.h
index 1df9131..73260a5 100644
--- a/media/base/capturerenderadapter.h
+++ b/media/base/capturerenderadapter.h
@@ -36,8 +36,8 @@
#include <vector>
-#include "talk/base/criticalsection.h"
-#include "talk/base/sigslot.h"
+#include "webrtc/base/criticalsection.h"
+#include "webrtc/base/sigslot.h"
#include "talk/media/base/videocapturer.h"
namespace cricket {
@@ -83,7 +83,7 @@
VideoRenderers video_renderers_;
VideoCapturer* video_capturer_;
// Critical section synchronizing the capture thread.
- mutable talk_base::CriticalSection capture_crit_;
+ mutable rtc::CriticalSection capture_crit_;
};
} // namespace cricket
diff --git a/media/base/codec.cc b/media/base/codec.cc
index c6f0ea5..e4ab540 100644
--- a/media/base/codec.cc
+++ b/media/base/codec.cc
@@ -30,10 +30,10 @@
#include <algorithm>
#include <sstream>
-#include "talk/base/common.h"
-#include "talk/base/logging.h"
-#include "talk/base/stringencode.h"
-#include "talk/base/stringutils.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/stringencode.h"
+#include "webrtc/base/stringutils.h"
namespace cricket {
@@ -108,7 +108,7 @@
CodecParameterMap::const_iterator iter = params.find(name);
if (iter == params.end())
return false;
- return talk_base::FromString(iter->second, out);
+ return rtc::FromString(iter->second, out);
}
void Codec::SetParam(const std::string& name, const std::string& value) {
@@ -116,7 +116,7 @@
}
void Codec::SetParam(const std::string& name, int value) {
- params[name] = talk_base::ToString(value);
+ params[name] = rtc::ToString(value);
}
bool Codec::RemoveParam(const std::string& name) {
diff --git a/media/base/codec_unittest.cc b/media/base/codec_unittest.cc
index ea7a131..8ead5ee 100644
--- a/media/base/codec_unittest.cc
+++ b/media/base/codec_unittest.cc
@@ -25,7 +25,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/gunit.h"
+#include "webrtc/base/gunit.h"
#include "talk/media/base/codec.h"
using cricket::AudioCodec;
diff --git a/media/base/cpuid.h b/media/base/cpuid.h
index 3b2aa76..310b221 100644
--- a/media/base/cpuid.h
+++ b/media/base/cpuid.h
@@ -28,7 +28,7 @@
#ifndef TALK_MEDIA_BASE_CPUID_H_
#define TALK_MEDIA_BASE_CPUID_H_
-#include "talk/base/basictypes.h" // For DISALLOW_IMPLICIT_CONSTRUCTORS
+#include "webrtc/base/basictypes.h" // For DISALLOW_IMPLICIT_CONSTRUCTORS
namespace cricket {
diff --git a/media/base/cpuid_unittest.cc b/media/base/cpuid_unittest.cc
index e8fcc2c..f03b77f 100644
--- a/media/base/cpuid_unittest.cc
+++ b/media/base/cpuid_unittest.cc
@@ -29,9 +29,9 @@
#include <iostream>
-#include "talk/base/basictypes.h"
-#include "talk/base/gunit.h"
-#include "talk/base/systeminfo.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/systeminfo.h"
TEST(CpuInfoTest, CpuId) {
LOG(LS_INFO) << "ARM: "
diff --git a/media/base/fakemediaengine.h b/media/base/fakemediaengine.h
index 27fbeb0..6fc6a34 100644
--- a/media/base/fakemediaengine.h
+++ b/media/base/fakemediaengine.h
@@ -34,8 +34,8 @@
#include <string>
#include <vector>
-#include "talk/base/buffer.h"
-#include "talk/base/stringutils.h"
+#include "webrtc/base/buffer.h"
+#include "webrtc/base/stringutils.h"
#include "talk/media/base/audiorenderer.h"
#include "talk/media/base/mediaengine.h"
#include "talk/media/base/rtputils.h"
@@ -73,11 +73,11 @@
if (!sending_) {
return false;
}
- talk_base::Buffer packet(data, len, kMaxRtpPacketLen);
+ rtc::Buffer packet(data, len, kMaxRtpPacketLen);
return Base::SendPacket(&packet);
}
bool SendRtcp(const void* data, int len) {
- talk_base::Buffer packet(data, len, kMaxRtpPacketLen);
+ rtc::Buffer packet(data, len, kMaxRtpPacketLen);
return Base::SendRtcp(&packet);
}
@@ -191,12 +191,12 @@
return true;
}
void set_playout(bool playout) { playout_ = playout; }
- virtual void OnPacketReceived(talk_base::Buffer* packet,
- const talk_base::PacketTime& packet_time) {
+ virtual void OnPacketReceived(rtc::Buffer* packet,
+ const rtc::PacketTime& packet_time) {
rtp_packets_.push_back(std::string(packet->data(), packet->length()));
}
- virtual void OnRtcpReceived(talk_base::Buffer* packet,
- const talk_base::PacketTime& packet_time) {
+ virtual void OnRtcpReceived(rtc::Buffer* packet,
+ const rtc::PacketTime& packet_time) {
rtcp_packets_.push_back(std::string(packet->data(), packet->length()));
}
virtual void OnReadyToSend(bool ready) {
@@ -690,7 +690,7 @@
}
virtual bool SendData(const SendDataParams& params,
- const talk_base::Buffer& payload,
+ const rtc::Buffer& payload,
SendDataResult* result) {
if (send_blocked_) {
*result = SDR_BLOCK;
@@ -724,7 +724,7 @@
: loglevel_(-1),
options_changed_(false),
fail_create_channel_(false) {}
- bool Init(talk_base::Thread* worker_thread) { return true; }
+ bool Init(rtc::Thread* worker_thread) { return true; }
void Terminate() {}
void SetLogging(int level, const char* filter) {
@@ -824,7 +824,7 @@
bool SetLocalMonitor(bool enable) { return true; }
- bool StartAecDump(talk_base::PlatformFile file) { return false; }
+ bool StartAecDump(rtc::PlatformFile file) { return false; }
bool RegisterProcessor(uint32 ssrc, VoiceProcessor* voice_processor,
MediaProcessorDirection direction) {
diff --git a/media/base/fakenetworkinterface.h b/media/base/fakenetworkinterface.h
index eb0175b..e4878e7 100644
--- a/media/base/fakenetworkinterface.h
+++ b/media/base/fakenetworkinterface.h
@@ -31,13 +31,13 @@
#include <vector>
#include <map>
-#include "talk/base/buffer.h"
-#include "talk/base/byteorder.h"
-#include "talk/base/criticalsection.h"
-#include "talk/base/dscp.h"
-#include "talk/base/messagehandler.h"
-#include "talk/base/messagequeue.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/buffer.h"
+#include "webrtc/base/byteorder.h"
+#include "webrtc/base/criticalsection.h"
+#include "webrtc/base/dscp.h"
+#include "webrtc/base/messagehandler.h"
+#include "webrtc/base/messagequeue.h"
+#include "webrtc/base/thread.h"
#include "talk/media/base/mediachannel.h"
#include "talk/media/base/rtputils.h"
@@ -45,15 +45,15 @@
// Fake NetworkInterface that sends/receives RTP/RTCP packets.
class FakeNetworkInterface : public MediaChannel::NetworkInterface,
- public talk_base::MessageHandler {
+ public rtc::MessageHandler {
public:
FakeNetworkInterface()
- : thread_(talk_base::Thread::Current()),
+ : thread_(rtc::Thread::Current()),
dest_(NULL),
conf_(false),
sendbuf_size_(-1),
recvbuf_size_(-1),
- dscp_(talk_base::DSCP_NO_CHANGE) {
+ dscp_(rtc::DSCP_NO_CHANGE) {
}
void SetDestination(MediaChannel* dest) { dest_ = dest; }
@@ -62,13 +62,13 @@
// the transport will send multiple copies of the packet with the specified
// SSRCs. This allows us to simulate receiving media from multiple sources.
void SetConferenceMode(bool conf, const std::vector<uint32>& ssrcs) {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
conf_ = conf;
conf_sent_ssrcs_ = ssrcs;
}
int NumRtpBytes() {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
int bytes = 0;
for (size_t i = 0; i < rtp_packets_.size(); ++i) {
bytes += static_cast<int>(rtp_packets_[i].length());
@@ -77,50 +77,50 @@
}
int NumRtpBytes(uint32 ssrc) {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
int bytes = 0;
GetNumRtpBytesAndPackets(ssrc, &bytes, NULL);
return bytes;
}
int NumRtpPackets() {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
return static_cast<int>(rtp_packets_.size());
}
int NumRtpPackets(uint32 ssrc) {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
int packets = 0;
GetNumRtpBytesAndPackets(ssrc, NULL, &packets);
return packets;
}
int NumSentSsrcs() {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
return static_cast<int>(sent_ssrcs_.size());
}
// Note: callers are responsible for deleting the returned buffer.
- const talk_base::Buffer* GetRtpPacket(int index) {
- talk_base::CritScope cs(&crit_);
+ const rtc::Buffer* GetRtpPacket(int index) {
+ rtc::CritScope cs(&crit_);
if (index >= NumRtpPackets()) {
return NULL;
}
- return new talk_base::Buffer(rtp_packets_[index]);
+ return new rtc::Buffer(rtp_packets_[index]);
}
int NumRtcpPackets() {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
return static_cast<int>(rtcp_packets_.size());
}
// Note: callers are responsible for deleting the returned buffer.
- const talk_base::Buffer* GetRtcpPacket(int index) {
- talk_base::CritScope cs(&crit_);
+ const rtc::Buffer* GetRtcpPacket(int index) {
+ rtc::CritScope cs(&crit_);
if (index >= NumRtcpPackets()) {
return NULL;
}
- return new talk_base::Buffer(rtcp_packets_[index]);
+ return new rtc::Buffer(rtcp_packets_[index]);
}
// Indicate that |n|'th packet for |ssrc| should be dropped.
@@ -130,12 +130,12 @@
int sendbuf_size() const { return sendbuf_size_; }
int recvbuf_size() const { return recvbuf_size_; }
- talk_base::DiffServCodePoint dscp() const { return dscp_; }
+ rtc::DiffServCodePoint dscp() const { return dscp_; }
protected:
- virtual bool SendPacket(talk_base::Buffer* packet,
- talk_base::DiffServCodePoint dscp) {
- talk_base::CritScope cs(&crit_);
+ virtual bool SendPacket(rtc::Buffer* packet,
+ rtc::DiffServCodePoint dscp) {
+ rtc::CritScope cs(&crit_);
uint32 cur_ssrc = 0;
if (!GetRtpSsrc(packet->data(), packet->length(), &cur_ssrc)) {
@@ -154,7 +154,7 @@
rtp_packets_.push_back(*packet);
if (conf_) {
- talk_base::Buffer buffer_copy(*packet);
+ rtc::Buffer buffer_copy(*packet);
for (size_t i = 0; i < conf_sent_ssrcs_.size(); ++i) {
if (!SetRtpSsrc(buffer_copy.data(), buffer_copy.length(),
conf_sent_ssrcs_[i])) {
@@ -168,9 +168,9 @@
return true;
}
- virtual bool SendRtcp(talk_base::Buffer* packet,
- talk_base::DiffServCodePoint dscp) {
- talk_base::CritScope cs(&crit_);
+ virtual bool SendRtcp(rtc::Buffer* packet,
+ rtc::DiffServCodePoint dscp) {
+ rtc::CritScope cs(&crit_);
rtcp_packets_.push_back(*packet);
if (!conf_) {
// don't worry about RTCP in conf mode for now
@@ -179,33 +179,33 @@
return true;
}
- virtual int SetOption(SocketType type, talk_base::Socket::Option opt,
+ virtual int SetOption(SocketType type, rtc::Socket::Option opt,
int option) {
- if (opt == talk_base::Socket::OPT_SNDBUF) {
+ if (opt == rtc::Socket::OPT_SNDBUF) {
sendbuf_size_ = option;
- } else if (opt == talk_base::Socket::OPT_RCVBUF) {
+ } else if (opt == rtc::Socket::OPT_RCVBUF) {
recvbuf_size_ = option;
- } else if (opt == talk_base::Socket::OPT_DSCP) {
- dscp_ = static_cast<talk_base::DiffServCodePoint>(option);
+ } else if (opt == rtc::Socket::OPT_DSCP) {
+ dscp_ = static_cast<rtc::DiffServCodePoint>(option);
}
return 0;
}
- void PostMessage(int id, const talk_base::Buffer& packet) {
- thread_->Post(this, id, talk_base::WrapMessageData(packet));
+ void PostMessage(int id, const rtc::Buffer& packet) {
+ thread_->Post(this, id, rtc::WrapMessageData(packet));
}
- virtual void OnMessage(talk_base::Message* msg) {
- talk_base::TypedMessageData<talk_base::Buffer>* msg_data =
- static_cast<talk_base::TypedMessageData<talk_base::Buffer>*>(
+ virtual void OnMessage(rtc::Message* msg) {
+ rtc::TypedMessageData<rtc::Buffer>* msg_data =
+ static_cast<rtc::TypedMessageData<rtc::Buffer>*>(
msg->pdata);
if (dest_) {
if (msg->message_id == ST_RTP) {
dest_->OnPacketReceived(&msg_data->data(),
- talk_base::CreatePacketTime(0));
+ rtc::CreatePacketTime(0));
} else {
dest_->OnRtcpReceived(&msg_data->data(),
- talk_base::CreatePacketTime(0));
+ rtc::CreatePacketTime(0));
}
}
delete msg_data;
@@ -236,7 +236,7 @@
}
}
- talk_base::Thread* thread_;
+ rtc::Thread* thread_;
MediaChannel* dest_;
bool conf_;
// The ssrcs used in sending out packets in conference mode.
@@ -246,12 +246,12 @@
std::map<uint32, uint32> sent_ssrcs_;
// Map to track packet-number that needs to be dropped per ssrc.
std::map<uint32, std::set<uint32> > drop_map_;
- talk_base::CriticalSection crit_;
- std::vector<talk_base::Buffer> rtp_packets_;
- std::vector<talk_base::Buffer> rtcp_packets_;
+ rtc::CriticalSection crit_;
+ std::vector<rtc::Buffer> rtp_packets_;
+ std::vector<rtc::Buffer> rtcp_packets_;
int sendbuf_size_;
int recvbuf_size_;
- talk_base::DiffServCodePoint dscp_;
+ rtc::DiffServCodePoint dscp_;
};
} // namespace cricket
diff --git a/media/base/fakevideocapturer.h b/media/base/fakevideocapturer.h
index 8dc69c3..089151f 100644
--- a/media/base/fakevideocapturer.h
+++ b/media/base/fakevideocapturer.h
@@ -32,7 +32,7 @@
#include <vector>
-#include "talk/base/timeutils.h"
+#include "webrtc/base/timeutils.h"
#include "talk/media/base/videocapturer.h"
#include "talk/media/base/videocommon.h"
#include "talk/media/base/videoframe.h"
@@ -44,8 +44,8 @@
public:
FakeVideoCapturer()
: running_(false),
- initial_unix_timestamp_(time(NULL) * talk_base::kNumNanosecsPerSec),
- next_timestamp_(talk_base::kNumNanosecsPerMillisec),
+ initial_unix_timestamp_(time(NULL) * rtc::kNumNanosecsPerSec),
+ next_timestamp_(rtc::kNumNanosecsPerMillisec),
is_screencast_(false) {
// Default supported formats. Use ResetSupportedFormats to over write.
std::vector<cricket::VideoFormat> formats;
@@ -101,7 +101,7 @@
frame.time_stamp = initial_unix_timestamp_ + next_timestamp_;
next_timestamp_ += 33333333; // 30 fps
- talk_base::scoped_ptr<char[]> data(new char[size]);
+ rtc::scoped_ptr<char[]> data(new char[size]);
frame.data = data.get();
// Copy something non-zero into the buffer so Validate wont complain that
// the frame is all duplicate.
diff --git a/media/base/fakevideorenderer.h b/media/base/fakevideorenderer.h
index cab77dd..f32fad5 100644
--- a/media/base/fakevideorenderer.h
+++ b/media/base/fakevideorenderer.h
@@ -28,8 +28,8 @@
#ifndef TALK_MEDIA_BASE_FAKEVIDEORENDERER_H_
#define TALK_MEDIA_BASE_FAKEVIDEORENDERER_H_
-#include "talk/base/logging.h"
-#include "talk/base/sigslot.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/sigslot.h"
#include "talk/media/base/videoframe.h"
#include "talk/media/base/videorenderer.h"
@@ -48,7 +48,7 @@
}
virtual bool SetSize(int width, int height, int reserved) {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
width_ = width;
height_ = height;
++num_set_sizes_;
@@ -57,7 +57,7 @@
}
virtual bool RenderFrame(const VideoFrame* frame) {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
// TODO(zhurunz) Check with VP8 team to see if we can remove this
// tolerance on Y values.
black_frame_ = CheckFrameColorYuv(6, 48, 128, 128, 128, 128, frame);
@@ -82,23 +82,23 @@
int errors() const { return errors_; }
int width() const {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
return width_;
}
int height() const {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
return height_;
}
int num_set_sizes() const {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
return num_set_sizes_;
}
int num_rendered_frames() const {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
return num_rendered_frames_;
}
bool black_frame() const {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
return black_frame_;
}
@@ -160,7 +160,7 @@
int num_set_sizes_;
int num_rendered_frames_;
bool black_frame_;
- mutable talk_base::CriticalSection crit_;
+ mutable rtc::CriticalSection crit_;
};
} // namespace cricket
diff --git a/media/base/filemediaengine.cc b/media/base/filemediaengine.cc
index e8c356e..08cea23 100644
--- a/media/base/filemediaengine.cc
+++ b/media/base/filemediaengine.cc
@@ -27,11 +27,11 @@
#include <limits.h>
-#include "talk/base/buffer.h"
-#include "talk/base/event.h"
-#include "talk/base/logging.h"
-#include "talk/base/pathutils.h"
-#include "talk/base/stream.h"
+#include "webrtc/base/buffer.h"
+#include "webrtc/base/event.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/pathutils.h"
+#include "webrtc/base/stream.h"
#include "talk/media/base/rtpdump.h"
#include "talk/media/base/rtputils.h"
#include "talk/media/base/streamparams.h"
@@ -59,14 +59,14 @@
}
VoiceMediaChannel* FileMediaEngine::CreateChannel() {
- talk_base::FileStream* input_file_stream = NULL;
- talk_base::FileStream* output_file_stream = NULL;
+ rtc::FileStream* input_file_stream = NULL;
+ rtc::FileStream* output_file_stream = NULL;
if (voice_input_filename_.empty() && voice_output_filename_.empty())
return NULL;
if (!voice_input_filename_.empty()) {
- input_file_stream = talk_base::Filesystem::OpenFile(
- talk_base::Pathname(voice_input_filename_), "rb");
+ input_file_stream = rtc::Filesystem::OpenFile(
+ rtc::Pathname(voice_input_filename_), "rb");
if (!input_file_stream) {
LOG(LS_ERROR) << "Not able to open the input audio stream file.";
return NULL;
@@ -74,8 +74,8 @@
}
if (!voice_output_filename_.empty()) {
- output_file_stream = talk_base::Filesystem::OpenFile(
- talk_base::Pathname(voice_output_filename_), "wb");
+ output_file_stream = rtc::Filesystem::OpenFile(
+ rtc::Pathname(voice_output_filename_), "wb");
if (!output_file_stream) {
delete input_file_stream;
LOG(LS_ERROR) << "Not able to open the output audio stream file.";
@@ -89,15 +89,15 @@
VideoMediaChannel* FileMediaEngine::CreateVideoChannel(
VoiceMediaChannel* voice_ch) {
- talk_base::FileStream* input_file_stream = NULL;
- talk_base::FileStream* output_file_stream = NULL;
+ rtc::FileStream* input_file_stream = NULL;
+ rtc::FileStream* output_file_stream = NULL;
if (video_input_filename_.empty() && video_output_filename_.empty())
return NULL;
if (!video_input_filename_.empty()) {
- input_file_stream = talk_base::Filesystem::OpenFile(
- talk_base::Pathname(video_input_filename_), "rb");
+ input_file_stream = rtc::Filesystem::OpenFile(
+ rtc::Pathname(video_input_filename_), "rb");
if (!input_file_stream) {
LOG(LS_ERROR) << "Not able to open the input video stream file.";
return NULL;
@@ -105,8 +105,8 @@
}
if (!video_output_filename_.empty()) {
- output_file_stream = talk_base::Filesystem::OpenFile(
- talk_base::Pathname(video_output_filename_), "wb");
+ output_file_stream = rtc::Filesystem::OpenFile(
+ rtc::Pathname(video_output_filename_), "wb");
if (!output_file_stream) {
delete input_file_stream;
LOG(LS_ERROR) << "Not able to open the output video stream file.";
@@ -121,21 +121,21 @@
///////////////////////////////////////////////////////////////////////////
// Definition of RtpSenderReceiver.
///////////////////////////////////////////////////////////////////////////
-class RtpSenderReceiver : public talk_base::MessageHandler {
+class RtpSenderReceiver : public rtc::MessageHandler {
public:
RtpSenderReceiver(MediaChannel* channel,
- talk_base::StreamInterface* input_file_stream,
- talk_base::StreamInterface* output_file_stream,
- talk_base::Thread* sender_thread);
+ rtc::StreamInterface* input_file_stream,
+ rtc::StreamInterface* output_file_stream,
+ rtc::Thread* sender_thread);
virtual ~RtpSenderReceiver();
// Called by media channel. Context: media channel thread.
bool SetSend(bool send);
void SetSendSsrc(uint32 ssrc);
- void OnPacketReceived(talk_base::Buffer* packet);
+ void OnPacketReceived(rtc::Buffer* packet);
// Override virtual method of parent MessageHandler. Context: Worker Thread.
- virtual void OnMessage(talk_base::Message* pmsg);
+ virtual void OnMessage(rtc::Message* pmsg);
private:
// Read the next RTP dump packet, whose RTP SSRC is the same as first_ssrc_.
@@ -147,11 +147,11 @@
bool SendRtpPacket(const void* data, size_t len);
MediaChannel* media_channel_;
- talk_base::scoped_ptr<talk_base::StreamInterface> input_stream_;
- talk_base::scoped_ptr<talk_base::StreamInterface> output_stream_;
- talk_base::scoped_ptr<RtpDumpLoopReader> rtp_dump_reader_;
- talk_base::scoped_ptr<RtpDumpWriter> rtp_dump_writer_;
- talk_base::Thread* sender_thread_;
+ rtc::scoped_ptr<rtc::StreamInterface> input_stream_;
+ rtc::scoped_ptr<rtc::StreamInterface> output_stream_;
+ rtc::scoped_ptr<RtpDumpLoopReader> rtp_dump_reader_;
+ rtc::scoped_ptr<RtpDumpWriter> rtp_dump_writer_;
+ rtc::Thread* sender_thread_;
bool own_sender_thread_;
// RTP dump packet read from the input stream.
RtpDumpPacket rtp_dump_packet_;
@@ -168,16 +168,16 @@
///////////////////////////////////////////////////////////////////////////
RtpSenderReceiver::RtpSenderReceiver(
MediaChannel* channel,
- talk_base::StreamInterface* input_file_stream,
- talk_base::StreamInterface* output_file_stream,
- talk_base::Thread* sender_thread)
+ rtc::StreamInterface* input_file_stream,
+ rtc::StreamInterface* output_file_stream,
+ rtc::Thread* sender_thread)
: media_channel_(channel),
input_stream_(input_file_stream),
output_stream_(output_file_stream),
sending_(false),
first_packet_(true) {
if (sender_thread == NULL) {
- sender_thread_ = new talk_base::Thread();
+ sender_thread_ = new rtc::Thread();
own_sender_thread_ = true;
} else {
sender_thread_ = sender_thread;
@@ -211,7 +211,7 @@
sending_ = send;
if (!was_sending && sending_) {
sender_thread_->PostDelayed(0, this); // Wake up the send thread.
- start_send_time_ = talk_base::Time();
+ start_send_time_ = rtc::Time();
}
return true;
}
@@ -222,13 +222,13 @@
}
}
-void RtpSenderReceiver::OnPacketReceived(talk_base::Buffer* packet) {
+void RtpSenderReceiver::OnPacketReceived(rtc::Buffer* packet) {
if (rtp_dump_writer_) {
rtp_dump_writer_->WriteRtpPacket(packet->data(), packet->length());
}
}
-void RtpSenderReceiver::OnMessage(talk_base::Message* pmsg) {
+void RtpSenderReceiver::OnMessage(rtc::Message* pmsg) {
if (!sending_) {
// If the sender thread is not sending, ignore this message. The thread goes
// to sleep until SetSend(true) wakes it up.
@@ -240,9 +240,9 @@
}
if (ReadNextPacket(&rtp_dump_packet_)) {
- int wait = talk_base::TimeUntil(
+ int wait = rtc::TimeUntil(
start_send_time_ + rtp_dump_packet_.elapsed_time);
- wait = talk_base::_max(0, wait);
+ wait = rtc::_max(0, wait);
sender_thread_->PostDelayed(wait, this);
} else {
sender_thread_->Quit();
@@ -250,7 +250,7 @@
}
bool RtpSenderReceiver::ReadNextPacket(RtpDumpPacket* packet) {
- while (talk_base::SR_SUCCESS == rtp_dump_reader_->ReadPacket(packet)) {
+ while (rtc::SR_SUCCESS == rtp_dump_reader_->ReadPacket(packet)) {
uint32 ssrc;
if (!packet->GetRtpSsrc(&ssrc)) {
return false;
@@ -270,7 +270,7 @@
if (!media_channel_)
return false;
- talk_base::Buffer packet(data, len, kMaxRtpPacketLen);
+ rtc::Buffer packet(data, len, kMaxRtpPacketLen);
return media_channel_->SendPacket(&packet);
}
@@ -278,9 +278,9 @@
// Implementation of FileVoiceChannel.
///////////////////////////////////////////////////////////////////////////
FileVoiceChannel::FileVoiceChannel(
- talk_base::StreamInterface* input_file_stream,
- talk_base::StreamInterface* output_file_stream,
- talk_base::Thread* rtp_sender_thread)
+ rtc::StreamInterface* input_file_stream,
+ rtc::StreamInterface* output_file_stream,
+ rtc::Thread* rtp_sender_thread)
: send_ssrc_(0),
rtp_sender_receiver_(new RtpSenderReceiver(this, input_file_stream,
output_file_stream,
@@ -316,7 +316,7 @@
}
void FileVoiceChannel::OnPacketReceived(
- talk_base::Buffer* packet, const talk_base::PacketTime& packet_time) {
+ rtc::Buffer* packet, const rtc::PacketTime& packet_time) {
rtp_sender_receiver_->OnPacketReceived(packet);
}
@@ -324,9 +324,9 @@
// Implementation of FileVideoChannel.
///////////////////////////////////////////////////////////////////////////
FileVideoChannel::FileVideoChannel(
- talk_base::StreamInterface* input_file_stream,
- talk_base::StreamInterface* output_file_stream,
- talk_base::Thread* rtp_sender_thread)
+ rtc::StreamInterface* input_file_stream,
+ rtc::StreamInterface* output_file_stream,
+ rtc::Thread* rtp_sender_thread)
: send_ssrc_(0),
rtp_sender_receiver_(new RtpSenderReceiver(this, input_file_stream,
output_file_stream,
@@ -362,7 +362,7 @@
}
void FileVideoChannel::OnPacketReceived(
- talk_base::Buffer* packet, const talk_base::PacketTime& packet_time) {
+ rtc::Buffer* packet, const rtc::PacketTime& packet_time) {
rtp_sender_receiver_->OnPacketReceived(packet);
}
diff --git a/media/base/filemediaengine.h b/media/base/filemediaengine.h
index 6656cdf..47802ca 100644
--- a/media/base/filemediaengine.h
+++ b/media/base/filemediaengine.h
@@ -29,13 +29,13 @@
#include <string>
#include <vector>
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/stream.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/stream.h"
#include "talk/media/base/codec.h"
#include "talk/media/base/mediachannel.h"
#include "talk/media/base/mediaengine.h"
-namespace talk_base {
+namespace rtc {
class StreamInterface;
}
@@ -78,7 +78,7 @@
}
// Implement pure virtual methods of MediaEngine.
- virtual bool Init(talk_base::Thread* worker_thread) {
+ virtual bool Init(rtc::Thread* worker_thread) {
return true;
}
virtual void Terminate() {}
@@ -133,7 +133,7 @@
virtual bool FindVideoCodec(const VideoCodec& codec) { return true; }
virtual void SetVoiceLogging(int min_sev, const char* filter) {}
virtual void SetVideoLogging(int min_sev, const char* filter) {}
- virtual bool StartAecDump(talk_base::PlatformFile) { return false; }
+ virtual bool StartAecDump(rtc::PlatformFile) { return false; }
virtual bool RegisterVideoProcessor(VideoProcessor* processor) {
return true;
@@ -160,7 +160,7 @@
return signal_state_change_;
}
- void set_rtp_sender_thread(talk_base::Thread* thread) {
+ void set_rtp_sender_thread(rtc::Thread* thread) {
rtp_sender_thread_ = thread;
}
@@ -175,7 +175,7 @@
std::vector<RtpHeaderExtension> video_rtp_header_extensions_;
sigslot::repeater2<VideoCapturer*, CaptureState>
signal_state_change_;
- talk_base::Thread* rtp_sender_thread_;
+ rtc::Thread* rtp_sender_thread_;
DISALLOW_COPY_AND_ASSIGN(FileMediaEngine);
};
@@ -184,9 +184,9 @@
class FileVoiceChannel : public VoiceMediaChannel {
public:
- FileVoiceChannel(talk_base::StreamInterface* input_file_stream,
- talk_base::StreamInterface* output_file_stream,
- talk_base::Thread* rtp_sender_thread);
+ FileVoiceChannel(rtc::StreamInterface* input_file_stream,
+ rtc::StreamInterface* output_file_stream,
+ rtc::Thread* rtp_sender_thread);
virtual ~FileVoiceChannel();
// Implement pure virtual methods of VoiceMediaChannel.
@@ -233,10 +233,10 @@
virtual bool GetStats(VoiceMediaInfo* info) { return true; }
// Implement pure virtual methods of MediaChannel.
- virtual void OnPacketReceived(talk_base::Buffer* packet,
- const talk_base::PacketTime& packet_time);
- virtual void OnRtcpReceived(talk_base::Buffer* packet,
- const talk_base::PacketTime& packet_time) {}
+ virtual void OnPacketReceived(rtc::Buffer* packet,
+ const rtc::PacketTime& packet_time);
+ virtual void OnRtcpReceived(rtc::Buffer* packet,
+ const rtc::PacketTime& packet_time) {}
virtual void OnReadyToSend(bool ready) {}
virtual bool AddSendStream(const StreamParams& sp);
virtual bool RemoveSendStream(uint32 ssrc);
@@ -256,7 +256,7 @@
private:
uint32 send_ssrc_;
- talk_base::scoped_ptr<RtpSenderReceiver> rtp_sender_receiver_;
+ rtc::scoped_ptr<RtpSenderReceiver> rtp_sender_receiver_;
AudioOptions options_;
DISALLOW_COPY_AND_ASSIGN(FileVoiceChannel);
@@ -264,9 +264,9 @@
class FileVideoChannel : public VideoMediaChannel {
public:
- FileVideoChannel(talk_base::StreamInterface* input_file_stream,
- talk_base::StreamInterface* output_file_stream,
- talk_base::Thread* rtp_sender_thread);
+ FileVideoChannel(rtc::StreamInterface* input_file_stream,
+ rtc::StreamInterface* output_file_stream,
+ rtc::Thread* rtp_sender_thread);
virtual ~FileVideoChannel();
// Implement pure virtual methods of VideoMediaChannel.
@@ -304,10 +304,10 @@
virtual bool RequestIntraFrame() { return false; }
// Implement pure virtual methods of MediaChannel.
- virtual void OnPacketReceived(talk_base::Buffer* packet,
- const talk_base::PacketTime& packet_time);
- virtual void OnRtcpReceived(talk_base::Buffer* packet,
- const talk_base::PacketTime& packet_time) {}
+ virtual void OnPacketReceived(rtc::Buffer* packet,
+ const rtc::PacketTime& packet_time);
+ virtual void OnRtcpReceived(rtc::Buffer* packet,
+ const rtc::PacketTime& packet_time) {}
virtual void OnReadyToSend(bool ready) {}
virtual bool AddSendStream(const StreamParams& sp);
virtual bool RemoveSendStream(uint32 ssrc);
@@ -328,7 +328,7 @@
private:
uint32 send_ssrc_;
- talk_base::scoped_ptr<RtpSenderReceiver> rtp_sender_receiver_;
+ rtc::scoped_ptr<RtpSenderReceiver> rtp_sender_receiver_;
VideoOptions options_;
DISALLOW_COPY_AND_ASSIGN(FileVideoChannel);
diff --git a/media/base/filemediaengine_unittest.cc b/media/base/filemediaengine_unittest.cc
index b1b021d..00be128 100644
--- a/media/base/filemediaengine_unittest.cc
+++ b/media/base/filemediaengine_unittest.cc
@@ -27,11 +27,11 @@
#include <set>
-#include "talk/base/buffer.h"
-#include "talk/base/gunit.h"
-#include "talk/base/helpers.h"
-#include "talk/base/pathutils.h"
-#include "talk/base/stream.h"
+#include "webrtc/base/buffer.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/pathutils.h"
+#include "webrtc/base/stream.h"
#include "talk/media/base/filemediaengine.h"
#include "talk/media/base/rtpdump.h"
#include "talk/media/base/streamparams.h"
@@ -49,7 +49,7 @@
//////////////////////////////////////////////////////////////////////////////
class FileNetworkInterface : public MediaChannel::NetworkInterface {
public:
- FileNetworkInterface(talk_base::StreamInterface* output, MediaChannel* ch)
+ FileNetworkInterface(rtc::StreamInterface* output, MediaChannel* ch)
: media_channel_(ch),
num_sent_packets_(0) {
if (output) {
@@ -58,15 +58,15 @@
}
// Implement pure virtual methods of NetworkInterface.
- virtual bool SendPacket(talk_base::Buffer* packet,
- talk_base::DiffServCodePoint dscp) {
+ virtual bool SendPacket(rtc::Buffer* packet,
+ rtc::DiffServCodePoint dscp) {
if (!packet) return false;
if (media_channel_) {
- media_channel_->OnPacketReceived(packet, talk_base::PacketTime());
+ media_channel_->OnPacketReceived(packet, rtc::PacketTime());
}
if (dump_writer_.get() &&
- talk_base::SR_SUCCESS != dump_writer_->WriteRtpPacket(
+ rtc::SR_SUCCESS != dump_writer_->WriteRtpPacket(
packet->data(), packet->length())) {
return false;
}
@@ -75,19 +75,19 @@
return true;
}
- virtual bool SendRtcp(talk_base::Buffer* packet,
- talk_base::DiffServCodePoint dscp) { return false; }
+ virtual bool SendRtcp(rtc::Buffer* packet,
+ rtc::DiffServCodePoint dscp) { return false; }
virtual int SetOption(MediaChannel::NetworkInterface::SocketType type,
- talk_base::Socket::Option opt, int option) {
+ rtc::Socket::Option opt, int option) {
return 0;
}
- virtual void SetDefaultDSCPCode(talk_base::DiffServCodePoint dscp) {}
+ virtual void SetDefaultDSCPCode(rtc::DiffServCodePoint dscp) {}
size_t num_sent_packets() const { return num_sent_packets_; }
private:
MediaChannel* media_channel_;
- talk_base::scoped_ptr<RtpDumpWriter> dump_writer_;
+ rtc::scoped_ptr<RtpDumpWriter> dump_writer_;
size_t num_sent_packets_;
DISALLOW_COPY_AND_ASSIGN(FileNetworkInterface);
@@ -136,7 +136,7 @@
engine_->set_voice_output_filename(voice_out);
engine_->set_video_input_filename(video_in);
engine_->set_video_output_filename(video_out);
- engine_->set_rtp_sender_thread(talk_base::Thread::Current());
+ engine_->set_rtp_sender_thread(rtc::Thread::Current());
voice_channel_.reset(engine_->CreateChannel());
video_channel_.reset(engine_->CreateVideoChannel(NULL));
@@ -145,12 +145,12 @@
}
bool GetTempFilename(std::string* filename) {
- talk_base::Pathname temp_path;
- if (!talk_base::Filesystem::GetTemporaryFolder(temp_path, true, NULL)) {
+ rtc::Pathname temp_path;
+ if (!rtc::Filesystem::GetTemporaryFolder(temp_path, true, NULL)) {
return false;
}
temp_path.SetPathname(
- talk_base::Filesystem::TempFilename(temp_path, "fme-test-"));
+ rtc::Filesystem::TempFilename(temp_path, "fme-test-"));
if (filename) {
*filename = temp_path.pathname();
@@ -159,8 +159,8 @@
}
bool WriteTestPacketsToFile(const std::string& filename, size_t ssrc_count) {
- talk_base::scoped_ptr<talk_base::StreamInterface> stream(
- talk_base::Filesystem::OpenFile(talk_base::Pathname(filename), "wb"));
+ rtc::scoped_ptr<rtc::StreamInterface> stream(
+ rtc::Filesystem::OpenFile(rtc::Pathname(filename), "wb"));
bool ret = (NULL != stream.get());
RtpDumpWriter writer(stream.get());
@@ -174,19 +174,19 @@
}
void DeleteTempFile(std::string filename) {
- talk_base::Pathname pathname(filename);
- if (talk_base::Filesystem::IsFile(talk_base::Pathname(pathname))) {
- talk_base::Filesystem::DeleteFile(pathname);
+ rtc::Pathname pathname(filename);
+ if (rtc::Filesystem::IsFile(rtc::Pathname(pathname))) {
+ rtc::Filesystem::DeleteFile(pathname);
}
}
- bool GetSsrcAndPacketCounts(talk_base::StreamInterface* stream,
+ bool GetSsrcAndPacketCounts(rtc::StreamInterface* stream,
size_t* ssrc_count, size_t* packet_count) {
- talk_base::scoped_ptr<RtpDumpReader> reader(new RtpDumpReader(stream));
+ rtc::scoped_ptr<RtpDumpReader> reader(new RtpDumpReader(stream));
size_t count = 0;
RtpDumpPacket packet;
std::set<uint32> ssrcs;
- while (talk_base::SR_SUCCESS == reader->ReadPacket(&packet)) {
+ while (rtc::SR_SUCCESS == reader->ReadPacket(&packet)) {
count++;
uint32 ssrc;
if (!packet.GetRtpSsrc(&ssrc)) {
@@ -209,14 +209,14 @@
std::string voice_output_filename_;
std::string video_input_filename_;
std::string video_output_filename_;
- talk_base::scoped_ptr<FileMediaEngine> engine_;
- talk_base::scoped_ptr<VoiceMediaChannel> voice_channel_;
- talk_base::scoped_ptr<VideoMediaChannel> video_channel_;
+ rtc::scoped_ptr<FileMediaEngine> engine_;
+ rtc::scoped_ptr<VoiceMediaChannel> voice_channel_;
+ rtc::scoped_ptr<VideoMediaChannel> video_channel_;
};
TEST_F(FileMediaEngineTest, TestDefaultImplementation) {
EXPECT_TRUE(CreateEngineAndChannels("", "", "", "", 1));
- EXPECT_TRUE(engine_->Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine_->Init(rtc::Thread::Current()));
EXPECT_EQ(0, engine_->GetCapabilities());
EXPECT_TRUE(NULL == voice_channel_.get());
EXPECT_TRUE(NULL == video_channel_.get());
@@ -313,12 +313,12 @@
EXPECT_TRUE(CreateEngineAndChannels(voice_input_filename_,
voice_output_filename_, "", "", 1));
EXPECT_TRUE(NULL != voice_channel_.get());
- talk_base::MemoryStream net_dump;
+ rtc::MemoryStream net_dump;
FileNetworkInterface net_interface(&net_dump, voice_channel_.get());
voice_channel_->SetInterface(&net_interface);
// The channel is not sending yet.
- talk_base::Thread::Current()->ProcessMessages(kWaitTimeMs);
+ rtc::Thread::Current()->ProcessMessages(kWaitTimeMs);
EXPECT_EQ(0U, net_interface.num_sent_packets());
// The channel starts sending.
@@ -328,9 +328,9 @@
// The channel stops sending.
voice_channel_->SetSend(SEND_NOTHING);
// Wait until packets are all delivered.
- talk_base::Thread::Current()->ProcessMessages(kWaitTimeMs);
+ rtc::Thread::Current()->ProcessMessages(kWaitTimeMs);
size_t old_number = net_interface.num_sent_packets();
- talk_base::Thread::Current()->ProcessMessages(kWaitTimeMs);
+ rtc::Thread::Current()->ProcessMessages(kWaitTimeMs);
EXPECT_EQ(old_number, net_interface.num_sent_packets());
// The channel starts sending again.
@@ -342,7 +342,7 @@
// fault. We hence stop sending and wait until all packets are delivered
// before we exit this function.
voice_channel_->SetSend(SEND_NOTHING);
- talk_base::Thread::Current()->ProcessMessages(kWaitTimeMs);
+ rtc::Thread::Current()->ProcessMessages(kWaitTimeMs);
}
// Test the sender thread of the channel. The sender sends RTP packets
@@ -351,7 +351,7 @@
EXPECT_TRUE(CreateEngineAndChannels(voice_input_filename_,
voice_output_filename_, "", "", 1));
EXPECT_TRUE(NULL != voice_channel_.get());
- talk_base::MemoryStream net_dump;
+ rtc::MemoryStream net_dump;
FileNetworkInterface net_interface(&net_dump, voice_channel_.get());
voice_channel_->SetInterface(&net_interface);
@@ -363,7 +363,7 @@
kWaitTimeout);
voice_channel_->SetSend(SEND_NOTHING);
// Wait until packets are all delivered.
- talk_base::Thread::Current()->ProcessMessages(kWaitTimeMs);
+ rtc::Thread::Current()->ProcessMessages(kWaitTimeMs);
EXPECT_TRUE(RtpTestUtility::VerifyTestPacketsFromStream(
2 * RtpTestUtility::GetTestPacketCount(), &net_dump,
RtpTestUtility::kDefaultSsrc));
@@ -372,9 +372,9 @@
// via OnPacketReceived, which in turn writes the packets into voice_output_.
// We next verify the packets in voice_output_.
voice_channel_.reset(); // Force to close the files.
- talk_base::scoped_ptr<talk_base::StreamInterface> voice_output_;
- voice_output_.reset(talk_base::Filesystem::OpenFile(
- talk_base::Pathname(voice_output_filename_), "rb"));
+ rtc::scoped_ptr<rtc::StreamInterface> voice_output_;
+ voice_output_.reset(rtc::Filesystem::OpenFile(
+ rtc::Pathname(voice_output_filename_), "rb"));
EXPECT_TRUE(voice_output_.get() != NULL);
EXPECT_TRUE(RtpTestUtility::VerifyTestPacketsFromStream(
2 * RtpTestUtility::GetTestPacketCount(), voice_output_.get(),
@@ -389,7 +389,7 @@
const uint32 send_ssrc = RtpTestUtility::kDefaultSsrc + 1;
voice_channel_->AddSendStream(StreamParams::CreateLegacy(send_ssrc));
- talk_base::MemoryStream net_dump;
+ rtc::MemoryStream net_dump;
FileNetworkInterface net_interface(&net_dump, voice_channel_.get());
voice_channel_->SetInterface(&net_interface);
@@ -401,7 +401,7 @@
kWaitTimeout);
voice_channel_->SetSend(SEND_NOTHING);
// Wait until packets are all delivered.
- talk_base::Thread::Current()->ProcessMessages(kWaitTimeMs);
+ rtc::Thread::Current()->ProcessMessages(kWaitTimeMs);
EXPECT_TRUE(RtpTestUtility::VerifyTestPacketsFromStream(
2 * RtpTestUtility::GetTestPacketCount(), &net_dump, send_ssrc));
@@ -409,9 +409,9 @@
// via OnPacketReceived, which in turn writes the packets into voice_output_.
// We next verify the packets in voice_output_.
voice_channel_.reset(); // Force to close the files.
- talk_base::scoped_ptr<talk_base::StreamInterface> voice_output_;
- voice_output_.reset(talk_base::Filesystem::OpenFile(
- talk_base::Pathname(voice_output_filename_), "rb"));
+ rtc::scoped_ptr<rtc::StreamInterface> voice_output_;
+ voice_output_.reset(rtc::Filesystem::OpenFile(
+ rtc::Pathname(voice_output_filename_), "rb"));
EXPECT_TRUE(voice_output_.get() != NULL);
EXPECT_TRUE(RtpTestUtility::VerifyTestPacketsFromStream(
2 * RtpTestUtility::GetTestPacketCount(), voice_output_.get(),
@@ -425,9 +425,9 @@
// Verify that voice_input_filename_ contains 2 *
// RtpTestUtility::GetTestPacketCount() packets
// with different SSRCs.
- talk_base::scoped_ptr<talk_base::StreamInterface> input_stream(
- talk_base::Filesystem::OpenFile(
- talk_base::Pathname(voice_input_filename_), "rb"));
+ rtc::scoped_ptr<rtc::StreamInterface> input_stream(
+ rtc::Filesystem::OpenFile(
+ rtc::Pathname(voice_input_filename_), "rb"));
ASSERT_TRUE(NULL != input_stream.get());
size_t ssrc_count;
size_t packet_count;
@@ -441,7 +441,7 @@
// these packets have the same SSRCs (that is, the packets with different
// SSRCs are skipped by the filemediaengine).
EXPECT_TRUE(NULL != voice_channel_.get());
- talk_base::MemoryStream net_dump;
+ rtc::MemoryStream net_dump;
FileNetworkInterface net_interface(&net_dump, voice_channel_.get());
voice_channel_->SetInterface(&net_interface);
voice_channel_->SetSend(SEND_MICROPHONE);
@@ -451,7 +451,7 @@
kWaitTimeout);
voice_channel_->SetSend(SEND_NOTHING);
// Wait until packets are all delivered.
- talk_base::Thread::Current()->ProcessMessages(kWaitTimeMs);
+ rtc::Thread::Current()->ProcessMessages(kWaitTimeMs);
net_dump.Rewind();
EXPECT_TRUE(GetSsrcAndPacketCounts(&net_dump, &ssrc_count, &packet_count));
EXPECT_EQ(1U, ssrc_count);
diff --git a/media/base/hybriddataengine.h b/media/base/hybriddataengine.h
index bece492..1d5b8b8 100644
--- a/media/base/hybriddataengine.h
+++ b/media/base/hybriddataengine.h
@@ -31,7 +31,7 @@
#include <string>
#include <vector>
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/media/base/codec.h"
#include "talk/media/base/mediachannel.h"
#include "talk/media/base/mediaengine.h"
@@ -66,8 +66,8 @@
virtual const std::vector<DataCodec>& data_codecs() { return codecs_; }
private:
- talk_base::scoped_ptr<DataEngineInterface> first_;
- talk_base::scoped_ptr<DataEngineInterface> second_;
+ rtc::scoped_ptr<DataEngineInterface> first_;
+ rtc::scoped_ptr<DataEngineInterface> second_;
std::vector<DataCodec> codecs_;
};
diff --git a/media/base/hybridvideoengine.cc b/media/base/hybridvideoengine.cc
index 8e992f0..289c4fe 100644
--- a/media/base/hybridvideoengine.cc
+++ b/media/base/hybridvideoengine.cc
@@ -27,7 +27,7 @@
#include "talk/media/base/hybridvideoengine.h"
-#include "talk/base/logging.h"
+#include "webrtc/base/logging.h"
namespace cricket {
@@ -281,7 +281,7 @@
}
void HybridVideoMediaChannel::OnPacketReceived(
- talk_base::Buffer* packet, const talk_base::PacketTime& packet_time) {
+ rtc::Buffer* packet, const rtc::PacketTime& packet_time) {
// Eat packets until we have an active channel;
if (active_channel_) {
active_channel_->OnPacketReceived(packet, packet_time);
@@ -291,7 +291,7 @@
}
void HybridVideoMediaChannel::OnRtcpReceived(
- talk_base::Buffer* packet, const talk_base::PacketTime& packet_time) {
+ rtc::Buffer* packet, const rtc::PacketTime& packet_time) {
// Eat packets until we have an active channel;
if (active_channel_) {
active_channel_->OnRtcpReceived(packet, packet_time);
diff --git a/media/base/hybridvideoengine.h b/media/base/hybridvideoengine.h
index 8cfb884..4d819c7 100644
--- a/media/base/hybridvideoengine.h
+++ b/media/base/hybridvideoengine.h
@@ -31,8 +31,8 @@
#include <string>
#include <vector>
-#include "talk/base/logging.h"
-#include "talk/base/sigslotrepeater.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/sigslotrepeater.h"
#include "talk/media/base/codec.h"
#include "talk/media/base/mediachannel.h"
#include "talk/media/base/videocapturer.h"
@@ -88,10 +88,10 @@
virtual bool GetStats(const StatsOptions& options, VideoMediaInfo* info);
- virtual void OnPacketReceived(talk_base::Buffer* packet,
- const talk_base::PacketTime& packet_time);
- virtual void OnRtcpReceived(talk_base::Buffer* packet,
- const talk_base::PacketTime& packet_time);
+ virtual void OnPacketReceived(rtc::Buffer* packet,
+ const rtc::PacketTime& packet_time);
+ virtual void OnRtcpReceived(rtc::Buffer* packet,
+ const rtc::PacketTime& packet_time);
virtual void OnReadyToSend(bool ready);
virtual void UpdateAspectRatio(int ratio_w, int ratio_h);
@@ -110,8 +110,8 @@
void OnMediaError(uint32 ssrc, Error error);
HybridVideoEngineInterface* engine_;
- talk_base::scoped_ptr<VideoMediaChannel> channel1_;
- talk_base::scoped_ptr<VideoMediaChannel> channel2_;
+ rtc::scoped_ptr<VideoMediaChannel> channel1_;
+ rtc::scoped_ptr<VideoMediaChannel> channel2_;
VideoMediaChannel* active_channel_;
bool sending_;
};
@@ -149,7 +149,7 @@
SignalCaptureStateChange.repeat(video2_.SignalCaptureStateChange);
}
- bool Init(talk_base::Thread* worker_thread) {
+ bool Init(rtc::Thread* worker_thread) {
if (!video1_.Init(worker_thread)) {
LOG(LS_ERROR) << "Failed to init VideoEngine1";
return false;
@@ -170,13 +170,13 @@
return (video1_.GetCapabilities() | video2_.GetCapabilities());
}
HybridVideoMediaChannel* CreateChannel(VoiceMediaChannel* channel) {
- talk_base::scoped_ptr<VideoMediaChannel> channel1(
+ rtc::scoped_ptr<VideoMediaChannel> channel1(
video1_.CreateChannel(channel));
if (!channel1) {
LOG(LS_ERROR) << "Failed to create VideoMediaChannel1";
return NULL;
}
- talk_base::scoped_ptr<VideoMediaChannel> channel2(
+ rtc::scoped_ptr<VideoMediaChannel> channel2(
video2_.CreateChannel(channel));
if (!channel2) {
LOG(LS_ERROR) << "Failed to create VideoMediaChannel2";
diff --git a/media/base/hybridvideoengine_unittest.cc b/media/base/hybridvideoengine_unittest.cc
index aa9d4ac..df7e1fa 100644
--- a/media/base/hybridvideoengine_unittest.cc
+++ b/media/base/hybridvideoengine_unittest.cc
@@ -25,7 +25,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/gunit.h"
+#include "webrtc/base/gunit.h"
#include "talk/media/base/fakemediaengine.h"
#include "talk/media/base/fakenetworkinterface.h"
#include "talk/media/base/fakevideocapturer.h"
@@ -116,7 +116,7 @@
engine_.Terminate();
}
bool SetupEngine() {
- bool result = engine_.Init(talk_base::Thread::Current());
+ bool result = engine_.Init(rtc::Thread::Current());
if (result) {
channel_.reset(engine_.CreateChannel(NULL));
result = (channel_.get() != NULL);
@@ -134,12 +134,12 @@
channel_->SetRender(true);
}
void DeliverPacket(const void* data, int len) {
- talk_base::Buffer packet(data, len);
- channel_->OnPacketReceived(&packet, talk_base::CreatePacketTime(0));
+ rtc::Buffer packet(data, len);
+ channel_->OnPacketReceived(&packet, rtc::CreatePacketTime(0));
}
void DeliverRtcp(const void* data, int len) {
- talk_base::Buffer packet(data, len);
- channel_->OnRtcpReceived(&packet, talk_base::CreatePacketTime(0));
+ rtc::Buffer packet(data, len);
+ channel_->OnRtcpReceived(&packet, rtc::CreatePacketTime(0));
}
protected:
@@ -166,14 +166,14 @@
EXPECT_EQ(max_bitrate, sub_channel->max_bps());
}
HybridVideoEngineForTest engine_;
- talk_base::scoped_ptr<cricket::HybridVideoMediaChannel> channel_;
- talk_base::scoped_ptr<cricket::FakeNetworkInterface> transport_;
+ rtc::scoped_ptr<cricket::HybridVideoMediaChannel> channel_;
+ rtc::scoped_ptr<cricket::FakeNetworkInterface> transport_;
cricket::FakeVideoMediaChannel* sub_channel1_;
cricket::FakeVideoMediaChannel* sub_channel2_;
};
TEST_F(HybridVideoEngineTest, StartupShutdown) {
- EXPECT_TRUE(engine_.Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
engine_.Terminate();
}
diff --git a/media/base/mediachannel.h b/media/base/mediachannel.h
index 60cdebd..c45ae29 100644
--- a/media/base/mediachannel.h
+++ b/media/base/mediachannel.h
@@ -31,20 +31,20 @@
#include <string>
#include <vector>
-#include "talk/base/basictypes.h"
-#include "talk/base/buffer.h"
-#include "talk/base/dscp.h"
-#include "talk/base/logging.h"
-#include "talk/base/sigslot.h"
-#include "talk/base/socket.h"
-#include "talk/base/window.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/buffer.h"
+#include "webrtc/base/dscp.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/socket.h"
+#include "webrtc/base/window.h"
#include "talk/media/base/codec.h"
#include "talk/media/base/constants.h"
#include "talk/media/base/streamparams.h"
// TODO(juberti): re-evaluate this include
#include "talk/session/media/audiomonitor.h"
-namespace talk_base {
+namespace rtc {
class Buffer;
class RateLimiter;
class Timing;
@@ -104,7 +104,7 @@
}
std::string ToString() const {
- return set_ ? talk_base::ToString(val_) : "";
+ return set_ ? rtc::ToString(val_) : "";
}
bool operator==(const Settable<T>& o) const {
@@ -312,8 +312,6 @@
video_start_bitrate.SetFrom(change.video_start_bitrate);
video_temporal_layer_screencast.SetFrom(
change.video_temporal_layer_screencast);
- video_temporal_layer_realtime.SetFrom(
- change.video_temporal_layer_realtime);
video_leaky_bucket.SetFrom(change.video_leaky_bucket);
video_highest_bitrate.SetFrom(change.video_highest_bitrate);
cpu_overuse_detection.SetFrom(change.cpu_overuse_detection);
@@ -331,12 +329,10 @@
system_high_adaptation_threshhold.SetFrom(
change.system_high_adaptation_threshhold);
buffered_mode_latency.SetFrom(change.buffered_mode_latency);
- lower_min_bitrate.SetFrom(change.lower_min_bitrate);
dscp.SetFrom(change.dscp);
suspend_below_min_bitrate.SetFrom(change.suspend_below_min_bitrate);
unsignalled_recv_stream_limit.SetFrom(change.unsignalled_recv_stream_limit);
use_simulcast_adapter.SetFrom(change.use_simulcast_adapter);
- skip_encoding_unused_streams.SetFrom(change.skip_encoding_unused_streams);
screencast_min_bitrate.SetFrom(change.screencast_min_bitrate);
use_improved_wifi_bandwidth_estimator.SetFrom(
change.use_improved_wifi_bandwidth_estimator);
@@ -354,7 +350,6 @@
video_high_bitrate == o.video_high_bitrate &&
video_start_bitrate == o.video_start_bitrate &&
video_temporal_layer_screencast == o.video_temporal_layer_screencast &&
- video_temporal_layer_realtime == o.video_temporal_layer_realtime &&
video_leaky_bucket == o.video_leaky_bucket &&
video_highest_bitrate == o.video_highest_bitrate &&
cpu_overuse_detection == o.cpu_overuse_detection &&
@@ -372,12 +367,10 @@
system_high_adaptation_threshhold ==
o.system_high_adaptation_threshhold &&
buffered_mode_latency == o.buffered_mode_latency &&
- lower_min_bitrate == o.lower_min_bitrate &&
dscp == o.dscp &&
suspend_below_min_bitrate == o.suspend_below_min_bitrate &&
unsignalled_recv_stream_limit == o.unsignalled_recv_stream_limit &&
use_simulcast_adapter == o.use_simulcast_adapter &&
- skip_encoding_unused_streams == o.skip_encoding_unused_streams &&
screencast_min_bitrate == o.screencast_min_bitrate &&
use_improved_wifi_bandwidth_estimator ==
o.use_improved_wifi_bandwidth_estimator &&
@@ -398,8 +391,6 @@
ost << ToStringIfSet("start bitrate", video_start_bitrate);
ost << ToStringIfSet("video temporal layer screencast",
video_temporal_layer_screencast);
- ost << ToStringIfSet("video temporal layer realtime",
- video_temporal_layer_realtime);
ost << ToStringIfSet("leaky bucket", video_leaky_bucket);
ost << ToStringIfSet("highest video bitrate", video_highest_bitrate);
ost << ToStringIfSet("cpu overuse detection", cpu_overuse_detection);
@@ -416,15 +407,12 @@
ost << ToStringIfSet("low", system_low_adaptation_threshhold);
ost << ToStringIfSet("high", system_high_adaptation_threshhold);
ost << ToStringIfSet("buffered mode latency", buffered_mode_latency);
- ost << ToStringIfSet("lower min bitrate", lower_min_bitrate);
ost << ToStringIfSet("dscp", dscp);
ost << ToStringIfSet("suspend below min bitrate",
suspend_below_min_bitrate);
ost << ToStringIfSet("num channels for early receive",
unsignalled_recv_stream_limit);
ost << ToStringIfSet("use simulcast adapter", use_simulcast_adapter);
- ost << ToStringIfSet("skip encoding unused streams",
- skip_encoding_unused_streams);
ost << ToStringIfSet("screencast min bitrate", screencast_min_bitrate);
ost << ToStringIfSet("improved wifi bwe",
use_improved_wifi_bandwidth_estimator);
@@ -453,8 +441,6 @@
Settable<int> video_start_bitrate;
// Experimental: Enable WebRTC layered screencast.
Settable<bool> video_temporal_layer_screencast;
- // Experimental: Enable WebRTC temporal layer strategy for realtime video.
- Settable<bool> video_temporal_layer_realtime;
// Enable WebRTC leaky bucket when sending media packets.
Settable<bool> video_leaky_bucket;
// Set highest bitrate mode for video.
@@ -491,8 +477,6 @@
SettablePercent system_high_adaptation_threshhold;
// Specify buffered mode latency in milliseconds.
Settable<int> buffered_mode_latency;
- // Make minimum configured send bitrate even lower than usual, at 30kbit.
- Settable<bool> lower_min_bitrate;
// Set DSCP value for packet sent from video channel.
Settable<bool> dscp;
// Enable WebRTC suspension of video. No video frames will be sent when the
@@ -502,9 +486,6 @@
Settable<int> unsignalled_recv_stream_limit;
// Enable use of simulcast adapter.
Settable<bool> use_simulcast_adapter;
- // Enables the encoder to skip encoding stream not actually sent due to too
- // low available bit rate.
- Settable<bool> skip_encoding_unused_streams;
// Force screencast to use a minimum bitrate
Settable<int> screencast_min_bitrate;
// Enable improved bandwidth estiamtor on wifi.
@@ -579,12 +560,12 @@
public:
enum SocketType { ST_RTP, ST_RTCP };
virtual bool SendPacket(
- talk_base::Buffer* packet,
- talk_base::DiffServCodePoint dscp = talk_base::DSCP_NO_CHANGE) = 0;
+ rtc::Buffer* packet,
+ rtc::DiffServCodePoint dscp = rtc::DSCP_NO_CHANGE) = 0;
virtual bool SendRtcp(
- talk_base::Buffer* packet,
- talk_base::DiffServCodePoint dscp = talk_base::DSCP_NO_CHANGE) = 0;
- virtual int SetOption(SocketType type, talk_base::Socket::Option opt,
+ rtc::Buffer* packet,
+ rtc::DiffServCodePoint dscp = rtc::DSCP_NO_CHANGE) = 0;
+ virtual int SetOption(SocketType type, rtc::Socket::Option opt,
int option) = 0;
virtual ~NetworkInterface() {}
};
@@ -594,16 +575,16 @@
// Sets the abstract interface class for sending RTP/RTCP data.
virtual void SetInterface(NetworkInterface *iface) {
- talk_base::CritScope cs(&network_interface_crit_);
+ rtc::CritScope cs(&network_interface_crit_);
network_interface_ = iface;
}
// Called when a RTP packet is received.
- virtual void OnPacketReceived(talk_base::Buffer* packet,
- const talk_base::PacketTime& packet_time) = 0;
+ virtual void OnPacketReceived(rtc::Buffer* packet,
+ const rtc::PacketTime& packet_time) = 0;
// Called when a RTCP packet is received.
- virtual void OnRtcpReceived(talk_base::Buffer* packet,
- const talk_base::PacketTime& packet_time) = 0;
+ virtual void OnRtcpReceived(rtc::Buffer* packet,
+ const rtc::PacketTime& packet_time) = 0;
// Called when the socket's ability to send has changed.
virtual void OnReadyToSend(bool ready) = 0;
// Creates a new outgoing media stream with SSRCs and CNAME as described
@@ -639,18 +620,18 @@
virtual bool SetMaxSendBandwidth(int bps) = 0;
// Base method to send packet using NetworkInterface.
- bool SendPacket(talk_base::Buffer* packet) {
+ bool SendPacket(rtc::Buffer* packet) {
return DoSendPacket(packet, false);
}
- bool SendRtcp(talk_base::Buffer* packet) {
+ bool SendRtcp(rtc::Buffer* packet) {
return DoSendPacket(packet, true);
}
int SetOption(NetworkInterface::SocketType type,
- talk_base::Socket::Option opt,
+ rtc::Socket::Option opt,
int option) {
- talk_base::CritScope cs(&network_interface_crit_);
+ rtc::CritScope cs(&network_interface_crit_);
if (!network_interface_)
return -1;
@@ -659,22 +640,22 @@
protected:
// This method sets DSCP |value| on both RTP and RTCP channels.
- int SetDscp(talk_base::DiffServCodePoint value) {
+ int SetDscp(rtc::DiffServCodePoint value) {
int ret;
ret = SetOption(NetworkInterface::ST_RTP,
- talk_base::Socket::OPT_DSCP,
+ rtc::Socket::OPT_DSCP,
value);
if (ret == 0) {
ret = SetOption(NetworkInterface::ST_RTCP,
- talk_base::Socket::OPT_DSCP,
+ rtc::Socket::OPT_DSCP,
value);
}
return ret;
}
private:
- bool DoSendPacket(talk_base::Buffer* packet, bool rtcp) {
- talk_base::CritScope cs(&network_interface_crit_);
+ bool DoSendPacket(rtc::Buffer* packet, bool rtcp) {
+ rtc::CritScope cs(&network_interface_crit_);
if (!network_interface_)
return false;
@@ -685,7 +666,7 @@
// |network_interface_| can be accessed from the worker_thread and
// from any MediaEngine threads. This critical section is to protect accessing
// of network_interface_ object.
- talk_base::CriticalSection network_interface_crit_;
+ rtc::CriticalSection network_interface_crit_;
NetworkInterface* network_interface_;
};
@@ -1307,7 +1288,7 @@
virtual bool SendData(
const SendDataParams& params,
- const talk_base::Buffer& payload,
+ const rtc::Buffer& payload,
SendDataResult* result = NULL) = 0;
// Signals when data is received (params, data, len)
sigslot::signal3<const ReceiveDataParams&,
diff --git a/media/base/mediacommon.h b/media/base/mediacommon.h
index e0d7eca..6eb5457 100644
--- a/media/base/mediacommon.h
+++ b/media/base/mediacommon.h
@@ -28,7 +28,7 @@
#ifndef TALK_MEDIA_BASE_MEDIACOMMON_H_
#define TALK_MEDIA_BASE_MEDIACOMMON_H_
-#include "talk/base/stringencode.h"
+#include "webrtc/base/stringencode.h"
namespace cricket {
diff --git a/media/base/mediaengine.h b/media/base/mediaengine.h
index 326b722..2380430 100644
--- a/media/base/mediaengine.h
+++ b/media/base/mediaengine.h
@@ -37,8 +37,8 @@
#include <string>
#include <vector>
-#include "talk/base/fileutils.h"
-#include "talk/base/sigslotrepeater.h"
+#include "webrtc/base/fileutils.h"
+#include "webrtc/base/sigslotrepeater.h"
#include "talk/media/base/codec.h"
#include "talk/media/base/mediachannel.h"
#include "talk/media/base/mediacommon.h"
@@ -69,7 +69,7 @@
// Initialization
// Starts the engine.
- virtual bool Init(talk_base::Thread* worker_thread) = 0;
+ virtual bool Init(rtc::Thread* worker_thread) = 0;
// Shuts down the engine.
virtual void Terminate() = 0;
// Returns what the engine is capable of, as a set of Capabilities, above.
@@ -138,7 +138,7 @@
virtual void SetVideoLogging(int min_sev, const char* filter) = 0;
// Starts AEC dump using existing file.
- virtual bool StartAecDump(talk_base::PlatformFile file) = 0;
+ virtual bool StartAecDump(rtc::PlatformFile file) = 0;
// Voice processors for effects.
virtual bool RegisterVoiceProcessor(uint32 ssrc,
@@ -180,7 +180,7 @@
public:
CompositeMediaEngine() {}
virtual ~CompositeMediaEngine() {}
- virtual bool Init(talk_base::Thread* worker_thread) {
+ virtual bool Init(rtc::Thread* worker_thread) {
if (!voice_.Init(worker_thread))
return false;
if (!video_.Init(worker_thread)) {
@@ -269,7 +269,7 @@
video_.SetLogging(min_sev, filter);
}
- virtual bool StartAecDump(talk_base::PlatformFile file) {
+ virtual bool StartAecDump(rtc::PlatformFile file) {
return voice_.StartAecDump(file);
}
@@ -301,7 +301,7 @@
// a video engine is desired.
class NullVoiceEngine {
public:
- bool Init(talk_base::Thread* worker_thread) { return true; }
+ bool Init(rtc::Thread* worker_thread) { return true; }
void Terminate() {}
int GetCapabilities() { return 0; }
// If you need this to return an actual channel, use FakeMediaEngine instead.
@@ -329,7 +329,7 @@
return rtp_header_extensions_;
}
void SetLogging(int min_sev, const char* filter) {}
- bool StartAecDump(talk_base::PlatformFile file) { return false; }
+ bool StartAecDump(rtc::PlatformFile file) { return false; }
bool RegisterProcessor(uint32 ssrc,
VoiceProcessor* voice_processor,
MediaProcessorDirection direction) { return true; }
@@ -346,7 +346,7 @@
// a voice engine is desired.
class NullVideoEngine {
public:
- bool Init(talk_base::Thread* worker_thread) { return true; }
+ bool Init(rtc::Thread* worker_thread) { return true; }
void Terminate() {}
int GetCapabilities() { return 0; }
// If you need this to return an actual channel, use FakeMediaEngine instead.
diff --git a/media/base/mutedvideocapturer.cc b/media/base/mutedvideocapturer.cc
index 0c74b9f..6ff60a0 100644
--- a/media/base/mutedvideocapturer.cc
+++ b/media/base/mutedvideocapturer.cc
@@ -25,8 +25,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/logging.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/thread.h"
#include "talk/media/base/mutedvideocapturer.h"
#include "talk/media/base/videoframe.h"
@@ -39,7 +39,7 @@
const char MutedVideoCapturer::kCapturerId[] = "muted_camera";
-class MutedFramesGenerator : public talk_base::MessageHandler {
+class MutedFramesGenerator : public rtc::MessageHandler {
public:
explicit MutedFramesGenerator(const VideoFormat& format);
virtual ~MutedFramesGenerator();
@@ -49,11 +49,11 @@
sigslot::signal1<VideoFrame*> SignalFrame;
protected:
- virtual void OnMessage(talk_base::Message* message);
+ virtual void OnMessage(rtc::Message* message);
private:
- talk_base::Thread capture_thread_;
- talk_base::scoped_ptr<VideoFrame> muted_frame_;
+ rtc::Thread capture_thread_;
+ rtc::scoped_ptr<VideoFrame> muted_frame_;
const VideoFormat format_;
const int interval_;
uint32 create_time_;
@@ -62,15 +62,15 @@
MutedFramesGenerator::MutedFramesGenerator(const VideoFormat& format)
: format_(format),
interval_(static_cast<int>(format.interval /
- talk_base::kNumNanosecsPerMillisec)),
- create_time_(talk_base::Time()) {
+ rtc::kNumNanosecsPerMillisec)),
+ create_time_(rtc::Time()) {
capture_thread_.Start();
capture_thread_.PostDelayed(interval_, this);
}
MutedFramesGenerator::~MutedFramesGenerator() { capture_thread_.Clear(this); }
-void MutedFramesGenerator::OnMessage(talk_base::Message* message) {
+void MutedFramesGenerator::OnMessage(rtc::Message* message) {
// Queue a new frame as soon as possible to minimize drift.
capture_thread_.PostDelayed(interval_, this);
if (!muted_frame_) {
@@ -83,7 +83,7 @@
return;
#endif
}
- uint32 current_timestamp = talk_base::Time();
+ uint32 current_timestamp = rtc::Time();
// Delta between create time and current time will be correct even if there is
// a wraparound since they are unsigned integers.
uint32 elapsed_time = current_timestamp - create_time_;
diff --git a/media/base/mutedvideocapturer.h b/media/base/mutedvideocapturer.h
old mode 100644
new mode 100755
index fb249a9..11512bc
--- a/media/base/mutedvideocapturer.h
+++ b/media/base/mutedvideocapturer.h
@@ -28,7 +28,7 @@
#ifndef TALK_MEDIA_BASE_MUTEDVIDEOCAPTURER_H_
#define TALK_MEDIA_BASE_MUTEDVIDEOCAPTURER_H_
-#include "talk/base/thread.h"
+#include "webrtc/base/thread.h"
#include "talk/media/base/videocapturer.h"
namespace cricket {
@@ -52,7 +52,7 @@
protected:
void OnMutedFrame(VideoFrame* muted_frame);
- talk_base::scoped_ptr<MutedFramesGenerator> frame_generator_;
+ rtc::scoped_ptr<MutedFramesGenerator> frame_generator_;
};
} // namespace cricket
diff --git a/media/base/mutedvideocapturer_unittest.cc b/media/base/mutedvideocapturer_unittest.cc
old mode 100644
new mode 100755
index dfb56df..739874f
--- a/media/base/mutedvideocapturer_unittest.cc
+++ b/media/base/mutedvideocapturer_unittest.cc
@@ -27,7 +27,7 @@
#include "talk/media/base/mutedvideocapturer.h"
-#include "talk/base/gunit.h"
+#include "webrtc/base/gunit.h"
#include "talk/media/base/videoframe.h"
class MutedVideoCapturerTest : public sigslot::has_slots<>,
diff --git a/media/base/rtpdataengine.cc b/media/base/rtpdataengine.cc
index 3d0efc4..4505911 100644
--- a/media/base/rtpdataengine.cc
+++ b/media/base/rtpdataengine.cc
@@ -27,11 +27,11 @@
#include "talk/media/base/rtpdataengine.h"
-#include "talk/base/buffer.h"
-#include "talk/base/helpers.h"
-#include "talk/base/logging.h"
-#include "talk/base/ratelimiter.h"
-#include "talk/base/timing.h"
+#include "webrtc/base/buffer.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/ratelimiter.h"
+#include "webrtc/base/timing.h"
#include "talk/media/base/codec.h"
#include "talk/media/base/constants.h"
#include "talk/media/base/rtputils.h"
@@ -55,7 +55,7 @@
data_codecs_.push_back(
DataCodec(kGoogleRtpDataCodecId,
kGoogleRtpDataCodecName, 0));
- SetTiming(new talk_base::Timing());
+ SetTiming(new rtc::Timing());
}
DataMediaChannel* RtpDataEngine::CreateChannel(
@@ -92,7 +92,7 @@
return false;
}
-RtpDataMediaChannel::RtpDataMediaChannel(talk_base::Timing* timing) {
+RtpDataMediaChannel::RtpDataMediaChannel(rtc::Timing* timing) {
Construct(timing);
}
@@ -100,11 +100,11 @@
Construct(NULL);
}
-void RtpDataMediaChannel::Construct(talk_base::Timing* timing) {
+void RtpDataMediaChannel::Construct(rtc::Timing* timing) {
sending_ = false;
receiving_ = false;
timing_ = timing;
- send_limiter_.reset(new talk_base::RateLimiter(kDataMaxBandwidth / 8, 1.0));
+ send_limiter_.reset(new rtc::RateLimiter(kDataMaxBandwidth / 8, 1.0));
}
@@ -187,7 +187,7 @@
// And we should probably allow more than one per stream.
rtp_clock_by_send_ssrc_[stream.first_ssrc()] = new RtpClock(
kDataCodecClockrate,
- talk_base::CreateRandomNonZeroId(), talk_base::CreateRandomNonZeroId());
+ rtc::CreateRandomNonZeroId(), rtc::CreateRandomNonZeroId());
LOG(LS_INFO) << "Added data send stream '" << stream.id
<< "' with ssrc=" << stream.first_ssrc();
@@ -231,7 +231,7 @@
}
void RtpDataMediaChannel::OnPacketReceived(
- talk_base::Buffer* packet, const talk_base::PacketTime& packet_time) {
+ rtc::Buffer* packet, const rtc::PacketTime& packet_time) {
RtpHeader header;
if (!GetRtpHeader(packet->data(), packet->length(), &header)) {
// Don't want to log for every corrupt packet.
@@ -294,14 +294,14 @@
if (bps <= 0) {
bps = kDataMaxBandwidth;
}
- send_limiter_.reset(new talk_base::RateLimiter(bps / 8, 1.0));
+ send_limiter_.reset(new rtc::RateLimiter(bps / 8, 1.0));
LOG(LS_INFO) << "RtpDataMediaChannel::SetSendBandwidth to " << bps << "bps.";
return true;
}
bool RtpDataMediaChannel::SendData(
const SendDataParams& params,
- const talk_base::Buffer& payload,
+ const rtc::Buffer& payload,
SendDataResult* result) {
if (result) {
// If we return true, we'll set this to SDR_SUCCESS.
@@ -353,7 +353,7 @@
rtp_clock_by_send_ssrc_[header.ssrc]->Tick(
now, &header.seq_num, &header.timestamp);
- talk_base::Buffer packet;
+ rtc::Buffer packet;
packet.SetCapacity(packet_len);
packet.SetLength(kMinRtpPacketLen);
if (!SetRtpHeader(packet.data(), packet.length(), header)) {
diff --git a/media/base/rtpdataengine.h b/media/base/rtpdataengine.h
index d5abeef..6dc5788 100644
--- a/media/base/rtpdataengine.h
+++ b/media/base/rtpdataengine.h
@@ -31,7 +31,7 @@
#include <string>
#include <vector>
-#include "talk/base/timing.h"
+#include "webrtc/base/timing.h"
#include "talk/media/base/constants.h"
#include "talk/media/base/mediachannel.h"
#include "talk/media/base/mediaengine.h"
@@ -51,13 +51,13 @@
}
// Mostly for testing with a fake clock. Ownership is passed in.
- void SetTiming(talk_base::Timing* timing) {
+ void SetTiming(rtc::Timing* timing) {
timing_.reset(timing);
}
private:
std::vector<DataCodec> data_codecs_;
- talk_base::scoped_ptr<talk_base::Timing> timing_;
+ rtc::scoped_ptr<rtc::Timing> timing_;
};
// Keep track of sequence number and timestamp of an RTP stream. The
@@ -86,13 +86,13 @@
class RtpDataMediaChannel : public DataMediaChannel {
public:
// Timing* Used for the RtpClock
- explicit RtpDataMediaChannel(talk_base::Timing* timing);
+ explicit RtpDataMediaChannel(rtc::Timing* timing);
// Sets Timing == NULL, so you'll need to call set_timer() before
// using it. This is needed by FakeMediaEngine.
RtpDataMediaChannel();
virtual ~RtpDataMediaChannel();
- void set_timing(talk_base::Timing* timing) {
+ void set_timing(rtc::Timing* timing) {
timing_ = timing;
}
@@ -116,28 +116,28 @@
receiving_ = receive;
return true;
}
- virtual void OnPacketReceived(talk_base::Buffer* packet,
- const talk_base::PacketTime& packet_time);
- virtual void OnRtcpReceived(talk_base::Buffer* packet,
- const talk_base::PacketTime& packet_time) {}
+ virtual void OnPacketReceived(rtc::Buffer* packet,
+ const rtc::PacketTime& packet_time);
+ virtual void OnRtcpReceived(rtc::Buffer* packet,
+ const rtc::PacketTime& packet_time) {}
virtual void OnReadyToSend(bool ready) {}
virtual bool SendData(
const SendDataParams& params,
- const talk_base::Buffer& payload,
+ const rtc::Buffer& payload,
SendDataResult* result);
private:
- void Construct(talk_base::Timing* timing);
+ void Construct(rtc::Timing* timing);
bool sending_;
bool receiving_;
- talk_base::Timing* timing_;
+ rtc::Timing* timing_;
std::vector<DataCodec> send_codecs_;
std::vector<DataCodec> recv_codecs_;
std::vector<StreamParams> send_streams_;
std::vector<StreamParams> recv_streams_;
std::map<uint32, RtpClock*> rtp_clock_by_send_ssrc_;
- talk_base::scoped_ptr<talk_base::RateLimiter> send_limiter_;
+ rtc::scoped_ptr<rtc::RateLimiter> send_limiter_;
};
} // namespace cricket
diff --git a/media/base/rtpdataengine_unittest.cc b/media/base/rtpdataengine_unittest.cc
index 640c18d..034df54 100644
--- a/media/base/rtpdataengine_unittest.cc
+++ b/media/base/rtpdataengine_unittest.cc
@@ -27,18 +27,18 @@
#include <string>
-#include "talk/base/buffer.h"
-#include "talk/base/gunit.h"
-#include "talk/base/helpers.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/ssladapter.h"
-#include "talk/base/timing.h"
+#include "webrtc/base/buffer.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/ssladapter.h"
+#include "webrtc/base/timing.h"
#include "talk/media/base/constants.h"
#include "talk/media/base/fakenetworkinterface.h"
#include "talk/media/base/rtpdataengine.h"
#include "talk/media/base/rtputils.h"
-class FakeTiming : public talk_base::Timing {
+class FakeTiming : public rtc::Timing {
public:
FakeTiming() : now_(0.0) {}
@@ -84,11 +84,11 @@
class RtpDataMediaChannelTest : public testing::Test {
protected:
static void SetUpTestCase() {
- talk_base::InitializeSSL();
+ rtc::InitializeSSL();
}
static void TearDownTestCase() {
- talk_base::CleanupSSL();
+ rtc::CleanupSSL();
}
virtual void SetUp() {
@@ -149,7 +149,7 @@
std::string GetSentData(int index) {
// Assume RTP header of length 12
- talk_base::scoped_ptr<const talk_base::Buffer> packet(
+ rtc::scoped_ptr<const rtc::Buffer> packet(
iface_->GetRtpPacket(index));
if (packet->length() > 12) {
return std::string(packet->data() + 12, packet->length() - 12);
@@ -159,7 +159,7 @@
}
cricket::RtpHeader GetSentDataHeader(int index) {
- talk_base::scoped_ptr<const talk_base::Buffer> packet(
+ rtc::scoped_ptr<const rtc::Buffer> packet(
iface_->GetRtpPacket(index));
cricket::RtpHeader header;
GetRtpHeader(packet->data(), packet->length(), &header);
@@ -167,15 +167,15 @@
}
private:
- talk_base::scoped_ptr<cricket::RtpDataEngine> dme_;
+ rtc::scoped_ptr<cricket::RtpDataEngine> dme_;
// Timing passed into dme_. Owned by dme_;
FakeTiming* timing_;
- talk_base::scoped_ptr<cricket::FakeNetworkInterface> iface_;
- talk_base::scoped_ptr<FakeDataReceiver> receiver_;
+ rtc::scoped_ptr<cricket::FakeNetworkInterface> iface_;
+ rtc::scoped_ptr<FakeDataReceiver> receiver_;
};
TEST_F(RtpDataMediaChannelTest, SetUnknownCodecs) {
- talk_base::scoped_ptr<cricket::RtpDataMediaChannel> dmc(CreateChannel());
+ rtc::scoped_ptr<cricket::RtpDataMediaChannel> dmc(CreateChannel());
cricket::DataCodec known_codec;
known_codec.id = 103;
@@ -203,7 +203,7 @@
}
TEST_F(RtpDataMediaChannelTest, AddRemoveSendStream) {
- talk_base::scoped_ptr<cricket::RtpDataMediaChannel> dmc(CreateChannel());
+ rtc::scoped_ptr<cricket::RtpDataMediaChannel> dmc(CreateChannel());
cricket::StreamParams stream1;
stream1.add_ssrc(41);
@@ -218,7 +218,7 @@
}
TEST_F(RtpDataMediaChannelTest, AddRemoveRecvStream) {
- talk_base::scoped_ptr<cricket::RtpDataMediaChannel> dmc(CreateChannel());
+ rtc::scoped_ptr<cricket::RtpDataMediaChannel> dmc(CreateChannel());
cricket::StreamParams stream1;
stream1.add_ssrc(41);
@@ -233,12 +233,12 @@
}
TEST_F(RtpDataMediaChannelTest, SendData) {
- talk_base::scoped_ptr<cricket::RtpDataMediaChannel> dmc(CreateChannel());
+ rtc::scoped_ptr<cricket::RtpDataMediaChannel> dmc(CreateChannel());
cricket::SendDataParams params;
params.ssrc = 42;
unsigned char data[] = "food";
- talk_base::Buffer payload(data, 4);
+ rtc::Buffer payload(data, 4);
unsigned char padded_data[] = {
0x00, 0x00, 0x00, 0x00,
'f', 'o', 'o', 'd',
@@ -275,7 +275,7 @@
// Length too large;
std::string x10000(10000, 'x');
EXPECT_FALSE(dmc->SendData(
- params, talk_base::Buffer(x10000.data(), x10000.length()), &result));
+ params, rtc::Buffer(x10000.data(), x10000.length()), &result));
EXPECT_EQ(cricket::SDR_ERROR, result);
EXPECT_FALSE(HasSentData(0));
@@ -311,12 +311,12 @@
TEST_F(RtpDataMediaChannelTest, SendDataMultipleClocks) {
// Timings owned by RtpDataEngines.
FakeTiming* timing1 = new FakeTiming();
- talk_base::scoped_ptr<cricket::RtpDataEngine> dme1(CreateEngine(timing1));
- talk_base::scoped_ptr<cricket::RtpDataMediaChannel> dmc1(
+ rtc::scoped_ptr<cricket::RtpDataEngine> dme1(CreateEngine(timing1));
+ rtc::scoped_ptr<cricket::RtpDataMediaChannel> dmc1(
CreateChannel(dme1.get()));
FakeTiming* timing2 = new FakeTiming();
- talk_base::scoped_ptr<cricket::RtpDataEngine> dme2(CreateEngine(timing2));
- talk_base::scoped_ptr<cricket::RtpDataMediaChannel> dmc2(
+ rtc::scoped_ptr<cricket::RtpDataEngine> dme2(CreateEngine(timing2));
+ rtc::scoped_ptr<cricket::RtpDataMediaChannel> dmc2(
CreateChannel(dme2.get()));
ASSERT_TRUE(dmc1->SetSend(true));
@@ -343,7 +343,7 @@
params2.ssrc = 42;
unsigned char data[] = "foo";
- talk_base::Buffer payload(data, 3);
+ rtc::Buffer payload(data, 3);
cricket::SendDataResult result;
EXPECT_TRUE(dmc1->SendData(params1, payload, &result));
@@ -372,7 +372,7 @@
}
TEST_F(RtpDataMediaChannelTest, SendDataRate) {
- talk_base::scoped_ptr<cricket::RtpDataMediaChannel> dmc(CreateChannel());
+ rtc::scoped_ptr<cricket::RtpDataMediaChannel> dmc(CreateChannel());
ASSERT_TRUE(dmc->SetSend(true));
@@ -390,7 +390,7 @@
cricket::SendDataParams params;
params.ssrc = 42;
unsigned char data[] = "food";
- talk_base::Buffer payload(data, 4);
+ rtc::Buffer payload(data, 4);
cricket::SendDataResult result;
// With rtp overhead of 32 bytes, each one of our packets is 36
@@ -427,18 +427,18 @@
0x00, 0x00, 0x00, 0x00,
'a', 'b', 'c', 'd', 'e'
};
- talk_base::Buffer packet(data, sizeof(data));
+ rtc::Buffer packet(data, sizeof(data));
- talk_base::scoped_ptr<cricket::RtpDataMediaChannel> dmc(CreateChannel());
+ rtc::scoped_ptr<cricket::RtpDataMediaChannel> dmc(CreateChannel());
// SetReceived not called.
- dmc->OnPacketReceived(&packet, talk_base::PacketTime());
+ dmc->OnPacketReceived(&packet, rtc::PacketTime());
EXPECT_FALSE(HasReceivedData());
dmc->SetReceive(true);
// Unknown payload id
- dmc->OnPacketReceived(&packet, talk_base::PacketTime());
+ dmc->OnPacketReceived(&packet, rtc::PacketTime());
EXPECT_FALSE(HasReceivedData());
cricket::DataCodec codec;
@@ -449,7 +449,7 @@
ASSERT_TRUE(dmc->SetRecvCodecs(codecs));
// Unknown stream
- dmc->OnPacketReceived(&packet, talk_base::PacketTime());
+ dmc->OnPacketReceived(&packet, rtc::PacketTime());
EXPECT_FALSE(HasReceivedData());
cricket::StreamParams stream;
@@ -457,7 +457,7 @@
ASSERT_TRUE(dmc->AddRecvStream(stream));
// Finally works!
- dmc->OnPacketReceived(&packet, talk_base::PacketTime());
+ dmc->OnPacketReceived(&packet, rtc::PacketTime());
EXPECT_TRUE(HasReceivedData());
EXPECT_EQ("abcde", GetReceivedData());
EXPECT_EQ(5U, GetReceivedDataLen());
@@ -467,11 +467,11 @@
unsigned char data[] = {
0x80, 0x65, 0x00, 0x02
};
- talk_base::Buffer packet(data, sizeof(data));
+ rtc::Buffer packet(data, sizeof(data));
- talk_base::scoped_ptr<cricket::RtpDataMediaChannel> dmc(CreateChannel());
+ rtc::scoped_ptr<cricket::RtpDataMediaChannel> dmc(CreateChannel());
// Too short
- dmc->OnPacketReceived(&packet, talk_base::PacketTime());
+ dmc->OnPacketReceived(&packet, rtc::PacketTime());
EXPECT_FALSE(HasReceivedData());
}
diff --git a/media/base/rtpdump.cc b/media/base/rtpdump.cc
index 10c835c..0b09b2a 100644
--- a/media/base/rtpdump.cc
+++ b/media/base/rtpdump.cc
@@ -31,9 +31,9 @@
#include <string>
-#include "talk/base/byteorder.h"
-#include "talk/base/logging.h"
-#include "talk/base/timeutils.h"
+#include "webrtc/base/byteorder.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/timeutils.h"
#include "talk/media/base/rtputils.h"
namespace {
@@ -53,7 +53,7 @@
padding(0) {
}
-void RtpDumpFileHeader::WriteToByteBuffer(talk_base::ByteBuffer* buf) {
+void RtpDumpFileHeader::WriteToByteBuffer(rtc::ByteBuffer* buf) {
buf->WriteUInt32(start_sec);
buf->WriteUInt32(start_usec);
buf->WriteUInt32(source);
@@ -111,14 +111,14 @@
ssrc_override_ = ssrc;
}
-talk_base::StreamResult RtpDumpReader::ReadPacket(RtpDumpPacket* packet) {
- if (!packet) return talk_base::SR_ERROR;
+rtc::StreamResult RtpDumpReader::ReadPacket(RtpDumpPacket* packet) {
+ if (!packet) return rtc::SR_ERROR;
- talk_base::StreamResult res = talk_base::SR_SUCCESS;
+ rtc::StreamResult res = rtc::SR_SUCCESS;
// Read the file header if it has not been read yet.
if (!file_header_read_) {
res = ReadFileHeader();
- if (res != talk_base::SR_SUCCESS) {
+ if (res != rtc::SR_SUCCESS) {
return res;
}
file_header_read_ = true;
@@ -127,10 +127,10 @@
// Read the RTP dump packet header.
char header[RtpDumpPacket::kHeaderLength];
res = stream_->ReadAll(header, sizeof(header), NULL, NULL);
- if (res != talk_base::SR_SUCCESS) {
+ if (res != rtc::SR_SUCCESS) {
return res;
}
- talk_base::ByteBuffer buf(header, sizeof(header));
+ rtc::ByteBuffer buf(header, sizeof(header));
uint16 dump_packet_len;
uint16 data_len;
// Read the full length of the rtpdump packet, including the rtpdump header.
@@ -150,31 +150,31 @@
// If the packet is RTP and we have specified a ssrc, replace the RTP ssrc
// with the specified ssrc.
- if (res == talk_base::SR_SUCCESS &&
+ if (res == rtc::SR_SUCCESS &&
packet->IsValidRtpPacket() &&
ssrc_override_ != 0) {
- talk_base::SetBE32(&packet->data[kRtpSsrcOffset], ssrc_override_);
+ rtc::SetBE32(&packet->data[kRtpSsrcOffset], ssrc_override_);
}
return res;
}
-talk_base::StreamResult RtpDumpReader::ReadFileHeader() {
+rtc::StreamResult RtpDumpReader::ReadFileHeader() {
// Read the first line.
std::string first_line;
- talk_base::StreamResult res = stream_->ReadLine(&first_line);
- if (res != talk_base::SR_SUCCESS) {
+ rtc::StreamResult res = stream_->ReadLine(&first_line);
+ if (res != rtc::SR_SUCCESS) {
return res;
}
if (!CheckFirstLine(first_line)) {
- return talk_base::SR_ERROR;
+ return rtc::SR_ERROR;
}
// Read the 16 byte file header.
char header[RtpDumpFileHeader::kHeaderLength];
res = stream_->ReadAll(header, sizeof(header), NULL, NULL);
- if (res == talk_base::SR_SUCCESS) {
- talk_base::ByteBuffer buf(header, sizeof(header));
+ if (res == rtc::SR_SUCCESS) {
+ rtc::ByteBuffer buf(header, sizeof(header));
uint32 start_sec;
uint32 start_usec;
buf.ReadUInt32(&start_sec);
@@ -204,7 +204,7 @@
///////////////////////////////////////////////////////////////////////////
// Implementation of RtpDumpLoopReader.
///////////////////////////////////////////////////////////////////////////
-RtpDumpLoopReader::RtpDumpLoopReader(talk_base::StreamInterface* stream)
+RtpDumpLoopReader::RtpDumpLoopReader(rtc::StreamInterface* stream)
: RtpDumpReader(stream),
loop_count_(0),
elapsed_time_increases_(0),
@@ -220,16 +220,16 @@
prev_rtp_timestamp_(0) {
}
-talk_base::StreamResult RtpDumpLoopReader::ReadPacket(RtpDumpPacket* packet) {
- if (!packet) return talk_base::SR_ERROR;
+rtc::StreamResult RtpDumpLoopReader::ReadPacket(RtpDumpPacket* packet) {
+ if (!packet) return rtc::SR_ERROR;
- talk_base::StreamResult res = RtpDumpReader::ReadPacket(packet);
- if (talk_base::SR_SUCCESS == res) {
+ rtc::StreamResult res = RtpDumpReader::ReadPacket(packet);
+ if (rtc::SR_SUCCESS == res) {
if (0 == loop_count_) {
// During the first loop, we update the statistics of the input stream.
UpdateStreamStatistics(*packet);
}
- } else if (talk_base::SR_EOS == res) {
+ } else if (rtc::SR_EOS == res) {
if (0 == loop_count_) {
// At the end of the first loop, calculate elapsed_time_increases_,
// rtp_seq_num_increase_, and rtp_timestamp_increase_, which will be
@@ -244,7 +244,7 @@
}
}
- if (talk_base::SR_SUCCESS == res && loop_count_ > 0) {
+ if (rtc::SR_SUCCESS == res && loop_count_ > 0) {
// During the second and later loops, we update the elapsed time of the dump
// packet. If the dumped packet is a RTP packet, we also update its RTP
// sequence number and timestamp.
@@ -307,7 +307,7 @@
sequence += loop_count_ * rtp_seq_num_increase_;
timestamp += loop_count_ * rtp_timestamp_increase_;
// Write the updated sequence number and timestamp back to the RTP packet.
- talk_base::ByteBuffer buffer;
+ rtc::ByteBuffer buffer;
buffer.WriteUInt16(sequence);
buffer.WriteUInt32(timestamp);
memcpy(&packet->data[2], buffer.Data(), buffer.Length());
@@ -318,11 +318,11 @@
// Implementation of RtpDumpWriter.
///////////////////////////////////////////////////////////////////////////
-RtpDumpWriter::RtpDumpWriter(talk_base::StreamInterface* stream)
+RtpDumpWriter::RtpDumpWriter(rtc::StreamInterface* stream)
: stream_(stream),
packet_filter_(PF_ALL),
file_header_written_(false),
- start_time_ms_(talk_base::Time()),
+ start_time_ms_(rtc::Time()),
warn_slow_writes_delay_(kWarnSlowWritesDelayMs) {
}
@@ -332,32 +332,32 @@
}
uint32 RtpDumpWriter::GetElapsedTime() const {
- return talk_base::TimeSince(start_time_ms_);
+ return rtc::TimeSince(start_time_ms_);
}
-talk_base::StreamResult RtpDumpWriter::WriteFileHeader() {
- talk_base::StreamResult res = WriteToStream(
+rtc::StreamResult RtpDumpWriter::WriteFileHeader() {
+ rtc::StreamResult res = WriteToStream(
RtpDumpFileHeader::kFirstLine,
strlen(RtpDumpFileHeader::kFirstLine));
- if (res != talk_base::SR_SUCCESS) {
+ if (res != rtc::SR_SUCCESS) {
return res;
}
- talk_base::ByteBuffer buf;
- RtpDumpFileHeader file_header(talk_base::Time(), 0, 0);
+ rtc::ByteBuffer buf;
+ RtpDumpFileHeader file_header(rtc::Time(), 0, 0);
file_header.WriteToByteBuffer(&buf);
return WriteToStream(buf.Data(), buf.Length());
}
-talk_base::StreamResult RtpDumpWriter::WritePacket(
+rtc::StreamResult RtpDumpWriter::WritePacket(
const void* data, size_t data_len, uint32 elapsed, bool rtcp) {
- if (!stream_ || !data || 0 == data_len) return talk_base::SR_ERROR;
+ if (!stream_ || !data || 0 == data_len) return rtc::SR_ERROR;
- talk_base::StreamResult res = talk_base::SR_SUCCESS;
+ rtc::StreamResult res = rtc::SR_SUCCESS;
// Write the file header if it has not been written yet.
if (!file_header_written_) {
res = WriteFileHeader();
- if (res != talk_base::SR_SUCCESS) {
+ if (res != rtc::SR_SUCCESS) {
return res;
}
file_header_written_ = true;
@@ -366,17 +366,17 @@
// Figure out what to write.
size_t write_len = FilterPacket(data, data_len, rtcp);
if (write_len == 0) {
- return talk_base::SR_SUCCESS;
+ return rtc::SR_SUCCESS;
}
// Write the dump packet header.
- talk_base::ByteBuffer buf;
+ rtc::ByteBuffer buf;
buf.WriteUInt16(static_cast<uint16>(
RtpDumpPacket::kHeaderLength + write_len));
buf.WriteUInt16(static_cast<uint16>(rtcp ? 0 : data_len));
buf.WriteUInt32(elapsed);
res = WriteToStream(buf.Data(), buf.Length());
- if (res != talk_base::SR_SUCCESS) {
+ if (res != rtc::SR_SUCCESS) {
return res;
}
@@ -408,12 +408,12 @@
return filtered_len;
}
-talk_base::StreamResult RtpDumpWriter::WriteToStream(
+rtc::StreamResult RtpDumpWriter::WriteToStream(
const void* data, size_t data_len) {
- uint32 before = talk_base::Time();
- talk_base::StreamResult result =
+ uint32 before = rtc::Time();
+ rtc::StreamResult result =
stream_->WriteAll(data, data_len, NULL, NULL);
- uint32 delay = talk_base::TimeSince(before);
+ uint32 delay = rtc::TimeSince(before);
if (delay >= warn_slow_writes_delay_) {
LOG(LS_WARNING) << "Slow RtpDump: took " << delay << "ms to write "
<< data_len << " bytes.";
diff --git a/media/base/rtpdump.h b/media/base/rtpdump.h
index ceacab2..33c31c9 100644
--- a/media/base/rtpdump.h
+++ b/media/base/rtpdump.h
@@ -33,9 +33,9 @@
#include <string>
#include <vector>
-#include "talk/base/basictypes.h"
-#include "talk/base/bytebuffer.h"
-#include "talk/base/stream.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/bytebuffer.h"
+#include "webrtc/base/stream.h"
namespace cricket {
@@ -57,7 +57,7 @@
struct RtpDumpFileHeader {
RtpDumpFileHeader(uint32 start_ms, uint32 s, uint16 p);
- void WriteToByteBuffer(talk_base::ByteBuffer* buf);
+ void WriteToByteBuffer(rtc::ByteBuffer* buf);
static const char kFirstLine[];
static const size_t kHeaderLength = 16;
@@ -104,7 +104,7 @@
class RtpDumpReader {
public:
- explicit RtpDumpReader(talk_base::StreamInterface* stream)
+ explicit RtpDumpReader(rtc::StreamInterface* stream)
: stream_(stream),
file_header_read_(false),
first_line_and_file_header_len_(0),
@@ -115,10 +115,10 @@
// Use the specified ssrc, rather than the ssrc from dump, for RTP packets.
void SetSsrc(uint32 ssrc);
- virtual talk_base::StreamResult ReadPacket(RtpDumpPacket* packet);
+ virtual rtc::StreamResult ReadPacket(RtpDumpPacket* packet);
protected:
- talk_base::StreamResult ReadFileHeader();
+ rtc::StreamResult ReadFileHeader();
bool RewindToFirstDumpPacket() {
return stream_->SetPosition(first_line_and_file_header_len_);
}
@@ -127,7 +127,7 @@
// Check if its matches "#!rtpplay1.0 address/port\n".
bool CheckFirstLine(const std::string& first_line);
- talk_base::StreamInterface* stream_;
+ rtc::StreamInterface* stream_;
bool file_header_read_;
size_t first_line_and_file_header_len_;
uint32 start_time_ms_;
@@ -143,8 +143,8 @@
// RTP packets and RTCP packets.
class RtpDumpLoopReader : public RtpDumpReader {
public:
- explicit RtpDumpLoopReader(talk_base::StreamInterface* stream);
- virtual talk_base::StreamResult ReadPacket(RtpDumpPacket* packet);
+ explicit RtpDumpLoopReader(rtc::StreamInterface* stream);
+ virtual rtc::StreamResult ReadPacket(RtpDumpPacket* packet);
private:
// During the first loop, update the statistics, including packet count, frame
@@ -186,19 +186,19 @@
class RtpDumpWriter {
public:
- explicit RtpDumpWriter(talk_base::StreamInterface* stream);
+ explicit RtpDumpWriter(rtc::StreamInterface* stream);
// Filter to control what packets we actually record.
void set_packet_filter(int filter);
// Write a RTP or RTCP packet. The parameters data points to the packet and
// data_len is its length.
- talk_base::StreamResult WriteRtpPacket(const void* data, size_t data_len) {
+ rtc::StreamResult WriteRtpPacket(const void* data, size_t data_len) {
return WritePacket(data, data_len, GetElapsedTime(), false);
}
- talk_base::StreamResult WriteRtcpPacket(const void* data, size_t data_len) {
+ rtc::StreamResult WriteRtcpPacket(const void* data, size_t data_len) {
return WritePacket(data, data_len, GetElapsedTime(), true);
}
- talk_base::StreamResult WritePacket(const RtpDumpPacket& packet) {
+ rtc::StreamResult WritePacket(const RtpDumpPacket& packet) {
return WritePacket(&packet.data[0], packet.data.size(), packet.elapsed_time,
packet.is_rtcp());
}
@@ -211,15 +211,15 @@
}
protected:
- talk_base::StreamResult WriteFileHeader();
+ rtc::StreamResult WriteFileHeader();
private:
- talk_base::StreamResult WritePacket(const void* data, size_t data_len,
+ rtc::StreamResult WritePacket(const void* data, size_t data_len,
uint32 elapsed, bool rtcp);
size_t FilterPacket(const void* data, size_t data_len, bool rtcp);
- talk_base::StreamResult WriteToStream(const void* data, size_t data_len);
+ rtc::StreamResult WriteToStream(const void* data, size_t data_len);
- talk_base::StreamInterface* stream_;
+ rtc::StreamInterface* stream_;
int packet_filter_;
bool file_header_written_;
uint32 start_time_ms_; // Time when the record starts.
diff --git a/media/base/rtpdump_unittest.cc b/media/base/rtpdump_unittest.cc
index c327189..4e32f0a 100644
--- a/media/base/rtpdump_unittest.cc
+++ b/media/base/rtpdump_unittest.cc
@@ -27,9 +27,9 @@
#include <string>
-#include "talk/base/bytebuffer.h"
-#include "talk/base/gunit.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/bytebuffer.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/thread.h"
#include "talk/media/base/rtpdump.h"
#include "talk/media/base/rtputils.h"
#include "talk/media/base/testutils.h"
@@ -40,7 +40,7 @@
// Test that we read the correct header fields from the RTP/RTCP packet.
TEST(RtpDumpTest, ReadRtpDumpPacket) {
- talk_base::ByteBuffer rtp_buf;
+ rtc::ByteBuffer rtp_buf;
RtpTestUtility::kTestRawRtpPackets[0].WriteToByteBuffer(kTestSsrc, &rtp_buf);
RtpDumpPacket rtp_packet(rtp_buf.Data(), rtp_buf.Length(), 0, false);
@@ -61,7 +61,7 @@
EXPECT_EQ(kTestSsrc, ssrc);
EXPECT_FALSE(rtp_packet.GetRtcpType(&type));
- talk_base::ByteBuffer rtcp_buf;
+ rtc::ByteBuffer rtcp_buf;
RtpTestUtility::kTestRawRtcpPackets[0].WriteToByteBuffer(&rtcp_buf);
RtpDumpPacket rtcp_packet(rtcp_buf.Data(), rtcp_buf.Length(), 0, true);
@@ -75,48 +75,48 @@
// Test that we read only the RTP dump file.
TEST(RtpDumpTest, ReadRtpDumpFile) {
RtpDumpPacket packet;
- talk_base::MemoryStream stream;
+ rtc::MemoryStream stream;
RtpDumpWriter writer(&stream);
- talk_base::scoped_ptr<RtpDumpReader> reader;
+ rtc::scoped_ptr<RtpDumpReader> reader;
// Write a RTP packet to the stream, which is a valid RTP dump. Next, we will
// change the first line to make the RTP dump valid or invalid.
ASSERT_TRUE(RtpTestUtility::WriteTestPackets(1, false, kTestSsrc, &writer));
stream.Rewind();
reader.reset(new RtpDumpReader(&stream));
- EXPECT_EQ(talk_base::SR_SUCCESS, reader->ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_SUCCESS, reader->ReadPacket(&packet));
// The first line is correct.
stream.Rewind();
const char new_line[] = "#!rtpplay1.0 1.1.1.1/1\n";
- EXPECT_EQ(talk_base::SR_SUCCESS,
+ EXPECT_EQ(rtc::SR_SUCCESS,
stream.WriteAll(new_line, strlen(new_line), NULL, NULL));
stream.Rewind();
reader.reset(new RtpDumpReader(&stream));
- EXPECT_EQ(talk_base::SR_SUCCESS, reader->ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_SUCCESS, reader->ReadPacket(&packet));
// The first line is not correct: not started with #!rtpplay1.0.
stream.Rewind();
const char new_line2[] = "#!rtpplaz1.0 0.0.0.0/0\n";
- EXPECT_EQ(talk_base::SR_SUCCESS,
+ EXPECT_EQ(rtc::SR_SUCCESS,
stream.WriteAll(new_line2, strlen(new_line2), NULL, NULL));
stream.Rewind();
reader.reset(new RtpDumpReader(&stream));
- EXPECT_EQ(talk_base::SR_ERROR, reader->ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_ERROR, reader->ReadPacket(&packet));
// The first line is not correct: no port.
stream.Rewind();
const char new_line3[] = "#!rtpplay1.0 0.0.0.0//\n";
- EXPECT_EQ(talk_base::SR_SUCCESS,
+ EXPECT_EQ(rtc::SR_SUCCESS,
stream.WriteAll(new_line3, strlen(new_line3), NULL, NULL));
stream.Rewind();
reader.reset(new RtpDumpReader(&stream));
- EXPECT_EQ(talk_base::SR_ERROR, reader->ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_ERROR, reader->ReadPacket(&packet));
}
// Test that we read the same RTP packets that rtp dump writes.
TEST(RtpDumpTest, WriteReadSameRtp) {
- talk_base::MemoryStream stream;
+ rtc::MemoryStream stream;
RtpDumpWriter writer(&stream);
ASSERT_TRUE(RtpTestUtility::WriteTestPackets(
RtpTestUtility::GetTestPacketCount(), false, kTestSsrc, &writer));
@@ -127,13 +127,13 @@
RtpDumpPacket packet;
RtpDumpReader reader(&stream);
for (size_t i = 0; i < RtpTestUtility::GetTestPacketCount(); ++i) {
- EXPECT_EQ(talk_base::SR_SUCCESS, reader.ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_SUCCESS, reader.ReadPacket(&packet));
uint32 ssrc;
EXPECT_TRUE(GetRtpSsrc(&packet.data[0], packet.data.size(), &ssrc));
EXPECT_EQ(kTestSsrc, ssrc);
}
// No more packets to read.
- EXPECT_EQ(talk_base::SR_EOS, reader.ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_EOS, reader.ReadPacket(&packet));
// Rewind the stream and read again with a specified ssrc.
stream.Rewind();
@@ -141,7 +141,7 @@
const uint32 send_ssrc = kTestSsrc + 1;
reader_w_ssrc.SetSsrc(send_ssrc);
for (size_t i = 0; i < RtpTestUtility::GetTestPacketCount(); ++i) {
- EXPECT_EQ(talk_base::SR_SUCCESS, reader_w_ssrc.ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_SUCCESS, reader_w_ssrc.ReadPacket(&packet));
EXPECT_FALSE(packet.is_rtcp());
EXPECT_EQ(packet.original_data_len, packet.data.size());
uint32 ssrc;
@@ -149,12 +149,12 @@
EXPECT_EQ(send_ssrc, ssrc);
}
// No more packets to read.
- EXPECT_EQ(talk_base::SR_EOS, reader_w_ssrc.ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_EOS, reader_w_ssrc.ReadPacket(&packet));
}
// Test that we read the same RTCP packets that rtp dump writes.
TEST(RtpDumpTest, WriteReadSameRtcp) {
- talk_base::MemoryStream stream;
+ rtc::MemoryStream stream;
RtpDumpWriter writer(&stream);
ASSERT_TRUE(RtpTestUtility::WriteTestPackets(
RtpTestUtility::GetTestPacketCount(), true, kTestSsrc, &writer));
@@ -166,17 +166,17 @@
RtpDumpReader reader(&stream);
reader.SetSsrc(kTestSsrc + 1); // Does not affect RTCP packet.
for (size_t i = 0; i < RtpTestUtility::GetTestPacketCount(); ++i) {
- EXPECT_EQ(talk_base::SR_SUCCESS, reader.ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_SUCCESS, reader.ReadPacket(&packet));
EXPECT_TRUE(packet.is_rtcp());
EXPECT_EQ(0U, packet.original_data_len);
}
// No more packets to read.
- EXPECT_EQ(talk_base::SR_EOS, reader.ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_EOS, reader.ReadPacket(&packet));
}
// Test dumping only RTP packet headers.
TEST(RtpDumpTest, WriteReadRtpHeadersOnly) {
- talk_base::MemoryStream stream;
+ rtc::MemoryStream stream;
RtpDumpWriter writer(&stream);
writer.set_packet_filter(PF_RTPHEADER);
@@ -192,7 +192,7 @@
RtpDumpPacket packet;
RtpDumpReader reader(&stream);
for (size_t i = 0; i < RtpTestUtility::GetTestPacketCount(); ++i) {
- EXPECT_EQ(talk_base::SR_SUCCESS, reader.ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_SUCCESS, reader.ReadPacket(&packet));
EXPECT_FALSE(packet.is_rtcp());
size_t len = 0;
packet.GetRtpHeaderLen(&len);
@@ -200,12 +200,12 @@
EXPECT_GT(packet.original_data_len, packet.data.size());
}
// No more packets to read.
- EXPECT_EQ(talk_base::SR_EOS, reader.ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_EOS, reader.ReadPacket(&packet));
}
// Test dumping only RTCP packets.
TEST(RtpDumpTest, WriteReadRtcpOnly) {
- talk_base::MemoryStream stream;
+ rtc::MemoryStream stream;
RtpDumpWriter writer(&stream);
writer.set_packet_filter(PF_RTCPPACKET);
@@ -220,18 +220,18 @@
RtpDumpPacket packet;
RtpDumpReader reader(&stream);
for (size_t i = 0; i < RtpTestUtility::GetTestPacketCount(); ++i) {
- EXPECT_EQ(talk_base::SR_SUCCESS, reader.ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_SUCCESS, reader.ReadPacket(&packet));
EXPECT_TRUE(packet.is_rtcp());
EXPECT_EQ(0U, packet.original_data_len);
}
// No more packets to read.
- EXPECT_EQ(talk_base::SR_EOS, reader.ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_EOS, reader.ReadPacket(&packet));
}
// Test that RtpDumpLoopReader reads RTP packets continously and the elapsed
// time, the sequence number, and timestamp are maintained properly.
TEST(RtpDumpTest, LoopReadRtp) {
- talk_base::MemoryStream stream;
+ rtc::MemoryStream stream;
RtpDumpWriter writer(&stream);
ASSERT_TRUE(RtpTestUtility::WriteTestPackets(
RtpTestUtility::GetTestPacketCount(), false, kTestSsrc, &writer));
@@ -242,7 +242,7 @@
// Test that RtpDumpLoopReader reads RTCP packets continously and the elapsed
// time is maintained properly.
TEST(RtpDumpTest, LoopReadRtcp) {
- talk_base::MemoryStream stream;
+ rtc::MemoryStream stream;
RtpDumpWriter writer(&stream);
ASSERT_TRUE(RtpTestUtility::WriteTestPackets(
RtpTestUtility::GetTestPacketCount(), true, kTestSsrc, &writer));
@@ -253,7 +253,7 @@
// Test that RtpDumpLoopReader reads continously from stream with a single RTP
// packets.
TEST(RtpDumpTest, LoopReadSingleRtp) {
- talk_base::MemoryStream stream;
+ rtc::MemoryStream stream;
RtpDumpWriter writer(&stream);
ASSERT_TRUE(RtpTestUtility::WriteTestPackets(1, false, kTestSsrc, &writer));
@@ -261,21 +261,21 @@
RtpDumpPacket packet;
stream.Rewind();
RtpDumpReader reader(&stream);
- EXPECT_EQ(talk_base::SR_SUCCESS, reader.ReadPacket(&packet));
- EXPECT_EQ(talk_base::SR_EOS, reader.ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_SUCCESS, reader.ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_EOS, reader.ReadPacket(&packet));
// The loop reader reads three packets from the input stream.
stream.Rewind();
RtpDumpLoopReader loop_reader(&stream);
- EXPECT_EQ(talk_base::SR_SUCCESS, loop_reader.ReadPacket(&packet));
- EXPECT_EQ(talk_base::SR_SUCCESS, loop_reader.ReadPacket(&packet));
- EXPECT_EQ(talk_base::SR_SUCCESS, loop_reader.ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_SUCCESS, loop_reader.ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_SUCCESS, loop_reader.ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_SUCCESS, loop_reader.ReadPacket(&packet));
}
// Test that RtpDumpLoopReader reads continously from stream with a single RTCP
// packets.
TEST(RtpDumpTest, LoopReadSingleRtcp) {
- talk_base::MemoryStream stream;
+ rtc::MemoryStream stream;
RtpDumpWriter writer(&stream);
ASSERT_TRUE(RtpTestUtility::WriteTestPackets(1, true, kTestSsrc, &writer));
@@ -283,15 +283,15 @@
RtpDumpPacket packet;
stream.Rewind();
RtpDumpReader reader(&stream);
- EXPECT_EQ(talk_base::SR_SUCCESS, reader.ReadPacket(&packet));
- EXPECT_EQ(talk_base::SR_EOS, reader.ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_SUCCESS, reader.ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_EOS, reader.ReadPacket(&packet));
// The loop reader reads three packets from the input stream.
stream.Rewind();
RtpDumpLoopReader loop_reader(&stream);
- EXPECT_EQ(talk_base::SR_SUCCESS, loop_reader.ReadPacket(&packet));
- EXPECT_EQ(talk_base::SR_SUCCESS, loop_reader.ReadPacket(&packet));
- EXPECT_EQ(talk_base::SR_SUCCESS, loop_reader.ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_SUCCESS, loop_reader.ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_SUCCESS, loop_reader.ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_SUCCESS, loop_reader.ReadPacket(&packet));
}
} // namespace cricket
diff --git a/media/base/rtputils.cc b/media/base/rtputils.cc
index 221d949..8c35983 100644
--- a/media/base/rtputils.cc
+++ b/media/base/rtputils.cc
@@ -50,7 +50,7 @@
return false;
}
*value = static_cast<int>(
- talk_base::GetBE16(static_cast<const uint8*>(data) + offset));
+ rtc::GetBE16(static_cast<const uint8*>(data) + offset));
return true;
}
@@ -58,7 +58,7 @@
if (!data || !value) {
return false;
}
- *value = talk_base::GetBE32(static_cast<const uint8*>(data) + offset);
+ *value = rtc::GetBE32(static_cast<const uint8*>(data) + offset);
return true;
}
@@ -66,7 +66,7 @@
if (!data) {
return false;
}
- talk_base::Set8(data, offset, value);
+ rtc::Set8(data, offset, value);
return true;
}
@@ -74,7 +74,7 @@
if (!data) {
return false;
}
- talk_base::SetBE16(static_cast<uint8*>(data) + offset, value);
+ rtc::SetBE16(static_cast<uint8*>(data) + offset, value);
return true;
}
@@ -82,7 +82,7 @@
if (!data) {
return false;
}
- talk_base::SetBE32(static_cast<uint8*>(data) + offset, value);
+ rtc::SetBE32(static_cast<uint8*>(data) + offset, value);
return true;
}
@@ -134,7 +134,7 @@
// If there's an extension, read and add in the extension size.
if (header[0] & 0x10) {
if (len < header_size + sizeof(uint32)) return false;
- header_size += ((talk_base::GetBE16(header + header_size + 2) + 1) *
+ header_size += ((rtc::GetBE16(header + header_size + 2) + 1) *
sizeof(uint32));
if (len < header_size) return false;
}
@@ -176,7 +176,7 @@
if (!GetRtcpType(data, len, &pl_type)) return false;
// SDES packet parsing is not supported.
if (pl_type == kRtcpTypeSDES) return false;
- *value = talk_base::GetBE32(static_cast<const uint8*>(data) + 4);
+ *value = rtc::GetBE32(static_cast<const uint8*>(data) + 4);
return true;
}
diff --git a/media/base/rtputils.h b/media/base/rtputils.h
index f653e42..ca69ace 100644
--- a/media/base/rtputils.h
+++ b/media/base/rtputils.h
@@ -28,7 +28,7 @@
#ifndef TALK_MEDIA_BASE_RTPUTILS_H_
#define TALK_MEDIA_BASE_RTPUTILS_H_
-#include "talk/base/byteorder.h"
+#include "webrtc/base/byteorder.h"
namespace cricket {
diff --git a/media/base/rtputils_unittest.cc b/media/base/rtputils_unittest.cc
index d3ea521..b06f78b 100644
--- a/media/base/rtputils_unittest.cc
+++ b/media/base/rtputils_unittest.cc
@@ -25,7 +25,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/gunit.h"
+#include "webrtc/base/gunit.h"
#include "talk/media/base/fakertp.h"
#include "talk/media/base/rtputils.h"
diff --git a/media/base/screencastid.h b/media/base/screencastid.h
index d1f84f3..b70c172 100644
--- a/media/base/screencastid.h
+++ b/media/base/screencastid.h
@@ -9,8 +9,8 @@
#include <string>
#include <vector>
-#include "talk/base/window.h"
-#include "talk/base/windowpicker.h"
+#include "webrtc/base/window.h"
+#include "webrtc/base/windowpicker.h"
namespace cricket {
@@ -24,16 +24,16 @@
// Default constructor indicates invalid ScreencastId.
ScreencastId() : type_(INVALID) {}
- explicit ScreencastId(const talk_base::WindowId& id)
+ explicit ScreencastId(const rtc::WindowId& id)
: type_(WINDOW), window_(id) {
}
- explicit ScreencastId(const talk_base::DesktopId& id)
+ explicit ScreencastId(const rtc::DesktopId& id)
: type_(DESKTOP), desktop_(id) {
}
Type type() const { return type_; }
- const talk_base::WindowId& window() const { return window_; }
- const talk_base::DesktopId& desktop() const { return desktop_; }
+ const rtc::WindowId& window() const { return window_; }
+ const rtc::DesktopId& desktop() const { return desktop_; }
// Title is an optional parameter.
const std::string& title() const { return title_; }
@@ -78,8 +78,8 @@
private:
Type type_;
- talk_base::WindowId window_;
- talk_base::DesktopId desktop_;
+ rtc::WindowId window_;
+ rtc::DesktopId desktop_;
std::string title_; // Optional.
};
diff --git a/media/base/streamparams.cc b/media/base/streamparams.cc
index 19d8269..09bfefb 100644
--- a/media/base/streamparams.cc
+++ b/media/base/streamparams.cc
@@ -97,6 +97,26 @@
ost << "}";
return ost.str();
}
+void StreamParams::GetPrimarySsrcs(std::vector<uint32>* ssrcs) const {
+ const SsrcGroup* sim_group = get_ssrc_group(kSimSsrcGroupSemantics);
+ if (sim_group == NULL) {
+ ssrcs->push_back(first_ssrc());
+ } else {
+ for (size_t i = 0; i < sim_group->ssrcs.size(); ++i) {
+ ssrcs->push_back(sim_group->ssrcs[i]);
+ }
+ }
+}
+
+void StreamParams::GetFidSsrcs(const std::vector<uint32>& primary_ssrcs,
+ std::vector<uint32>* fid_ssrcs) const {
+ for (size_t i = 0; i < primary_ssrcs.size(); ++i) {
+ uint32 fid_ssrc;
+ if (GetFidSsrc(primary_ssrcs[i], &fid_ssrc)) {
+ fid_ssrcs->push_back(fid_ssrc);
+ }
+ }
+}
bool StreamParams::AddSecondarySsrc(const std::string& semantics,
uint32 primary_ssrc,
diff --git a/media/base/streamparams.h b/media/base/streamparams.h
index b57f1f7..43b5996 100644
--- a/media/base/streamparams.h
+++ b/media/base/streamparams.h
@@ -48,7 +48,7 @@
#include <set>
#include <vector>
-#include "talk/base/basictypes.h"
+#include "webrtc/base/basictypes.h"
namespace cricket {
@@ -141,6 +141,16 @@
return GetSecondarySsrc(kFidSsrcGroupSemantics, primary_ssrc, fid_ssrc);
}
+ // Convenience to get all the SIM SSRCs if there are SIM ssrcs, or
+ // the first SSRC otherwise.
+ void GetPrimarySsrcs(std::vector<uint32>* ssrcs) const;
+
+ // Convenience to get all the FID SSRCs for the given primary ssrcs.
+ // If a given primary SSRC does not have a FID SSRC, the list of FID
+ // SSRCS will be smaller than the list of primary SSRCs.
+ void GetFidSsrcs(const std::vector<uint32>& primary_ssrcs,
+ std::vector<uint32>* fid_ssrcs) const;
+
std::string ToString() const;
// Resource of the MUC jid of the participant of with this stream.
diff --git a/media/base/streamparams_unittest.cc b/media/base/streamparams_unittest.cc
index f3a03d6..8d51d7d 100644
--- a/media/base/streamparams_unittest.cc
+++ b/media/base/streamparams_unittest.cc
@@ -25,7 +25,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/gunit.h"
+#include "webrtc/base/gunit.h"
#include "talk/media/base/streamparams.h"
#include "talk/media/base/testutils.h"
@@ -159,6 +159,38 @@
EXPECT_FALSE(sp_invalid.GetFidSsrc(13, &fid_ssrc));
}
+TEST(StreamParams, GetPrimaryAndFidSsrcs) {
+ cricket::StreamParams sp;
+ sp.ssrcs.push_back(1);
+ sp.ssrcs.push_back(2);
+ sp.ssrcs.push_back(3);
+
+ std::vector<uint32> primary_ssrcs;
+ sp.GetPrimarySsrcs(&primary_ssrcs);
+ std::vector<uint32> fid_ssrcs;
+ sp.GetFidSsrcs(primary_ssrcs, &fid_ssrcs);
+ ASSERT_EQ(1u, primary_ssrcs.size());
+ EXPECT_EQ(1u, primary_ssrcs[0]);
+ ASSERT_EQ(0u, fid_ssrcs.size());
+
+ sp.ssrc_groups.push_back(
+ cricket::SsrcGroup(cricket::kSimSsrcGroupSemantics, sp.ssrcs));
+ sp.AddFidSsrc(1, 10);
+ sp.AddFidSsrc(2, 20);
+
+ primary_ssrcs.clear();
+ sp.GetPrimarySsrcs(&primary_ssrcs);
+ fid_ssrcs.clear();
+ sp.GetFidSsrcs(primary_ssrcs, &fid_ssrcs);
+ ASSERT_EQ(3u, primary_ssrcs.size());
+ EXPECT_EQ(1u, primary_ssrcs[0]);
+ EXPECT_EQ(2u, primary_ssrcs[1]);
+ EXPECT_EQ(3u, primary_ssrcs[2]);
+ ASSERT_EQ(2u, fid_ssrcs.size());
+ EXPECT_EQ(10u, fid_ssrcs[0]);
+ EXPECT_EQ(20u, fid_ssrcs[1]);
+}
+
TEST(StreamParams, ToString) {
cricket::StreamParams sp =
CreateStreamParamsWithSsrcGroup("XYZ", kSsrcs2, ARRAY_SIZE(kSsrcs2));
diff --git a/media/base/testutils.cc b/media/base/testutils.cc
index 7320613..c06e9e1 100644
--- a/media/base/testutils.cc
+++ b/media/base/testutils.cc
@@ -29,13 +29,13 @@
#include <math.h>
-#include "talk/base/bytebuffer.h"
-#include "talk/base/fileutils.h"
-#include "talk/base/gunit.h"
-#include "talk/base/pathutils.h"
-#include "talk/base/stream.h"
-#include "talk/base/stringutils.h"
-#include "talk/base/testutils.h"
+#include "webrtc/base/bytebuffer.h"
+#include "webrtc/base/fileutils.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/pathutils.h"
+#include "webrtc/base/stream.h"
+#include "webrtc/base/stringutils.h"
+#include "webrtc/base/testutils.h"
#include "talk/media/base/rtpdump.h"
#include "talk/media/base/videocapturer.h"
#include "talk/media/base/videoframe.h"
@@ -46,7 +46,7 @@
// Implementation of RawRtpPacket
/////////////////////////////////////////////////////////////////////////
void RawRtpPacket::WriteToByteBuffer(
- uint32 in_ssrc, talk_base::ByteBuffer *buf) const {
+ uint32 in_ssrc, rtc::ByteBuffer *buf) const {
if (!buf) return;
buf->WriteUInt8(ver_to_cc);
@@ -57,7 +57,7 @@
buf->WriteBytes(payload, sizeof(payload));
}
-bool RawRtpPacket::ReadFromByteBuffer(talk_base::ByteBuffer* buf) {
+bool RawRtpPacket::ReadFromByteBuffer(rtc::ByteBuffer* buf) {
if (!buf) return false;
bool ret = true;
@@ -83,7 +83,7 @@
/////////////////////////////////////////////////////////////////////////
// Implementation of RawRtcpPacket
/////////////////////////////////////////////////////////////////////////
-void RawRtcpPacket::WriteToByteBuffer(talk_base::ByteBuffer *buf) const {
+void RawRtcpPacket::WriteToByteBuffer(rtc::ByteBuffer *buf) const {
if (!buf) return;
buf->WriteUInt8(ver_to_count);
@@ -92,7 +92,7 @@
buf->WriteBytes(payload, sizeof(payload));
}
-bool RawRtcpPacket::ReadFromByteBuffer(talk_base::ByteBuffer* buf) {
+bool RawRtcpPacket::ReadFromByteBuffer(rtc::ByteBuffer* buf) {
if (!buf) return false;
bool ret = true;
@@ -128,7 +128,7 @@
};
size_t RtpTestUtility::GetTestPacketCount() {
- return talk_base::_min(
+ return rtc::_min(
ARRAY_SIZE(kTestRawRtpPackets),
ARRAY_SIZE(kTestRawRtcpPackets));
}
@@ -140,7 +140,7 @@
bool result = true;
uint32 elapsed_time_ms = 0;
for (size_t i = 0; i < count && result; ++i) {
- talk_base::ByteBuffer buf;
+ rtc::ByteBuffer buf;
if (rtcp) {
kTestRawRtcpPackets[i].WriteToByteBuffer(&buf);
} else {
@@ -149,13 +149,13 @@
RtpDumpPacket dump_packet(buf.Data(), buf.Length(), elapsed_time_ms, rtcp);
elapsed_time_ms += kElapsedTimeInterval;
- result &= (talk_base::SR_SUCCESS == writer->WritePacket(dump_packet));
+ result &= (rtc::SR_SUCCESS == writer->WritePacket(dump_packet));
}
return result;
}
bool RtpTestUtility::VerifyTestPacketsFromStream(
- size_t count, talk_base::StreamInterface* stream, uint32 ssrc) {
+ size_t count, rtc::StreamInterface* stream, uint32 ssrc) {
if (!stream) return false;
uint32 prev_elapsed_time = 0;
@@ -168,13 +168,13 @@
size_t index = i % GetTestPacketCount();
RtpDumpPacket packet;
- result &= (talk_base::SR_SUCCESS == reader.ReadPacket(&packet));
+ result &= (rtc::SR_SUCCESS == reader.ReadPacket(&packet));
// Check the elapsed time of the dump packet.
result &= (packet.elapsed_time >= prev_elapsed_time);
prev_elapsed_time = packet.elapsed_time;
// Check the RTP or RTCP packet.
- talk_base::ByteBuffer buf(reinterpret_cast<const char*>(&packet.data[0]),
+ rtc::ByteBuffer buf(reinterpret_cast<const char*>(&packet.data[0]),
packet.data.size());
if (packet.is_rtcp()) {
// RTCP packet.
@@ -204,7 +204,7 @@
bool header_only) {
if (!dump || !raw) return false;
- talk_base::ByteBuffer buf;
+ rtc::ByteBuffer buf;
raw->WriteToByteBuffer(RtpTestUtility::kDefaultSsrc, &buf);
if (header_only) {
@@ -255,7 +255,7 @@
// Returns the absolute path to a file in the testdata/ directory.
std::string GetTestFilePath(const std::string& filename) {
// Locate test data directory.
- talk_base::Pathname path = testing::GetTalkDirectory();
+ rtc::Pathname path = testing::GetTalkDirectory();
EXPECT_FALSE(path.empty()); // must be run from inside "talk"
path.AppendFolder("media");
path.AppendFolder("testdata");
@@ -269,25 +269,25 @@
std::stringstream ss;
ss << prefix << "." << width << "x" << height << "_P420.yuv";
- talk_base::scoped_ptr<talk_base::FileStream> stream(
- talk_base::Filesystem::OpenFile(talk_base::Pathname(
+ rtc::scoped_ptr<rtc::FileStream> stream(
+ rtc::Filesystem::OpenFile(rtc::Pathname(
GetTestFilePath(ss.str())), "rb"));
if (!stream) {
return false;
}
- talk_base::StreamResult res =
+ rtc::StreamResult res =
stream->ReadAll(out, I420_SIZE(width, height), NULL, NULL);
- return (res == talk_base::SR_SUCCESS);
+ return (res == rtc::SR_SUCCESS);
}
// Dumps the YUV image out to a file, for visual inspection.
// PYUV tool can be used to view dump files.
void DumpPlanarYuvTestImage(const std::string& prefix, const uint8* img,
int w, int h) {
- talk_base::FileStream fs;
+ rtc::FileStream fs;
char filename[256];
- talk_base::sprintfn(filename, sizeof(filename), "%s.%dx%d_P420.yuv",
+ rtc::sprintfn(filename, sizeof(filename), "%s.%dx%d_P420.yuv",
prefix.c_str(), w, h);
fs.Open(filename, "wb", NULL);
fs.Write(img, I420_SIZE(w, h), NULL, NULL);
@@ -297,9 +297,9 @@
// ffplay tool can be used to view dump files.
void DumpPlanarArgbTestImage(const std::string& prefix, const uint8* img,
int w, int h) {
- talk_base::FileStream fs;
+ rtc::FileStream fs;
char filename[256];
- talk_base::sprintfn(filename, sizeof(filename), "%s.%dx%d_ARGB.raw",
+ rtc::sprintfn(filename, sizeof(filename), "%s.%dx%d_ARGB.raw",
prefix.c_str(), w, h);
fs.Open(filename, "wb", NULL);
fs.Write(img, ARGB_SIZE(w, h), NULL, NULL);
diff --git a/media/base/testutils.h b/media/base/testutils.h
index dd13d5a..2d5f75f 100644
--- a/media/base/testutils.h
+++ b/media/base/testutils.h
@@ -34,14 +34,14 @@
#if !defined(DISABLE_YUV)
#include "libyuv/compare.h"
#endif
-#include "talk/base/basictypes.h"
-#include "talk/base/sigslot.h"
-#include "talk/base/window.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/window.h"
#include "talk/media/base/mediachannel.h"
#include "talk/media/base/videocapturer.h"
#include "talk/media/base/videocommon.h"
-namespace talk_base {
+namespace rtc {
class ByteBuffer;
class StreamInterface;
}
@@ -63,8 +63,8 @@
class VideoFrame;
struct RawRtpPacket {
- void WriteToByteBuffer(uint32 in_ssrc, talk_base::ByteBuffer* buf) const;
- bool ReadFromByteBuffer(talk_base::ByteBuffer* buf);
+ void WriteToByteBuffer(uint32 in_ssrc, rtc::ByteBuffer* buf) const;
+ bool ReadFromByteBuffer(rtc::ByteBuffer* buf);
// Check if this packet is the same as the specified packet except the
// sequence number and timestamp, which should be the same as the specified
// parameters.
@@ -81,8 +81,8 @@
};
struct RawRtcpPacket {
- void WriteToByteBuffer(talk_base::ByteBuffer* buf) const;
- bool ReadFromByteBuffer(talk_base::ByteBuffer* buf);
+ void WriteToByteBuffer(rtc::ByteBuffer* buf) const;
+ bool ReadFromByteBuffer(rtc::ByteBuffer* buf);
bool EqualsTo(const RawRtcpPacket& packet) const;
uint8 ver_to_count;
@@ -107,7 +107,7 @@
// payload. If the stream is a RTCP stream, verify the RTCP header and
// payload.
static bool VerifyTestPacketsFromStream(
- size_t count, talk_base::StreamInterface* stream, uint32 ssrc);
+ size_t count, rtc::StreamInterface* stream, uint32 ssrc);
// Verify the dump packet is the same as the raw RTP packet.
static bool VerifyPacket(const RtpDumpPacket* dump,
@@ -153,16 +153,16 @@
class ScreencastEventCatcher : public sigslot::has_slots<> {
public:
- ScreencastEventCatcher() : ssrc_(0), ev_(talk_base::WE_RESIZE) { }
+ ScreencastEventCatcher() : ssrc_(0), ev_(rtc::WE_RESIZE) { }
uint32 ssrc() const { return ssrc_; }
- talk_base::WindowEvent event() const { return ev_; }
- void OnEvent(uint32 ssrc, talk_base::WindowEvent ev) {
+ rtc::WindowEvent event() const { return ev_; }
+ void OnEvent(uint32 ssrc, rtc::WindowEvent ev) {
ssrc_ = ssrc;
ev_ = ev;
}
private:
uint32 ssrc_;
- talk_base::WindowEvent ev_;
+ rtc::WindowEvent ev_;
};
class VideoMediaErrorCatcher : public sigslot::has_slots<> {
diff --git a/media/base/videoadapter.cc b/media/base/videoadapter.cc
index 76ec527..4b550d2 100644
--- a/media/base/videoadapter.cc
+++ b/media/base/videoadapter.cc
@@ -27,8 +27,8 @@
#include <limits.h> // For INT_MAX
-#include "talk/base/logging.h"
-#include "talk/base/timeutils.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/timeutils.h"
#include "talk/media/base/constants.h"
#include "talk/media/base/videocommon.h"
#include "talk/media/base/videoframe.h"
@@ -178,10 +178,10 @@
}
void VideoAdapter::SetInputFormat(const VideoFormat& format) {
- talk_base::CritScope cs(&critical_section_);
+ rtc::CritScope cs(&critical_section_);
int64 old_input_interval = input_format_.interval;
input_format_ = format;
- output_format_.interval = talk_base::_max(
+ output_format_.interval = rtc::_max(
output_format_.interval, input_format_.interval);
if (old_input_interval != input_format_.interval) {
LOG(LS_INFO) << "VAdapt input interval changed from "
@@ -219,11 +219,11 @@
}
void VideoAdapter::SetOutputFormat(const VideoFormat& format) {
- talk_base::CritScope cs(&critical_section_);
+ rtc::CritScope cs(&critical_section_);
int64 old_output_interval = output_format_.interval;
output_format_ = format;
output_num_pixels_ = output_format_.width * output_format_.height;
- output_format_.interval = talk_base::_max(
+ output_format_.interval = rtc::_max(
output_format_.interval, input_format_.interval);
if (old_output_interval != output_format_.interval) {
LOG(LS_INFO) << "VAdapt output interval changed from "
@@ -232,7 +232,7 @@
}
const VideoFormat& VideoAdapter::input_format() {
- talk_base::CritScope cs(&critical_section_);
+ rtc::CritScope cs(&critical_section_);
return input_format_;
}
@@ -241,12 +241,12 @@
}
const VideoFormat& VideoAdapter::output_format() {
- talk_base::CritScope cs(&critical_section_);
+ rtc::CritScope cs(&critical_section_);
return output_format_;
}
void VideoAdapter::SetBlackOutput(bool black) {
- talk_base::CritScope cs(&critical_section_);
+ rtc::CritScope cs(&critical_section_);
black_output_ = black;
}
@@ -263,7 +263,7 @@
// not resolution.
bool VideoAdapter::AdaptFrame(VideoFrame* in_frame,
VideoFrame** out_frame) {
- talk_base::CritScope cs(&critical_section_);
+ rtc::CritScope cs(&critical_section_);
if (!in_frame || !out_frame) {
return false;
}
@@ -489,7 +489,7 @@
// A remote view request for a new resolution.
void CoordinatedVideoAdapter::OnOutputFormatRequest(const VideoFormat& format) {
- talk_base::CritScope cs(&request_critical_section_);
+ rtc::CritScope cs(&request_critical_section_);
if (!view_adaptation_) {
return;
}
@@ -553,7 +553,7 @@
// A Bandwidth GD request for new resolution
void CoordinatedVideoAdapter::OnEncoderResolutionRequest(
int width, int height, AdaptRequest request) {
- talk_base::CritScope cs(&request_critical_section_);
+ rtc::CritScope cs(&request_critical_section_);
if (!gd_adaptation_) {
return;
}
@@ -589,7 +589,7 @@
// A Bandwidth GD request for new resolution
void CoordinatedVideoAdapter::OnCpuResolutionRequest(AdaptRequest request) {
- talk_base::CritScope cs(&request_critical_section_);
+ rtc::CritScope cs(&request_critical_section_);
if (!cpu_adaptation_) {
return;
}
@@ -644,7 +644,7 @@
// TODO(fbarchard): Move outside adapter.
void CoordinatedVideoAdapter::OnCpuLoadUpdated(
int current_cpus, int max_cpus, float process_load, float system_load) {
- talk_base::CritScope cs(&request_critical_section_);
+ rtc::CritScope cs(&request_critical_section_);
if (!cpu_adaptation_) {
return;
}
diff --git a/media/base/videoadapter.h b/media/base/videoadapter.h
index 8881837..50b4a13 100644
--- a/media/base/videoadapter.h
+++ b/media/base/videoadapter.h
@@ -26,10 +26,10 @@
#ifndef TALK_MEDIA_BASE_VIDEOADAPTER_H_ // NOLINT
#define TALK_MEDIA_BASE_VIDEOADAPTER_H_
-#include "talk/base/common.h" // For ASSERT
-#include "talk/base/criticalsection.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/sigslot.h"
+#include "webrtc/base/common.h" // For ASSERT
+#include "webrtc/base/criticalsection.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/sigslot.h"
#include "talk/media/base/videocommon.h"
namespace cricket {
@@ -99,9 +99,9 @@
bool black_output_; // Flag to tell if we need to black output_frame_.
bool is_black_; // Flag to tell if output_frame_ is currently black.
int64 interval_next_frame_;
- talk_base::scoped_ptr<VideoFrame> output_frame_;
+ rtc::scoped_ptr<VideoFrame> output_frame_;
// The critical section to protect the above variables.
- talk_base::CriticalSection critical_section_;
+ rtc::CriticalSection critical_section_;
DISALLOW_COPY_AND_ASSIGN(VideoAdapter);
};
@@ -206,7 +206,7 @@
int cpu_desired_num_pixels_;
CoordinatedVideoAdapter::AdaptReason adapt_reason_;
// The critical section to protect handling requests.
- talk_base::CriticalSection request_critical_section_;
+ rtc::CriticalSection request_critical_section_;
// The weighted average of cpu load over time. It's always updated (if cpu
// adaptation is on), but only used if cpu_smoothing_ is set.
diff --git a/media/base/videocapturer.cc b/media/base/videocapturer.cc
index 59860a4..139fd09 100644
--- a/media/base/videocapturer.cc
+++ b/media/base/videocapturer.cc
@@ -32,9 +32,9 @@
#if !defined(DISABLE_YUV)
#include "libyuv/scale_argb.h"
#endif
-#include "talk/base/common.h"
-#include "talk/base/logging.h"
-#include "talk/base/systeminfo.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/systeminfo.h"
#include "talk/media/base/videoprocessor.h"
#if defined(HAVE_WEBRTC_VIDEO)
@@ -63,7 +63,7 @@
static const int kYU12Penalty = 16; // Needs to be higher than MJPG index.
#endif
static const int kDefaultScreencastFps = 5;
-typedef talk_base::TypedMessageData<CaptureState> StateChangeParams;
+typedef rtc::TypedMessageData<CaptureState> StateChangeParams;
// Limit stats data collections to ~20 seconds of 30fps data before dropping
// old data in case stats aren't reset for long periods of time.
@@ -99,14 +99,14 @@
// Implementation of class VideoCapturer
/////////////////////////////////////////////////////////////////////
VideoCapturer::VideoCapturer()
- : thread_(talk_base::Thread::Current()),
+ : thread_(rtc::Thread::Current()),
adapt_frame_drops_data_(kMaxAccumulatorSize),
effect_frame_drops_data_(kMaxAccumulatorSize),
frame_time_data_(kMaxAccumulatorSize) {
Construct();
}
-VideoCapturer::VideoCapturer(talk_base::Thread* thread)
+VideoCapturer::VideoCapturer(rtc::Thread* thread)
: thread_(thread),
adapt_frame_drops_data_(kMaxAccumulatorSize),
effect_frame_drops_data_(kMaxAccumulatorSize),
@@ -176,7 +176,7 @@
return false;
}
LOG(LS_INFO) << "Pausing a camera.";
- talk_base::scoped_ptr<VideoFormat> capture_format_when_paused(
+ rtc::scoped_ptr<VideoFormat> capture_format_when_paused(
capture_format_ ? new VideoFormat(*capture_format_) : NULL);
Stop();
SetCaptureState(CS_PAUSED);
@@ -284,14 +284,14 @@
}
void VideoCapturer::AddVideoProcessor(VideoProcessor* video_processor) {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
ASSERT(std::find(video_processors_.begin(), video_processors_.end(),
video_processor) == video_processors_.end());
video_processors_.push_back(video_processor);
}
bool VideoCapturer::RemoveVideoProcessor(VideoProcessor* video_processor) {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
VideoProcessors::iterator found = std::find(
video_processors_.begin(), video_processors_.end(), video_processor);
if (found == video_processors_.end()) {
@@ -328,7 +328,7 @@
VariableInfo<int>* effect_drops_stats,
VariableInfo<double>* frame_time_stats,
VideoFormat* last_captured_frame_format) {
- talk_base::CritScope cs(&frame_stats_crit_);
+ rtc::CritScope cs(&frame_stats_crit_);
GetVariableSnapshot(adapt_frame_drops_data_, adapt_drops_stats);
GetVariableSnapshot(effect_frame_drops_data_, effect_drops_stats);
GetVariableSnapshot(frame_time_data_, frame_time_stats);
@@ -407,7 +407,7 @@
// TODO(fbarchard): Avoid scale and convert if muted.
// Temporary buffer is scoped here so it will persist until i420_frame.Init()
// makes a copy of the frame, converting to I420.
- talk_base::scoped_ptr<uint8[]> temp_buffer;
+ rtc::scoped_ptr<uint8[]> temp_buffer;
// YUY2 can be scaled vertically using an ARGB scaler. Aspect ratio is only
// a problem on OSX. OSX always converts webcams to YUY2 or UYVY.
bool can_scale =
@@ -547,10 +547,10 @@
thread_->Post(this, MSG_STATE_CHANGE, state_params);
}
-void VideoCapturer::OnMessage(talk_base::Message* message) {
+void VideoCapturer::OnMessage(rtc::Message* message) {
switch (message->message_id) {
case MSG_STATE_CHANGE: {
- talk_base::scoped_ptr<StateChangeParams> p(
+ rtc::scoped_ptr<StateChangeParams> p(
static_cast<StateChangeParams*>(message->pdata));
SignalStateChange(this, p->data());
break;
@@ -667,7 +667,7 @@
bool VideoCapturer::ApplyProcessors(VideoFrame* video_frame) {
bool drop_frame = false;
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
for (VideoProcessors::iterator iter = video_processors_.begin();
iter != video_processors_.end(); ++iter) {
(*iter)->OnFrame(kDummyVideoSsrc, video_frame, &drop_frame);
@@ -710,7 +710,7 @@
void VideoCapturer::UpdateStats(const CapturedFrame* captured_frame) {
// Update stats protected from fetches from different thread.
- talk_base::CritScope cs(&frame_stats_crit_);
+ rtc::CritScope cs(&frame_stats_crit_);
last_captured_frame_format_.width = captured_frame->width;
last_captured_frame_format_.height = captured_frame->height;
@@ -731,7 +731,7 @@
template<class T>
void VideoCapturer::GetVariableSnapshot(
- const talk_base::RollingAccumulator<T>& data,
+ const rtc::RollingAccumulator<T>& data,
VariableInfo<T>* stats) {
stats->max_val = data.ComputeMax();
stats->mean = data.ComputeMean();
diff --git a/media/base/videocapturer.h b/media/base/videocapturer.h
index 6b1c46d..d4192be 100644
--- a/media/base/videocapturer.h
+++ b/media/base/videocapturer.h
@@ -31,14 +31,14 @@
#include <string>
#include <vector>
-#include "talk/base/basictypes.h"
-#include "talk/base/criticalsection.h"
-#include "talk/base/messagehandler.h"
-#include "talk/base/rollingaccumulator.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/sigslot.h"
-#include "talk/base/thread.h"
-#include "talk/base/timing.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/criticalsection.h"
+#include "webrtc/base/messagehandler.h"
+#include "webrtc/base/rollingaccumulator.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/thread.h"
+#include "webrtc/base/timing.h"
#include "talk/media/base/mediachannel.h"
#include "talk/media/base/videoadapter.h"
#include "talk/media/base/videocommon.h"
@@ -125,14 +125,14 @@
//
class VideoCapturer
: public sigslot::has_slots<>,
- public talk_base::MessageHandler {
+ public rtc::MessageHandler {
public:
typedef std::vector<VideoProcessor*> VideoProcessors;
// All signals are marshalled to |thread| or the creating thread if
// none is provided.
VideoCapturer();
- explicit VideoCapturer(talk_base::Thread* thread);
+ explicit VideoCapturer(rtc::Thread* thread);
virtual ~VideoCapturer() {}
// Gets the id of the underlying device, which is available after the capturer
@@ -273,7 +273,7 @@
// resolution of 2048 x 1280.
int screencast_max_pixels() const { return screencast_max_pixels_; }
void set_screencast_max_pixels(int p) {
- screencast_max_pixels_ = talk_base::_max(0, p);
+ screencast_max_pixels_ = rtc::_max(0, p);
}
// If true, run video adaptation. By default, video adaptation is enabled
@@ -304,7 +304,7 @@
void SetCaptureState(CaptureState state);
// Marshals SignalStateChange onto thread_.
- void OnMessage(talk_base::Message* message);
+ void OnMessage(rtc::Message* message);
// subclasses override this virtual method to provide a vector of fourccs, in
// order of preference, that are expected by the media engine.
@@ -355,15 +355,15 @@
// RollingAccumulator into stats.
template<class T>
static void GetVariableSnapshot(
- const talk_base::RollingAccumulator<T>& data,
+ const rtc::RollingAccumulator<T>& data,
VariableInfo<T>* stats);
- talk_base::Thread* thread_;
+ rtc::Thread* thread_;
std::string id_;
CaptureState capture_state_;
- talk_base::scoped_ptr<VideoFormat> capture_format_;
+ rtc::scoped_ptr<VideoFormat> capture_format_;
std::vector<VideoFormat> supported_formats_;
- talk_base::scoped_ptr<VideoFormat> max_format_;
+ rtc::scoped_ptr<VideoFormat> max_format_;
std::vector<VideoFormat> filtered_supported_formats_;
int ratio_w_; // View resolution. e.g. 1280 x 720.
@@ -379,19 +379,19 @@
bool enable_video_adapter_;
CoordinatedVideoAdapter video_adapter_;
- talk_base::Timing frame_length_time_reporter_;
- talk_base::CriticalSection frame_stats_crit_;
+ rtc::Timing frame_length_time_reporter_;
+ rtc::CriticalSection frame_stats_crit_;
int adapt_frame_drops_;
- talk_base::RollingAccumulator<int> adapt_frame_drops_data_;
+ rtc::RollingAccumulator<int> adapt_frame_drops_data_;
int effect_frame_drops_;
- talk_base::RollingAccumulator<int> effect_frame_drops_data_;
+ rtc::RollingAccumulator<int> effect_frame_drops_data_;
double previous_frame_time_;
- talk_base::RollingAccumulator<double> frame_time_data_;
+ rtc::RollingAccumulator<double> frame_time_data_;
// The captured frame format before potential adapation.
VideoFormat last_captured_frame_format_;
- talk_base::CriticalSection crit_;
+ rtc::CriticalSection crit_;
VideoProcessors video_processors_;
DISALLOW_COPY_AND_ASSIGN(VideoCapturer);
diff --git a/media/base/videocapturer_unittest.cc b/media/base/videocapturer_unittest.cc
index 9f025e3..b70280f 100644
--- a/media/base/videocapturer_unittest.cc
+++ b/media/base/videocapturer_unittest.cc
@@ -3,9 +3,9 @@
#include <stdio.h>
#include <vector>
-#include "talk/base/gunit.h"
-#include "talk/base/logging.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/thread.h"
#include "talk/media/base/fakemediaprocessor.h"
#include "talk/media/base/fakevideocapturer.h"
#include "talk/media/base/fakevideorenderer.h"
@@ -113,7 +113,7 @@
EXPECT_EQ_WAIT(cricket::CS_STOPPED, capture_state(), kMsCallbackWait);
EXPECT_EQ(2, num_state_changes());
capturer_.Stop();
- talk_base::Thread::Current()->ProcessMessages(100);
+ rtc::Thread::Current()->ProcessMessages(100);
EXPECT_EQ(2, num_state_changes());
}
@@ -135,7 +135,7 @@
EXPECT_TRUE(capturer_.IsRunning());
EXPECT_GE(1, num_state_changes());
capturer_.Stop();
- talk_base::Thread::Current()->ProcessMessages(100);
+ rtc::Thread::Current()->ProcessMessages(100);
EXPECT_FALSE(capturer_.IsRunning());
}
diff --git a/media/base/videocommon.cc b/media/base/videocommon.cc
index 12d0ee7..7c35d2a 100644
--- a/media/base/videocommon.cc
+++ b/media/base/videocommon.cc
@@ -29,7 +29,7 @@
#include <math.h>
#include <sstream>
-#include "talk/base/common.h"
+#include "webrtc/base/common.h"
namespace cricket {
diff --git a/media/base/videocommon.h b/media/base/videocommon.h
index c83a3d8..a175c13 100644
--- a/media/base/videocommon.h
+++ b/media/base/videocommon.h
@@ -30,8 +30,8 @@
#include <string>
-#include "talk/base/basictypes.h"
-#include "talk/base/timeutils.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/timeutils.h"
namespace cricket {
@@ -44,8 +44,8 @@
// Minimum interval is 10k fps.
#define FPS_TO_INTERVAL(fps) \
- (fps ? talk_base::kNumNanosecsPerSec / fps : \
- talk_base::kNumNanosecsPerSec / 10000)
+ (fps ? rtc::kNumNanosecsPerSec / fps : \
+ rtc::kNumNanosecsPerSec / 10000)
//////////////////////////////////////////////////////////////////////////////
// Definition of FourCC codes
@@ -186,7 +186,7 @@
struct VideoFormat : VideoFormatPod {
static const int64 kMinimumInterval =
- talk_base::kNumNanosecsPerSec / 10000; // 10k fps.
+ rtc::kNumNanosecsPerSec / 10000; // 10k fps.
VideoFormat() {
Construct(0, 0, 0, 0);
@@ -208,21 +208,21 @@
}
static int64 FpsToInterval(int fps) {
- return fps ? talk_base::kNumNanosecsPerSec / fps : kMinimumInterval;
+ return fps ? rtc::kNumNanosecsPerSec / fps : kMinimumInterval;
}
static int IntervalToFps(int64 interval) {
if (!interval) {
return 0;
}
- return static_cast<int>(talk_base::kNumNanosecsPerSec / interval);
+ return static_cast<int>(rtc::kNumNanosecsPerSec / interval);
}
static float IntervalToFpsFloat(int64 interval) {
if (!interval) {
return 0.f;
}
- return static_cast<float>(talk_base::kNumNanosecsPerSec) /
+ return static_cast<float>(rtc::kNumNanosecsPerSec) /
static_cast<float>(interval);
}
diff --git a/media/base/videocommon_unittest.cc b/media/base/videocommon_unittest.cc
index 90bcd0a..a30a2c9 100644
--- a/media/base/videocommon_unittest.cc
+++ b/media/base/videocommon_unittest.cc
@@ -25,7 +25,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/gunit.h"
+#include "webrtc/base/gunit.h"
#include "talk/media/base/videocommon.h"
namespace cricket {
@@ -55,8 +55,8 @@
// Test conversion between interval and fps
TEST(VideoCommonTest, TestVideoFormatFps) {
EXPECT_EQ(VideoFormat::kMinimumInterval, VideoFormat::FpsToInterval(0));
- EXPECT_EQ(talk_base::kNumNanosecsPerSec / 20, VideoFormat::FpsToInterval(20));
- EXPECT_EQ(20, VideoFormat::IntervalToFps(talk_base::kNumNanosecsPerSec / 20));
+ EXPECT_EQ(rtc::kNumNanosecsPerSec / 20, VideoFormat::FpsToInterval(20));
+ EXPECT_EQ(20, VideoFormat::IntervalToFps(rtc::kNumNanosecsPerSec / 20));
EXPECT_EQ(0, VideoFormat::IntervalToFps(0));
}
diff --git a/media/base/videoengine_unittest.h b/media/base/videoengine_unittest.h
index d0f8401..25811ba 100644
--- a/media/base/videoengine_unittest.h
+++ b/media/base/videoengine_unittest.h
@@ -29,9 +29,9 @@
#include <string>
#include <vector>
-#include "talk/base/bytebuffer.h"
-#include "talk/base/gunit.h"
-#include "talk/base/timeutils.h"
+#include "webrtc/base/bytebuffer.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/timeutils.h"
#include "talk/media/base/fakenetworkinterface.h"
#include "talk/media/base/fakevideocapturer.h"
#include "talk/media/base/fakevideorenderer.h"
@@ -61,6 +61,7 @@
EXPECT_EQ(0, (r).errors()); \
static const uint32 kTimeout = 5000U;
+static const uint32 kDefaultReceiveSsrc = 0;
static const uint32 kSsrc = 1234u;
static const uint32 kRtxSsrc = 4321u;
static const uint32 kSsrcs4[] = {1, 2, 3, 4};
@@ -86,7 +87,7 @@
inline int TimeBetweenSend(const cricket::VideoCodec& codec) {
return static_cast<int>(
cricket::VideoFormat::FpsToInterval(codec.framerate) /
- talk_base::kNumNanosecsPerMillisec);
+ rtc::kNumNanosecsPerMillisec);
}
// Fake video engine that makes it possible to test enabling and disabling
@@ -133,7 +134,7 @@
}
#define TEST_POST_VIDEOENGINE_INIT(TestClass, func) \
TEST_F(TestClass, func##PostInit) { \
- EXPECT_TRUE(engine_.Init(talk_base::Thread::Current())); \
+ EXPECT_TRUE(engine_.Init(rtc::Thread::Current())); \
func##Body(); \
engine_.Terminate(); \
}
@@ -143,7 +144,7 @@
protected:
// Tests starting and stopping the engine, and creating a channel.
void StartupShutdown() {
- EXPECT_TRUE(engine_.Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
cricket::VideoMediaChannel* channel = engine_.CreateChannel(NULL);
EXPECT_TRUE(channel != NULL);
delete channel;
@@ -158,7 +159,7 @@
EXPECT_EQ(S_OK, CoInitializeEx(NULL, COINIT_MULTITHREADED));
// Engine should start even with COM already inited.
- EXPECT_TRUE(engine_.Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
engine_.Terminate();
// Refcount after terminate should be 1; this tests if it is nonzero.
EXPECT_EQ(S_FALSE, CoInitializeEx(NULL, COINIT_MULTITHREADED));
@@ -478,7 +479,7 @@
}
VideoEngineOverride<E> engine_;
- talk_base::scoped_ptr<cricket::FakeVideoCapturer> video_capturer_;
+ rtc::scoped_ptr<cricket::FakeVideoCapturer> video_capturer_;
};
template<class E, class C>
@@ -493,13 +494,12 @@
virtual void SetUp() {
cricket::Device device("test", "device");
- EXPECT_TRUE(engine_.Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
channel_.reset(engine_.CreateChannel(NULL));
EXPECT_TRUE(channel_.get() != NULL);
ConnectVideoChannelError();
network_interface_.SetDestination(channel_.get());
channel_->SetInterface(&network_interface_);
- SetRendererAsDefault();
media_error_ = cricket::VideoMediaChannel::ERROR_NONE;
channel_->SetRecvCodecs(engine_.codecs());
EXPECT_TRUE(channel_->AddSendStream(DefaultSendStreamParams()));
@@ -527,6 +527,7 @@
// SetUp() already added kSsrc make sure duplicate SSRCs cant be added.
EXPECT_TRUE(channel_->AddRecvStream(
cricket::StreamParams::CreateLegacy(kSsrc)));
+ EXPECT_TRUE(channel_->SetRenderer(kSsrc, &renderer_));
EXPECT_FALSE(channel_->AddSendStream(
cricket::StreamParams::CreateLegacy(kSsrc)));
EXPECT_TRUE(channel_->AddSendStream(
@@ -553,9 +554,6 @@
bool SetDefaultCodec() {
return SetOneCodec(DefaultCodec());
}
- void SetRendererAsDefault() {
- EXPECT_TRUE(channel_->SetRenderer(0, &renderer_));
- }
bool SetOneCodec(int pt, const char* name, int w, int h, int fr) {
return SetOneCodec(cricket::VideoCodec(pt, name, w, h, fr, 0));
@@ -597,7 +595,7 @@
do {
packets = NumRtpPackets();
// 100 ms should be long enough.
- talk_base::Thread::Current()->ProcessMessages(100);
+ rtc::Thread::Current()->ProcessMessages(100);
} while (NumRtpPackets() > packets);
return NumRtpPackets();
}
@@ -609,7 +607,7 @@
video_capturer_->CaptureFrame();
}
bool WaitAndSendFrame(int wait_ms) {
- bool ret = talk_base::Thread::Current()->ProcessMessages(wait_ms);
+ bool ret = rtc::Thread::Current()->ProcessMessages(wait_ms);
ret &= SendFrame();
return ret;
}
@@ -649,24 +647,24 @@
int NumSentSsrcs() {
return network_interface_.NumSentSsrcs();
}
- const talk_base::Buffer* GetRtpPacket(int index) {
+ const rtc::Buffer* GetRtpPacket(int index) {
return network_interface_.GetRtpPacket(index);
}
int NumRtcpPackets() {
return network_interface_.NumRtcpPackets();
}
- const talk_base::Buffer* GetRtcpPacket(int index) {
+ const rtc::Buffer* GetRtcpPacket(int index) {
return network_interface_.GetRtcpPacket(index);
}
- static int GetPayloadType(const talk_base::Buffer* p) {
+ static int GetPayloadType(const rtc::Buffer* p) {
int pt = -1;
ParseRtpPacket(p, NULL, &pt, NULL, NULL, NULL, NULL);
return pt;
}
- static bool ParseRtpPacket(const talk_base::Buffer* p, bool* x, int* pt,
+ static bool ParseRtpPacket(const rtc::Buffer* p, bool* x, int* pt,
int* seqnum, uint32* tstamp, uint32* ssrc,
std::string* payload) {
- talk_base::ByteBuffer buf(p->data(), p->length());
+ rtc::ByteBuffer buf(p->data(), p->length());
uint8 u08 = 0;
uint16 u16 = 0;
uint32 u32 = 0;
@@ -725,8 +723,8 @@
bool CountRtcpFir(int start_index, int stop_index, int* fir_count) {
int count = 0;
for (int i = start_index; i < stop_index; ++i) {
- talk_base::scoped_ptr<const talk_base::Buffer> p(GetRtcpPacket(i));
- talk_base::ByteBuffer buf(p->data(), p->length());
+ rtc::scoped_ptr<const rtc::Buffer> p(GetRtcpPacket(i));
+ rtc::ByteBuffer buf(p->data(), p->length());
size_t total_len = 0;
// The packet may be a compound RTCP packet.
while (total_len < p->length()) {
@@ -793,7 +791,7 @@
EXPECT_TRUE(SetSend(true));
EXPECT_TRUE(SendFrame());
EXPECT_TRUE_WAIT(NumRtpPackets() > 0, kTimeout);
- talk_base::scoped_ptr<const talk_base::Buffer> p(GetRtpPacket(0));
+ rtc::scoped_ptr<const rtc::Buffer> p(GetRtpPacket(0));
EXPECT_EQ(codec.id, GetPayloadType(p.get()));
}
// Tests that we can send and receive frames.
@@ -801,10 +799,11 @@
EXPECT_TRUE(SetOneCodec(codec));
EXPECT_TRUE(SetSend(true));
EXPECT_TRUE(channel_->SetRender(true));
+ EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_));
EXPECT_EQ(0, renderer_.num_rendered_frames());
EXPECT_TRUE(SendFrame());
EXPECT_FRAME_WAIT(1, codec.width, codec.height, kTimeout);
- talk_base::scoped_ptr<const talk_base::Buffer> p(GetRtpPacket(0));
+ rtc::scoped_ptr<const rtc::Buffer> p(GetRtpPacket(0));
EXPECT_EQ(codec.id, GetPayloadType(p.get()));
}
// Tests that we only get a VideoRenderer::SetSize() callback when needed.
@@ -813,12 +812,13 @@
EXPECT_TRUE(SetOneCodec(codec));
EXPECT_TRUE(SetSend(true));
EXPECT_TRUE(channel_->SetRender(true));
+ EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_));
EXPECT_EQ(0, renderer_.num_rendered_frames());
EXPECT_TRUE(WaitAndSendFrame(30));
EXPECT_FRAME_WAIT(1, codec.width, codec.height, kTimeout);
EXPECT_TRUE(WaitAndSendFrame(30));
EXPECT_FRAME_WAIT(2, codec.width, codec.height, kTimeout);
- talk_base::scoped_ptr<const talk_base::Buffer> p(GetRtpPacket(0));
+ rtc::scoped_ptr<const rtc::Buffer> p(GetRtpPacket(0));
EXPECT_EQ(codec.id, GetPayloadType(p.get()));
EXPECT_EQ(1, renderer_.num_set_sizes());
@@ -834,6 +834,7 @@
EXPECT_TRUE(SetOneCodec(codec));
EXPECT_TRUE(SetSend(true));
EXPECT_TRUE(channel_->SetRender(true));
+ EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_));
EXPECT_EQ(0, renderer_.num_rendered_frames());
for (int i = 0; i < duration_sec; ++i) {
for (int frame = 1; frame <= fps; ++frame) {
@@ -852,7 +853,7 @@
// Therefore insert frames (and call GetStats each sec) for a few seconds
// before testing stats.
}
- talk_base::scoped_ptr<const talk_base::Buffer> p(GetRtpPacket(0));
+ rtc::scoped_ptr<const rtc::Buffer> p(GetRtpPacket(0));
EXPECT_EQ(codec.id, GetPayloadType(p.get()));
}
@@ -954,7 +955,8 @@
vmo.conference_mode.Set(true);
EXPECT_TRUE(channel_->SetOptions(vmo));
EXPECT_TRUE(channel_->AddRecvStream(
- cricket::StreamParams::CreateLegacy(1234)));
+ cricket::StreamParams::CreateLegacy(kSsrc)));
+ EXPECT_TRUE(channel_->SetRenderer(kSsrc, &renderer_));
channel_->UpdateAspectRatio(640, 400);
EXPECT_TRUE(SetSend(true));
EXPECT_TRUE(channel_->SetRender(true));
@@ -964,7 +966,7 @@
// Add an additional capturer, and hook up a renderer to receive it.
cricket::FakeVideoRenderer renderer1;
- talk_base::scoped_ptr<cricket::FakeVideoCapturer> capturer(
+ rtc::scoped_ptr<cricket::FakeVideoCapturer> capturer(
new cricket::FakeVideoCapturer);
capturer->SetScreencast(true);
const int kTestWidth = 160;
@@ -1016,7 +1018,7 @@
EXPECT_TRUE(SendFrame());
EXPECT_TRUE_WAIT(NumRtpPackets() > 0, kTimeout);
uint32 ssrc = 0;
- talk_base::scoped_ptr<const talk_base::Buffer> p(GetRtpPacket(0));
+ rtc::scoped_ptr<const rtc::Buffer> p(GetRtpPacket(0));
ParseRtpPacket(p.get(), NULL, NULL, NULL, NULL, &ssrc, NULL);
EXPECT_EQ(kSsrc, ssrc);
EXPECT_EQ(NumRtpPackets(), NumRtpPackets(ssrc));
@@ -1038,7 +1040,7 @@
EXPECT_TRUE(WaitAndSendFrame(0));
EXPECT_TRUE_WAIT(NumRtpPackets() > 0, kTimeout);
uint32 ssrc = 0;
- talk_base::scoped_ptr<const talk_base::Buffer> p(GetRtpPacket(0));
+ rtc::scoped_ptr<const rtc::Buffer> p(GetRtpPacket(0));
ParseRtpPacket(p.get(), NULL, NULL, NULL, NULL, &ssrc, NULL);
EXPECT_EQ(999u, ssrc);
EXPECT_EQ(NumRtpPackets(), NumRtpPackets(ssrc));
@@ -1054,15 +1056,15 @@
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
- talk_base::Buffer packet1(data1, sizeof(data1));
- talk_base::SetBE32(packet1.data() + 8, kSsrc);
- channel_->SetRenderer(0, NULL);
+ rtc::Buffer packet1(data1, sizeof(data1));
+ rtc::SetBE32(packet1.data() + 8, kSsrc);
+ channel_->SetRenderer(kDefaultReceiveSsrc, NULL);
EXPECT_TRUE(SetDefaultCodec());
EXPECT_TRUE(SetSend(true));
EXPECT_TRUE(channel_->SetRender(true));
EXPECT_EQ(0, renderer_.num_rendered_frames());
- channel_->OnPacketReceived(&packet1, talk_base::PacketTime());
- SetRendererAsDefault();
+ channel_->OnPacketReceived(&packet1, rtc::PacketTime());
+ EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_));
EXPECT_TRUE(SendFrame());
EXPECT_FRAME_WAIT(1, DefaultCodec().width, DefaultCodec().height, kTimeout);
}
@@ -1083,12 +1085,13 @@
EXPECT_TRUE(SetOneCodec(DefaultCodec()));
EXPECT_TRUE(SetSend(true));
EXPECT_TRUE(channel_->SetRender(true));
+ EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_));
EXPECT_TRUE(SendFrame());
EXPECT_FRAME_WAIT(1, DefaultCodec().width, DefaultCodec().height, kTimeout);
EXPECT_GE(2, NumRtpPackets());
uint32 ssrc = 0;
size_t last_packet = NumRtpPackets() - 1;
- talk_base::scoped_ptr<const talk_base::Buffer>
+ rtc::scoped_ptr<const rtc::Buffer>
p(GetRtpPacket(static_cast<int>(last_packet)));
ParseRtpPacket(p.get(), NULL, NULL, NULL, NULL, &ssrc, NULL);
EXPECT_EQ(kSsrc, ssrc);
@@ -1151,8 +1154,7 @@
EXPECT_TRUE(channel_->AddRecvStream(
cricket::StreamParams::CreateLegacy(2)));
EXPECT_TRUE(channel_->GetRenderer(1, &renderer));
- // Verify the first AddRecvStream hook up to the default renderer.
- EXPECT_EQ(&renderer_, renderer);
+ EXPECT_TRUE(renderer == NULL);
EXPECT_TRUE(channel_->GetRenderer(2, &renderer));
EXPECT_TRUE(NULL == renderer);
@@ -1196,7 +1198,7 @@
cricket::StreamParams::CreateLegacy(2)));
EXPECT_TRUE(channel_->GetRenderer(1, &renderer));
// Verify the first AddRecvStream hook up to the default renderer.
- EXPECT_EQ(&renderer_, renderer);
+ EXPECT_TRUE(renderer == NULL);
EXPECT_TRUE(channel_->GetRenderer(2, &renderer));
EXPECT_TRUE(NULL == renderer);
@@ -1291,7 +1293,7 @@
EXPECT_FRAME_ON_RENDERER_WAIT(
renderer2, 1, DefaultCodec().width, DefaultCodec().height, kTimeout);
- talk_base::scoped_ptr<const talk_base::Buffer> p(GetRtpPacket(0));
+ rtc::scoped_ptr<const rtc::Buffer> p(GetRtpPacket(0));
EXPECT_EQ(DefaultCodec().id, GetPayloadType(p.get()));
EXPECT_EQ(DefaultCodec().width, renderer1.width());
EXPECT_EQ(DefaultCodec().height, renderer1.height());
@@ -1310,10 +1312,11 @@
EXPECT_TRUE(SetOneCodec(codec));
EXPECT_TRUE(SetSend(true));
EXPECT_TRUE(channel_->SetRender(true));
+ EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_));
EXPECT_EQ(0, renderer_.num_rendered_frames());
EXPECT_TRUE(SendFrame());
EXPECT_FRAME_WAIT(1, codec.width, codec.height, kTimeout);
- talk_base::scoped_ptr<cricket::FakeVideoCapturer> capturer(
+ rtc::scoped_ptr<cricket::FakeVideoCapturer> capturer(
new cricket::FakeVideoCapturer);
capturer->SetScreencast(true);
cricket::VideoFormat format(480, 360,
@@ -1329,7 +1332,7 @@
int captured_frames = 1;
for (int iterations = 0; iterations < 2; ++iterations) {
EXPECT_TRUE(channel_->SetCapturer(kSsrc, capturer.get()));
- talk_base::Thread::Current()->ProcessMessages(time_between_send);
+ rtc::Thread::Current()->ProcessMessages(time_between_send);
EXPECT_TRUE(capturer->CaptureCustomFrame(format.width, format.height,
cricket::FOURCC_I420));
++captured_frames;
@@ -1370,6 +1373,7 @@
EXPECT_TRUE(SetOneCodec(DefaultCodec()));
EXPECT_TRUE(SetSend(true));
EXPECT_TRUE(channel_->SetRender(true));
+ EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_));
EXPECT_EQ(0, renderer_.num_rendered_frames());
EXPECT_TRUE(SendFrame());
EXPECT_FRAME_WAIT(1, 640, 400, kTimeout);
@@ -1381,7 +1385,7 @@
// No capturer was added, so this RemoveCapturer should
// fail.
EXPECT_FALSE(channel_->SetCapturer(kSsrc, NULL));
- talk_base::Thread::Current()->ProcessMessages(300);
+ rtc::Thread::Current()->ProcessMessages(300);
// Verify no more frames were sent.
EXPECT_EQ(2, renderer_.num_rendered_frames());
}
@@ -1406,7 +1410,7 @@
EXPECT_TRUE(channel_->SetRenderer(1, &renderer1));
EXPECT_TRUE(channel_->AddSendStream(
cricket::StreamParams::CreateLegacy(1)));
- talk_base::scoped_ptr<cricket::FakeVideoCapturer> capturer1(
+ rtc::scoped_ptr<cricket::FakeVideoCapturer> capturer1(
new cricket::FakeVideoCapturer);
capturer1->SetScreencast(true);
EXPECT_EQ(cricket::CS_RUNNING, capturer1->Start(capture_format));
@@ -1418,7 +1422,7 @@
EXPECT_TRUE(channel_->SetRenderer(2, &renderer2));
EXPECT_TRUE(channel_->AddSendStream(
cricket::StreamParams::CreateLegacy(2)));
- talk_base::scoped_ptr<cricket::FakeVideoCapturer> capturer2(
+ rtc::scoped_ptr<cricket::FakeVideoCapturer> capturer2(
new cricket::FakeVideoCapturer);
capturer2->SetScreencast(true);
EXPECT_EQ(cricket::CS_RUNNING, capturer2->Start(capture_format));
@@ -1476,7 +1480,7 @@
// Registering an external capturer is currently the same as screen casting
// (update the test when this changes).
- talk_base::scoped_ptr<cricket::FakeVideoCapturer> capturer(
+ rtc::scoped_ptr<cricket::FakeVideoCapturer> capturer(
new cricket::FakeVideoCapturer);
capturer->SetScreencast(true);
const std::vector<cricket::VideoFormat>* formats =
@@ -1486,7 +1490,7 @@
// Capture frame to not get same frame timestamps as previous capturer.
capturer->CaptureFrame();
EXPECT_TRUE(channel_->SetCapturer(kSsrc, capturer.get()));
- EXPECT_TRUE(talk_base::Thread::Current()->ProcessMessages(30));
+ EXPECT_TRUE(rtc::Thread::Current()->ProcessMessages(30));
EXPECT_TRUE(capturer->CaptureCustomFrame(kWidth, kHeight,
cricket::FOURCC_ARGB));
EXPECT_GT_FRAME_ON_RENDERER_WAIT(
@@ -1496,6 +1500,7 @@
// Tests that we can adapt video resolution with 16:10 aspect ratio properly.
void AdaptResolution16x10() {
+ EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_));
cricket::VideoCodec codec(DefaultCodec());
codec.width = 640;
codec.height = 400;
@@ -1509,6 +1514,7 @@
}
// Tests that we can adapt video resolution with 4:3 aspect ratio properly.
void AdaptResolution4x3() {
+ EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_));
cricket::VideoCodec codec(DefaultCodec());
codec.width = 640;
codec.height = 400;
@@ -1529,10 +1535,11 @@
EXPECT_TRUE(SetOneCodec(codec));
EXPECT_TRUE(SetSend(true));
EXPECT_TRUE(channel_->SetRender(true));
+ EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_));
EXPECT_EQ(0, renderer_.num_rendered_frames());
EXPECT_TRUE(SendFrame());
EXPECT_TRUE(SendFrame());
- talk_base::Thread::Current()->ProcessMessages(500);
+ rtc::Thread::Current()->ProcessMessages(500);
EXPECT_EQ(0, renderer_.num_rendered_frames());
}
// Tests that we can reduce the frame rate on demand properly.
@@ -1549,7 +1556,7 @@
EXPECT_TRUE(WaitAndSendFrame(30)); // Should be rendered.
frame_count += 2;
EXPECT_FRAME_WAIT(frame_count, codec.width, codec.height, kTimeout);
- talk_base::scoped_ptr<const talk_base::Buffer> p(GetRtpPacket(0));
+ rtc::scoped_ptr<const rtc::Buffer> p(GetRtpPacket(0));
EXPECT_EQ(codec.id, GetPayloadType(p.get()));
// The channel requires 15 fps.
@@ -1611,7 +1618,7 @@
EXPECT_TRUE(channel_->SetSendStreamFormat(kSsrc, format));
EXPECT_TRUE(SendFrame());
EXPECT_TRUE(SendFrame());
- talk_base::Thread::Current()->ProcessMessages(500);
+ rtc::Thread::Current()->ProcessMessages(500);
EXPECT_EQ(frame_count, renderer_.num_rendered_frames());
}
// Test that setting send stream format to 0x0 resolution will result in
@@ -1621,6 +1628,7 @@
EXPECT_TRUE(SetSendStreamFormat(kSsrc, DefaultCodec()));
EXPECT_TRUE(SetSend(true));
EXPECT_TRUE(channel_->SetRender(true));
+ EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_));
EXPECT_EQ(0, renderer_.num_rendered_frames());
// This frame should be received.
EXPECT_TRUE(SendFrame());
@@ -1635,14 +1643,13 @@
EXPECT_TRUE(channel_->SetSendStreamFormat(kSsrc, format));
// This frame should not be received.
EXPECT_TRUE(WaitAndSendFrame(
- static_cast<int>(interval/talk_base::kNumNanosecsPerMillisec)));
- talk_base::Thread::Current()->ProcessMessages(500);
+ static_cast<int>(interval/rtc::kNumNanosecsPerMillisec)));
+ rtc::Thread::Current()->ProcessMessages(500);
EXPECT_EQ(1, renderer_.num_rendered_frames());
}
// Tests that we can mute and unmute the channel properly.
void MuteStream() {
- int frame_count = 0;
EXPECT_TRUE(SetDefaultCodec());
cricket::FakeVideoCapturer video_capturer;
video_capturer.Start(
@@ -1653,9 +1660,11 @@
EXPECT_TRUE(channel_->SetCapturer(kSsrc, &video_capturer));
EXPECT_TRUE(SetSend(true));
EXPECT_TRUE(channel_->SetRender(true));
- EXPECT_EQ(frame_count, renderer_.num_rendered_frames());
+ EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_));
+ EXPECT_EQ(0, renderer_.num_rendered_frames());
// Mute the channel and expect black output frame.
+ int frame_count = 0;
EXPECT_TRUE(channel_->MuteStream(kSsrc, true));
EXPECT_TRUE(video_capturer.CaptureFrame());
++frame_count;
@@ -1664,7 +1673,7 @@
// Unmute the channel and expect non-black output frame.
EXPECT_TRUE(channel_->MuteStream(kSsrc, false));
- EXPECT_TRUE(talk_base::Thread::Current()->ProcessMessages(30));
+ EXPECT_TRUE(rtc::Thread::Current()->ProcessMessages(30));
EXPECT_TRUE(video_capturer.CaptureFrame());
++frame_count;
EXPECT_EQ_WAIT(frame_count, renderer_.num_rendered_frames(), kTimeout);
@@ -1672,14 +1681,14 @@
// Test that we can also Mute using the correct send stream SSRC.
EXPECT_TRUE(channel_->MuteStream(kSsrc, true));
- EXPECT_TRUE(talk_base::Thread::Current()->ProcessMessages(30));
+ EXPECT_TRUE(rtc::Thread::Current()->ProcessMessages(30));
EXPECT_TRUE(video_capturer.CaptureFrame());
++frame_count;
EXPECT_EQ_WAIT(frame_count, renderer_.num_rendered_frames(), kTimeout);
EXPECT_TRUE(renderer_.black_frame());
EXPECT_TRUE(channel_->MuteStream(kSsrc, false));
- EXPECT_TRUE(talk_base::Thread::Current()->ProcessMessages(30));
+ EXPECT_TRUE(rtc::Thread::Current()->ProcessMessages(30));
EXPECT_TRUE(video_capturer.CaptureFrame());
++frame_count;
EXPECT_EQ_WAIT(frame_count, renderer_.num_rendered_frames(), kTimeout);
@@ -1736,7 +1745,6 @@
EXPECT_FALSE(channel_->RemoveSendStream(kSsrc));
// Default channel is no longer used by a stream.
EXPECT_EQ(0u, channel_->GetDefaultChannelSsrc());
- SetRendererAsDefault();
uint32 new_ssrc = kSsrc + 100;
EXPECT_TRUE(channel_->AddSendStream(
cricket::StreamParams::CreateLegacy(new_ssrc)));
@@ -1746,6 +1754,7 @@
cricket::StreamParams::CreateLegacy(new_ssrc)));
EXPECT_TRUE(channel_->AddRecvStream(
cricket::StreamParams::CreateLegacy(new_ssrc)));
+ EXPECT_TRUE(channel_->SetRenderer(new_ssrc, &renderer_));
EXPECT_FALSE(channel_->AddRecvStream(
cricket::StreamParams::CreateLegacy(new_ssrc)));
@@ -1773,7 +1782,7 @@
// instead of packets.
EXPECT_EQ(0, renderer2_.num_rendered_frames());
// Give a chance for the decoder to process before adding the receiver.
- talk_base::Thread::Current()->ProcessMessages(100);
+ rtc::Thread::Current()->ProcessMessages(100);
// Test sending and receiving on second stream.
EXPECT_TRUE(channel_->AddRecvStream(
cricket::StreamParams::CreateLegacy(kSsrc + 2)));
@@ -1799,11 +1808,11 @@
EXPECT_TRUE(channel_->SetRender(true));
Send(codec);
EXPECT_EQ_WAIT(2, NumRtpPackets(), kTimeout);
- talk_base::Thread::Current()->ProcessMessages(100);
+ rtc::Thread::Current()->ProcessMessages(100);
EXPECT_EQ_WAIT(1, renderer_.num_rendered_frames(), kTimeout);
EXPECT_EQ_WAIT(0, renderer2_.num_rendered_frames(), kTimeout);
// Give a chance for the decoder to process before adding the receiver.
- talk_base::Thread::Current()->ProcessMessages(10);
+ rtc::Thread::Current()->ProcessMessages(10);
// Test sending and receiving on second stream.
EXPECT_TRUE(channel_->AddRecvStream(
cricket::StreamParams::CreateLegacy(kSsrc + 2)));
@@ -1834,7 +1843,7 @@
// is no registered recv channel for the ssrc.
EXPECT_TRUE_WAIT(renderer_.num_rendered_frames() >= 1, kTimeout);
// Give a chance for the decoder to process before adding the receiver.
- talk_base::Thread::Current()->ProcessMessages(100);
+ rtc::Thread::Current()->ProcessMessages(100);
// Test sending and receiving on second stream.
EXPECT_TRUE(channel_->AddRecvStream(
cricket::StreamParams::CreateLegacy(kSsrc + 2)));
@@ -1867,16 +1876,16 @@
// instead of packets.
EXPECT_EQ(0, renderer2_.num_rendered_frames());
// Give a chance for the decoder to process before adding the receiver.
- talk_base::Thread::Current()->ProcessMessages(100);
+ rtc::Thread::Current()->ProcessMessages(100);
// Ensure that we can remove the unsignalled recv stream that was created
// when the first video packet with unsignalled recv ssrc is received.
EXPECT_TRUE(channel_->RemoveRecvStream(kSsrc + 2));
}
VideoEngineOverride<E> engine_;
- talk_base::scoped_ptr<cricket::FakeVideoCapturer> video_capturer_;
- talk_base::scoped_ptr<cricket::FakeVideoCapturer> video_capturer_2_;
- talk_base::scoped_ptr<C> channel_;
+ rtc::scoped_ptr<cricket::FakeVideoCapturer> video_capturer_;
+ rtc::scoped_ptr<cricket::FakeVideoCapturer> video_capturer_2_;
+ rtc::scoped_ptr<C> channel_;
cricket::FakeNetworkInterface network_interface_;
cricket::FakeVideoRenderer renderer_;
cricket::VideoMediaChannel::Error media_error_;
diff --git a/media/base/videoframe.cc b/media/base/videoframe.cc
index cf5f852..d841693 100644
--- a/media/base/videoframe.cc
+++ b/media/base/videoframe.cc
@@ -35,7 +35,7 @@
#include "libyuv/scale.h"
#endif
-#include "talk/base/logging.h"
+#include "webrtc/base/logging.h"
#include "talk/media/base/videocommon.h"
namespace cricket {
@@ -43,9 +43,9 @@
// Round to 2 pixels because Chroma channels are half size.
#define ROUNDTO2(v) (v & ~1)
-talk_base::StreamResult VideoFrame::Write(talk_base::StreamInterface* stream,
+rtc::StreamResult VideoFrame::Write(rtc::StreamInterface* stream,
int* error) {
- talk_base::StreamResult result = talk_base::SR_SUCCESS;
+ rtc::StreamResult result = rtc::SR_SUCCESS;
const uint8* src_y = GetYPlane();
const uint8* src_u = GetUPlane();
const uint8* src_v = GetVPlane();
@@ -62,21 +62,21 @@
// Write Y.
for (size_t row = 0; row < height; ++row) {
result = stream->Write(src_y + row * y_pitch, width, NULL, error);
- if (result != talk_base::SR_SUCCESS) {
+ if (result != rtc::SR_SUCCESS) {
return result;
}
}
// Write U.
for (size_t row = 0; row < half_height; ++row) {
result = stream->Write(src_u + row * u_pitch, half_width, NULL, error);
- if (result != talk_base::SR_SUCCESS) {
+ if (result != rtc::SR_SUCCESS) {
return result;
}
}
// Write V.
for (size_t row = 0; row < half_height; ++row) {
result = stream->Write(src_v + row * v_pitch, half_width, NULL, error);
- if (result != talk_base::SR_SUCCESS) {
+ if (result != rtc::SR_SUCCESS) {
return result;
}
}
diff --git a/media/base/videoframe.h b/media/base/videoframe.h
index fe5ff01..d94e470 100644
--- a/media/base/videoframe.h
+++ b/media/base/videoframe.h
@@ -28,8 +28,8 @@
#ifndef TALK_MEDIA_BASE_VIDEOFRAME_H_
#define TALK_MEDIA_BASE_VIDEOFRAME_H_
-#include "talk/base/basictypes.h"
-#include "talk/base/stream.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/stream.h"
namespace cricket {
@@ -126,10 +126,10 @@
virtual void CopyToFrame(VideoFrame* target) const;
// Writes the frame into the given stream and returns the StreamResult.
- // See talk/base/stream.h for a description of StreamResult and error.
+ // See webrtc/base/stream.h for a description of StreamResult and error.
// Error may be NULL. If a non-success value is returned from
// StreamInterface::Write(), we immediately return with that value.
- virtual talk_base::StreamResult Write(talk_base::StreamInterface *stream,
+ virtual rtc::StreamResult Write(rtc::StreamInterface *stream,
int *error);
// Converts the I420 data to RGB of a certain type such as ARGB and ABGR.
diff --git a/media/base/videoframe_unittest.h b/media/base/videoframe_unittest.h
index d7be7e3..120f0e2 100644
--- a/media/base/videoframe_unittest.h
+++ b/media/base/videoframe_unittest.h
@@ -35,10 +35,10 @@
#include "libyuv/format_conversion.h"
#include "libyuv/planar_functions.h"
#include "libyuv/rotate.h"
-#include "talk/base/gunit.h"
-#include "talk/base/pathutils.h"
-#include "talk/base/stream.h"
-#include "talk/base/stringutils.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/pathutils.h"
+#include "webrtc/base/stream.h"
+#include "webrtc/base/stringutils.h"
#include "talk/media/base/testutils.h"
#include "talk/media/base/videocommon.h"
#include "talk/media/base/videoframe.h"
@@ -89,16 +89,16 @@
bool LoadFrame(const std::string& filename, uint32 format,
int32 width, int32 height, int dw, int dh, int rotation,
T* frame) {
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(LoadSample(filename));
+ rtc::scoped_ptr<rtc::MemoryStream> ms(LoadSample(filename));
return LoadFrame(ms.get(), format, width, height, dw, dh, rotation, frame);
}
// Load a video frame from a memory stream.
- bool LoadFrame(talk_base::MemoryStream* ms, uint32 format,
+ bool LoadFrame(rtc::MemoryStream* ms, uint32 format,
int32 width, int32 height, T* frame) {
return LoadFrame(ms, format, width, height,
width, abs(height), 0, frame);
}
- bool LoadFrame(talk_base::MemoryStream* ms, uint32 format,
+ bool LoadFrame(rtc::MemoryStream* ms, uint32 format,
int32 width, int32 height, int dw, int dh, int rotation,
T* frame) {
if (!ms) {
@@ -130,19 +130,19 @@
return ret;
}
- talk_base::MemoryStream* LoadSample(const std::string& filename) {
- talk_base::Pathname path(cricket::GetTestFilePath(filename));
- talk_base::scoped_ptr<talk_base::FileStream> fs(
- talk_base::Filesystem::OpenFile(path, "rb"));
+ rtc::MemoryStream* LoadSample(const std::string& filename) {
+ rtc::Pathname path(cricket::GetTestFilePath(filename));
+ rtc::scoped_ptr<rtc::FileStream> fs(
+ rtc::Filesystem::OpenFile(path, "rb"));
if (!fs.get()) {
return NULL;
}
char buf[4096];
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
- new talk_base::MemoryStream());
- talk_base::StreamResult res = Flow(fs.get(), buf, sizeof(buf), ms.get());
- if (res != talk_base::SR_SUCCESS) {
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
+ new rtc::MemoryStream());
+ rtc::StreamResult res = Flow(fs.get(), buf, sizeof(buf), ms.get());
+ if (res != rtc::SR_SUCCESS) {
return NULL;
}
@@ -153,24 +153,24 @@
bool DumpFrame(const std::string& prefix,
const cricket::VideoFrame& frame) {
char filename[256];
- talk_base::sprintfn(filename, sizeof(filename), "%s.%dx%d_P420.yuv",
+ rtc::sprintfn(filename, sizeof(filename), "%s.%dx%d_P420.yuv",
prefix.c_str(), frame.GetWidth(), frame.GetHeight());
size_t out_size = cricket::VideoFrame::SizeOf(frame.GetWidth(),
frame.GetHeight());
- talk_base::scoped_ptr<uint8[]> out(new uint8[out_size]);
+ rtc::scoped_ptr<uint8[]> out(new uint8[out_size]);
frame.CopyToBuffer(out.get(), out_size);
return DumpSample(filename, out.get(), out_size);
}
bool DumpSample(const std::string& filename, const void* buffer, int size) {
- talk_base::Pathname path(filename);
- talk_base::scoped_ptr<talk_base::FileStream> fs(
- talk_base::Filesystem::OpenFile(path, "wb"));
+ rtc::Pathname path(filename);
+ rtc::scoped_ptr<rtc::FileStream> fs(
+ rtc::Filesystem::OpenFile(path, "wb"));
if (!fs.get()) {
return false;
}
- return (fs->Write(buffer, size, NULL, NULL) == talk_base::SR_SUCCESS);
+ return (fs->Write(buffer, size, NULL, NULL) == rtc::SR_SUCCESS);
}
// Create a test image in the desired color space.
@@ -179,15 +179,15 @@
// The pattern is { { green, orange }, { blue, purple } }
// There is also a gradient within each square to ensure that the luma
// values are handled properly.
- talk_base::MemoryStream* CreateYuv422Sample(uint32 fourcc,
+ rtc::MemoryStream* CreateYuv422Sample(uint32 fourcc,
uint32 width, uint32 height) {
int y1_pos, y2_pos, u_pos, v_pos;
if (!GetYuv422Packing(fourcc, &y1_pos, &y2_pos, &u_pos, &v_pos)) {
return NULL;
}
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
- new talk_base::MemoryStream);
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
+ new rtc::MemoryStream);
int awidth = (width + 1) & ~1;
int size = awidth * 2 * height;
if (!ms->ReserveSize(size)) {
@@ -207,10 +207,10 @@
}
// Create a test image for YUV 420 formats with 12 bits per pixel.
- talk_base::MemoryStream* CreateYuvSample(uint32 width, uint32 height,
+ rtc::MemoryStream* CreateYuvSample(uint32 width, uint32 height,
uint32 bpp) {
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
- new talk_base::MemoryStream);
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
+ new rtc::MemoryStream);
if (!ms->ReserveSize(width * height * bpp / 8)) {
return NULL;
}
@@ -222,15 +222,15 @@
return ms.release();
}
- talk_base::MemoryStream* CreateRgbSample(uint32 fourcc,
+ rtc::MemoryStream* CreateRgbSample(uint32 fourcc,
uint32 width, uint32 height) {
int r_pos, g_pos, b_pos, bytes;
if (!GetRgbPacking(fourcc, &r_pos, &g_pos, &b_pos, &bytes)) {
return NULL;
}
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
- new talk_base::MemoryStream);
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
+ new rtc::MemoryStream);
if (!ms->ReserveSize(width * height * bytes)) {
return NULL;
}
@@ -249,7 +249,7 @@
// Simple conversion routines to verify the optimized VideoFrame routines.
// Converts from the specified colorspace to I420.
- bool ConvertYuv422(const talk_base::MemoryStream* ms,
+ bool ConvertYuv422(const rtc::MemoryStream* ms,
uint32 fourcc, uint32 width, uint32 height,
T* frame) {
int y1_pos, y2_pos, u_pos, v_pos;
@@ -287,7 +287,7 @@
// Convert RGB to 420.
// A negative height inverts the image.
- bool ConvertRgb(const talk_base::MemoryStream* ms,
+ bool ConvertRgb(const rtc::MemoryStream* ms,
uint32 fourcc, int32 width, int32 height,
T* frame) {
int r_pos, g_pos, b_pos, bytes;
@@ -482,7 +482,7 @@
void ConstructI420() {
T frame;
EXPECT_TRUE(IsNull(frame));
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
CreateYuvSample(kWidth, kHeight, 12));
EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_I420,
kWidth, kHeight, &frame));
@@ -497,7 +497,7 @@
// Test constructing an image from a YV12 buffer.
void ConstructYV12() {
T frame;
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
CreateYuvSample(kWidth, kHeight, 12));
EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_YV12,
kWidth, kHeight, &frame));
@@ -514,7 +514,7 @@
T frame1, frame2;
ASSERT_TRUE(LoadFrameNoRepeat(&frame1));
size_t buf_size = kWidth * kHeight * 2;
- talk_base::scoped_ptr<uint8[]> buf(new uint8[buf_size + kAlignment]);
+ rtc::scoped_ptr<uint8[]> buf(new uint8[buf_size + kAlignment]);
uint8* y = ALIGNP(buf.get(), kAlignment);
uint8* u = y + kWidth * kHeight;
uint8* v = u + (kWidth / 2) * kHeight;
@@ -535,7 +535,7 @@
T frame1, frame2;
ASSERT_TRUE(LoadFrameNoRepeat(&frame1));
size_t buf_size = kWidth * kHeight * 2;
- talk_base::scoped_ptr<uint8[]> buf(new uint8[buf_size + kAlignment]);
+ rtc::scoped_ptr<uint8[]> buf(new uint8[buf_size + kAlignment]);
uint8* yuy2 = ALIGNP(buf.get(), kAlignment);
EXPECT_EQ(0, libyuv::I420ToYUY2(frame1.GetYPlane(), frame1.GetYPitch(),
frame1.GetUPlane(), frame1.GetUPitch(),
@@ -552,7 +552,7 @@
T frame1, frame2;
ASSERT_TRUE(LoadFrameNoRepeat(&frame1));
size_t buf_size = kWidth * kHeight * 2;
- talk_base::scoped_ptr<uint8[]> buf(new uint8[buf_size + kAlignment + 1]);
+ rtc::scoped_ptr<uint8[]> buf(new uint8[buf_size + kAlignment + 1]);
uint8* yuy2 = ALIGNP(buf.get(), kAlignment) + 1;
EXPECT_EQ(0, libyuv::I420ToYUY2(frame1.GetYPlane(), frame1.GetYPitch(),
frame1.GetUPlane(), frame1.GetUPitch(),
@@ -568,7 +568,7 @@
// Normal is 1280x720. Wide is 12800x72
void ConstructYuy2Wide() {
T frame1, frame2;
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
CreateYuv422Sample(cricket::FOURCC_YUY2, kWidth * 10, kHeight / 10));
ASSERT_TRUE(ms.get() != NULL);
EXPECT_TRUE(ConvertYuv422(ms.get(), cricket::FOURCC_YUY2,
@@ -582,7 +582,7 @@
// Test constructing an image from a UYVY buffer.
void ConstructUyvy() {
T frame1, frame2;
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
CreateYuv422Sample(cricket::FOURCC_UYVY, kWidth, kHeight));
ASSERT_TRUE(ms.get() != NULL);
EXPECT_TRUE(ConvertYuv422(ms.get(), cricket::FOURCC_UYVY, kWidth, kHeight,
@@ -596,7 +596,7 @@
// We are merely verifying that the code succeeds and is free of crashes.
void ConstructM420() {
T frame;
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
CreateYuvSample(kWidth, kHeight, 12));
ASSERT_TRUE(ms.get() != NULL);
EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_M420,
@@ -605,7 +605,7 @@
void ConstructQ420() {
T frame;
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
CreateYuvSample(kWidth, kHeight, 12));
ASSERT_TRUE(ms.get() != NULL);
EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_Q420,
@@ -614,7 +614,7 @@
void ConstructNV21() {
T frame;
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
CreateYuvSample(kWidth, kHeight, 12));
ASSERT_TRUE(ms.get() != NULL);
EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_NV21,
@@ -623,7 +623,7 @@
void ConstructNV12() {
T frame;
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
CreateYuvSample(kWidth, kHeight, 12));
ASSERT_TRUE(ms.get() != NULL);
EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_NV12,
@@ -634,7 +634,7 @@
// Due to rounding, some pixels may differ slightly from the VideoFrame impl.
void ConstructABGR() {
T frame1, frame2;
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
CreateRgbSample(cricket::FOURCC_ABGR, kWidth, kHeight));
ASSERT_TRUE(ms.get() != NULL);
EXPECT_TRUE(ConvertRgb(ms.get(), cricket::FOURCC_ABGR, kWidth, kHeight,
@@ -648,7 +648,7 @@
// Due to rounding, some pixels may differ slightly from the VideoFrame impl.
void ConstructARGB() {
T frame1, frame2;
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
CreateRgbSample(cricket::FOURCC_ARGB, kWidth, kHeight));
ASSERT_TRUE(ms.get() != NULL);
EXPECT_TRUE(ConvertRgb(ms.get(), cricket::FOURCC_ARGB, kWidth, kHeight,
@@ -662,7 +662,7 @@
// Normal is 1280x720. Wide is 12800x72
void ConstructARGBWide() {
T frame1, frame2;
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
CreateRgbSample(cricket::FOURCC_ARGB, kWidth * 10, kHeight / 10));
ASSERT_TRUE(ms.get() != NULL);
EXPECT_TRUE(ConvertRgb(ms.get(), cricket::FOURCC_ARGB,
@@ -676,7 +676,7 @@
// Due to rounding, some pixels may differ slightly from the VideoFrame impl.
void ConstructBGRA() {
T frame1, frame2;
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
CreateRgbSample(cricket::FOURCC_BGRA, kWidth, kHeight));
ASSERT_TRUE(ms.get() != NULL);
EXPECT_TRUE(ConvertRgb(ms.get(), cricket::FOURCC_BGRA, kWidth, kHeight,
@@ -690,7 +690,7 @@
// Due to rounding, some pixels may differ slightly from the VideoFrame impl.
void Construct24BG() {
T frame1, frame2;
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
CreateRgbSample(cricket::FOURCC_24BG, kWidth, kHeight));
ASSERT_TRUE(ms.get() != NULL);
EXPECT_TRUE(ConvertRgb(ms.get(), cricket::FOURCC_24BG, kWidth, kHeight,
@@ -704,7 +704,7 @@
// Due to rounding, some pixels may differ slightly from the VideoFrame impl.
void ConstructRaw() {
T frame1, frame2;
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
CreateRgbSample(cricket::FOURCC_RAW, kWidth, kHeight));
ASSERT_TRUE(ms.get() != NULL);
EXPECT_TRUE(ConvertRgb(ms.get(), cricket::FOURCC_RAW, kWidth, kHeight,
@@ -718,7 +718,7 @@
void ConstructRGB565() {
T frame1, frame2;
size_t out_size = kWidth * kHeight * 2;
- talk_base::scoped_ptr<uint8[]> outbuf(new uint8[out_size + kAlignment]);
+ rtc::scoped_ptr<uint8[]> outbuf(new uint8[out_size + kAlignment]);
uint8 *out = ALIGNP(outbuf.get(), kAlignment);
T frame;
ASSERT_TRUE(LoadFrameNoRepeat(&frame1));
@@ -734,7 +734,7 @@
void ConstructARGB1555() {
T frame1, frame2;
size_t out_size = kWidth * kHeight * 2;
- talk_base::scoped_ptr<uint8[]> outbuf(new uint8[out_size + kAlignment]);
+ rtc::scoped_ptr<uint8[]> outbuf(new uint8[out_size + kAlignment]);
uint8 *out = ALIGNP(outbuf.get(), kAlignment);
T frame;
ASSERT_TRUE(LoadFrameNoRepeat(&frame1));
@@ -750,7 +750,7 @@
void ConstructARGB4444() {
T frame1, frame2;
size_t out_size = kWidth * kHeight * 2;
- talk_base::scoped_ptr<uint8[]> outbuf(new uint8[out_size + kAlignment]);
+ rtc::scoped_ptr<uint8[]> outbuf(new uint8[out_size + kAlignment]);
uint8 *out = ALIGNP(outbuf.get(), kAlignment);
T frame;
ASSERT_TRUE(LoadFrameNoRepeat(&frame1));
@@ -769,11 +769,11 @@
#define TEST_BYR(NAME, BAYER) \
void NAME() { \
size_t bayer_size = kWidth * kHeight; \
- talk_base::scoped_ptr<uint8[]> bayerbuf(new uint8[ \
+ rtc::scoped_ptr<uint8[]> bayerbuf(new uint8[ \
bayer_size + kAlignment]); \
uint8 *bayer = ALIGNP(bayerbuf.get(), kAlignment); \
T frame1, frame2; \
- talk_base::scoped_ptr<talk_base::MemoryStream> ms( \
+ rtc::scoped_ptr<rtc::MemoryStream> ms( \
CreateRgbSample(cricket::FOURCC_ARGB, kWidth, kHeight)); \
ASSERT_TRUE(ms.get() != NULL); \
libyuv::ARGBToBayer##BAYER(reinterpret_cast<uint8 *>(ms->GetBuffer()), \
@@ -798,7 +798,7 @@
#define TEST_MIRROR(FOURCC, BPP) \
void Construct##FOURCC##Mirror() { \
T frame1, frame2, frame3; \
- talk_base::scoped_ptr<talk_base::MemoryStream> ms( \
+ rtc::scoped_ptr<rtc::MemoryStream> ms( \
CreateYuvSample(kWidth, kHeight, BPP)); \
ASSERT_TRUE(ms.get() != NULL); \
EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_##FOURCC, \
@@ -831,7 +831,7 @@
#define TEST_ROTATE(FOURCC, BPP, ROTATE) \
void Construct##FOURCC##Rotate##ROTATE() { \
T frame1, frame2, frame3; \
- talk_base::scoped_ptr<talk_base::MemoryStream> ms( \
+ rtc::scoped_ptr<rtc::MemoryStream> ms( \
CreateYuvSample(kWidth, kHeight, BPP)); \
ASSERT_TRUE(ms.get() != NULL); \
EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_##FOURCC, \
@@ -887,7 +887,7 @@
// Test constructing an image from a UYVY buffer rotated 90 degrees.
void ConstructUyvyRotate90() {
T frame2;
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
CreateYuv422Sample(cricket::FOURCC_UYVY, kWidth, kHeight));
ASSERT_TRUE(ms.get() != NULL);
EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_UYVY,
@@ -898,7 +898,7 @@
// Test constructing an image from a UYVY buffer rotated 180 degrees.
void ConstructUyvyRotate180() {
T frame2;
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
CreateYuv422Sample(cricket::FOURCC_UYVY, kWidth, kHeight));
ASSERT_TRUE(ms.get() != NULL);
EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_UYVY,
@@ -909,7 +909,7 @@
// Test constructing an image from a UYVY buffer rotated 270 degrees.
void ConstructUyvyRotate270() {
T frame2;
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
CreateYuv422Sample(cricket::FOURCC_UYVY, kWidth, kHeight));
ASSERT_TRUE(ms.get() != NULL);
EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_UYVY,
@@ -920,7 +920,7 @@
// Test constructing an image from a YUY2 buffer rotated 90 degrees.
void ConstructYuy2Rotate90() {
T frame2;
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
CreateYuv422Sample(cricket::FOURCC_YUY2, kWidth, kHeight));
ASSERT_TRUE(ms.get() != NULL);
EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_YUY2,
@@ -931,7 +931,7 @@
// Test constructing an image from a YUY2 buffer rotated 180 degrees.
void ConstructYuy2Rotate180() {
T frame2;
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
CreateYuv422Sample(cricket::FOURCC_YUY2, kWidth, kHeight));
ASSERT_TRUE(ms.get() != NULL);
EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_YUY2,
@@ -942,7 +942,7 @@
// Test constructing an image from a YUY2 buffer rotated 270 degrees.
void ConstructYuy2Rotate270() {
T frame2;
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
CreateYuv422Sample(cricket::FOURCC_YUY2, kWidth, kHeight));
ASSERT_TRUE(ms.get() != NULL);
EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_YUY2,
@@ -994,7 +994,7 @@
}
// Convert back to ARGB.
size_t out_size = 4;
- talk_base::scoped_ptr<uint8[]> outbuf(new uint8[out_size + kAlignment]);
+ rtc::scoped_ptr<uint8[]> outbuf(new uint8[out_size + kAlignment]);
uint8 *out = ALIGNP(outbuf.get(), kAlignment);
EXPECT_EQ(out_size, frame.ConvertToRgbBuffer(cricket::FOURCC_ARGB,
@@ -1031,7 +1031,7 @@
}
// Convert back to ARGB
size_t out_size = 10 * 4;
- talk_base::scoped_ptr<uint8[]> outbuf(new uint8[out_size + kAlignment]);
+ rtc::scoped_ptr<uint8[]> outbuf(new uint8[out_size + kAlignment]);
uint8 *out = ALIGNP(outbuf.get(), kAlignment);
EXPECT_EQ(out_size, frame.ConvertToRgbBuffer(cricket::FOURCC_ARGB,
@@ -1055,7 +1055,7 @@
// Test constructing an image from a YUY2 buffer with horizontal cropping.
void ConstructYuy2CropHorizontal() {
T frame1, frame2;
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
CreateYuv422Sample(cricket::FOURCC_YUY2, kWidth, kHeight));
ASSERT_TRUE(ms.get() != NULL);
EXPECT_TRUE(ConvertYuv422(ms.get(), cricket::FOURCC_YUY2, kWidth, kHeight,
@@ -1068,7 +1068,7 @@
// Test constructing an image from an ARGB buffer with horizontal cropping.
void ConstructARGBCropHorizontal() {
T frame1, frame2;
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
CreateRgbSample(cricket::FOURCC_ARGB, kWidth, kHeight));
ASSERT_TRUE(ms.get() != NULL);
EXPECT_TRUE(ConvertRgb(ms.get(), cricket::FOURCC_ARGB, kWidth, kHeight,
@@ -1153,7 +1153,7 @@
void ValidateFrame(const char* name, uint32 fourcc, int data_adjust,
int size_adjust, bool expected_result) {
T frame;
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(LoadSample(name));
+ rtc::scoped_ptr<rtc::MemoryStream> ms(LoadSample(name));
ASSERT_TRUE(ms.get() != NULL);
const uint8* sample = reinterpret_cast<const uint8*>(ms.get()->GetBuffer());
size_t sample_size;
@@ -1163,7 +1163,7 @@
// Allocate a buffer with end page aligned.
const int kPadToHeapSized = 16 * 1024 * 1024;
- talk_base::scoped_ptr<uint8[]> page_buffer(
+ rtc::scoped_ptr<uint8[]> page_buffer(
new uint8[((data_size + kPadToHeapSized + 4095) & ~4095)]);
uint8* data_ptr = page_buffer.get();
if (!data_ptr) {
@@ -1172,7 +1172,7 @@
return;
}
data_ptr += kPadToHeapSized + (-(static_cast<int>(data_size)) & 4095);
- memcpy(data_ptr, sample, talk_base::_min(data_size, sample_size));
+ memcpy(data_ptr, sample, rtc::_min(data_size, sample_size));
for (int i = 0; i < repeat_; ++i) {
EXPECT_EQ(expected_result, frame.Validate(fourcc, kWidth, kHeight,
data_ptr,
@@ -1269,7 +1269,7 @@
// Test constructing an image from a YUY2 buffer (and synonymous formats).
void ConstructYuy2Aliases() {
T frame1, frame2, frame3, frame4;
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
CreateYuv422Sample(cricket::FOURCC_YUY2, kWidth, kHeight));
ASSERT_TRUE(ms.get() != NULL);
EXPECT_TRUE(ConvertYuv422(ms.get(), cricket::FOURCC_YUY2, kWidth, kHeight,
@@ -1288,7 +1288,7 @@
// Test constructing an image from a UYVY buffer (and synonymous formats).
void ConstructUyvyAliases() {
T frame1, frame2, frame3, frame4;
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
CreateYuv422Sample(cricket::FOURCC_UYVY, kWidth, kHeight));
ASSERT_TRUE(ms.get() != NULL);
EXPECT_TRUE(ConvertYuv422(ms.get(), cricket::FOURCC_UYVY, kWidth, kHeight,
@@ -1343,7 +1343,7 @@
T frame1, frame2;
for (int height = kMinHeightAll; height <= kMaxHeightAll; ++height) {
for (int width = kMinWidthAll; width <= kMaxWidthAll; ++width) {
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
CreateYuv422Sample(cricket::FOURCC_YUY2, width, height));
ASSERT_TRUE(ms.get() != NULL);
EXPECT_TRUE(ConvertYuv422(ms.get(), cricket::FOURCC_YUY2, width, height,
@@ -1361,7 +1361,7 @@
T frame1, frame2;
for (int height = kMinHeightAll; height <= kMaxHeightAll; ++height) {
for (int width = kMinWidthAll; width <= kMaxWidthAll; ++width) {
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
CreateRgbSample(cricket::FOURCC_ARGB, width, height));
ASSERT_TRUE(ms.get() != NULL);
EXPECT_TRUE(ConvertRgb(ms.get(), cricket::FOURCC_ARGB, width, height,
@@ -1376,7 +1376,7 @@
const int kOddHeight = 260;
for (int j = 0; j < 2; ++j) {
for (int i = 0; i < 2; ++i) {
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
CreateRgbSample(cricket::FOURCC_ARGB, kOddWidth + i, kOddHeight + j));
ASSERT_TRUE(ms.get() != NULL);
EXPECT_TRUE(ConvertRgb(ms.get(), cricket::FOURCC_ARGB,
@@ -1392,7 +1392,7 @@
// Tests re-initing an existing image.
void Reset() {
T frame1, frame2;
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
LoadSample(kImageFilename));
ASSERT_TRUE(ms.get() != NULL);
size_t data_size;
@@ -1429,7 +1429,7 @@
int astride = kWidth * bpp + rowpad;
size_t out_size = astride * kHeight;
- talk_base::scoped_ptr<uint8[]> outbuf(new uint8[out_size + kAlignment + 1]);
+ rtc::scoped_ptr<uint8[]> outbuf(new uint8[out_size + kAlignment + 1]);
memset(outbuf.get(), 0, out_size + kAlignment + 1);
uint8 *outtop = ALIGNP(outbuf.get(), kAlignment);
uint8 *out = outtop;
@@ -1843,7 +1843,7 @@
void ConvertToI422Buffer() {
T frame1, frame2;
size_t out_size = kWidth * kHeight * 2;
- talk_base::scoped_ptr<uint8[]> buf(new uint8[out_size + kAlignment]);
+ rtc::scoped_ptr<uint8[]> buf(new uint8[out_size + kAlignment]);
uint8* y = ALIGNP(buf.get(), kAlignment);
uint8* u = y + kWidth * kHeight;
uint8* v = u + (kWidth / 2) * kHeight;
@@ -1867,11 +1867,11 @@
#define TEST_TOBYR(NAME, BAYER) \
void NAME() { \
size_t bayer_size = kWidth * kHeight; \
- talk_base::scoped_ptr<uint8[]> bayerbuf(new uint8[ \
+ rtc::scoped_ptr<uint8[]> bayerbuf(new uint8[ \
bayer_size + kAlignment]); \
uint8 *bayer = ALIGNP(bayerbuf.get(), kAlignment); \
T frame; \
- talk_base::scoped_ptr<talk_base::MemoryStream> ms( \
+ rtc::scoped_ptr<rtc::MemoryStream> ms( \
CreateRgbSample(cricket::FOURCC_ARGB, kWidth, kHeight)); \
ASSERT_TRUE(ms.get() != NULL); \
for (int i = 0; i < repeat_; ++i) { \
@@ -1880,7 +1880,7 @@
bayer, kWidth, \
kWidth, kHeight); \
} \
- talk_base::scoped_ptr<talk_base::MemoryStream> ms2( \
+ rtc::scoped_ptr<rtc::MemoryStream> ms2( \
CreateRgbSample(cricket::FOURCC_ARGB, kWidth, kHeight)); \
size_t data_size; \
bool ret = ms2->GetSize(&data_size); \
@@ -1896,11 +1896,11 @@
} \
void NAME##Unaligned() { \
size_t bayer_size = kWidth * kHeight; \
- talk_base::scoped_ptr<uint8[]> bayerbuf(new uint8[ \
+ rtc::scoped_ptr<uint8[]> bayerbuf(new uint8[ \
bayer_size + 1 + kAlignment]); \
uint8 *bayer = ALIGNP(bayerbuf.get(), kAlignment) + 1; \
T frame; \
- talk_base::scoped_ptr<talk_base::MemoryStream> ms( \
+ rtc::scoped_ptr<rtc::MemoryStream> ms( \
CreateRgbSample(cricket::FOURCC_ARGB, kWidth, kHeight)); \
ASSERT_TRUE(ms.get() != NULL); \
for (int i = 0; i < repeat_; ++i) { \
@@ -1909,7 +1909,7 @@
bayer, kWidth, \
kWidth, kHeight); \
} \
- talk_base::scoped_ptr<talk_base::MemoryStream> ms2( \
+ rtc::scoped_ptr<rtc::MemoryStream> ms2( \
CreateRgbSample(cricket::FOURCC_ARGB, kWidth, kHeight)); \
size_t data_size; \
bool ret = ms2->GetSize(&data_size); \
@@ -1933,14 +1933,14 @@
#define TEST_BYRTORGB(NAME, BAYER) \
void NAME() { \
size_t bayer_size = kWidth * kHeight; \
- talk_base::scoped_ptr<uint8[]> bayerbuf(new uint8[ \
+ rtc::scoped_ptr<uint8[]> bayerbuf(new uint8[ \
bayer_size + kAlignment]); \
uint8 *bayer1 = ALIGNP(bayerbuf.get(), kAlignment); \
for (int i = 0; i < kWidth * kHeight; ++i) { \
bayer1[i] = static_cast<uint8>(i * 33u + 183u); \
} \
T frame; \
- talk_base::scoped_ptr<talk_base::MemoryStream> ms( \
+ rtc::scoped_ptr<rtc::MemoryStream> ms( \
CreateRgbSample(cricket::FOURCC_ARGB, kWidth, kHeight)); \
ASSERT_TRUE(ms.get() != NULL); \
for (int i = 0; i < repeat_; ++i) { \
@@ -1949,7 +1949,7 @@
kWidth * 4, \
kWidth, kHeight); \
} \
- talk_base::scoped_ptr<uint8[]> bayer2buf(new uint8[ \
+ rtc::scoped_ptr<uint8[]> bayer2buf(new uint8[ \
bayer_size + kAlignment]); \
uint8 *bayer2 = ALIGNP(bayer2buf.get(), kAlignment); \
libyuv::ARGBToBayer##BAYER(reinterpret_cast<uint8*>(ms->GetBuffer()), \
@@ -1973,8 +1973,8 @@
///////////////////
void Copy() {
- talk_base::scoped_ptr<T> source(new T);
- talk_base::scoped_ptr<cricket::VideoFrame> target;
+ rtc::scoped_ptr<T> source(new T);
+ rtc::scoped_ptr<cricket::VideoFrame> target;
ASSERT_TRUE(LoadFrameNoRepeat(source.get()));
target.reset(source->Copy());
EXPECT_TRUE(IsEqual(*source, *target, 0));
@@ -1983,8 +1983,8 @@
}
void CopyIsRef() {
- talk_base::scoped_ptr<T> source(new T);
- talk_base::scoped_ptr<cricket::VideoFrame> target;
+ rtc::scoped_ptr<T> source(new T);
+ rtc::scoped_ptr<cricket::VideoFrame> target;
ASSERT_TRUE(LoadFrameNoRepeat(source.get()));
target.reset(source->Copy());
EXPECT_TRUE(IsEqual(*source, *target, 0));
@@ -1994,8 +1994,8 @@
}
void MakeExclusive() {
- talk_base::scoped_ptr<T> source(new T);
- talk_base::scoped_ptr<cricket::VideoFrame> target;
+ rtc::scoped_ptr<T> source(new T);
+ rtc::scoped_ptr<cricket::VideoFrame> target;
ASSERT_TRUE(LoadFrameNoRepeat(source.get()));
target.reset(source->Copy());
EXPECT_TRUE(target->MakeExclusive());
@@ -2007,13 +2007,13 @@
void CopyToBuffer() {
T frame;
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
LoadSample(kImageFilename));
ASSERT_TRUE(ms.get() != NULL);
ASSERT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_I420, kWidth, kHeight,
&frame));
size_t out_size = kWidth * kHeight * 3 / 2;
- talk_base::scoped_ptr<uint8[]> out(new uint8[out_size]);
+ rtc::scoped_ptr<uint8[]> out(new uint8[out_size]);
for (int i = 0; i < repeat_; ++i) {
EXPECT_EQ(out_size, frame.CopyToBuffer(out.get(), out_size));
}
@@ -2022,7 +2022,7 @@
void CopyToFrame() {
T source;
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
LoadSample(kImageFilename));
ASSERT_TRUE(ms.get() != NULL);
ASSERT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_I420, kWidth, kHeight,
@@ -2041,10 +2041,10 @@
void Write() {
T frame;
- talk_base::scoped_ptr<talk_base::MemoryStream> ms(
+ rtc::scoped_ptr<rtc::MemoryStream> ms(
LoadSample(kImageFilename));
ASSERT_TRUE(ms.get() != NULL);
- talk_base::MemoryStream ms2;
+ rtc::MemoryStream ms2;
size_t size;
ASSERT_TRUE(ms->GetSize(&size));
ASSERT_TRUE(ms2.ReserveSize(size));
@@ -2053,7 +2053,7 @@
for (int i = 0; i < repeat_; ++i) {
ms2.SetPosition(0u); // Useful when repeat_ > 1.
int error;
- EXPECT_EQ(talk_base::SR_SUCCESS, frame.Write(&ms2, &error));
+ EXPECT_EQ(rtc::SR_SUCCESS, frame.Write(&ms2, &error));
}
size_t out_size = cricket::VideoFrame::SizeOf(kWidth, kHeight);
EXPECT_EQ(0, memcmp(ms2.GetBuffer(), ms->GetBuffer(), out_size));
@@ -2061,7 +2061,7 @@
void CopyToBuffer1Pixel() {
size_t out_size = 3;
- talk_base::scoped_ptr<uint8[]> out(new uint8[out_size + 1]);
+ rtc::scoped_ptr<uint8[]> out(new uint8[out_size + 1]);
memset(out.get(), 0xfb, out_size + 1); // Fill buffer
uint8 pixel[3] = { 1, 2, 3 };
T frame;
diff --git a/media/base/videoprocessor.h b/media/base/videoprocessor.h
index 412d989..78a3bf8 100755
--- a/media/base/videoprocessor.h
+++ b/media/base/videoprocessor.h
@@ -28,7 +28,7 @@
#ifndef TALK_MEDIA_BASE_VIDEOPROCESSOR_H_
#define TALK_MEDIA_BASE_VIDEOPROCESSOR_H_
-#include "talk/base/sigslot.h"
+#include "webrtc/base/sigslot.h"
#include "talk/media/base/videoframe.h"
namespace cricket {
diff --git a/media/base/videorenderer.h b/media/base/videorenderer.h
index ccbe978..73b0eab 100644
--- a/media/base/videorenderer.h
+++ b/media/base/videorenderer.h
@@ -32,7 +32,7 @@
#include <string>
#endif // _DEBUG
-#include "talk/base/sigslot.h"
+#include "webrtc/base/sigslot.h"
namespace cricket {
diff --git a/media/base/voiceprocessor.h b/media/base/voiceprocessor.h
index 576bdca..90dfc27 100755
--- a/media/base/voiceprocessor.h
+++ b/media/base/voiceprocessor.h
@@ -28,8 +28,8 @@
#ifndef TALK_MEDIA_BASE_VOICEPROCESSOR_H_
#define TALK_MEDIA_BASE_VOICEPROCESSOR_H_
-#include "talk/base/basictypes.h"
-#include "talk/base/sigslot.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/sigslot.h"
#include "talk/media/base/audioframe.h"
namespace cricket {
diff --git a/media/base/yuvframegenerator.cc b/media/base/yuvframegenerator.cc
index 57b5314..bffa715 100644
--- a/media/base/yuvframegenerator.cc
+++ b/media/base/yuvframegenerator.cc
@@ -3,8 +3,8 @@
#include <string.h>
#include <sstream>
-#include "talk/base/basictypes.h"
-#include "talk/base/common.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/common.h"
namespace cricket {
diff --git a/media/base/yuvframegenerator.h b/media/base/yuvframegenerator.h
index 4adf971..104fb54 100644
--- a/media/base/yuvframegenerator.h
+++ b/media/base/yuvframegenerator.h
@@ -12,7 +12,7 @@
#ifndef TALK_MEDIA_BASE_YUVFRAMEGENERATOR_H_
#define TALK_MEDIA_BASE_YUVFRAMEGENERATOR_H_
-#include "talk/base/basictypes.h"
+#include "webrtc/base/basictypes.h"
namespace cricket {
diff --git a/media/devices/carbonvideorenderer.cc b/media/devices/carbonvideorenderer.cc
index 71abf26..a0b4870 100644
--- a/media/devices/carbonvideorenderer.cc
+++ b/media/devices/carbonvideorenderer.cc
@@ -27,7 +27,7 @@
#include "talk/media/devices/carbonvideorenderer.h"
-#include "talk/base/logging.h"
+#include "webrtc/base/logging.h"
#include "talk/media/base/videocommon.h"
#include "talk/media/base/videoframe.h"
@@ -65,7 +65,7 @@
bool CarbonVideoRenderer::DrawFrame() {
// Grab the image lock to make sure it is not changed why we'll draw it.
- talk_base::CritScope cs(&image_crit_);
+ rtc::CritScope cs(&image_crit_);
if (image_.get() == NULL) {
// Nothing to draw, just return.
@@ -111,7 +111,7 @@
bool CarbonVideoRenderer::SetSize(int width, int height, int reserved) {
if (width != image_width_ || height != image_height_) {
// Grab the image lock while changing its size.
- talk_base::CritScope cs(&image_crit_);
+ rtc::CritScope cs(&image_crit_);
image_width_ = width;
image_height_ = height;
image_.reset(new uint8[width * height * 4]);
@@ -126,7 +126,7 @@
}
{
// Grab the image lock so we are not trashing up the image being drawn.
- talk_base::CritScope cs(&image_crit_);
+ rtc::CritScope cs(&image_crit_);
frame->ConvertToRgbBuffer(cricket::FOURCC_ABGR,
image_.get(),
frame->GetWidth() * frame->GetHeight() * 4,
diff --git a/media/devices/carbonvideorenderer.h b/media/devices/carbonvideorenderer.h
index 6c52fcf..5cfc9ae 100644
--- a/media/devices/carbonvideorenderer.h
+++ b/media/devices/carbonvideorenderer.h
@@ -31,8 +31,8 @@
#include <Carbon/Carbon.h>
-#include "talk/base/criticalsection.h"
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/criticalsection.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/media/base/videorenderer.h"
namespace cricket {
@@ -57,8 +57,8 @@
static OSStatus DrawEventHandler(EventHandlerCallRef handler,
EventRef event,
void* data);
- talk_base::scoped_ptr<uint8[]> image_;
- talk_base::CriticalSection image_crit_;
+ rtc::scoped_ptr<uint8[]> image_;
+ rtc::CriticalSection image_crit_;
int image_width_;
int image_height_;
int x_;
diff --git a/media/devices/devicemanager.cc b/media/devices/devicemanager.cc
index 75b935c..c331adc 100644
--- a/media/devices/devicemanager.cc
+++ b/media/devices/devicemanager.cc
@@ -27,13 +27,13 @@
#include "talk/media/devices/devicemanager.h"
-#include "talk/base/fileutils.h"
-#include "talk/base/logging.h"
-#include "talk/base/pathutils.h"
-#include "talk/base/stringutils.h"
-#include "talk/base/thread.h"
-#include "talk/base/windowpicker.h"
-#include "talk/base/windowpickerfactory.h"
+#include "webrtc/base/fileutils.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/pathutils.h"
+#include "webrtc/base/stringutils.h"
+#include "webrtc/base/thread.h"
+#include "webrtc/base/windowpicker.h"
+#include "webrtc/base/windowpickerfactory.h"
#include "talk/media/base/mediacommon.h"
#include "talk/media/devices/deviceinfo.h"
#include "talk/media/devices/filevideocapturer.h"
@@ -54,7 +54,7 @@
bool StringMatchWithWildcard(
const std::pair<const std::basic_string<char>, cricket::VideoFormat> key,
const std::string& val) {
- return talk_base::string_match(val.c_str(), key.first.c_str());
+ return rtc::string_match(val.c_str(), key.first.c_str());
}
} // namespace
@@ -86,7 +86,7 @@
DeviceManager::DeviceManager()
: initialized_(false),
device_video_capturer_factory_(new DefaultVideoCapturerFactory),
- window_picker_(talk_base::WindowPickerFactory::CreateWindowPicker()) {
+ window_picker_(rtc::WindowPickerFactory::CreateWindowPicker()) {
}
DeviceManager::~DeviceManager() {
@@ -187,7 +187,7 @@
bool DeviceManager::GetFakeVideoCaptureDevice(const std::string& name,
Device* out) const {
- if (talk_base::Filesystem::IsFile(name)) {
+ if (rtc::Filesystem::IsFile(name)) {
*out = FileVideoCapturer::CreateFileVideoCapturerDevice(name);
return true;
}
@@ -242,7 +242,7 @@
return NULL;
}
LOG(LS_INFO) << "Created file video capturer " << device.name;
- capturer->set_repeat(talk_base::kForever);
+ capturer->set_repeat(rtc::kForever);
return capturer;
}
@@ -255,14 +255,14 @@
}
bool DeviceManager::GetWindows(
- std::vector<talk_base::WindowDescription>* descriptions) {
+ std::vector<rtc::WindowDescription>* descriptions) {
if (!window_picker_) {
return false;
}
return window_picker_->GetWindowList(descriptions);
}
-VideoCapturer* DeviceManager::CreateWindowCapturer(talk_base::WindowId window) {
+VideoCapturer* DeviceManager::CreateWindowCapturer(rtc::WindowId window) {
#if defined(WINDOW_CAPTURER_NAME)
WINDOW_CAPTURER_NAME* window_capturer = new WINDOW_CAPTURER_NAME();
if (!window_capturer->Init(window)) {
@@ -276,7 +276,7 @@
}
bool DeviceManager::GetDesktops(
- std::vector<talk_base::DesktopDescription>* descriptions) {
+ std::vector<rtc::DesktopDescription>* descriptions) {
if (!window_picker_) {
return false;
}
@@ -284,7 +284,7 @@
}
VideoCapturer* DeviceManager::CreateDesktopCapturer(
- talk_base::DesktopId desktop) {
+ rtc::DesktopId desktop) {
#if defined(DESKTOP_CAPTURER_NAME)
DESKTOP_CAPTURER_NAME* desktop_capturer = new DESKTOP_CAPTURER_NAME();
if (!desktop_capturer->Init(desktop.index())) {
diff --git a/media/devices/devicemanager.h b/media/devices/devicemanager.h
index f6099f3..0107348 100644
--- a/media/devices/devicemanager.h
+++ b/media/devices/devicemanager.h
@@ -32,13 +32,13 @@
#include <string>
#include <vector>
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/sigslot.h"
-#include "talk/base/stringencode.h"
-#include "talk/base/window.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/stringencode.h"
+#include "webrtc/base/window.h"
#include "talk/media/base/videocommon.h"
-namespace talk_base {
+namespace rtc {
class DesktopDescription;
class WindowDescription;
@@ -54,7 +54,7 @@
Device() {}
Device(const std::string& first, int second)
: name(first),
- id(talk_base::ToString(second)) {
+ id(rtc::ToString(second)) {
}
Device(const std::string& first, const std::string& second)
: name(first), id(second) {}
@@ -108,13 +108,13 @@
virtual VideoCapturer* CreateVideoCapturer(const Device& device) const = 0;
virtual bool GetWindows(
- std::vector<talk_base::WindowDescription>* descriptions) = 0;
- virtual VideoCapturer* CreateWindowCapturer(talk_base::WindowId window) = 0;
+ std::vector<rtc::WindowDescription>* descriptions) = 0;
+ virtual VideoCapturer* CreateWindowCapturer(rtc::WindowId window) = 0;
virtual bool GetDesktops(
- std::vector<talk_base::DesktopDescription>* descriptions) = 0;
+ std::vector<rtc::DesktopDescription>* descriptions) = 0;
virtual VideoCapturer* CreateDesktopCapturer(
- talk_base::DesktopId desktop) = 0;
+ rtc::DesktopId desktop) = 0;
sigslot::signal0<> SignalDevicesChange;
@@ -171,12 +171,12 @@
virtual VideoCapturer* CreateVideoCapturer(const Device& device) const;
virtual bool GetWindows(
- std::vector<talk_base::WindowDescription>* descriptions);
- virtual VideoCapturer* CreateWindowCapturer(talk_base::WindowId window);
+ std::vector<rtc::WindowDescription>* descriptions);
+ virtual VideoCapturer* CreateWindowCapturer(rtc::WindowId window);
virtual bool GetDesktops(
- std::vector<talk_base::DesktopDescription>* descriptions);
- virtual VideoCapturer* CreateDesktopCapturer(talk_base::DesktopId desktop);
+ std::vector<rtc::DesktopDescription>* descriptions);
+ virtual VideoCapturer* CreateDesktopCapturer(rtc::DesktopId desktop);
// The exclusion_list MUST be a NULL terminated list.
static bool FilterDevices(std::vector<Device>* devices,
@@ -205,10 +205,10 @@
VideoCapturer* ConstructFakeVideoCapturer(const Device& device) const;
bool initialized_;
- talk_base::scoped_ptr<VideoCapturerFactory> device_video_capturer_factory_;
+ rtc::scoped_ptr<VideoCapturerFactory> device_video_capturer_factory_;
std::map<std::string, VideoFormat> max_formats_;
- talk_base::scoped_ptr<DeviceWatcher> watcher_;
- talk_base::scoped_ptr<talk_base::WindowPicker> window_picker_;
+ rtc::scoped_ptr<DeviceWatcher> watcher_;
+ rtc::scoped_ptr<rtc::WindowPicker> window_picker_;
};
} // namespace cricket
diff --git a/media/devices/devicemanager_unittest.cc b/media/devices/devicemanager_unittest.cc
index d8564ea..3bc0241 100644
--- a/media/devices/devicemanager_unittest.cc
+++ b/media/devices/devicemanager_unittest.cc
@@ -28,18 +28,18 @@
#include "talk/media/devices/devicemanager.h"
#ifdef WIN32
-#include "talk/base/win32.h"
+#include "webrtc/base/win32.h"
#include <objbase.h>
#endif
#include <string>
-#include "talk/base/fileutils.h"
-#include "talk/base/gunit.h"
-#include "talk/base/logging.h"
-#include "talk/base/pathutils.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/stream.h"
-#include "talk/base/windowpickerfactory.h"
+#include "webrtc/base/fileutils.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/pathutils.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/stream.h"
+#include "webrtc/base/windowpickerfactory.h"
#include "talk/media/base/fakevideocapturer.h"
#include "talk/media/base/testutils.h"
#include "talk/media/devices/filevideocapturer.h"
@@ -47,12 +47,12 @@
#ifdef LINUX
// TODO(juberti): Figure out why this doesn't compile on Windows.
-#include "talk/base/fileutils_mock.h"
+#include "webrtc/base/fileutils_mock.h"
#endif // LINUX
-using talk_base::Pathname;
-using talk_base::FileTimeType;
-using talk_base::scoped_ptr;
+using rtc::Pathname;
+using rtc::FileTimeType;
+using rtc::scoped_ptr;
using cricket::Device;
using cricket::DeviceManager;
using cricket::DeviceManagerFactory;
@@ -290,17 +290,17 @@
devices.push_back("/dev/video5");
cricket::V4LLookup::SetV4LLookup(new FakeV4LLookup(devices));
- std::vector<talk_base::FakeFileSystem::File> files;
- files.push_back(talk_base::FakeFileSystem::File("/dev/video0", ""));
- files.push_back(talk_base::FakeFileSystem::File("/dev/video5", ""));
- files.push_back(talk_base::FakeFileSystem::File(
+ std::vector<rtc::FakeFileSystem::File> files;
+ files.push_back(rtc::FakeFileSystem::File("/dev/video0", ""));
+ files.push_back(rtc::FakeFileSystem::File("/dev/video5", ""));
+ files.push_back(rtc::FakeFileSystem::File(
"/sys/class/video4linux/video0/name", "Video Device 1"));
- files.push_back(talk_base::FakeFileSystem::File(
+ files.push_back(rtc::FakeFileSystem::File(
"/sys/class/video4linux/video1/model", "Bad Device"));
files.push_back(
- talk_base::FakeFileSystem::File("/sys/class/video4linux/video5/model",
+ rtc::FakeFileSystem::File("/sys/class/video4linux/video5/model",
"Video Device 2"));
- talk_base::FilesystemScope fs(new talk_base::FakeFileSystem(files));
+ rtc::FilesystemScope fs(new rtc::FakeFileSystem(files));
scoped_ptr<DeviceManagerInterface> dm(DeviceManagerFactory::Create());
std::vector<Device> video_ins;
@@ -317,19 +317,19 @@
devices.push_back("/dev/video5");
cricket::V4LLookup::SetV4LLookup(new FakeV4LLookup(devices));
- std::vector<talk_base::FakeFileSystem::File> files;
- files.push_back(talk_base::FakeFileSystem::File("/dev/video0", ""));
- files.push_back(talk_base::FakeFileSystem::File("/dev/video5", ""));
- files.push_back(talk_base::FakeFileSystem::File(
+ std::vector<rtc::FakeFileSystem::File> files;
+ files.push_back(rtc::FakeFileSystem::File("/dev/video0", ""));
+ files.push_back(rtc::FakeFileSystem::File("/dev/video5", ""));
+ files.push_back(rtc::FakeFileSystem::File(
"/proc/video/dev/video0",
"param1: value1\nname: Video Device 1\n param2: value2\n"));
- files.push_back(talk_base::FakeFileSystem::File(
+ files.push_back(rtc::FakeFileSystem::File(
"/proc/video/dev/video1",
"param1: value1\nname: Bad Device\n param2: value2\n"));
- files.push_back(talk_base::FakeFileSystem::File(
+ files.push_back(rtc::FakeFileSystem::File(
"/proc/video/dev/video5",
"param1: value1\nname: Video Device 2\n param2: value2\n"));
- talk_base::FilesystemScope fs(new talk_base::FakeFileSystem(files));
+ rtc::FilesystemScope fs(new rtc::FakeFileSystem(files));
scoped_ptr<DeviceManagerInterface> dm(DeviceManagerFactory::Create());
std::vector<Device> video_ins;
@@ -346,11 +346,11 @@
devices.push_back("/dev/video5");
cricket::V4LLookup::SetV4LLookup(new FakeV4LLookup(devices));
- std::vector<talk_base::FakeFileSystem::File> files;
- files.push_back(talk_base::FakeFileSystem::File("/dev/video0", ""));
- files.push_back(talk_base::FakeFileSystem::File("/dev/video1", ""));
- files.push_back(talk_base::FakeFileSystem::File("/dev/video5", ""));
- talk_base::FilesystemScope fs(new talk_base::FakeFileSystem(files));
+ std::vector<rtc::FakeFileSystem::File> files;
+ files.push_back(rtc::FakeFileSystem::File("/dev/video0", ""));
+ files.push_back(rtc::FakeFileSystem::File("/dev/video1", ""));
+ files.push_back(rtc::FakeFileSystem::File("/dev/video5", ""));
+ rtc::FilesystemScope fs(new rtc::FakeFileSystem(files));
scoped_ptr<DeviceManagerInterface> dm(DeviceManagerFactory::Create());
std::vector<Device> video_ins;
@@ -365,13 +365,13 @@
// TODO(noahric): These are flaky on windows on headless machines.
#ifndef WIN32
TEST(DeviceManagerTest, GetWindows) {
- if (!talk_base::WindowPickerFactory::IsSupported()) {
+ if (!rtc::WindowPickerFactory::IsSupported()) {
LOG(LS_INFO) << "skipping test: window capturing is not supported with "
<< "current configuration.";
return;
}
scoped_ptr<DeviceManagerInterface> dm(DeviceManagerFactory::Create());
- std::vector<talk_base::WindowDescription> descriptions;
+ std::vector<rtc::WindowDescription> descriptions;
EXPECT_TRUE(dm->Init());
if (!dm->GetWindows(&descriptions) || descriptions.empty()) {
LOG(LS_INFO) << "skipping test: window capturing. Does not have any "
@@ -384,17 +384,17 @@
// TODO(hellner): creating a window capturer and immediately deleting it
// results in "Continuous Build and Test Mainline - Mac opt" failure (crash).
// Remove the following line as soon as this has been resolved.
- talk_base::Thread::Current()->ProcessMessages(1);
+ rtc::Thread::Current()->ProcessMessages(1);
}
TEST(DeviceManagerTest, GetDesktops) {
- if (!talk_base::WindowPickerFactory::IsSupported()) {
+ if (!rtc::WindowPickerFactory::IsSupported()) {
LOG(LS_INFO) << "skipping test: desktop capturing is not supported with "
<< "current configuration.";
return;
}
scoped_ptr<DeviceManagerInterface> dm(DeviceManagerFactory::Create());
- std::vector<talk_base::DesktopDescription> descriptions;
+ std::vector<rtc::DesktopDescription> descriptions;
EXPECT_TRUE(dm->Init());
if (!dm->GetDesktops(&descriptions) || descriptions.empty()) {
LOG(LS_INFO) << "skipping test: desktop capturing. Does not have any "
diff --git a/media/devices/dummydevicemanager_unittest.cc b/media/devices/dummydevicemanager_unittest.cc
index 1abf1ea..86b5352 100644
--- a/media/devices/dummydevicemanager_unittest.cc
+++ b/media/devices/dummydevicemanager_unittest.cc
@@ -25,7 +25,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/gunit.h"
+#include "webrtc/base/gunit.h"
#include "talk/media/devices/dummydevicemanager.h"
using cricket::Device;
diff --git a/media/devices/fakedevicemanager.h b/media/devices/fakedevicemanager.h
index 0dbed43..5fc3715 100644
--- a/media/devices/fakedevicemanager.h
+++ b/media/devices/fakedevicemanager.h
@@ -31,8 +31,8 @@
#include <string>
#include <vector>
-#include "talk/base/window.h"
-#include "talk/base/windowpicker.h"
+#include "webrtc/base/window.h"
+#include "webrtc/base/windowpicker.h"
#include "talk/media/base/fakevideocapturer.h"
#include "talk/media/base/mediacommon.h"
#include "talk/media/devices/devicemanager.h"
@@ -98,35 +98,35 @@
return new FakeVideoCapturer();
}
virtual bool GetWindows(
- std::vector<talk_base::WindowDescription>* descriptions) {
+ std::vector<rtc::WindowDescription>* descriptions) {
descriptions->clear();
const uint32_t id = 1u; // Note that 0 is not a valid ID.
- const talk_base::WindowId window_id =
- talk_base::WindowId::Cast(id);
+ const rtc::WindowId window_id =
+ rtc::WindowId::Cast(id);
std::string title = "FakeWindow";
- talk_base::WindowDescription window_description(window_id, title);
+ rtc::WindowDescription window_description(window_id, title);
descriptions->push_back(window_description);
return true;
}
- virtual VideoCapturer* CreateWindowCapturer(talk_base::WindowId window) {
+ virtual VideoCapturer* CreateWindowCapturer(rtc::WindowId window) {
if (!window.IsValid()) {
return NULL;
}
return new FakeVideoCapturer;
}
virtual bool GetDesktops(
- std::vector<talk_base::DesktopDescription>* descriptions) {
+ std::vector<rtc::DesktopDescription>* descriptions) {
descriptions->clear();
const int id = 0;
const int valid_index = 0;
- const talk_base::DesktopId desktop_id =
- talk_base::DesktopId::Cast(id, valid_index);
+ const rtc::DesktopId desktop_id =
+ rtc::DesktopId::Cast(id, valid_index);
std::string title = "FakeDesktop";
- talk_base::DesktopDescription desktop_description(desktop_id, title);
+ rtc::DesktopDescription desktop_description(desktop_id, title);
descriptions->push_back(desktop_description);
return true;
}
- virtual VideoCapturer* CreateDesktopCapturer(talk_base::DesktopId desktop) {
+ virtual VideoCapturer* CreateDesktopCapturer(rtc::DesktopId desktop) {
if (!desktop.IsValid()) {
return NULL;
}
diff --git a/media/devices/filevideocapturer.cc b/media/devices/filevideocapturer.cc
index e79783f..dcb776f 100644
--- a/media/devices/filevideocapturer.cc
+++ b/media/devices/filevideocapturer.cc
@@ -27,10 +27,10 @@
#include "talk/media/devices/filevideocapturer.h"
-#include "talk/base/bytebuffer.h"
-#include "talk/base/criticalsection.h"
-#include "talk/base/logging.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/bytebuffer.h"
+#include "webrtc/base/criticalsection.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/thread.h"
namespace cricket {
@@ -53,7 +53,7 @@
}
bool VideoRecorder::RecordFrame(const CapturedFrame& frame) {
- if (talk_base::SS_CLOSED == video_file_.GetState()) {
+ if (rtc::SS_CLOSED == video_file_.GetState()) {
LOG(LS_ERROR) << "File not opened yet";
return false;
}
@@ -66,7 +66,7 @@
if (write_header_) {
// Convert the frame header to bytebuffer.
- talk_base::ByteBuffer buffer;
+ rtc::ByteBuffer buffer;
buffer.WriteUInt32(frame.width);
buffer.WriteUInt32(frame.height);
buffer.WriteUInt32(frame.fourcc);
@@ -77,7 +77,7 @@
buffer.WriteUInt32(size);
// Write the bytebuffer to file.
- if (talk_base::SR_SUCCESS != video_file_.Write(buffer.Data(),
+ if (rtc::SR_SUCCESS != video_file_.Write(buffer.Data(),
buffer.Length(),
NULL,
NULL)) {
@@ -86,7 +86,7 @@
}
}
// Write the frame data to file.
- if (talk_base::SR_SUCCESS != video_file_.Write(frame.data,
+ if (rtc::SR_SUCCESS != video_file_.Write(frame.data,
size,
NULL,
NULL)) {
@@ -102,7 +102,7 @@
// frames from a file.
///////////////////////////////////////////////////////////////////////
class FileVideoCapturer::FileReadThread
- : public talk_base::Thread, public talk_base::MessageHandler {
+ : public rtc::Thread, public rtc::MessageHandler {
public:
explicit FileReadThread(FileVideoCapturer* capturer)
: capturer_(capturer),
@@ -123,12 +123,12 @@
Thread::Run();
}
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
finished_ = true;
}
// Override virtual method of parent MessageHandler. Context: Worker Thread.
- virtual void OnMessage(talk_base::Message* /*pmsg*/) {
+ virtual void OnMessage(rtc::Message* /*pmsg*/) {
int waiting_time_ms = 0;
if (capturer_ && capturer_->ReadFrame(false, &waiting_time_ms)) {
PostDelayed(waiting_time_ms, this);
@@ -139,13 +139,13 @@
// Check if Run() is finished.
bool Finished() const {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
return finished_;
}
private:
FileVideoCapturer* capturer_;
- mutable talk_base::CriticalSection crit_;
+ mutable rtc::CriticalSection crit_;
bool finished_;
DISALLOW_COPY_AND_ASSIGN(FileReadThread);
@@ -188,7 +188,7 @@
}
// Read the first frame's header to determine the supported format.
CapturedFrame frame;
- if (talk_base::SR_SUCCESS != ReadFrameHeader(&frame)) {
+ if (rtc::SR_SUCCESS != ReadFrameHeader(&frame)) {
LOG(LS_ERROR) << "Failed to read the first frame header";
video_file_.Close();
return false;
@@ -230,7 +230,7 @@
return CS_FAILED;
}
- if (talk_base::SS_CLOSED == video_file_.GetState()) {
+ if (rtc::SS_CLOSED == video_file_.GetState()) {
LOG(LS_ERROR) << "File not opened yet";
return CS_NO_DEVICE;
} else if (!video_file_.SetPosition(0)) {
@@ -242,7 +242,7 @@
// Create a thread to read the file.
file_read_thread_ = new FileReadThread(this);
start_time_ns_ = kNumNanoSecsPerMilliSec *
- static_cast<int64>(talk_base::Time());
+ static_cast<int64>(rtc::Time());
bool ret = file_read_thread_->Start();
if (ret) {
LOG(LS_INFO) << "File video capturer '" << GetId() << "' started";
@@ -275,13 +275,13 @@
return true;
}
-talk_base::StreamResult FileVideoCapturer::ReadFrameHeader(
+rtc::StreamResult FileVideoCapturer::ReadFrameHeader(
CapturedFrame* frame) {
// We first read kFrameHeaderSize bytes from the file stream to a memory
// buffer, then construct a bytebuffer from the memory buffer, and finally
// read the frame header from the bytebuffer.
char header[CapturedFrame::kFrameHeaderSize];
- talk_base::StreamResult sr;
+ rtc::StreamResult sr;
size_t bytes_read;
int error;
sr = video_file_.Read(header,
@@ -290,11 +290,11 @@
&error);
LOG(LS_VERBOSE) << "Read frame header: stream_result = " << sr
<< ", bytes read = " << bytes_read << ", error = " << error;
- if (talk_base::SR_SUCCESS == sr) {
+ if (rtc::SR_SUCCESS == sr) {
if (CapturedFrame::kFrameHeaderSize != bytes_read) {
- return talk_base::SR_EOS;
+ return rtc::SR_EOS;
}
- talk_base::ByteBuffer buffer(header, CapturedFrame::kFrameHeaderSize);
+ rtc::ByteBuffer buffer(header, CapturedFrame::kFrameHeaderSize);
buffer.ReadUInt32(reinterpret_cast<uint32*>(&frame->width));
buffer.ReadUInt32(reinterpret_cast<uint32*>(&frame->height));
buffer.ReadUInt32(&frame->fourcc);
@@ -310,7 +310,7 @@
// Executed in the context of FileReadThread.
bool FileVideoCapturer::ReadFrame(bool first_frame, int* wait_time_ms) {
- uint32 start_read_time_ms = talk_base::Time();
+ uint32 start_read_time_ms = rtc::Time();
// 1. Signal the previously read frame to downstream.
if (!first_frame) {
@@ -321,14 +321,14 @@
}
// 2. Read the next frame.
- if (talk_base::SS_CLOSED == video_file_.GetState()) {
+ if (rtc::SS_CLOSED == video_file_.GetState()) {
LOG(LS_ERROR) << "File not opened yet";
return false;
}
// 2.1 Read the frame header.
- talk_base::StreamResult result = ReadFrameHeader(&captured_frame_);
- if (talk_base::SR_EOS == result) { // Loop back if repeat.
- if (repeat_ != talk_base::kForever) {
+ rtc::StreamResult result = ReadFrameHeader(&captured_frame_);
+ if (rtc::SR_EOS == result) { // Loop back if repeat.
+ if (repeat_ != rtc::kForever) {
if (repeat_ > 0) {
--repeat_;
} else {
@@ -340,7 +340,7 @@
result = ReadFrameHeader(&captured_frame_);
}
}
- if (talk_base::SR_SUCCESS != result) {
+ if (rtc::SR_SUCCESS != result) {
LOG(LS_ERROR) << "Failed to read the frame header";
return false;
}
@@ -351,7 +351,7 @@
captured_frame_.data = new char[frame_buffer_size_];
}
// 2.3 Read the frame adata.
- if (talk_base::SR_SUCCESS != video_file_.Read(captured_frame_.data,
+ if (rtc::SR_SUCCESS != video_file_.Read(captured_frame_.data,
captured_frame_.data_size,
NULL, NULL)) {
LOG(LS_ERROR) << "Failed to read frame data";
@@ -370,7 +370,7 @@
GetCaptureFormat()->interval :
captured_frame_.time_stamp - last_frame_timestamp_ns_;
int interval_ms = static_cast<int>(interval_ns / kNumNanoSecsPerMilliSec);
- interval_ms -= talk_base::Time() - start_read_time_ms;
+ interval_ms -= rtc::Time() - start_read_time_ms;
if (interval_ms > 0) {
*wait_time_ms = interval_ms;
}
diff --git a/media/devices/filevideocapturer.h b/media/devices/filevideocapturer.h
index e3e39b4..e6bd9b4 100644
--- a/media/devices/filevideocapturer.h
+++ b/media/devices/filevideocapturer.h
@@ -37,11 +37,11 @@
#include <string>
#include <vector>
-#include "talk/base/stream.h"
-#include "talk/base/stringutils.h"
+#include "webrtc/base/stream.h"
+#include "webrtc/base/stringutils.h"
#include "talk/media/base/videocapturer.h"
-namespace talk_base {
+namespace rtc {
class FileStream;
}
@@ -65,7 +65,7 @@
bool RecordFrame(const CapturedFrame& frame);
private:
- talk_base::FileStream video_file_;
+ rtc::FileStream video_file_;
bool write_header_;
DISALLOW_COPY_AND_ASSIGN(VideoRecorder);
@@ -80,7 +80,7 @@
// Determines if the given device is actually a video file, to be captured
// with a FileVideoCapturer.
static bool IsFileVideoCapturerDevice(const Device& device) {
- return talk_base::starts_with(device.id.c_str(), kVideoFileDevicePrefix);
+ return rtc::starts_with(device.id.c_str(), kVideoFileDevicePrefix);
}
// Creates a fake device for the given filename.
@@ -91,7 +91,7 @@
}
// Set how many times to repeat reading the file. Repeat forever if the
- // parameter is talk_base::kForever(-1); no repeat if the parameter is 0 or
+ // parameter is rtc::kForever(-1); no repeat if the parameter is 0 or
// less than -1.
void set_repeat(int repeat) { repeat_ = repeat; }
@@ -120,7 +120,7 @@
virtual bool GetPreferredFourccs(std::vector<uint32>* fourccs);
// Read the frame header from the file stream, video_file_.
- talk_base::StreamResult ReadFrameHeader(CapturedFrame* frame);
+ rtc::StreamResult ReadFrameHeader(CapturedFrame* frame);
// Read a frame and determine how long to wait for the next frame. If the
// frame is read successfully, Set the output parameter, wait_time_ms and
@@ -138,7 +138,7 @@
class FileReadThread; // Forward declaration, defined in .cc.
static const char* kVideoFileDevicePrefix;
- talk_base::FileStream video_file_;
+ rtc::FileStream video_file_;
CapturedFrame captured_frame_;
// The number of bytes allocated buffer for captured_frame_.data.
uint32 frame_buffer_size_;
diff --git a/media/devices/filevideocapturer_unittest.cc b/media/devices/filevideocapturer_unittest.cc
index 610d4f1..be416c0 100644
--- a/media/devices/filevideocapturer_unittest.cc
+++ b/media/devices/filevideocapturer_unittest.cc
@@ -30,9 +30,9 @@
#include <string>
#include <vector>
-#include "talk/base/gunit.h"
-#include "talk/base/logging.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/thread.h"
#include "talk/media/base/testutils.h"
#include "talk/media/devices/filevideocapturer.h"
@@ -82,7 +82,7 @@
bool resolution_changed_;
};
- talk_base::scoped_ptr<cricket::FileVideoCapturer> capturer_;
+ rtc::scoped_ptr<cricket::FileVideoCapturer> capturer_;
cricket::VideoFormat capture_format_;
};
@@ -158,7 +158,7 @@
VideoCapturerListener listener;
capturer_->SignalFrameCaptured.connect(
&listener, &VideoCapturerListener::OnFrameCaptured);
- capturer_->set_repeat(talk_base::kForever);
+ capturer_->set_repeat(rtc::kForever);
capture_format_ = capturer_->GetSupportedFormats()->at(0);
capture_format_.interval = cricket::VideoFormat::FpsToInterval(50);
EXPECT_EQ(cricket::CS_RUNNING, capturer_->Start(capture_format_));
diff --git a/media/devices/gdivideorenderer.cc b/media/devices/gdivideorenderer.cc
index 9633eb6..3d01b9a 100755
--- a/media/devices/gdivideorenderer.cc
+++ b/media/devices/gdivideorenderer.cc
@@ -29,9 +29,9 @@
#include "talk/media/devices/gdivideorenderer.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/thread.h"
-#include "talk/base/win32window.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/thread.h"
+#include "webrtc/base/win32window.h"
#include "talk/media/base/videocommon.h"
#include "talk/media/base/videoframe.h"
@@ -41,7 +41,7 @@
// Definition of private class VideoWindow. We use a worker thread to manage
// the window.
/////////////////////////////////////////////////////////////////////////////
-class GdiVideoRenderer::VideoWindow : public talk_base::Win32Window {
+class GdiVideoRenderer::VideoWindow : public rtc::Win32Window {
public:
VideoWindow(int x, int y, int width, int height);
virtual ~VideoWindow();
@@ -58,14 +58,14 @@
bool RenderFrame(const VideoFrame* frame);
protected:
- // Override virtual method of talk_base::Win32Window. Context: worker Thread.
+ // Override virtual method of rtc::Win32Window. Context: worker Thread.
virtual bool OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam,
LRESULT& result);
private:
enum { kSetSizeMsg = WM_USER, kRenderFrameMsg};
- class WindowThread : public talk_base::Thread {
+ class WindowThread : public rtc::Thread {
public:
explicit WindowThread(VideoWindow* window) : window_(window) {}
@@ -73,7 +73,7 @@
Stop();
}
- // Override virtual method of talk_base::Thread. Context: worker Thread.
+ // Override virtual method of rtc::Thread. Context: worker Thread.
virtual void Run() {
// Initialize the window
if (!window_ || !window_->Initialize()) {
@@ -98,8 +98,8 @@
void OnRenderFrame(const VideoFrame* frame);
BITMAPINFO bmi_;
- talk_base::scoped_ptr<uint8[]> image_;
- talk_base::scoped_ptr<WindowThread> window_thread_;
+ rtc::scoped_ptr<uint8[]> image_;
+ rtc::scoped_ptr<WindowThread> window_thread_;
// The initial position of the window.
int initial_x_;
int initial_y_;
@@ -180,7 +180,7 @@
}
bool GdiVideoRenderer::VideoWindow::Initialize() {
- if (!talk_base::Win32Window::Create(
+ if (!rtc::Win32Window::Create(
NULL, L"Video Renderer",
WS_OVERLAPPEDWINDOW | WS_SIZEBOX,
WS_EX_APPWINDOW,
diff --git a/media/devices/gdivideorenderer.h b/media/devices/gdivideorenderer.h
index da3897d..fc817c9 100755
--- a/media/devices/gdivideorenderer.h
+++ b/media/devices/gdivideorenderer.h
@@ -30,7 +30,7 @@
#define TALK_MEDIA_DEVICES_GDIVIDEORENDERER_H_
#ifdef WIN32
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/media/base/videorenderer.h"
namespace cricket {
@@ -48,7 +48,7 @@
private:
class VideoWindow; // forward declaration, defined in the .cc file
- talk_base::scoped_ptr<VideoWindow> window_;
+ rtc::scoped_ptr<VideoWindow> window_;
// The initial position of the window.
int initial_x_;
int initial_y_;
diff --git a/media/devices/gtkvideorenderer.h b/media/devices/gtkvideorenderer.h
index 744c19f..a6a3def 100755
--- a/media/devices/gtkvideorenderer.h
+++ b/media/devices/gtkvideorenderer.h
@@ -29,8 +29,8 @@
#ifndef TALK_MEDIA_DEVICES_GTKVIDEORENDERER_H_
#define TALK_MEDIA_DEVICES_GTKVIDEORENDERER_H_
-#include "talk/base/basictypes.h"
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/media/base/videorenderer.h"
typedef struct _GtkWidget GtkWidget; // forward declaration, defined in gtk.h
@@ -56,7 +56,7 @@
// Check if the window has been closed.
bool IsClosed() const;
- talk_base::scoped_ptr<uint8[]> image_;
+ rtc::scoped_ptr<uint8[]> image_;
GtkWidget* window_;
GtkWidget* draw_area_;
// The initial position of the window.
diff --git a/media/devices/libudevsymboltable.cc b/media/devices/libudevsymboltable.cc
index 20154e1..351a1e7 100644
--- a/media/devices/libudevsymboltable.cc
+++ b/media/devices/libudevsymboltable.cc
@@ -29,20 +29,20 @@
#include <dlfcn.h>
-#include "talk/base/logging.h"
+#include "webrtc/base/logging.h"
namespace cricket {
#define LATE_BINDING_SYMBOL_TABLE_CLASS_NAME LIBUDEV_SYMBOLS_CLASS_NAME
#define LATE_BINDING_SYMBOL_TABLE_SYMBOLS_LIST LIBUDEV_SYMBOLS_LIST
#define LATE_BINDING_SYMBOL_TABLE_DLL_NAME "libudev.so.0"
-#include "talk/base/latebindingsymboltable.cc.def"
+#include "webrtc/base/latebindingsymboltable.cc.def"
#undef LATE_BINDING_SYMBOL_TABLE_CLASS_NAME
#undef LATE_BINDING_SYMBOL_TABLE_SYMBOLS_LIST
#undef LATE_BINDING_SYMBOL_TABLE_DLL_NAME
-bool IsWrongLibUDevAbiVersion(talk_base::DllHandle libudev_0) {
- talk_base::DllHandle libudev_1 = dlopen("libudev.so.1",
+bool IsWrongLibUDevAbiVersion(rtc::DllHandle libudev_0) {
+ rtc::DllHandle libudev_1 = dlopen("libudev.so.1",
RTLD_NOW|RTLD_LOCAL|RTLD_NOLOAD);
bool unsafe_symlink = (libudev_0 == libudev_1);
if (unsafe_symlink) {
diff --git a/media/devices/libudevsymboltable.h b/media/devices/libudevsymboltable.h
index aa8c590..f764cd2 100644
--- a/media/devices/libudevsymboltable.h
+++ b/media/devices/libudevsymboltable.h
@@ -30,7 +30,7 @@
#include <libudev.h>
-#include "talk/base/latebindingsymboltable.h"
+#include "webrtc/base/latebindingsymboltable.h"
namespace cricket {
@@ -62,7 +62,7 @@
#define LATE_BINDING_SYMBOL_TABLE_CLASS_NAME LIBUDEV_SYMBOLS_CLASS_NAME
#define LATE_BINDING_SYMBOL_TABLE_SYMBOLS_LIST LIBUDEV_SYMBOLS_LIST
-#include "talk/base/latebindingsymboltable.h.def"
+#include "webrtc/base/latebindingsymboltable.h.def"
#undef LATE_BINDING_SYMBOL_TABLE_CLASS_NAME
#undef LATE_BINDING_SYMBOL_TABLE_SYMBOLS_LIST
@@ -72,7 +72,7 @@
// it has caused crashes in the wild. This function checks if the DllHandle that
// we got back for libudev.so.0 is actually for libudev.so.1. If so, the library
// cannot safely be used.
-bool IsWrongLibUDevAbiVersion(talk_base::DllHandle libudev_0);
+bool IsWrongLibUDevAbiVersion(rtc::DllHandle libudev_0);
} // namespace cricket
diff --git a/media/devices/linuxdeviceinfo.cc b/media/devices/linuxdeviceinfo.cc
index b1bc9dd..2aef463 100644
--- a/media/devices/linuxdeviceinfo.cc
+++ b/media/devices/linuxdeviceinfo.cc
@@ -27,7 +27,7 @@
#include "talk/media/devices/deviceinfo.h"
-#include "talk/base/common.h" // for ASSERT
+#include "webrtc/base/common.h" // for ASSERT
#include "talk/media/devices/libudevsymboltable.h"
namespace cricket {
@@ -94,7 +94,7 @@
bool GetUsbProperty(const Device& device, const char* property_name,
std::string* property) {
- talk_base::scoped_ptr<ScopedLibUdev> libudev_context(ScopedLibUdev::Create());
+ rtc::scoped_ptr<ScopedLibUdev> libudev_context(ScopedLibUdev::Create());
if (!libudev_context) {
return false;
}
diff --git a/media/devices/linuxdevicemanager.cc b/media/devices/linuxdevicemanager.cc
index 8e58d99..53eed80 100644
--- a/media/devices/linuxdevicemanager.cc
+++ b/media/devices/linuxdevicemanager.cc
@@ -28,14 +28,14 @@
#include "talk/media/devices/linuxdevicemanager.h"
#include <unistd.h>
-#include "talk/base/fileutils.h"
-#include "talk/base/linux.h"
-#include "talk/base/logging.h"
-#include "talk/base/pathutils.h"
-#include "talk/base/physicalsocketserver.h"
-#include "talk/base/stream.h"
-#include "talk/base/stringutils.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/fileutils.h"
+#include "webrtc/base/linux.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/pathutils.h"
+#include "webrtc/base/physicalsocketserver.h"
+#include "webrtc/base/stream.h"
+#include "webrtc/base/stringutils.h"
+#include "webrtc/base/thread.h"
#include "talk/media/base/mediacommon.h"
#include "talk/media/devices/libudevsymboltable.h"
#include "talk/media/devices/v4llookup.h"
@@ -52,7 +52,7 @@
class LinuxDeviceWatcher
: public DeviceWatcher,
- private talk_base::Dispatcher {
+ private rtc::Dispatcher {
public:
explicit LinuxDeviceWatcher(DeviceManagerInterface* dm);
virtual ~LinuxDeviceWatcher();
@@ -135,10 +135,10 @@
static void ScanDeviceDirectory(const std::string& devdir,
std::vector<Device>* devices) {
- talk_base::scoped_ptr<talk_base::DirectoryIterator> directoryIterator(
- talk_base::Filesystem::IterateDirectory());
+ rtc::scoped_ptr<rtc::DirectoryIterator> directoryIterator(
+ rtc::Filesystem::IterateDirectory());
- if (directoryIterator->Iterate(talk_base::Pathname(devdir))) {
+ if (directoryIterator->Iterate(rtc::Pathname(devdir))) {
do {
std::string filename = directoryIterator->Name();
std::string device_name = devdir + filename;
@@ -155,11 +155,11 @@
static std::string GetVideoDeviceNameK2_6(const std::string& device_meta_path) {
std::string device_name;
- talk_base::scoped_ptr<talk_base::FileStream> device_meta_stream(
- talk_base::Filesystem::OpenFile(device_meta_path, "r"));
+ rtc::scoped_ptr<rtc::FileStream> device_meta_stream(
+ rtc::Filesystem::OpenFile(device_meta_path, "r"));
if (device_meta_stream) {
- if (device_meta_stream->ReadLine(&device_name) != talk_base::SR_SUCCESS) {
+ if (device_meta_stream->ReadLine(&device_name) != rtc::SR_SUCCESS) {
LOG(LS_ERROR) << "Failed to read V4L2 device meta " << device_meta_path;
}
device_meta_stream->Close();
@@ -179,20 +179,20 @@
}
static std::string GetVideoDeviceNameK2_4(const std::string& device_meta_path) {
- talk_base::ConfigParser::MapVector all_values;
+ rtc::ConfigParser::MapVector all_values;
- talk_base::ConfigParser config_parser;
- talk_base::FileStream* file_stream =
- talk_base::Filesystem::OpenFile(device_meta_path, "r");
+ rtc::ConfigParser config_parser;
+ rtc::FileStream* file_stream =
+ rtc::Filesystem::OpenFile(device_meta_path, "r");
if (file_stream == NULL) return "";
config_parser.Attach(file_stream);
config_parser.Parse(&all_values);
- for (talk_base::ConfigParser::MapVector::iterator i = all_values.begin();
+ for (rtc::ConfigParser::MapVector::iterator i = all_values.begin();
i != all_values.end(); ++i) {
- talk_base::ConfigParser::SimpleMap::iterator device_name_i =
+ rtc::ConfigParser::SimpleMap::iterator device_name_i =
i->find("name");
if (device_name_i != i->end()) {
@@ -244,8 +244,8 @@
MetaType meta;
std::string metadata_dir;
- talk_base::scoped_ptr<talk_base::DirectoryIterator> directoryIterator(
- talk_base::Filesystem::IterateDirectory());
+ rtc::scoped_ptr<rtc::DirectoryIterator> directoryIterator(
+ rtc::Filesystem::IterateDirectory());
// Try and guess kernel version
if (directoryIterator->Iterate(kVideoMetaPathK2_6)) {
@@ -302,10 +302,10 @@
LinuxDeviceWatcher::~LinuxDeviceWatcher() {
}
-static talk_base::PhysicalSocketServer* CurrentSocketServer() {
- talk_base::SocketServer* ss =
- talk_base::ThreadManager::Instance()->WrapCurrentThread()->socketserver();
- return reinterpret_cast<talk_base::PhysicalSocketServer*>(ss);
+static rtc::PhysicalSocketServer* CurrentSocketServer() {
+ rtc::SocketServer* ss =
+ rtc::ThreadManager::Instance()->WrapCurrentThread()->socketserver();
+ return reinterpret_cast<rtc::PhysicalSocketServer*>(ss);
}
bool LinuxDeviceWatcher::Start() {
@@ -369,7 +369,7 @@
}
uint32 LinuxDeviceWatcher::GetRequestedEvents() {
- return talk_base::DE_READ;
+ return rtc::DE_READ;
}
void LinuxDeviceWatcher::OnPreEvent(uint32 ff) {
diff --git a/media/devices/linuxdevicemanager.h b/media/devices/linuxdevicemanager.h
index d8f1665..651dd6f 100644
--- a/media/devices/linuxdevicemanager.h
+++ b/media/devices/linuxdevicemanager.h
@@ -31,8 +31,8 @@
#include <string>
#include <vector>
-#include "talk/base/sigslot.h"
-#include "talk/base/stringencode.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/stringencode.h"
#include "talk/media/devices/devicemanager.h"
#include "talk/sound/soundsystemfactory.h"
diff --git a/media/devices/macdevicemanager.cc b/media/devices/macdevicemanager.cc
index 8055588..fa25b1f 100644
--- a/media/devices/macdevicemanager.cc
+++ b/media/devices/macdevicemanager.cc
@@ -30,9 +30,9 @@
#include <CoreAudio/CoreAudio.h>
#include <QuickTime/QuickTime.h>
-#include "talk/base/logging.h"
-#include "talk/base/stringutils.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/stringutils.h"
+#include "webrtc/base/thread.h"
#include "talk/media/base/mediacommon.h"
class DeviceWatcherImpl;
@@ -119,7 +119,7 @@
}
size_t num_devices = propsize / sizeof(AudioDeviceID);
- talk_base::scoped_ptr<AudioDeviceID[]> device_ids(
+ rtc::scoped_ptr<AudioDeviceID[]> device_ids(
new AudioDeviceID[num_devices]);
err = AudioHardwareGetProperty(kAudioHardwarePropertyDevices,
diff --git a/media/devices/macdevicemanager.h b/media/devices/macdevicemanager.h
index 25fe4fc..161e308 100644
--- a/media/devices/macdevicemanager.h
+++ b/media/devices/macdevicemanager.h
@@ -31,8 +31,8 @@
#include <string>
#include <vector>
-#include "talk/base/sigslot.h"
-#include "talk/base/stringencode.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/stringencode.h"
#include "talk/media/devices/devicemanager.h"
namespace cricket {
diff --git a/media/devices/macdevicemanagermm.mm b/media/devices/macdevicemanagermm.mm
index fdde91f..3091ec4 100644
--- a/media/devices/macdevicemanagermm.mm
+++ b/media/devices/macdevicemanagermm.mm
@@ -35,7 +35,7 @@
#import <assert.h>
#import <QTKit/QTKit.h>
-#include "talk/base/logging.h"
+#include "webrtc/base/logging.h"
@interface DeviceWatcherImpl : NSObject {
@private
diff --git a/media/devices/mobiledevicemanager.cc b/media/devices/mobiledevicemanager.cc
index a08911b..f9ff35b 100644
--- a/media/devices/mobiledevicemanager.cc
+++ b/media/devices/mobiledevicemanager.cc
@@ -47,7 +47,7 @@
bool MobileDeviceManager::GetVideoCaptureDevices(std::vector<Device>* devs) {
devs->clear();
- talk_base::scoped_ptr<webrtc::VideoCaptureModule::DeviceInfo> info(
+ rtc::scoped_ptr<webrtc::VideoCaptureModule::DeviceInfo> info(
webrtc::VideoCaptureFactory::CreateDeviceInfo(0));
if (!info)
return false;
diff --git a/media/devices/v4llookup.cc b/media/devices/v4llookup.cc
index 76eafa7..8b44a80 100644
--- a/media/devices/v4llookup.cc
+++ b/media/devices/v4llookup.cc
@@ -18,7 +18,7 @@
#include <sys/stat.h>
#include <unistd.h>
-#include "talk/base/logging.h"
+#include "webrtc/base/logging.h"
namespace cricket {
diff --git a/media/devices/win32devicemanager.cc b/media/devices/win32devicemanager.cc
index 071f111..668270e 100644
--- a/media/devices/win32devicemanager.cc
+++ b/media/devices/win32devicemanager.cc
@@ -38,11 +38,11 @@
#include <functiondiscoverykeys_devpkey.h>
#include <uuids.h>
-#include "talk/base/logging.h"
-#include "talk/base/stringutils.h"
-#include "talk/base/thread.h"
-#include "talk/base/win32.h" // ToUtf8
-#include "talk/base/win32window.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/stringutils.h"
+#include "webrtc/base/thread.h"
+#include "webrtc/base/win32.h" // ToUtf8
+#include "webrtc/base/win32window.h"
#include "talk/media/base/mediacommon.h"
#ifdef HAVE_LOGITECH_HEADERS
#include "third_party/logitech/files/logitechquickcam.h"
@@ -56,7 +56,7 @@
class Win32DeviceWatcher
: public DeviceWatcher,
- public talk_base::Win32Window {
+ public rtc::Win32Window {
public:
explicit Win32DeviceWatcher(Win32DeviceManager* dm);
virtual ~Win32DeviceWatcher();
@@ -151,7 +151,7 @@
std::vector<Device>* devs) {
devs->clear();
- if (talk_base::IsWindowsVistaOrLater()) {
+ if (rtc::IsWindowsVistaOrLater()) {
if (!GetCoreAudioDevices(input, devs))
return false;
} else {
@@ -199,11 +199,11 @@
std::string name_str, path_str;
if (SUCCEEDED(bag->Read(kFriendlyName, &name, 0)) &&
name.vt == VT_BSTR) {
- name_str = talk_base::ToUtf8(name.bstrVal);
+ name_str = rtc::ToUtf8(name.bstrVal);
// Get the device id if one exists.
if (SUCCEEDED(bag->Read(kDevicePath, &path, 0)) &&
path.vt == VT_BSTR) {
- path_str = talk_base::ToUtf8(path.bstrVal);
+ path_str = rtc::ToUtf8(path.bstrVal);
}
devices->push_back(Device(name_str, path_str));
@@ -224,7 +224,7 @@
HRESULT hr = bag->GetValue(key, &var);
if (SUCCEEDED(hr)) {
if (var.pwszVal)
- *out = talk_base::ToUtf8(var.pwszVal);
+ *out = rtc::ToUtf8(var.pwszVal);
else
hr = E_FAIL;
}
@@ -312,8 +312,8 @@
WAVEINCAPS caps;
if (waveInGetDevCaps(i, &caps, sizeof(caps)) == MMSYSERR_NOERROR &&
caps.wChannels > 0) {
- devs->push_back(Device(talk_base::ToUtf8(caps.szPname),
- talk_base::ToString(i)));
+ devs->push_back(Device(rtc::ToUtf8(caps.szPname),
+ rtc::ToString(i)));
}
}
} else {
@@ -322,7 +322,7 @@
WAVEOUTCAPS caps;
if (waveOutGetDevCaps(i, &caps, sizeof(caps)) == MMSYSERR_NOERROR &&
caps.wChannels > 0) {
- devs->push_back(Device(talk_base::ToUtf8(caps.szPname), i));
+ devs->push_back(Device(rtc::ToUtf8(caps.szPname), i));
}
}
}
diff --git a/media/devices/win32devicemanager.h b/media/devices/win32devicemanager.h
index 4854ec0..d931590 100644
--- a/media/devices/win32devicemanager.h
+++ b/media/devices/win32devicemanager.h
@@ -31,8 +31,8 @@
#include <string>
#include <vector>
-#include "talk/base/sigslot.h"
-#include "talk/base/stringencode.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/stringencode.h"
#include "talk/media/devices/devicemanager.h"
namespace cricket {
diff --git a/media/devices/yuvframescapturer.cc b/media/devices/yuvframescapturer.cc
index 648094b..0aa3b53 100644
--- a/media/devices/yuvframescapturer.cc
+++ b/media/devices/yuvframescapturer.cc
@@ -1,9 +1,9 @@
#include "talk/media/devices/yuvframescapturer.h"
-#include "talk/base/bytebuffer.h"
-#include "talk/base/criticalsection.h"
-#include "talk/base/logging.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/bytebuffer.h"
+#include "webrtc/base/criticalsection.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/thread.h"
#include "webrtc/system_wrappers/interface/clock.h"
@@ -13,7 +13,7 @@
// frames.
///////////////////////////////////////////////////////////////////////
class YuvFramesCapturer::YuvFramesThread
- : public talk_base::Thread, public talk_base::MessageHandler {
+ : public rtc::Thread, public rtc::MessageHandler {
public:
explicit YuvFramesThread(YuvFramesCapturer* capturer)
: capturer_(capturer),
@@ -35,12 +35,12 @@
Thread::Run();
}
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
finished_ = true;
}
// Override virtual method of parent MessageHandler. Context: Worker Thread.
- virtual void OnMessage(talk_base::Message* /*pmsg*/) {
+ virtual void OnMessage(rtc::Message* /*pmsg*/) {
int waiting_time_ms = 0;
if (capturer_) {
capturer_->ReadFrame(false);
@@ -52,13 +52,13 @@
// Check if Run() is finished.
bool Finished() const {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
return finished_;
}
private:
YuvFramesCapturer* capturer_;
- mutable talk_base::CriticalSection crit_;
+ mutable rtc::CriticalSection crit_;
bool finished_;
DISALLOW_COPY_AND_ASSIGN(YuvFramesThread);
@@ -113,7 +113,7 @@
SetCaptureFormat(&capture_format);
barcode_reference_timestamp_millis_ =
- static_cast<int64>(talk_base::Time()) * 1000;
+ static_cast<int64>(rtc::Time()) * 1000;
// Create a thread to generate frames.
frames_generator_thread = new YuvFramesThread(this);
bool ret = frames_generator_thread->Start();
@@ -166,7 +166,7 @@
frame_index_ % barcode_interval_ != 0) {
return -1;
}
- int64 now_millis = static_cast<int64>(talk_base::Time()) * 1000;
+ int64 now_millis = static_cast<int64>(rtc::Time()) * 1000;
return static_cast<int32>(now_millis - barcode_reference_timestamp_millis_);
}
diff --git a/media/devices/yuvframescapturer.h b/media/devices/yuvframescapturer.h
index 7886525..52eec58 100644
--- a/media/devices/yuvframescapturer.h
+++ b/media/devices/yuvframescapturer.h
@@ -4,13 +4,13 @@
#include <string>
#include <vector>
-#include "talk/base/stream.h"
-#include "talk/base/stringutils.h"
+#include "webrtc/base/stream.h"
+#include "webrtc/base/stringutils.h"
#include "talk/media/base/videocapturer.h"
#include "talk/media/base/yuvframegenerator.h"
-namespace talk_base {
+namespace rtc {
class FileStream;
}
@@ -31,7 +31,7 @@
return Device(id.str(), id.str());
}
static bool IsYuvFramesCapturerDevice(const Device& device) {
- return talk_base::starts_with(device.id.c_str(), kYuvFrameDeviceName);
+ return rtc::starts_with(device.id.c_str(), kYuvFrameDeviceName);
}
void Init();
diff --git a/media/other/linphonemediaengine.cc b/media/other/linphonemediaengine.cc
index 3b97c0b..fabb316 100644
--- a/media/other/linphonemediaengine.cc
+++ b/media/other/linphonemediaengine.cc
@@ -38,11 +38,11 @@
#include "talk/media/other/linphonemediaengine.h"
-#include "talk/base/buffer.h"
-#include "talk/base/event.h"
-#include "talk/base/logging.h"
-#include "talk/base/pathutils.h"
-#include "talk/base/stream.h"
+#include "webrtc/base/buffer.h"
+#include "webrtc/base/event.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/pathutils.h"
+#include "webrtc/base/stream.h"
#include "talk/media/base/rtpdump.h"
#ifndef WIN32
@@ -137,11 +137,11 @@
ring_stream_(0)
{
- talk_base::Thread *thread = talk_base::ThreadManager::CurrentThread();
- talk_base::SocketServer *ss = thread->socketserver();
+ rtc::Thread *thread = rtc::ThreadManager::CurrentThread();
+ rtc::SocketServer *ss = thread->socketserver();
socket_.reset(ss->CreateAsyncSocket(SOCK_DGRAM));
- socket_->Bind(talk_base::SocketAddress("localhost",3000));
+ socket_->Bind(rtc::SocketAddress("localhost",3000));
socket_->SignalReadEvent.connect(this, &LinphoneVoiceChannel::OnIncomingData);
}
@@ -216,7 +216,7 @@
return true;
}
-void LinphoneVoiceChannel::OnPacketReceived(talk_base::Buffer* packet) {
+void LinphoneVoiceChannel::OnPacketReceived(rtc::Buffer* packet) {
const void* data = packet->data();
int len = packet->length();
uint8 buf[2048];
@@ -227,7 +227,7 @@
*/
int payloadtype = buf[1] & 0x7f;
if (play_ && payloadtype != 13)
- socket_->SendTo(buf, len, talk_base::SocketAddress("localhost",2000));
+ socket_->SendTo(buf, len, rtc::SocketAddress("localhost",2000));
}
void LinphoneVoiceChannel::StartRing(bool bIncomingCall)
@@ -263,12 +263,12 @@
}
}
-void LinphoneVoiceChannel::OnIncomingData(talk_base::AsyncSocket *s)
+void LinphoneVoiceChannel::OnIncomingData(rtc::AsyncSocket *s)
{
char *buf[2048];
int len;
len = s->Recv(buf, sizeof(buf));
- talk_base::Buffer packet(buf, len);
+ rtc::Buffer packet(buf, len);
if (network_interface_ && !mute_)
network_interface_->SendPacket(&packet);
}
diff --git a/media/other/linphonemediaengine.h b/media/other/linphonemediaengine.h
index db3e69f..7c49c16 100644
--- a/media/other/linphonemediaengine.h
+++ b/media/other/linphonemediaengine.h
@@ -37,12 +37,12 @@
#include <mediastreamer2/mediastream.h>
}
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/media/base/codec.h"
#include "talk/media/base/mediachannel.h"
#include "talk/media/base/mediaengine.h"
-namespace talk_base {
+namespace rtc {
class StreamInterface;
}
@@ -140,8 +140,8 @@
virtual bool GetStats(VoiceMediaInfo* info) { return true; }
// Implement pure virtual methods of MediaChannel.
- virtual void OnPacketReceived(talk_base::Buffer* packet);
- virtual void OnRtcpReceived(talk_base::Buffer* packet) {}
+ virtual void OnPacketReceived(rtc::Buffer* packet);
+ virtual void OnRtcpReceived(rtc::Buffer* packet) {}
virtual void SetSendSsrc(uint32 id) {} // TODO: change RTP packet?
virtual bool SetRtcpCName(const std::string& cname) { return true; }
virtual bool Mute(bool on) { return mute_; }
@@ -163,8 +163,8 @@
AudioStream *audio_stream_;
LinphoneMediaEngine *engine_;
RingStream* ring_stream_;
- talk_base::scoped_ptr<talk_base::AsyncSocket> socket_;
- void OnIncomingData(talk_base::AsyncSocket *s);
+ rtc::scoped_ptr<rtc::AsyncSocket> socket_;
+ void OnIncomingData(rtc::AsyncSocket *s);
DISALLOW_COPY_AND_ASSIGN(LinphoneVoiceChannel);
};
diff --git a/media/sctp/sctpdataengine.cc b/media/sctp/sctpdataengine.cc
index 3647d21..eff18a8 100644
--- a/media/sctp/sctpdataengine.cc
+++ b/media/sctp/sctpdataengine.cc
@@ -32,10 +32,10 @@
#include <sstream>
#include <vector>
-#include "talk/base/buffer.h"
-#include "talk/base/helpers.h"
-#include "talk/base/logging.h"
-#include "talk/base/safe_conversions.h"
+#include "webrtc/base/buffer.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/safe_conversions.h"
#include "talk/media/base/codec.h"
#include "talk/media/base/constants.h"
#include "talk/media/base/streamparams.h"
@@ -102,8 +102,8 @@
} // namespace
namespace cricket {
-typedef talk_base::ScopedMessageData<SctpInboundPacket> InboundPacketMessage;
-typedef talk_base::ScopedMessageData<talk_base::Buffer> OutboundPacketMessage;
+typedef rtc::ScopedMessageData<SctpInboundPacket> InboundPacketMessage;
+typedef rtc::ScopedMessageData<rtc::Buffer> OutboundPacketMessage;
// TODO(ldixon): Find where this is defined, and also check is Sctp really
// respects this.
@@ -111,11 +111,11 @@
enum {
MSG_SCTPINBOUNDPACKET = 1, // MessageData is SctpInboundPacket
- MSG_SCTPOUTBOUNDPACKET = 2, // MessageData is talk_base:Buffer
+ MSG_SCTPOUTBOUNDPACKET = 2, // MessageData is rtc:Buffer
};
struct SctpInboundPacket {
- talk_base::Buffer buffer;
+ rtc::Buffer buffer;
ReceiveDataParams params;
// The |flags| parameter is used by SCTP to distinguish notification packets
// from other types of packets.
@@ -187,7 +187,7 @@
<< "; set_df: " << std::hex << static_cast<int>(set_df);
// Note: We have to copy the data; the caller will delete it.
OutboundPacketMessage* msg =
- new OutboundPacketMessage(new talk_base::Buffer(data, length));
+ new OutboundPacketMessage(new rtc::Buffer(data, length));
channel->worker_thread()->Post(channel, MSG_SCTPOUTBOUNDPACKET, msg);
return 0;
}
@@ -206,7 +206,7 @@
// memory cleanup. But this does simplify code.
const SctpDataMediaChannel::PayloadProtocolIdentifier ppid =
static_cast<SctpDataMediaChannel::PayloadProtocolIdentifier>(
- talk_base::HostToNetwork32(rcv.rcv_ppid));
+ rtc::HostToNetwork32(rcv.rcv_ppid));
cricket::DataMessageType type = cricket::DMT_NONE;
if (!GetDataMediaType(ppid, &type) && !(flags & MSG_NOTIFICATION)) {
// It's neither a notification nor a recognized data packet. Drop it.
@@ -287,7 +287,7 @@
if (usrsctp_finish() == 0)
return;
- talk_base::Thread::SleepMs(10);
+ rtc::Thread::SleepMs(10);
}
LOG(LS_ERROR) << "Failed to shutdown usrsctp.";
}
@@ -298,10 +298,10 @@
if (data_channel_type != DCT_SCTP) {
return NULL;
}
- return new SctpDataMediaChannel(talk_base::Thread::Current());
+ return new SctpDataMediaChannel(rtc::Thread::Current());
}
-SctpDataMediaChannel::SctpDataMediaChannel(talk_base::Thread* thread)
+SctpDataMediaChannel::SctpDataMediaChannel(rtc::Thread* thread)
: worker_thread_(thread),
local_port_(kSctpDefaultPort),
remote_port_(kSctpDefaultPort),
@@ -322,7 +322,7 @@
sconn.sconn_len = sizeof(sockaddr_conn);
#endif
// Note: conversion from int to uint16_t happens here.
- sconn.sconn_port = talk_base::HostToNetwork16(port);
+ sconn.sconn_port = rtc::HostToNetwork16(port);
sconn.sconn_addr = this;
return sconn;
}
@@ -501,7 +501,7 @@
bool SctpDataMediaChannel::SendData(
const SendDataParams& params,
- const talk_base::Buffer& payload,
+ const rtc::Buffer& payload,
SendDataResult* result) {
if (result) {
// Preset |result| to assume an error. If SendData succeeds, we'll
@@ -530,7 +530,7 @@
struct sctp_sendv_spa spa = {0};
spa.sendv_flags |= SCTP_SEND_SNDINFO_VALID;
spa.sendv_sndinfo.snd_sid = params.ssrc;
- spa.sendv_sndinfo.snd_ppid = talk_base::HostToNetwork32(
+ spa.sendv_sndinfo.snd_ppid = rtc::HostToNetwork32(
GetPpid(params.type));
// Ordered implies reliable.
@@ -551,7 +551,7 @@
send_res = usrsctp_sendv(sock_, payload.data(),
static_cast<size_t>(payload.length()),
NULL, 0, &spa,
- talk_base::checked_cast<socklen_t>(sizeof(spa)),
+ rtc::checked_cast<socklen_t>(sizeof(spa)),
SCTP_SENDV_SPA, 0);
if (send_res < 0) {
if (errno == SCTP_EWOULDBLOCK) {
@@ -573,7 +573,7 @@
// Called by network interface when a packet has been received.
void SctpDataMediaChannel::OnPacketReceived(
- talk_base::Buffer* packet, const talk_base::PacketTime& packet_time) {
+ rtc::Buffer* packet, const rtc::PacketTime& packet_time) {
LOG(LS_VERBOSE) << debug_name_ << "->OnPacketReceived(...): " << " length="
<< packet->length() << ", sending: " << sending_;
// Only give receiving packets to usrsctp after if connected. This enables two
@@ -613,7 +613,7 @@
}
void SctpDataMediaChannel::OnDataFromSctpToChannel(
- const ReceiveDataParams& params, talk_base::Buffer* buffer) {
+ const ReceiveDataParams& params, rtc::Buffer* buffer) {
if (receiving_) {
LOG(LS_VERBOSE) << debug_name_ << "->OnDataFromSctpToChannel(...): "
<< "Posting with length: " << buffer->length()
@@ -682,7 +682,7 @@
return true;
}
-void SctpDataMediaChannel::OnNotificationFromSctp(talk_base::Buffer* buffer) {
+void SctpDataMediaChannel::OnNotificationFromSctp(rtc::Buffer* buffer) {
const sctp_notification& notification =
reinterpret_cast<const sctp_notification&>(*buffer->data());
ASSERT(notification.sn_header.sn_length == buffer->length());
@@ -857,7 +857,7 @@
for (size_t i = 0; i < codecs.size(); ++i) {
if (codecs[i].Matches(match_pattern)) {
if (codecs[i].GetParam(param, &value)) {
- *dest = talk_base::FromString<int>(value);
+ *dest = rtc::FromString<int>(value);
return true;
}
}
@@ -878,7 +878,7 @@
}
void SctpDataMediaChannel::OnPacketFromSctpToNetwork(
- talk_base::Buffer* buffer) {
+ rtc::Buffer* buffer) {
if (buffer->length() > kSctpMtu) {
LOG(LS_ERROR) << debug_name_ << "->OnPacketFromSctpToNetwork(...): "
<< "SCTP seems to have made a packet that is bigger "
@@ -905,7 +905,7 @@
&reset_stream_buf[0]);
resetp->srs_assoc_id = SCTP_ALL_ASSOC;
resetp->srs_flags = SCTP_STREAM_RESET_INCOMING | SCTP_STREAM_RESET_OUTGOING;
- resetp->srs_number_streams = talk_base::checked_cast<uint16_t>(num_streams);
+ resetp->srs_number_streams = rtc::checked_cast<uint16_t>(num_streams);
int result_idx = 0;
for (StreamSet::iterator it = queued_reset_streams_.begin();
it != queued_reset_streams_.end(); ++it) {
@@ -914,7 +914,7 @@
int ret = usrsctp_setsockopt(
sock_, IPPROTO_SCTP, SCTP_RESET_STREAMS, resetp,
- talk_base::checked_cast<socklen_t>(reset_stream_buf.size()));
+ rtc::checked_cast<socklen_t>(reset_stream_buf.size()));
if (ret < 0) {
LOG_ERRNO(LS_ERROR) << debug_name_ << "Failed to send a stream reset for "
<< num_streams << " streams";
@@ -927,16 +927,16 @@
return true;
}
-void SctpDataMediaChannel::OnMessage(talk_base::Message* msg) {
+void SctpDataMediaChannel::OnMessage(rtc::Message* msg) {
switch (msg->message_id) {
case MSG_SCTPINBOUNDPACKET: {
- talk_base::scoped_ptr<InboundPacketMessage> pdata(
+ rtc::scoped_ptr<InboundPacketMessage> pdata(
static_cast<InboundPacketMessage*>(msg->pdata));
OnInboundPacketFromSctpToChannel(pdata->data().get());
break;
}
case MSG_SCTPOUTBOUNDPACKET: {
- talk_base::scoped_ptr<OutboundPacketMessage> pdata(
+ rtc::scoped_ptr<OutboundPacketMessage> pdata(
static_cast<OutboundPacketMessage*>(msg->pdata));
OnPacketFromSctpToNetwork(pdata->data().get());
break;
diff --git a/media/sctp/sctpdataengine.h b/media/sctp/sctpdataengine.h
index 2e8beec..1795059 100644
--- a/media/sctp/sctpdataengine.h
+++ b/media/sctp/sctpdataengine.h
@@ -41,8 +41,8 @@
};
} // namespace cricket
-#include "talk/base/buffer.h"
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/buffer.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/media/base/codec.h"
#include "talk/media/base/mediachannel.h"
#include "talk/media/base/mediaengine.h"
@@ -107,7 +107,7 @@
struct SctpInboundPacket;
class SctpDataMediaChannel : public DataMediaChannel,
- public talk_base::MessageHandler {
+ public rtc::MessageHandler {
public:
// DataMessageType is used for the SCTP "Payload Protocol Identifier", as
// defined in http://tools.ietf.org/html/rfc4960#section-14.4
@@ -132,7 +132,7 @@
// Given a thread which will be used to post messages (received data) to this
// SctpDataMediaChannel instance.
- explicit SctpDataMediaChannel(talk_base::Thread* thread);
+ explicit SctpDataMediaChannel(rtc::Thread* thread);
virtual ~SctpDataMediaChannel();
// When SetSend is set to true, connects. When set to false, disconnects.
@@ -149,19 +149,19 @@
// Called when Sctp gets data. The data may be a notification or data for
// OnSctpInboundData. Called from the worker thread.
- virtual void OnMessage(talk_base::Message* msg);
+ virtual void OnMessage(rtc::Message* msg);
// Send data down this channel (will be wrapped as SCTP packets then given to
// sctp that will then post the network interface by OnMessage).
// Returns true iff successful data somewhere on the send-queue/network.
virtual bool SendData(const SendDataParams& params,
- const talk_base::Buffer& payload,
+ const rtc::Buffer& payload,
SendDataResult* result = NULL);
// A packet is received from the network interface. Posted to OnMessage.
- virtual void OnPacketReceived(talk_base::Buffer* packet,
- const talk_base::PacketTime& packet_time);
+ virtual void OnPacketReceived(rtc::Buffer* packet,
+ const rtc::PacketTime& packet_time);
// Exposed to allow Post call from c-callbacks.
- talk_base::Thread* worker_thread() const { return worker_thread_; }
+ rtc::Thread* worker_thread() const { return worker_thread_; }
// TODO(ldixon): add a DataOptions class to mediachannel.h
virtual bool SetOptions(int options) { return false; }
@@ -180,8 +180,8 @@
const std::vector<RtpHeaderExtension>& extensions) { return true; }
virtual bool SetSendCodecs(const std::vector<DataCodec>& codecs);
virtual bool SetRecvCodecs(const std::vector<DataCodec>& codecs);
- virtual void OnRtcpReceived(talk_base::Buffer* packet,
- const talk_base::PacketTime& packet_time) {}
+ virtual void OnRtcpReceived(rtc::Buffer* packet,
+ const rtc::PacketTime& packet_time) {}
virtual void OnReadyToSend(bool ready) {}
// Helper for debugging.
@@ -213,19 +213,19 @@
bool ResetStream(uint32 ssrc);
// Called by OnMessage to send packet on the network.
- void OnPacketFromSctpToNetwork(talk_base::Buffer* buffer);
+ void OnPacketFromSctpToNetwork(rtc::Buffer* buffer);
// Called by OnMessage to decide what to do with the packet.
void OnInboundPacketFromSctpToChannel(SctpInboundPacket* packet);
void OnDataFromSctpToChannel(const ReceiveDataParams& params,
- talk_base::Buffer* buffer);
- void OnNotificationFromSctp(talk_base::Buffer* buffer);
+ rtc::Buffer* buffer);
+ void OnNotificationFromSctp(rtc::Buffer* buffer);
void OnNotificationAssocChange(const sctp_assoc_change& change);
void OnStreamResetEvent(const struct sctp_stream_reset_event* evt);
// Responsible for marshalling incoming data to the channels listeners, and
// outgoing data to the network interface.
- talk_base::Thread* worker_thread_;
+ rtc::Thread* worker_thread_;
// The local and remote SCTP port to use. These are passed along the wire
// and the listener and connector must be using the same port. It is not
// related to the ports at the IP level. If set to -1, we default to
diff --git a/media/sctp/sctpdataengine_unittest.cc b/media/sctp/sctpdataengine_unittest.cc
index cf410e5..a656603 100644
--- a/media/sctp/sctpdataengine_unittest.cc
+++ b/media/sctp/sctpdataengine_unittest.cc
@@ -31,16 +31,16 @@
#include <string>
#include <vector>
-#include "talk/base/bind.h"
-#include "talk/base/buffer.h"
-#include "talk/base/criticalsection.h"
-#include "talk/base/gunit.h"
-#include "talk/base/helpers.h"
-#include "talk/base/messagehandler.h"
-#include "talk/base/messagequeue.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/ssladapter.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/bind.h"
+#include "webrtc/base/buffer.h"
+#include "webrtc/base/criticalsection.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/messagehandler.h"
+#include "webrtc/base/messagequeue.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/ssladapter.h"
+#include "webrtc/base/thread.h"
#include "talk/media/base/constants.h"
#include "talk/media/base/mediachannel.h"
#include "talk/media/sctp/sctpdataengine.h"
@@ -52,9 +52,9 @@
// Fake NetworkInterface that sends/receives sctp packets. The one in
// talk/media/base/fakenetworkinterface.h only works with rtp/rtcp.
class SctpFakeNetworkInterface : public cricket::MediaChannel::NetworkInterface,
- public talk_base::MessageHandler {
+ public rtc::MessageHandler {
public:
- explicit SctpFakeNetworkInterface(talk_base::Thread* thread)
+ explicit SctpFakeNetworkInterface(rtc::Thread* thread)
: thread_(thread),
dest_(NULL) {
}
@@ -63,15 +63,15 @@
protected:
// Called to send raw packet down the wire (e.g. SCTP an packet).
- virtual bool SendPacket(talk_base::Buffer* packet,
- talk_base::DiffServCodePoint dscp) {
+ virtual bool SendPacket(rtc::Buffer* packet,
+ rtc::DiffServCodePoint dscp) {
LOG(LS_VERBOSE) << "SctpFakeNetworkInterface::SendPacket";
// TODO(ldixon): Can/should we use Buffer.TransferTo here?
// Note: this assignment does a deep copy of data from packet.
- talk_base::Buffer* buffer = new talk_base::Buffer(packet->data(),
+ rtc::Buffer* buffer = new rtc::Buffer(packet->data(),
packet->length());
- thread_->Post(this, MSG_PACKET, talk_base::WrapMessageData(buffer));
+ thread_->Post(this, MSG_PACKET, rtc::WrapMessageData(buffer));
LOG(LS_VERBOSE) << "SctpFakeNetworkInterface::SendPacket, Posted message.";
return true;
}
@@ -79,13 +79,13 @@
// Called when a raw packet has been recieved. This passes the data to the
// code that will interpret the packet. e.g. to get the content payload from
// an SCTP packet.
- virtual void OnMessage(talk_base::Message* msg) {
+ virtual void OnMessage(rtc::Message* msg) {
LOG(LS_VERBOSE) << "SctpFakeNetworkInterface::OnMessage";
- talk_base::scoped_ptr<talk_base::Buffer> buffer(
- static_cast<talk_base::TypedMessageData<talk_base::Buffer*>*>(
+ rtc::scoped_ptr<rtc::Buffer> buffer(
+ static_cast<rtc::TypedMessageData<rtc::Buffer*>*>(
msg->pdata)->data());
if (dest_) {
- dest_->OnPacketReceived(buffer.get(), talk_base::PacketTime());
+ dest_->OnPacketReceived(buffer.get(), rtc::PacketTime());
}
delete msg->pdata;
}
@@ -93,23 +93,23 @@
// Unsupported functions required to exist by NetworkInterface.
// TODO(ldixon): Refactor parent NetworkInterface class so these are not
// required. They are RTC specific and should be in an appropriate subclass.
- virtual bool SendRtcp(talk_base::Buffer* packet,
- talk_base::DiffServCodePoint dscp) {
+ virtual bool SendRtcp(rtc::Buffer* packet,
+ rtc::DiffServCodePoint dscp) {
LOG(LS_WARNING) << "Unsupported: SctpFakeNetworkInterface::SendRtcp.";
return false;
}
- virtual int SetOption(SocketType type, talk_base::Socket::Option opt,
+ virtual int SetOption(SocketType type, rtc::Socket::Option opt,
int option) {
LOG(LS_WARNING) << "Unsupported: SctpFakeNetworkInterface::SetOption.";
return 0;
}
- virtual void SetDefaultDSCPCode(talk_base::DiffServCodePoint dscp) {
+ virtual void SetDefaultDSCPCode(rtc::DiffServCodePoint dscp) {
LOG(LS_WARNING) << "Unsupported: SctpFakeNetworkInterface::SetOption.";
}
private:
// Not owned by this class.
- talk_base::Thread* thread_;
+ rtc::Thread* thread_;
cricket::DataMediaChannel* dest_;
};
@@ -219,11 +219,11 @@
// usrsctp uses the NSS random number generator on non-Android platforms,
// so we need to initialize SSL.
static void SetUpTestCase() {
- talk_base::InitializeSSL();
+ rtc::InitializeSSL();
}
static void TearDownTestCase() {
- talk_base::CleanupSSL();
+ rtc::CleanupSSL();
}
virtual void SetUp() {
@@ -231,8 +231,8 @@
}
void SetupConnectedChannels() {
- net1_.reset(new SctpFakeNetworkInterface(talk_base::Thread::Current()));
- net2_.reset(new SctpFakeNetworkInterface(talk_base::Thread::Current()));
+ net1_.reset(new SctpFakeNetworkInterface(rtc::Thread::Current()));
+ net2_.reset(new SctpFakeNetworkInterface(rtc::Thread::Current()));
recv1_.reset(new SctpFakeDataReceiver());
recv2_.reset(new SctpFakeDataReceiver());
chan1_.reset(CreateChannel(net1_.get(), recv1_.get()));
@@ -294,7 +294,7 @@
cricket::SendDataParams params;
params.ssrc = ssrc;
- return chan->SendData(params, talk_base::Buffer(
+ return chan->SendData(params, rtc::Buffer(
&msg[0], msg.length()), result);
}
@@ -306,10 +306,10 @@
}
bool ProcessMessagesUntilIdle() {
- talk_base::Thread* thread = talk_base::Thread::Current();
+ rtc::Thread* thread = rtc::Thread::Current();
while (!thread->empty()) {
- talk_base::Message msg;
- if (thread->Get(&msg, talk_base::kForever)) {
+ rtc::Message msg;
+ if (thread->Get(&msg, rtc::kForever)) {
thread->Dispatch(&msg);
}
}
@@ -322,13 +322,13 @@
SctpFakeDataReceiver* receiver2() { return recv2_.get(); }
private:
- talk_base::scoped_ptr<cricket::SctpDataEngine> engine_;
- talk_base::scoped_ptr<SctpFakeNetworkInterface> net1_;
- talk_base::scoped_ptr<SctpFakeNetworkInterface> net2_;
- talk_base::scoped_ptr<SctpFakeDataReceiver> recv1_;
- talk_base::scoped_ptr<SctpFakeDataReceiver> recv2_;
- talk_base::scoped_ptr<cricket::SctpDataMediaChannel> chan1_;
- talk_base::scoped_ptr<cricket::SctpDataMediaChannel> chan2_;
+ rtc::scoped_ptr<cricket::SctpDataEngine> engine_;
+ rtc::scoped_ptr<SctpFakeNetworkInterface> net1_;
+ rtc::scoped_ptr<SctpFakeNetworkInterface> net2_;
+ rtc::scoped_ptr<SctpFakeDataReceiver> recv1_;
+ rtc::scoped_ptr<SctpFakeDataReceiver> recv2_;
+ rtc::scoped_ptr<cricket::SctpDataMediaChannel> chan1_;
+ rtc::scoped_ptr<cricket::SctpDataMediaChannel> chan2_;
};
// Verifies that SignalReadyToSend is fired.
@@ -398,7 +398,7 @@
for (size_t i = 0; i < 100; ++i) {
channel1()->SendData(
- params, talk_base::Buffer(&buffer[0], buffer.size()), &result);
+ params, rtc::Buffer(&buffer[0], buffer.size()), &result);
if (result == cricket::SDR_BLOCK)
break;
}
diff --git a/media/webrtc/fakewebrtccommon.h b/media/webrtc/fakewebrtccommon.h
index 026ad10..d1c2320 100644
--- a/media/webrtc/fakewebrtccommon.h
+++ b/media/webrtc/fakewebrtccommon.h
@@ -28,7 +28,7 @@
#ifndef TALK_SESSION_PHONE_FAKEWEBRTCCOMMON_H_
#define TALK_SESSION_PHONE_FAKEWEBRTCCOMMON_H_
-#include "talk/base/common.h"
+#include "webrtc/base/common.h"
namespace cricket {
@@ -41,6 +41,11 @@
#define WEBRTC_BOOL_STUB(method, args) \
virtual bool method args OVERRIDE { return true; }
+#ifdef USE_WEBRTC_DEV_BRANCH
+#define WEBRTC_BOOL_STUB_CONST(method, args) \
+ virtual bool method args const OVERRIDE { return true; }
+#endif
+
#define WEBRTC_VOID_STUB(method, args) \
virtual void method args OVERRIDE {}
diff --git a/media/webrtc/fakewebrtcdeviceinfo.h b/media/webrtc/fakewebrtcdeviceinfo.h
index 585f31e..2d015de 100644
--- a/media/webrtc/fakewebrtcdeviceinfo.h
+++ b/media/webrtc/fakewebrtcdeviceinfo.h
@@ -28,7 +28,7 @@
#include <vector>
-#include "talk/base/stringutils.h"
+#include "webrtc/base/stringutils.h"
#include "talk/media/webrtc/webrtcvideocapturer.h"
// Fake class for mocking out webrtc::VideoCaptureModule::DeviceInfo.
@@ -64,12 +64,12 @@
uint32_t product_id_len) {
Device* dev = GetDeviceByIndex(device_num);
if (!dev) return -1;
- talk_base::strcpyn(reinterpret_cast<char*>(device_name), device_name_len,
+ rtc::strcpyn(reinterpret_cast<char*>(device_name), device_name_len,
dev->name.c_str());
- talk_base::strcpyn(reinterpret_cast<char*>(device_id), device_id_len,
+ rtc::strcpyn(reinterpret_cast<char*>(device_id), device_id_len,
dev->id.c_str());
if (product_id) {
- talk_base::strcpyn(reinterpret_cast<char*>(product_id), product_id_len,
+ rtc::strcpyn(reinterpret_cast<char*>(product_id), product_id_len,
dev->product.c_str());
}
return 0;
diff --git a/media/webrtc/fakewebrtcvideoengine.h b/media/webrtc/fakewebrtcvideoengine.h
index 528ada5..3a619bd 100644
--- a/media/webrtc/fakewebrtcvideoengine.h
+++ b/media/webrtc/fakewebrtcvideoengine.h
@@ -32,9 +32,9 @@
#include <set>
#include <vector>
-#include "talk/base/basictypes.h"
-#include "talk/base/gunit.h"
-#include "talk/base/stringutils.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/stringutils.h"
#include "talk/media/base/codec.h"
#include "talk/media/webrtc/fakewebrtccommon.h"
#include "talk/media/webrtc/webrtcvideodecoderfactory.h"
@@ -742,7 +742,7 @@
} else {
out_codec.codecType = webrtc::kVideoCodecUnknown;
}
- talk_base::strcpyn(out_codec.plName, sizeof(out_codec.plName),
+ rtc::strcpyn(out_codec.plName, sizeof(out_codec.plName),
c.name.c_str());
out_codec.plType = c.id;
out_codec.width = c.width;
@@ -1032,7 +1032,7 @@
WEBRTC_FUNC_CONST(GetRTCPCName, (const int channel,
char rtcp_cname[KMaxRTCPCNameLength])) {
WEBRTC_CHECK_CHANNEL(channel);
- talk_base::strcpyn(rtcp_cname, KMaxRTCPCNameLength,
+ rtc::strcpyn(rtcp_cname, KMaxRTCPCNameLength,
channels_.find(channel)->second->cname_.c_str());
return 0;
}
diff --git a/media/webrtc/fakewebrtcvoiceengine.h b/media/webrtc/fakewebrtcvoiceengine.h
index a5b6031..d95acb7 100644
--- a/media/webrtc/fakewebrtcvoiceengine.h
+++ b/media/webrtc/fakewebrtcvoiceengine.h
@@ -32,14 +32,17 @@
#include <map>
#include <vector>
-#include "talk/base/basictypes.h"
-#include "talk/base/gunit.h"
-#include "talk/base/stringutils.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/stringutils.h"
#include "talk/media/base/codec.h"
#include "talk/media/base/rtputils.h"
#include "talk/media/base/voiceprocessor.h"
#include "talk/media/webrtc/fakewebrtccommon.h"
#include "talk/media/webrtc/webrtcvoe.h"
+#ifdef USE_WEBRTC_DEV_BRANCH
+#include "webrtc/modules/audio_processing/include/audio_processing.h"
+#endif
namespace webrtc {
class ViENetwork;
@@ -70,6 +73,88 @@
} \
} while (0);
+#ifdef USE_WEBRTC_DEV_BRANCH
+class FakeAudioProcessing : public webrtc::AudioProcessing {
+ public:
+ FakeAudioProcessing() : experimental_ns_enabled_(false) {}
+
+ WEBRTC_STUB(Initialize, ())
+ WEBRTC_STUB(Initialize, (
+ int input_sample_rate_hz,
+ int output_sample_rate_hz,
+ int reverse_sample_rate_hz,
+ webrtc::AudioProcessing::ChannelLayout input_layout,
+ webrtc::AudioProcessing::ChannelLayout output_layout,
+ webrtc::AudioProcessing::ChannelLayout reverse_layout));
+
+ WEBRTC_VOID_FUNC(SetExtraOptions, (const webrtc::Config& config)) {
+ experimental_ns_enabled_ = config.Get<webrtc::ExperimentalNs>().enabled;
+ }
+
+ WEBRTC_STUB(set_sample_rate_hz, (int rate));
+ WEBRTC_STUB_CONST(input_sample_rate_hz, ());
+ WEBRTC_STUB_CONST(sample_rate_hz, ());
+ WEBRTC_STUB_CONST(proc_sample_rate_hz, ());
+ WEBRTC_STUB_CONST(proc_split_sample_rate_hz, ());
+ WEBRTC_STUB_CONST(num_input_channels, ());
+ WEBRTC_STUB_CONST(num_output_channels, ());
+ WEBRTC_STUB_CONST(num_reverse_channels, ());
+ WEBRTC_VOID_STUB(set_output_will_be_muted, (bool muted));
+ WEBRTC_BOOL_STUB_CONST(output_will_be_muted, ());
+ WEBRTC_STUB(ProcessStream, (webrtc::AudioFrame* frame));
+ WEBRTC_STUB(ProcessStream, (
+ const float* const* src,
+ int samples_per_channel,
+ int input_sample_rate_hz,
+ webrtc::AudioProcessing::ChannelLayout input_layout,
+ int output_sample_rate_hz,
+ webrtc::AudioProcessing::ChannelLayout output_layout,
+ float* const* dest));
+ WEBRTC_STUB(AnalyzeReverseStream, (webrtc::AudioFrame* frame));
+ WEBRTC_STUB(AnalyzeReverseStream, (
+ const float* const* data,
+ int samples_per_channel,
+ int sample_rate_hz,
+ webrtc::AudioProcessing::ChannelLayout layout));
+ WEBRTC_STUB(set_stream_delay_ms, (int delay));
+ WEBRTC_STUB_CONST(stream_delay_ms, ());
+ WEBRTC_BOOL_STUB_CONST(was_stream_delay_set, ());
+ WEBRTC_VOID_STUB(set_stream_key_pressed, (bool key_pressed));
+ WEBRTC_BOOL_STUB_CONST(stream_key_pressed, ());
+ WEBRTC_VOID_STUB(set_delay_offset_ms, (int offset));
+ WEBRTC_STUB_CONST(delay_offset_ms, ());
+ WEBRTC_STUB(StartDebugRecording, (const char filename[kMaxFilenameSize]));
+ WEBRTC_STUB(StartDebugRecording, (FILE* handle));
+ WEBRTC_STUB(StopDebugRecording, ());
+ virtual webrtc::EchoCancellation* echo_cancellation() const OVERRIDE {
+ return NULL;
+ }
+ virtual webrtc::EchoControlMobile* echo_control_mobile() const OVERRIDE {
+ return NULL;
+ }
+ virtual webrtc::GainControl* gain_control() const OVERRIDE { return NULL; }
+ virtual webrtc::HighPassFilter* high_pass_filter() const OVERRIDE {
+ return NULL;
+ }
+ virtual webrtc::LevelEstimator* level_estimator() const OVERRIDE {
+ return NULL;
+ }
+ virtual webrtc::NoiseSuppression* noise_suppression() const OVERRIDE {
+ return NULL;
+ }
+ virtual webrtc::VoiceDetection* voice_detection() const OVERRIDE {
+ return NULL;
+ }
+
+ bool experimental_ns_enabled() {
+ return experimental_ns_enabled_;
+ }
+
+ private:
+ bool experimental_ns_enabled_;
+};
+#endif
+
class FakeWebRtcVoiceEngine
: public webrtc::VoEAudioProcessing,
public webrtc::VoEBase, public webrtc::VoECodec, public webrtc::VoEDtmf,
@@ -347,7 +432,11 @@
return 0;
}
virtual webrtc::AudioProcessing* audio_processing() OVERRIDE {
+#ifdef USE_WEBRTC_DEV_BRANCH
+ return &audio_processing_;
+#else
return NULL;
+#endif
}
WEBRTC_FUNC(CreateChannel, ()) {
return AddChannel();
@@ -412,7 +501,7 @@
}
const cricket::AudioCodec& c(*codecs_[index]);
codec.pltype = c.id;
- talk_base::strcpyn(codec.plname, sizeof(codec.plname), c.name.c_str());
+ rtc::strcpyn(codec.plname, sizeof(codec.plname), c.name.c_str());
codec.plfreq = c.clockrate;
codec.pacsize = 0;
codec.channels = c.channels;
@@ -1197,6 +1286,9 @@
int playout_sample_rate_;
DtmfInfo dtmf_info_;
webrtc::VoEMediaProcess* media_processor_;
+#ifdef USE_WEBRTC_DEV_BRANCH
+ FakeAudioProcessing audio_processing_;
+#endif
};
#undef WEBRTC_CHECK_HEADER_EXTENSION_ID
diff --git a/media/webrtc/webrtcexport.h b/media/webrtc/webrtcexport.h
index 71ebe4e..b00b0cb 100644
--- a/media/webrtc/webrtcexport.h
+++ b/media/webrtc/webrtcexport.h
@@ -27,6 +27,9 @@
#ifndef TALK_MEDIA_WEBRTC_WEBRTCEXPORT_H_
#define TALK_MEDIA_WEBRTC_WEBRTCEXPORT_H_
+// When building for Chrome a part of the code can be built into
+// a shared library, which is controlled by these macros.
+// For all other builds, we always build a static library.
#if !defined(GOOGLE_CHROME_BUILD) && !defined(CHROMIUM_BUILD)
#define LIBPEERCONNECTION_LIB 1
#endif
diff --git a/media/webrtc/webrtcmediaengine.h b/media/webrtc/webrtcmediaengine.h
index 6ca39e7..701417c 100644
--- a/media/webrtc/webrtcmediaengine.h
+++ b/media/webrtc/webrtcmediaengine.h
@@ -68,7 +68,7 @@
virtual ~WebRtcMediaEngine() {
DestroyWebRtcMediaEngine(delegate_);
}
- virtual bool Init(talk_base::Thread* worker_thread) OVERRIDE {
+ virtual bool Init(rtc::Thread* worker_thread) OVERRIDE {
return delegate_->Init(worker_thread);
}
virtual void Terminate() OVERRIDE {
@@ -145,7 +145,7 @@
virtual void SetVideoLogging(int min_sev, const char* filter) OVERRIDE {
delegate_->SetVideoLogging(min_sev, filter);
}
- virtual bool StartAecDump(talk_base::PlatformFile file) OVERRIDE {
+ virtual bool StartAecDump(rtc::PlatformFile file) OVERRIDE {
return delegate_->StartAecDump(file);
}
virtual bool RegisterVoiceProcessor(
diff --git a/media/webrtc/webrtcpassthroughrender.cc b/media/webrtc/webrtcpassthroughrender.cc
index b4e78b4..0c6029d 100644
--- a/media/webrtc/webrtcpassthroughrender.cc
+++ b/media/webrtc/webrtcpassthroughrender.cc
@@ -27,8 +27,8 @@
#include "talk/media/webrtc/webrtcpassthroughrender.h"
-#include "talk/base/common.h"
-#include "talk/base/logging.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/logging.h"
namespace cricket {
@@ -45,7 +45,7 @@
}
virtual int32_t RenderFrame(const uint32_t stream_id,
webrtc::I420VideoFrame& videoFrame) {
- talk_base::CritScope cs(&stream_critical_);
+ rtc::CritScope cs(&stream_critical_);
// Send frame for rendering directly
if (running_ && renderer_) {
renderer_->RenderFrame(stream_id, videoFrame);
@@ -53,19 +53,19 @@
return 0;
}
int32_t SetRenderer(VideoRenderCallback* renderer) {
- talk_base::CritScope cs(&stream_critical_);
+ rtc::CritScope cs(&stream_critical_);
renderer_ = renderer;
return 0;
}
int32_t StartRender() {
- talk_base::CritScope cs(&stream_critical_);
+ rtc::CritScope cs(&stream_critical_);
running_ = true;
return 0;
}
int32_t StopRender() {
- talk_base::CritScope cs(&stream_critical_);
+ rtc::CritScope cs(&stream_critical_);
running_ = false;
return 0;
}
@@ -73,7 +73,7 @@
private:
uint32_t stream_id_;
VideoRenderCallback* renderer_;
- talk_base::CriticalSection stream_critical_;
+ rtc::CriticalSection stream_critical_;
bool running_;
};
@@ -94,7 +94,7 @@
const uint32_t zOrder,
const float left, const float top,
const float right, const float bottom) {
- talk_base::CritScope cs(&render_critical_);
+ rtc::CritScope cs(&render_critical_);
// Stream already exist.
if (FindStream(stream_id) != NULL) {
LOG(LS_ERROR) << "AddIncomingRenderStream - Stream already exists: "
@@ -110,7 +110,7 @@
int32_t WebRtcPassthroughRender::DeleteIncomingRenderStream(
const uint32_t stream_id) {
- talk_base::CritScope cs(&render_critical_);
+ rtc::CritScope cs(&render_critical_);
PassthroughStream* stream = FindStream(stream_id);
if (stream == NULL) {
LOG_FIND_STREAM_ERROR("DeleteIncomingRenderStream", stream_id);
@@ -124,7 +124,7 @@
int32_t WebRtcPassthroughRender::AddExternalRenderCallback(
const uint32_t stream_id,
webrtc::VideoRenderCallback* render_object) {
- talk_base::CritScope cs(&render_critical_);
+ rtc::CritScope cs(&render_critical_);
PassthroughStream* stream = FindStream(stream_id);
if (stream == NULL) {
LOG_FIND_STREAM_ERROR("AddExternalRenderCallback", stream_id);
@@ -143,7 +143,7 @@
}
int32_t WebRtcPassthroughRender::StartRender(const uint32_t stream_id) {
- talk_base::CritScope cs(&render_critical_);
+ rtc::CritScope cs(&render_critical_);
PassthroughStream* stream = FindStream(stream_id);
if (stream == NULL) {
LOG_FIND_STREAM_ERROR("StartRender", stream_id);
@@ -153,7 +153,7 @@
}
int32_t WebRtcPassthroughRender::StopRender(const uint32_t stream_id) {
- talk_base::CritScope cs(&render_critical_);
+ rtc::CritScope cs(&render_critical_);
PassthroughStream* stream = FindStream(stream_id);
if (stream == NULL) {
LOG_FIND_STREAM_ERROR("StopRender", stream_id);
diff --git a/media/webrtc/webrtcpassthroughrender.h b/media/webrtc/webrtcpassthroughrender.h
index e09182f..a432776 100644
--- a/media/webrtc/webrtcpassthroughrender.h
+++ b/media/webrtc/webrtcpassthroughrender.h
@@ -30,7 +30,7 @@
#include <map>
-#include "talk/base/criticalsection.h"
+#include "webrtc/base/criticalsection.h"
#include "webrtc/modules/video_render/include/video_render.h"
namespace cricket {
@@ -56,12 +56,12 @@
virtual int32_t Process() { return 0; }
virtual void* Window() {
- talk_base::CritScope cs(&render_critical_);
+ rtc::CritScope cs(&render_critical_);
return window_;
}
virtual int32_t ChangeWindow(void* window) {
- talk_base::CritScope cs(&render_critical_);
+ rtc::CritScope cs(&render_critical_);
window_ = window;
return 0;
}
@@ -204,7 +204,7 @@
void* window_;
StreamMap stream_render_map_;
- talk_base::CriticalSection render_critical_;
+ rtc::CriticalSection render_critical_;
};
} // namespace cricket
diff --git a/media/webrtc/webrtcpassthroughrender_unittest.cc b/media/webrtc/webrtcpassthroughrender_unittest.cc
index 4eb2892..5429161 100644
--- a/media/webrtc/webrtcpassthroughrender_unittest.cc
+++ b/media/webrtc/webrtcpassthroughrender_unittest.cc
@@ -4,7 +4,7 @@
#include <string>
-#include "talk/base/gunit.h"
+#include "webrtc/base/gunit.h"
#include "talk/media/base/testutils.h"
#include "talk/media/webrtc/webrtcpassthroughrender.h"
@@ -67,7 +67,7 @@
}
private:
- talk_base::scoped_ptr<cricket::WebRtcPassthroughRender> renderer_;
+ rtc::scoped_ptr<cricket::WebRtcPassthroughRender> renderer_;
};
TEST_F(WebRtcPassthroughRenderTest, Streams) {
diff --git a/media/webrtc/webrtctexturevideoframe.cc b/media/webrtc/webrtctexturevideoframe.cc
index 08f63a5..ba7cf5e 100644
--- a/media/webrtc/webrtctexturevideoframe.cc
+++ b/media/webrtc/webrtctexturevideoframe.cc
@@ -27,9 +27,9 @@
#include "talk/media/webrtc/webrtctexturevideoframe.h"
-#include "talk/base/common.h"
-#include "talk/base/logging.h"
-#include "talk/base/stream.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/stream.h"
#define UNIMPLEMENTED \
LOG(LS_ERROR) << "Call to unimplemented function "<< __FUNCTION__; \
@@ -137,10 +137,10 @@
UNIMPLEMENTED;
}
-talk_base::StreamResult WebRtcTextureVideoFrame::Write(
- talk_base::StreamInterface* stream, int* error) {
+rtc::StreamResult WebRtcTextureVideoFrame::Write(
+ rtc::StreamInterface* stream, int* error) {
UNIMPLEMENTED;
- return talk_base::SR_ERROR;
+ return rtc::SR_ERROR;
}
void WebRtcTextureVideoFrame::StretchToPlanes(
uint8* dst_y, uint8* dst_u, uint8* dst_v, int32 dst_pitch_y,
diff --git a/media/webrtc/webrtctexturevideoframe.h b/media/webrtc/webrtctexturevideoframe.h
index 691c814..76c25ee 100644
--- a/media/webrtc/webrtctexturevideoframe.h
+++ b/media/webrtc/webrtctexturevideoframe.h
@@ -28,8 +28,8 @@
#ifndef TALK_MEDIA_WEBRTC_WEBRTCTEXTUREVIDEOFRAME_H_
#define TALK_MEDIA_WEBRTC_WEBRTCTEXTUREVIDEOFRAME_H_
-#include "talk/base/refcount.h"
-#include "talk/base/scoped_ref_ptr.h"
+#include "webrtc/base/refcount.h"
+#include "webrtc/base/scoped_ref_ptr.h"
#include "talk/media/base/videoframe.h"
#include "webrtc/common_video/interface/native_handle.h"
@@ -81,7 +81,7 @@
uint8* dst_y, uint8* dst_u, uint8* dst_v,
int32 dst_pitch_y, int32 dst_pitch_u, int32 dst_pitch_v) const;
virtual void CopyToFrame(VideoFrame* target) const;
- virtual talk_base::StreamResult Write(talk_base::StreamInterface* stream,
+ virtual rtc::StreamResult Write(rtc::StreamInterface* stream,
int* error);
virtual void StretchToPlanes(
uint8* y, uint8* u, uint8* v, int32 pitchY, int32 pitchU, int32 pitchV,
@@ -101,7 +101,7 @@
private:
// The handle of the underlying video frame.
- talk_base::scoped_refptr<webrtc::NativeHandle> handle_;
+ rtc::scoped_refptr<webrtc::NativeHandle> handle_;
int width_;
int height_;
int64 elapsed_time_;
diff --git a/media/webrtc/webrtctexturevideoframe_unittest.cc b/media/webrtc/webrtctexturevideoframe_unittest.cc
index 9ac16da..8f5561a 100644
--- a/media/webrtc/webrtctexturevideoframe_unittest.cc
+++ b/media/webrtc/webrtctexturevideoframe_unittest.cc
@@ -27,7 +27,7 @@
#include "talk/media/webrtc/webrtctexturevideoframe.h"
-#include "talk/base/gunit.h"
+#include "webrtc/base/gunit.h"
#include "talk/media/base/videocommon.h"
class NativeHandleImpl : public webrtc::NativeHandle {
diff --git a/media/webrtc/webrtcvideocapturer.cc b/media/webrtc/webrtcvideocapturer.cc
index d7fc1b2..d341d12 100644
--- a/media/webrtc/webrtcvideocapturer.cc
+++ b/media/webrtc/webrtcvideocapturer.cc
@@ -32,13 +32,13 @@
#endif
#ifdef HAVE_WEBRTC_VIDEO
-#include "talk/base/criticalsection.h"
-#include "talk/base/logging.h"
-#include "talk/base/thread.h"
-#include "talk/base/timeutils.h"
+#include "webrtc/base/criticalsection.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/thread.h"
+#include "webrtc/base/timeutils.h"
#include "talk/media/webrtc/webrtcvideoframe.h"
-#include "talk/base/win32.h" // Need this to #include the impl files.
+#include "webrtc/base/win32.h" // Need this to #include the impl files.
#include "webrtc/modules/video_capture/include/video_capture_factory.h"
namespace cricket {
@@ -53,10 +53,10 @@
static kVideoFourCCEntry kSupportedFourCCs[] = {
{ FOURCC_I420, webrtc::kVideoI420 }, // 12 bpp, no conversion.
{ FOURCC_YV12, webrtc::kVideoYV12 }, // 12 bpp, no conversion.
- { FOURCC_NV12, webrtc::kVideoNV12 }, // 12 bpp, fast conversion.
- { FOURCC_NV21, webrtc::kVideoNV21 }, // 12 bpp, fast conversion.
{ FOURCC_YUY2, webrtc::kVideoYUY2 }, // 16 bpp, fast conversion.
{ FOURCC_UYVY, webrtc::kVideoUYVY }, // 16 bpp, fast conversion.
+ { FOURCC_NV12, webrtc::kVideoNV12 }, // 12 bpp, fast conversion.
+ { FOURCC_NV21, webrtc::kVideoNV21 }, // 12 bpp, fast conversion.
{ FOURCC_MJPG, webrtc::kVideoMJPEG }, // compressed, slow conversion.
{ FOURCC_ARGB, webrtc::kVideoARGB }, // 32 bpp, slow conversion.
{ FOURCC_24BG, webrtc::kVideoRGB24 }, // 24 bpp, slow conversion.
@@ -252,7 +252,7 @@
return CS_NO_DEVICE;
}
- talk_base::CritScope cs(&critical_section_stopping_);
+ rtc::CritScope cs(&critical_section_stopping_);
// TODO(hellner): weird to return failure when it is in fact actually running.
if (IsRunning()) {
LOG(LS_ERROR) << "The capturer is already running";
@@ -268,7 +268,7 @@
}
std::string camera_id(GetId());
- uint32 start = talk_base::Time();
+ uint32 start = rtc::Time();
module_->RegisterCaptureDataCallback(*this);
if (module_->StartCapture(cap) != 0) {
LOG(LS_ERROR) << "Camera '" << camera_id << "' failed to start";
@@ -277,7 +277,7 @@
LOG(LS_INFO) << "Camera '" << camera_id << "' started with format "
<< capture_format.ToString() << ", elapsed time "
- << talk_base::TimeSince(start) << " ms";
+ << rtc::TimeSince(start) << " ms";
captured_frames_ = 0;
SetCaptureState(CS_RUNNING);
@@ -290,9 +290,9 @@
// controlling the camera is reversed: system frame -> OnIncomingCapturedFrame;
// Stop -> system stop camera).
void WebRtcVideoCapturer::Stop() {
- talk_base::CritScope cs(&critical_section_stopping_);
+ rtc::CritScope cs(&critical_section_stopping_);
if (IsRunning()) {
- talk_base::Thread::Current()->Clear(this);
+ rtc::Thread::Current()->Clear(this);
module_->StopCapture();
module_->DeRegisterCaptureDataCallback();
@@ -331,7 +331,7 @@
// the same lock. Due to the reversed order, we have to try-lock in order to
// avoid a potential deadlock. Besides, if we can't enter because we're
// stopping, we may as well drop the frame.
- talk_base::TryCritScope cs(&critical_section_stopping_);
+ rtc::TryCritScope cs(&critical_section_stopping_);
if (!cs.locked() || !IsRunning()) {
// Capturer has been stopped or is in the process of stopping.
return;
@@ -373,7 +373,7 @@
pixel_width = 1;
pixel_height = 1;
// Convert units from VideoFrame RenderTimeMs to CapturedFrame (nanoseconds).
- elapsed_time = sample.render_time_ms() * talk_base::kNumNanosecsPerMillisec;
+ elapsed_time = sample.render_time_ms() * rtc::kNumNanosecsPerMillisec;
time_stamp = elapsed_time;
data_size = length;
data = buffer;
diff --git a/media/webrtc/webrtcvideocapturer.h b/media/webrtc/webrtcvideocapturer.h
index cefad56..ef84fe5 100644
--- a/media/webrtc/webrtcvideocapturer.h
+++ b/media/webrtc/webrtcvideocapturer.h
@@ -31,8 +31,8 @@
#include <string>
#include <vector>
-#include "talk/base/criticalsection.h"
-#include "talk/base/messagehandler.h"
+#include "webrtc/base/criticalsection.h"
+#include "webrtc/base/messagehandler.h"
#include "talk/media/base/videocapturer.h"
#include "talk/media/webrtc/webrtcvideoframe.h"
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
@@ -86,13 +86,13 @@
virtual void OnCaptureDelayChanged(const int32_t id,
const int32_t delay);
- talk_base::scoped_ptr<WebRtcVcmFactoryInterface> factory_;
+ rtc::scoped_ptr<WebRtcVcmFactoryInterface> factory_;
webrtc::VideoCaptureModule* module_;
int captured_frames_;
std::vector<uint8_t> capture_buffer_;
// Critical section to avoid Stop during an OnIncomingCapturedFrame callback.
- talk_base::CriticalSection critical_section_stopping_;
+ rtc::CriticalSection critical_section_stopping_;
};
struct WebRtcCapturedFrame : public CapturedFrame {
diff --git a/media/webrtc/webrtcvideocapturer_unittest.cc b/media/webrtc/webrtcvideocapturer_unittest.cc
index 226aa4b..494ec2b 100644
--- a/media/webrtc/webrtcvideocapturer_unittest.cc
+++ b/media/webrtc/webrtcvideocapturer_unittest.cc
@@ -25,10 +25,10 @@
#include <stdio.h>
#include <vector>
-#include "talk/base/gunit.h"
-#include "talk/base/logging.h"
-#include "talk/base/stringutils.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/stringutils.h"
+#include "webrtc/base/thread.h"
#include "talk/media/base/testutils.h"
#include "talk/media/base/videocommon.h"
#include "talk/media/webrtc/fakewebrtcvcmfactory.h"
@@ -59,7 +59,7 @@
protected:
FakeWebRtcVcmFactory* factory_; // owned by capturer_
- talk_base::scoped_ptr<cricket::WebRtcVideoCapturer> capturer_;
+ rtc::scoped_ptr<cricket::WebRtcVideoCapturer> capturer_;
cricket::VideoCapturerListener listener_;
};
diff --git a/media/webrtc/webrtcvideodecoderfactory.h b/media/webrtc/webrtcvideodecoderfactory.h
index 483bca7..ce26f0e 100644
--- a/media/webrtc/webrtcvideodecoderfactory.h
+++ b/media/webrtc/webrtcvideodecoderfactory.h
@@ -28,7 +28,7 @@
#ifndef TALK_MEDIA_WEBRTC_WEBRTCVIDEODECODERFACTORY_H_
#define TALK_MEDIA_WEBRTC_WEBRTCVIDEODECODERFACTORY_H_
-#include "talk/base/refcount.h"
+#include "webrtc/base/refcount.h"
#include "webrtc/common_types.h"
namespace webrtc {
diff --git a/media/webrtc/webrtcvideoencoderfactory.h b/media/webrtc/webrtcvideoencoderfactory.h
index a844309..22f6739 100644
--- a/media/webrtc/webrtcvideoencoderfactory.h
+++ b/media/webrtc/webrtcvideoencoderfactory.h
@@ -28,7 +28,7 @@
#ifndef TALK_MEDIA_WEBRTC_WEBRTCVIDEOENCODERFACTORY_H_
#define TALK_MEDIA_WEBRTC_WEBRTCVIDEOENCODERFACTORY_H_
-#include "talk/base/refcount.h"
+#include "webrtc/base/refcount.h"
#include "talk/media/base/codec.h"
#include "webrtc/common_types.h"
diff --git a/media/webrtc/webrtcvideoengine.cc b/media/webrtc/webrtcvideoengine.cc
index db0d26f..7afe5de 100644
--- a/media/webrtc/webrtcvideoengine.cc
+++ b/media/webrtc/webrtcvideoengine.cc
@@ -35,15 +35,15 @@
#include <math.h>
#include <set>
-#include "talk/base/basictypes.h"
-#include "talk/base/buffer.h"
-#include "talk/base/byteorder.h"
-#include "talk/base/common.h"
-#include "talk/base/cpumonitor.h"
-#include "talk/base/logging.h"
-#include "talk/base/stringutils.h"
-#include "talk/base/thread.h"
-#include "talk/base/timeutils.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/buffer.h"
+#include "webrtc/base/byteorder.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/cpumonitor.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/stringutils.h"
+#include "webrtc/base/thread.h"
+#include "webrtc/base/timeutils.h"
#include "talk/media/base/constants.h"
#include "talk/media/base/rtputils.h"
#include "talk/media/base/streamparams.h"
@@ -75,17 +75,14 @@
const char kVp8CodecName[] = "VP8";
const int kDefaultFramerate = 30;
-const int kMinVideoBitrate = 50;
+const int kMinVideoBitrate = 30;
const int kStartVideoBitrate = 300;
const int kMaxVideoBitrate = 2000;
const int kCpuMonitorPeriodMs = 2000; // 2 seconds.
-static const int kDefaultLogSeverity = talk_base::LS_WARNING;
-
-// Controlled by exp, try a super low minimum bitrate for poor connections.
-static const int kLowerMinBitrate = 30;
+static const int kDefaultLogSeverity = rtc::LS_WARNING;
static const int kDefaultNumberOfTemporalLayers = 1; // 1:1
@@ -108,7 +105,7 @@
return kExternalVideoPayloadTypeBase + index;
}
-static void LogMultiline(talk_base::LoggingSeverity sev, char* text) {
+static void LogMultiline(rtc::LoggingSeverity sev, char* text) {
const char* delim = "\r\n";
// TODO(fbarchard): Fix strtok lint warning.
for (char* tok = strtok(text, delim); tok; tok = strtok(NULL, delim)) {
@@ -120,13 +117,13 @@
static int SeverityToFilter(int severity) {
int filter = webrtc::kTraceNone;
switch (severity) {
- case talk_base::LS_VERBOSE:
+ case rtc::LS_VERBOSE:
filter |= webrtc::kTraceAll;
- case talk_base::LS_INFO:
+ case rtc::LS_INFO:
filter |= (webrtc::kTraceStateInfo | webrtc::kTraceInfo);
- case talk_base::LS_WARNING:
+ case rtc::LS_WARNING:
filter |= (webrtc::kTraceTerseInfo | webrtc::kTraceWarning);
- case talk_base::LS_ERROR:
+ case rtc::LS_ERROR:
filter |= (webrtc::kTraceError | webrtc::kTraceCritical);
}
return filter;
@@ -137,8 +134,8 @@
// Default video dscp value.
// See http://tools.ietf.org/html/rfc2474 for details
// See also http://tools.ietf.org/html/draft-jennings-rtcweb-qos-00
-static const talk_base::DiffServCodePoint kVideoDscpValue =
- talk_base::DSCP_AF41;
+static const rtc::DiffServCodePoint kVideoDscpValue =
+ rtc::DSCP_AF41;
static bool IsNackEnabled(const VideoCodec& codec) {
return codec.HasFeedbackParam(FeedbackParam(kRtcpFbParamNack,
@@ -151,7 +148,7 @@
kParamValueEmpty));
}
-struct FlushBlackFrameData : public talk_base::MessageData {
+struct FlushBlackFrameData : public rtc::MessageData {
FlushBlackFrameData(uint32 s, int64 t) : ssrc(s), timestamp(t) {
}
uint32 ssrc;
@@ -173,7 +170,7 @@
}
void SetRenderer(VideoRenderer* renderer) {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
renderer_ = renderer;
// FrameSizeChange may have already been called when renderer was not set.
// If so we should call SetSize here.
@@ -193,7 +190,7 @@
// Implementation of webrtc::ExternalRenderer.
virtual int FrameSizeChange(unsigned int width, unsigned int height,
unsigned int /*number_of_streams*/) {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
width_ = width;
height_ = height;
LOG(LS_INFO) << "WebRtcRenderAdapter (channel " << channel_id_
@@ -214,7 +211,7 @@
int64_t ntp_time_ms,
int64_t render_time,
void* handle) {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
if (capture_start_rtp_time_stamp_ < 0) {
capture_start_rtp_time_stamp_ = rtp_time_stamp;
}
@@ -233,10 +230,10 @@
}
// Convert elapsed_time_ms to ns timestamp.
int64 elapsed_time_ns =
- elapsed_time_ms * talk_base::kNumNanosecsPerMillisec;
+ elapsed_time_ms * rtc::kNumNanosecsPerMillisec;
// Convert milisecond render time to ns timestamp.
int64 render_time_ns = render_time *
- talk_base::kNumNanosecsPerMillisec;
+ rtc::kNumNanosecsPerMillisec;
// Note that here we send the |elapsed_time_ns| to renderer as the
// cricket::VideoFrame's elapsed_time_ and the |render_time_ns| as the
// cricket::VideoFrame's time_stamp_.
@@ -276,38 +273,38 @@
}
unsigned int width() {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
return width_;
}
unsigned int height() {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
return height_;
}
int framerate() {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
return static_cast<int>(frame_rate_tracker_.units_second());
}
VideoRenderer* renderer() {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
return renderer_;
}
int64 capture_start_ntp_time_ms() {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
return capture_start_ntp_time_ms_;
}
private:
- talk_base::CriticalSection crit_;
+ rtc::CriticalSection crit_;
VideoRenderer* renderer_;
int channel_id_;
unsigned int width_;
unsigned int height_;
- talk_base::RateTracker frame_rate_tracker_;
- talk_base::TimestampWrapAroundHandler rtp_ts_wraparound_handler_;
+ rtc::RateTracker frame_rate_tracker_;
+ rtc::TimestampWrapAroundHandler rtp_ts_wraparound_handler_;
int64 capture_start_rtp_time_stamp_;
int64 capture_start_ntp_time_ms_;
};
@@ -333,7 +330,7 @@
virtual void IncomingRate(const int videoChannel,
const unsigned int framerate,
const unsigned int bitrate) {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
ASSERT(video_channel_ == videoChannel);
framerate_ = framerate;
bitrate_ = bitrate;
@@ -346,7 +343,7 @@
int jitter_buffer_ms,
int min_playout_delay_ms,
int render_delay_ms) {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
decode_ms_ = decode_ms;
max_decode_ms_ = max_decode_ms;
current_delay_ms_ = current_delay_ms;
@@ -360,7 +357,7 @@
// Populate |rinfo| based on previously-set data in |*this|.
void ExportTo(VideoReceiverInfo* rinfo) {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
rinfo->framerate_rcvd = framerate_;
rinfo->decode_ms = decode_ms_;
rinfo->max_decode_ms = max_decode_ms_;
@@ -372,7 +369,7 @@
}
private:
- mutable talk_base::CriticalSection crit_;
+ mutable rtc::CriticalSection crit_;
int video_channel_;
int framerate_;
int bitrate_;
@@ -398,33 +395,33 @@
virtual void OutgoingRate(const int videoChannel,
const unsigned int framerate,
const unsigned int bitrate) {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
ASSERT(video_channel_ == videoChannel);
framerate_ = framerate;
bitrate_ = bitrate;
}
virtual void SuspendChange(int video_channel, bool is_suspended) {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
ASSERT(video_channel_ == video_channel);
suspended_ = is_suspended;
}
int framerate() const {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
return framerate_;
}
int bitrate() const {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
return bitrate_;
}
bool suspended() const {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
return suspended_;
}
private:
- mutable talk_base::CriticalSection crit_;
+ mutable rtc::CriticalSection crit_;
int video_channel_;
int framerate_;
int bitrate_;
@@ -436,35 +433,35 @@
WebRtcLocalStreamInfo()
: width_(0), height_(0), elapsed_time_(-1), time_stamp_(-1) {}
size_t width() const {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
return width_;
}
size_t height() const {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
return height_;
}
int64 elapsed_time() const {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
return elapsed_time_;
}
int64 time_stamp() const {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
return time_stamp_;
}
int framerate() {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
return static_cast<int>(rate_tracker_.units_second());
}
void GetLastFrameInfo(
size_t* width, size_t* height, int64* elapsed_time) const {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
*width = width_;
*height = height_;
*elapsed_time = elapsed_time_;
}
void UpdateFrame(const VideoFrame* frame) {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
width_ = frame->GetWidth();
height_ = frame->GetHeight();
@@ -475,12 +472,12 @@
}
private:
- mutable talk_base::CriticalSection crit_;
+ mutable rtc::CriticalSection crit_;
size_t width_;
size_t height_;
int64 elapsed_time_;
int64 time_stamp_;
- talk_base::RateTracker rate_tracker_;
+ rtc::RateTracker rate_tracker_;
DISALLOW_COPY_AND_ASSIGN(WebRtcLocalStreamInfo);
};
@@ -537,7 +534,7 @@
// adapter know what resolution the request is based on. Helps eliminate stale
// data, race conditions.
virtual void OveruseDetected() OVERRIDE {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
if (!enabled_) {
return;
}
@@ -546,7 +543,7 @@
}
virtual void NormalUsage() OVERRIDE {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
if (!enabled_) {
return;
}
@@ -556,7 +553,7 @@
void Enable(bool enable) {
LOG(LS_INFO) << "WebRtcOveruseObserver enable: " << enable;
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
enabled_ = enable;
}
@@ -565,7 +562,7 @@
private:
CoordinatedVideoAdapter* video_adapter_;
bool enabled_;
- talk_base::CriticalSection crit_;
+ rtc::CriticalSection crit_;
};
@@ -574,7 +571,7 @@
typedef std::map<int, webrtc::VideoEncoder*> EncoderMap; // key: payload type
WebRtcVideoChannelSendInfo(int channel_id, int capture_id,
webrtc::ViEExternalCapture* external_capture,
- talk_base::CpuMonitor* cpu_monitor)
+ rtc::CpuMonitor* cpu_monitor)
: channel_id_(channel_id),
capture_id_(capture_id),
sending_(false),
@@ -815,14 +812,14 @@
VideoFormat video_format_;
- talk_base::scoped_ptr<StreamParams> stream_params_;
+ rtc::scoped_ptr<StreamParams> stream_params_;
WebRtcLocalStreamInfo local_stream_info_;
int64 interval_;
- talk_base::CpuMonitor* cpu_monitor_;
- talk_base::scoped_ptr<WebRtcOveruseObserver> overuse_observer_;
+ rtc::CpuMonitor* cpu_monitor_;
+ rtc::scoped_ptr<WebRtcOveruseObserver> overuse_observer_;
int old_adaptation_changes_;
@@ -896,26 +893,26 @@
WebRtcVideoEngine::WebRtcVideoEngine() {
Construct(new ViEWrapper(), new ViETraceWrapper(), NULL,
- new talk_base::CpuMonitor(NULL));
+ new rtc::CpuMonitor(NULL));
}
WebRtcVideoEngine::WebRtcVideoEngine(WebRtcVoiceEngine* voice_engine,
ViEWrapper* vie_wrapper,
- talk_base::CpuMonitor* cpu_monitor) {
+ rtc::CpuMonitor* cpu_monitor) {
Construct(vie_wrapper, new ViETraceWrapper(), voice_engine, cpu_monitor);
}
WebRtcVideoEngine::WebRtcVideoEngine(WebRtcVoiceEngine* voice_engine,
ViEWrapper* vie_wrapper,
ViETraceWrapper* tracing,
- talk_base::CpuMonitor* cpu_monitor) {
+ rtc::CpuMonitor* cpu_monitor) {
Construct(vie_wrapper, tracing, voice_engine, cpu_monitor);
}
void WebRtcVideoEngine::Construct(ViEWrapper* vie_wrapper,
ViETraceWrapper* tracing,
WebRtcVoiceEngine* voice_engine,
- talk_base::CpuMonitor* cpu_monitor) {
+ rtc::CpuMonitor* cpu_monitor) {
LOG(LS_INFO) << "WebRtcVideoEngine::WebRtcVideoEngine";
worker_thread_ = NULL;
vie_wrapper_.reset(vie_wrapper);
@@ -975,7 +972,7 @@
ASSERT(SignalMediaFrame.is_empty());
}
-bool WebRtcVideoEngine::Init(talk_base::Thread* worker_thread) {
+bool WebRtcVideoEngine::Init(rtc::Thread* worker_thread) {
LOG(LS_INFO) << "WebRtcVideoEngine::Init";
worker_thread_ = worker_thread;
ASSERT(worker_thread_ != NULL);
@@ -1016,7 +1013,7 @@
}
LOG(LS_INFO) << "WebRtc VideoEngine Version:";
- LogMultiline(talk_base::LS_INFO, buffer);
+ LogMultiline(rtc::LS_INFO, buffer);
// Hook up to VoiceEngine for sync purposes, if supplied.
if (!voice_engine_) {
@@ -1180,7 +1177,7 @@
out->name = requested.name;
out->preference = requested.preference;
out->params = requested.params;
- out->framerate = talk_base::_min(requested.framerate, local_max->framerate);
+ out->framerate = rtc::_min(requested.framerate, local_max->framerate);
out->width = 0;
out->height = 0;
out->params = requested.params;
@@ -1251,7 +1248,7 @@
if (_stricmp(in_codec.name.c_str(), codecs[i].name.c_str()) == 0) {
out_codec->codecType = codecs[i].type;
out_codec->plType = GetExternalVideoPayloadType(static_cast<int>(i));
- talk_base::strcpyn(out_codec->plName, sizeof(out_codec->plName),
+ rtc::strcpyn(out_codec->plName, sizeof(out_codec->plName),
codecs[i].name.c_str(), codecs[i].name.length());
found = true;
break;
@@ -1262,7 +1259,7 @@
// Is this an RTX codec? Handled separately here since webrtc doesn't handle
// them as webrtc::VideoCodec internally.
if (!found && _stricmp(in_codec.name.c_str(), kRtxCodecName) == 0) {
- talk_base::strcpyn(out_codec->plName, sizeof(out_codec->plName),
+ rtc::strcpyn(out_codec->plName, sizeof(out_codec->plName),
in_codec.name.c_str(), in_codec.name.length());
out_codec->plType = in_codec.id;
found = true;
@@ -1311,12 +1308,12 @@
}
void WebRtcVideoEngine::RegisterChannel(WebRtcVideoMediaChannel *channel) {
- talk_base::CritScope cs(&channels_crit_);
+ rtc::CritScope cs(&channels_crit_);
channels_.push_back(channel);
}
void WebRtcVideoEngine::UnregisterChannel(WebRtcVideoMediaChannel *channel) {
- talk_base::CritScope cs(&channels_crit_);
+ rtc::CritScope cs(&channels_crit_);
channels_.erase(std::remove(channels_.begin(), channels_.end(), channel),
channels_.end());
}
@@ -1350,7 +1347,7 @@
void WebRtcVideoEngine::SetTraceOptions(const std::string& options) {
// Set WebRTC trace file.
std::vector<std::string> opts;
- talk_base::tokenize(options, ' ', '"', '"', &opts);
+ rtc::tokenize(options, ' ', '"', '"', &opts);
std::vector<std::string>::iterator tracefile =
std::find(opts.begin(), opts.end(), "tracefile");
if (tracefile != opts.end() && ++tracefile != opts.end()) {
@@ -1444,21 +1441,21 @@
}
int WebRtcVideoEngine::GetNumOfChannels() {
- talk_base::CritScope cs(&channels_crit_);
+ rtc::CritScope cs(&channels_crit_);
return static_cast<int>(channels_.size());
}
void WebRtcVideoEngine::Print(webrtc::TraceLevel level, const char* trace,
int length) {
- talk_base::LoggingSeverity sev = talk_base::LS_VERBOSE;
+ rtc::LoggingSeverity sev = rtc::LS_VERBOSE;
if (level == webrtc::kTraceError || level == webrtc::kTraceCritical)
- sev = talk_base::LS_ERROR;
+ sev = rtc::LS_ERROR;
else if (level == webrtc::kTraceWarning)
- sev = talk_base::LS_WARNING;
+ sev = rtc::LS_WARNING;
else if (level == webrtc::kTraceStateInfo || level == webrtc::kTraceInfo)
- sev = talk_base::LS_INFO;
+ sev = rtc::LS_INFO;
else if (level == webrtc::kTraceTerseInfo)
- sev = talk_base::LS_INFO;
+ sev = rtc::LS_INFO;
// Skip past boilerplate prefix text
if (length < 72) {
@@ -2699,7 +2696,7 @@
}
void WebRtcVideoMediaChannel::OnPacketReceived(
- talk_base::Buffer* packet, const talk_base::PacketTime& packet_time) {
+ rtc::Buffer* packet, const rtc::PacketTime& packet_time) {
// Pick which channel to send this packet to. If this packet doesn't match
// any multiplexed streams, just send it to the default channel. Otherwise,
// send it to the specific decoder instance for that stream.
@@ -2727,7 +2724,7 @@
}
void WebRtcVideoMediaChannel::OnRtcpReceived(
- talk_base::Buffer* packet, const talk_base::PacketTime& packet_time) {
+ rtc::Buffer* packet, const rtc::PacketTime& packet_time) {
// Sending channels need all RTCP packets with feedback information.
// Even sender reports can contain attached report blocks.
// Receiving channels need sender reports in order to create
@@ -2845,7 +2842,7 @@
// Extension closer to the network, @ socket level before sending.
// Pushing the extension id to socket layer.
MediaChannel::SetOption(NetworkInterface::ST_RTP,
- talk_base::Socket::OPT_RTP_SENDTIME_EXTN_ID,
+ rtc::Socket::OPT_RTP_SENDTIME_EXTN_ID,
send_time_extension->id);
}
@@ -2958,13 +2955,6 @@
bool reset_send_codec_needed = denoiser_changed;
webrtc::VideoCodec new_codec = *send_codec_;
- // TODO(pthatcher): Remove this. We don't need 4 ways to set bitrates.
- bool lower_min_bitrate;
- if (options.lower_min_bitrate.Get(&lower_min_bitrate)) {
- new_codec.minBitrate = kLowerMinBitrate;
- reset_send_codec_needed = true;
- }
-
if (conference_mode_turned_off) {
// This is a special case for turning conference mode off.
// Max bitrate should go back to the default maximum value instead
@@ -3030,7 +3020,7 @@
}
}
if (dscp_option_changed) {
- talk_base::DiffServCodePoint dscp = talk_base::DSCP_DEFAULT;
+ rtc::DiffServCodePoint dscp = rtc::DSCP_DEFAULT;
if (options_.dscp.GetWithDefaultIfUnset(false))
dscp = kVideoDscpValue;
LOG(LS_INFO) << "DSCP is " << dscp;
@@ -3090,14 +3080,14 @@
MediaChannel::SetInterface(iface);
// Set the RTP recv/send buffer to a bigger size
MediaChannel::SetOption(NetworkInterface::ST_RTP,
- talk_base::Socket::OPT_RCVBUF,
+ rtc::Socket::OPT_RCVBUF,
kVideoRtpBufferSize);
// TODO(sriniv): Remove or re-enable this.
// As part of b/8030474, send-buffer is size now controlled through
// portallocator flags.
// network_interface_->SetOption(NetworkInterface::ST_RTP,
- // talk_base::Socket::OPT_SNDBUF,
+ // rtc::Socket::OPT_SNDBUF,
// kVideoRtpBufferSize);
}
@@ -3204,7 +3194,7 @@
return false;
}
const VideoFrame* frame_out = frame;
- talk_base::scoped_ptr<VideoFrame> processed_frame;
+ rtc::scoped_ptr<VideoFrame> processed_frame;
// TODO(hellner): Remove the need for disabling mute when screencasting.
const bool mute = (send_channel->muted() && !is_screencast);
send_channel->ProcessFrame(*frame_out, mute, processed_frame.use());
@@ -3233,7 +3223,7 @@
// If the frame timestamp is 0, we will use the deliver time.
const int64 frame_timestamp = frame->GetTimeStamp();
if (frame_timestamp != 0) {
- if (abs(time(NULL) - frame_timestamp / talk_base::kNumNanosecsPerSec) >
+ if (abs(time(NULL) - frame_timestamp / rtc::kNumNanosecsPerSec) >
kTimestampDeltaInSecondsForWarning) {
LOG(LS_WARNING) << "Frame timestamp differs by more than "
<< kTimestampDeltaInSecondsForWarning << " seconds from "
@@ -3241,7 +3231,7 @@
}
timestamp_ntp_ms =
- talk_base::UnixTimestampNanosecsToNtpMillisecs(frame_timestamp);
+ rtc::UnixTimestampNanosecsToNtpMillisecs(frame_timestamp);
}
#endif
@@ -3395,7 +3385,7 @@
}
}
- talk_base::scoped_ptr<WebRtcVideoChannelRecvInfo> channel_info(
+ rtc::scoped_ptr<WebRtcVideoChannelRecvInfo> channel_info(
new WebRtcVideoChannelRecvInfo(channel_id));
// Install a render adapter.
@@ -3505,7 +3495,7 @@
LOG_RTCERR2(ConnectCaptureDevice, vie_capture, channel_id);
return false;
}
- talk_base::scoped_ptr<WebRtcVideoChannelSendInfo> send_channel(
+ rtc::scoped_ptr<WebRtcVideoChannelSendInfo> send_channel(
new WebRtcVideoChannelSendInfo(channel_id, vie_capture,
external_capture,
engine()->cpu_monitor()));
@@ -3796,6 +3786,7 @@
it != receive_codecs_.end(); ++it) {
pt_to_codec[it->plType] = &(*it);
}
+ bool rtx_registered = false;
for (std::vector<webrtc::VideoCodec>::iterator it = receive_codecs_.begin();
it != receive_codecs_.end(); ++it) {
if (it->codecType == webrtc::kVideoCodecRED) {
@@ -3806,16 +3797,18 @@
// If this is an RTX codec we have to verify that it is associated with
// a valid video codec which we have RTX support for.
if (_stricmp(it->plName, kRtxCodecName) == 0) {
+ // WebRTC only supports one RTX codec at a time.
+ if (rtx_registered) {
+ LOG(LS_ERROR) << "Only one RTX codec at a time is supported.";
+ return false;
+ }
std::map<int, int>::iterator apt_it = associated_payload_types_.find(
it->plType);
bool valid_apt = false;
if (apt_it != associated_payload_types_.end()) {
std::map<int, webrtc::VideoCodec*>::iterator codec_it =
pt_to_codec.find(apt_it->second);
- // We currently only support RTX associated with VP8 due to limitations
- // in webrtc where only one RTX payload type can be registered.
- valid_apt = codec_it != pt_to_codec.end() &&
- _stricmp(codec_it->second->plName, kVp8CodecName) == 0;
+ valid_apt = codec_it != pt_to_codec.end();
}
if (!valid_apt) {
LOG(LS_ERROR) << "The RTX codec isn't associated with a known and "
@@ -3827,6 +3820,7 @@
LOG_RTCERR2(SetRtxReceivePayloadType, channel_id, it->plType);
return false;
}
+ rtx_registered = true;
continue;
}
if (engine()->vie()->codec()->SetReceiveCodec(channel_id, *it) != 0) {
@@ -3936,10 +3930,13 @@
options_.screencast_min_bitrate.GetWithDefaultIfUnset(0);
bool leaky_bucket = options_.video_leaky_bucket.GetWithDefaultIfUnset(true);
bool reset_send_codec =
- target_width != cur_width || target_height != cur_height ||
+ target_width != cur_width || target_height != cur_height;
+ if (vie_codec.codecType == webrtc::kVideoCodecVP8) {
+ reset_send_codec = reset_send_codec ||
automatic_resize != vie_codec.codecSpecific.VP8.automaticResizeOn ||
enable_denoising != vie_codec.codecSpecific.VP8.denoisingOn ||
vp8_frame_dropping != vie_codec.codecSpecific.VP8.frameDroppingOn;
+ }
if (reset_send_codec) {
// Set the new codec on vie.
@@ -3950,9 +3947,11 @@
vie_codec.minBitrate = target_codec.minBitrate;
vie_codec.maxBitrate = target_codec.maxBitrate;
vie_codec.targetBitrate = 0;
- vie_codec.codecSpecific.VP8.automaticResizeOn = automatic_resize;
- vie_codec.codecSpecific.VP8.denoisingOn = enable_denoising;
- vie_codec.codecSpecific.VP8.frameDroppingOn = vp8_frame_dropping;
+ if (vie_codec.codecType == webrtc::kVideoCodecVP8) {
+ vie_codec.codecSpecific.VP8.automaticResizeOn = automatic_resize;
+ vie_codec.codecSpecific.VP8.denoisingOn = enable_denoising;
+ vie_codec.codecSpecific.VP8.frameDroppingOn = vp8_frame_dropping;
+ }
MaybeChangeBitrates(channel_id, &vie_codec);
if (engine()->vie()->codec()->SetSendCodec(channel_id, vie_codec) != 0) {
@@ -4024,7 +4023,7 @@
}
-void WebRtcVideoMediaChannel::OnMessage(talk_base::Message* msg) {
+void WebRtcVideoMediaChannel::OnMessage(rtc::Message* msg) {
FlushBlackFrameData* black_frame_data =
static_cast<FlushBlackFrameData*>(msg->pdata);
FlushBlackFrame(black_frame_data->ssrc, black_frame_data->timestamp);
@@ -4033,14 +4032,14 @@
int WebRtcVideoMediaChannel::SendPacket(int channel, const void* data,
int len) {
- talk_base::Buffer packet(data, len, kMaxRtpPacketLen);
+ rtc::Buffer packet(data, len, kMaxRtpPacketLen);
return MediaChannel::SendPacket(&packet) ? len : -1;
}
int WebRtcVideoMediaChannel::SendRTCPPacket(int channel,
const void* data,
int len) {
- talk_base::Buffer packet(data, len, kMaxRtpPacketLen);
+ rtc::Buffer packet(data, len, kMaxRtpPacketLen);
return MediaChannel::SendRtcp(&packet) ? len : -1;
}
@@ -4052,7 +4051,7 @@
timestamp);
const int delay_ms = static_cast<int>(
2 * cricket::VideoFormat::FpsToInterval(framerate) *
- talk_base::kNumMillisecsPerSec / talk_base::kNumNanosecsPerSec);
+ rtc::kNumMillisecsPerSec / rtc::kNumNanosecsPerSec);
worker_thread()->PostDelayed(delay_ms, this, 0, black_frame_data);
}
}
@@ -4062,7 +4061,7 @@
if (!send_channel) {
return;
}
- talk_base::scoped_ptr<const VideoFrame> black_frame_ptr;
+ rtc::scoped_ptr<const VideoFrame> black_frame_ptr;
const WebRtcLocalStreamInfo* channel_stream_info =
send_channel->local_stream_info();
diff --git a/media/webrtc/webrtcvideoengine.h b/media/webrtc/webrtcvideoengine.h
index 360f1d1..f467b97 100644
--- a/media/webrtc/webrtcvideoengine.h
+++ b/media/webrtc/webrtcvideoengine.h
@@ -31,7 +31,7 @@
#include <map>
#include <vector>
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/media/base/codec.h"
#include "talk/media/base/videocommon.h"
#include "talk/media/webrtc/webrtccommon.h"
@@ -54,9 +54,9 @@
class ViERTP_RTCP;
}
-namespace talk_base {
+namespace rtc {
class CpuMonitor;
-} // namespace talk_base
+} // namespace rtc
namespace cricket {
@@ -93,15 +93,15 @@
// TODO(juberti): Remove the 3-arg ctor once fake tracing is implemented.
WebRtcVideoEngine(WebRtcVoiceEngine* voice_engine,
ViEWrapper* vie_wrapper,
- talk_base::CpuMonitor* cpu_monitor);
+ rtc::CpuMonitor* cpu_monitor);
WebRtcVideoEngine(WebRtcVoiceEngine* voice_engine,
ViEWrapper* vie_wrapper,
ViETraceWrapper* tracing,
- talk_base::CpuMonitor* cpu_monitor);
+ rtc::CpuMonitor* cpu_monitor);
~WebRtcVideoEngine();
// Basic video engine implementation.
- bool Init(talk_base::Thread* worker_thread);
+ bool Init(rtc::Thread* worker_thread);
void Terminate();
int GetCapabilities();
@@ -149,7 +149,7 @@
bool IsExternalEncoderCodecType(webrtc::VideoCodecType type) const;
// Functions called by WebRtcVideoMediaChannel.
- talk_base::Thread* worker_thread() { return worker_thread_; }
+ rtc::Thread* worker_thread() { return worker_thread_; }
ViEWrapper* vie() { return vie_wrapper_.get(); }
const VideoFormat& default_codec_format() const {
return default_codec_format_;
@@ -168,7 +168,7 @@
VideoFormat GetStartCaptureFormat() const { return default_codec_format_; }
- talk_base::CpuMonitor* cpu_monitor() { return cpu_monitor_.get(); }
+ rtc::CpuMonitor* cpu_monitor() { return cpu_monitor_.get(); }
protected:
// When a video processor registers with the engine.
@@ -194,7 +194,7 @@
void Construct(ViEWrapper* vie_wrapper,
ViETraceWrapper* tracing,
WebRtcVoiceEngine* voice_engine,
- talk_base::CpuMonitor* cpu_monitor);
+ rtc::CpuMonitor* cpu_monitor);
bool SetDefaultCodec(const VideoCodec& codec);
bool RebuildCodecList(const VideoCodec& max_codec);
void SetTraceFilter(int filter);
@@ -208,12 +208,12 @@
// WebRtcVideoEncoderFactory::Observer implementation.
virtual void OnCodecsAvailable();
- talk_base::Thread* worker_thread_;
- talk_base::scoped_ptr<ViEWrapper> vie_wrapper_;
+ rtc::Thread* worker_thread_;
+ rtc::scoped_ptr<ViEWrapper> vie_wrapper_;
bool vie_wrapper_base_initialized_;
- talk_base::scoped_ptr<ViETraceWrapper> tracing_;
+ rtc::scoped_ptr<ViETraceWrapper> tracing_;
WebRtcVoiceEngine* voice_engine_;
- talk_base::scoped_ptr<webrtc::VideoRender> render_module_;
+ rtc::scoped_ptr<webrtc::VideoRender> render_module_;
WebRtcVideoEncoderFactory* encoder_factory_;
WebRtcVideoDecoderFactory* decoder_factory_;
std::vector<VideoCodec> video_codecs_;
@@ -221,7 +221,7 @@
VideoFormat default_codec_format_;
bool initialized_;
- talk_base::CriticalSection channels_crit_;
+ rtc::CriticalSection channels_crit_;
VideoChannels channels_;
bool capture_started_;
@@ -229,10 +229,10 @@
int local_renderer_h_;
VideoRenderer* local_renderer_;
- talk_base::scoped_ptr<talk_base::CpuMonitor> cpu_monitor_;
+ rtc::scoped_ptr<rtc::CpuMonitor> cpu_monitor_;
};
-class WebRtcVideoMediaChannel : public talk_base::MessageHandler,
+class WebRtcVideoMediaChannel : public rtc::MessageHandler,
public VideoMediaChannel,
public webrtc::Transport {
public:
@@ -267,10 +267,10 @@
virtual bool SendIntraFrame();
virtual bool RequestIntraFrame();
- virtual void OnPacketReceived(talk_base::Buffer* packet,
- const talk_base::PacketTime& packet_time);
- virtual void OnRtcpReceived(talk_base::Buffer* packet,
- const talk_base::PacketTime& packet_time);
+ virtual void OnPacketReceived(rtc::Buffer* packet,
+ const rtc::PacketTime& packet_time);
+ virtual void OnRtcpReceived(rtc::Buffer* packet,
+ const rtc::PacketTime& packet_time);
virtual void OnReadyToSend(bool ready);
virtual bool MuteStream(uint32 ssrc, bool on);
virtual bool SetRecvRtpHeaderExtensions(
@@ -303,7 +303,7 @@
void OnLocalFrameFormat(VideoCapturer* capturer, const VideoFormat* format) {
}
- virtual void OnMessage(talk_base::Message* msg);
+ virtual void OnMessage(rtc::Message* msg);
protected:
int GetLastEngineError() { return engine()->GetLastEngineError(); }
@@ -389,7 +389,7 @@
}
bool RemoveCapturer(uint32 ssrc);
- talk_base::MessageQueue* worker_thread() { return engine_->worker_thread(); }
+ rtc::MessageQueue* worker_thread() { return engine_->worker_thread(); }
void QueueBlackFrame(uint32 ssrc, int64 timestamp, int framerate);
void FlushBlackFrame(uint32 ssrc, int64 timestamp);
@@ -449,7 +449,7 @@
// Global send side state.
SendChannelMap send_channels_;
- talk_base::scoped_ptr<webrtc::VideoCodec> send_codec_;
+ rtc::scoped_ptr<webrtc::VideoCodec> send_codec_;
int send_rtx_type_;
int send_red_type_;
int send_fec_type_;
diff --git a/media/webrtc/webrtcvideoengine2.cc b/media/webrtc/webrtcvideoengine2.cc
index 2776647..0bf3b51 100644
--- a/media/webrtc/webrtcvideoengine2.cc
+++ b/media/webrtc/webrtcvideoengine2.cc
@@ -28,18 +28,13 @@
#ifdef HAVE_WEBRTC_VIDEO
#include "talk/media/webrtc/webrtcvideoengine2.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <math.h>
-
+#include <set>
#include <string>
#include "libyuv/convert_from.h"
-#include "talk/base/buffer.h"
-#include "talk/base/logging.h"
-#include "talk/base/stringutils.h"
+#include "webrtc/base/buffer.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/stringutils.h"
#include "talk/media/base/videocapturer.h"
#include "talk/media/base/videorenderer.h"
#include "talk/media/webrtc/constants.h"
@@ -73,28 +68,8 @@
// The formats are sorted by the descending order of width. We use the order to
// find the next format for CPU and bandwidth adaptation.
-const VideoFormatPod kDefaultVideoFormat = {
+const VideoFormatPod kDefaultMaxVideoFormat = {
640, 400, FPS_TO_INTERVAL(kDefaultFramerate), FOURCC_ANY};
-const VideoFormatPod kVideoFormats[] = {
- {1280, 800, FPS_TO_INTERVAL(kDefaultFramerate), FOURCC_ANY},
- {1280, 720, FPS_TO_INTERVAL(kDefaultFramerate), FOURCC_ANY},
- {960, 600, FPS_TO_INTERVAL(kDefaultFramerate), FOURCC_ANY},
- {960, 540, FPS_TO_INTERVAL(kDefaultFramerate), FOURCC_ANY},
- kDefaultVideoFormat,
- {640, 360, FPS_TO_INTERVAL(kDefaultFramerate), FOURCC_ANY},
- {640, 480, FPS_TO_INTERVAL(kDefaultFramerate), FOURCC_ANY},
- {480, 300, FPS_TO_INTERVAL(kDefaultFramerate), FOURCC_ANY},
- {480, 270, FPS_TO_INTERVAL(kDefaultFramerate), FOURCC_ANY},
- {480, 360, FPS_TO_INTERVAL(kDefaultFramerate), FOURCC_ANY},
- {320, 200, FPS_TO_INTERVAL(kDefaultFramerate), FOURCC_ANY},
- {320, 180, FPS_TO_INTERVAL(kDefaultFramerate), FOURCC_ANY},
- {320, 240, FPS_TO_INTERVAL(kDefaultFramerate), FOURCC_ANY},
- {240, 150, FPS_TO_INTERVAL(kDefaultFramerate), FOURCC_ANY},
- {240, 135, FPS_TO_INTERVAL(kDefaultFramerate), FOURCC_ANY},
- {240, 180, FPS_TO_INTERVAL(kDefaultFramerate), FOURCC_ANY},
- {160, 100, FPS_TO_INTERVAL(kDefaultFramerate), FOURCC_ANY},
- {160, 90, FPS_TO_INTERVAL(kDefaultFramerate), FOURCC_ANY},
- {160, 120, FPS_TO_INTERVAL(kDefaultFramerate), FOURCC_ANY}, };
static bool FindFirstMatchingCodec(const std::vector<VideoCodec>& codecs,
const VideoCodec& requested_codec,
@@ -107,49 +82,6 @@
}
return false;
}
-static bool FindBestVideoFormat(int max_width,
- int max_height,
- int aspect_width,
- int aspect_height,
- VideoFormat* video_format) {
- assert(max_width > 0);
- assert(max_height > 0);
- assert(aspect_width > 0);
- assert(aspect_height > 0);
- VideoFormat best_format;
- for (int i = 0; i < ARRAY_SIZE(kVideoFormats); ++i) {
- const VideoFormat format(kVideoFormats[i]);
-
- // Skip any format that is larger than the local or remote maximums, or
- // smaller than the current best match
- if (format.width > max_width || format.height > max_height ||
- (format.width < best_format.width &&
- format.height < best_format.height)) {
- continue;
- }
-
- // If we don't have any matches yet, this is the best so far.
- if (best_format.width == 0) {
- best_format = format;
- continue;
- }
-
- // Prefer closer aspect ratios i.e:
- // |format| aspect - requested aspect <
- // |best_format| aspect - requested aspect
- if (abs(format.width * aspect_height * best_format.height -
- aspect_width * format.height * best_format.height) <
- abs(best_format.width * aspect_height * format.height -
- aspect_width * format.height * best_format.height)) {
- best_format = format;
- }
- }
- if (best_format.width != 0) {
- *video_format = best_format;
- return true;
- }
- return false;
-}
static void AddDefaultFeedbackParams(VideoCodec* codec) {
const FeedbackParam kFir(kRtcpFbParamCcm, kRtcpFbCcmParamFir);
@@ -167,11 +99,16 @@
FeedbackParam(kRtcpFbParamNack, kParamValueEmpty));
}
+static bool IsRembEnabled(const VideoCodec& codec) {
+ return codec.HasFeedbackParam(
+ FeedbackParam(kRtcpFbParamRemb, kParamValueEmpty));
+}
+
static VideoCodec DefaultVideoCodec() {
VideoCodec default_codec(kDefaultVideoCodecPref.payload_type,
kDefaultVideoCodecPref.name,
- kDefaultVideoFormat.width,
- kDefaultVideoFormat.height,
+ kDefaultMaxVideoFormat.width,
+ kDefaultMaxVideoFormat.height,
kDefaultFramerate,
0);
AddDefaultFeedbackParams(&default_codec);
@@ -199,6 +136,34 @@
return codecs;
}
+static bool ValidateRtpHeaderExtensionIds(
+ const std::vector<RtpHeaderExtension>& extensions) {
+ std::set<int> extensions_used;
+ for (size_t i = 0; i < extensions.size(); ++i) {
+ if (extensions[i].id < 0 || extensions[i].id >= 15 ||
+ !extensions_used.insert(extensions[i].id).second) {
+ LOG(LS_ERROR) << "RTP extensions are with incorrect or duplicate ids.";
+ return false;
+ }
+ }
+ return true;
+}
+
+static std::vector<webrtc::RtpExtension> FilterRtpExtensions(
+ const std::vector<RtpHeaderExtension>& extensions) {
+ std::vector<webrtc::RtpExtension> webrtc_extensions;
+ for (size_t i = 0; i < extensions.size(); ++i) {
+ // Unsupported extensions will be ignored.
+ if (webrtc::RtpExtension::IsSupported(extensions[i].uri)) {
+ webrtc_extensions.push_back(webrtc::RtpExtension(
+ extensions[i].uri, extensions[i].id));
+ } else {
+ LOG(LS_WARNING) << "Unsupported RTP extension: " << extensions[i].uri;
+ }
+ }
+ return webrtc_extensions;
+}
+
WebRtcVideoEncoderFactory2::~WebRtcVideoEncoderFactory2() {
}
@@ -237,7 +202,47 @@
const VideoCodec& codec,
const VideoOptions& options) {
assert(SupportsCodec(codec));
- return webrtc::VP8Encoder::Create();
+ if (_stricmp(codec.name.c_str(), kVp8CodecName) == 0) {
+ return webrtc::VP8Encoder::Create();
+ }
+ // This shouldn't happen, we should be able to create encoders for all codecs
+ // we support.
+ assert(false);
+ return NULL;
+}
+
+void* WebRtcVideoEncoderFactory2::CreateVideoEncoderSettings(
+ const VideoCodec& codec,
+ const VideoOptions& options) {
+ assert(SupportsCodec(codec));
+ if (_stricmp(codec.name.c_str(), kVp8CodecName) == 0) {
+ webrtc::VideoCodecVP8* settings = new webrtc::VideoCodecVP8();
+ settings->resilience = webrtc::kResilientStream;
+ settings->numberOfTemporalLayers = 1;
+ options.video_noise_reduction.Get(&settings->denoisingOn);
+ settings->errorConcealmentOn = false;
+ settings->automaticResizeOn = false;
+ settings->frameDroppingOn = true;
+ settings->keyFrameInterval = 3000;
+ return settings;
+ }
+ return NULL;
+}
+
+void WebRtcVideoEncoderFactory2::DestroyVideoEncoderSettings(
+ const VideoCodec& codec,
+ void* encoder_settings) {
+ assert(SupportsCodec(codec));
+ if (encoder_settings == NULL) {
+ return;
+ }
+
+ if (_stricmp(codec.name.c_str(), kVp8CodecName) == 0) {
+ delete reinterpret_cast<webrtc::VideoCodecVP8*>(encoder_settings);
+ return;
+ }
+ // We should be able to destroy all encoder settings we've allocated.
+ assert(false);
}
bool WebRtcVideoEncoderFactory2::SupportsCodec(const VideoCodec& codec) {
@@ -246,18 +251,18 @@
WebRtcVideoEngine2::WebRtcVideoEngine2() {
// Construct without a factory or voice engine.
- Construct(NULL, NULL, new talk_base::CpuMonitor(NULL));
+ Construct(NULL, NULL, new rtc::CpuMonitor(NULL));
}
WebRtcVideoEngine2::WebRtcVideoEngine2(
WebRtcVideoChannelFactory* channel_factory) {
// Construct without a voice engine.
- Construct(channel_factory, NULL, new talk_base::CpuMonitor(NULL));
+ Construct(channel_factory, NULL, new rtc::CpuMonitor(NULL));
}
void WebRtcVideoEngine2::Construct(WebRtcVideoChannelFactory* channel_factory,
WebRtcVoiceEngine* voice_engine,
- talk_base::CpuMonitor* cpu_monitor) {
+ rtc::CpuMonitor* cpu_monitor) {
LOG(LS_INFO) << "WebRtcVideoEngine2::WebRtcVideoEngine2";
worker_thread_ = NULL;
voice_engine_ = voice_engine;
@@ -267,7 +272,7 @@
channel_factory_ = channel_factory;
video_codecs_ = DefaultVideoCodecs();
- default_codec_format_ = VideoFormat(kDefaultVideoFormat);
+ default_codec_format_ = VideoFormat(kDefaultMaxVideoFormat);
rtp_header_extensions_.push_back(
RtpHeaderExtension(kRtpTimestampOffsetHeaderExtension,
@@ -285,7 +290,7 @@
}
}
-bool WebRtcVideoEngine2::Init(talk_base::Thread* worker_thread) {
+bool WebRtcVideoEngine2::Init(rtc::Thread* worker_thread) {
LOG(LS_INFO) << "WebRtcVideoEngine2::Init";
worker_thread_ = worker_thread;
ASSERT(worker_thread_ != NULL);
@@ -320,8 +325,21 @@
bool WebRtcVideoEngine2::SetDefaultEncoderConfig(
const VideoEncoderConfig& config) {
- // TODO(pbos): Implement. Should be covered by corresponding unit tests.
- LOG(LS_VERBOSE) << "SetDefaultEncoderConfig()";
+ const VideoCodec& codec = config.max_codec;
+ // TODO(pbos): Make use of external encoder factory.
+ if (!GetVideoEncoderFactory()->SupportsCodec(codec)) {
+ LOG(LS_ERROR) << "SetDefaultEncoderConfig, codec not supported:"
+ << codec.ToString();
+ return false;
+ }
+
+ default_codec_format_ =
+ VideoFormat(codec.width,
+ codec.height,
+ VideoFormat::FpsToInterval(codec.framerate),
+ FOURCC_ANY);
+ video_codecs_.clear();
+ video_codecs_.push_back(codec);
return true;
}
@@ -382,17 +400,10 @@
// TODO(pbos): Probe encoder factory to figure out that the codec is supported
// if supported by the encoder factory. Add a corresponding test that fails
// with this code (that doesn't ask the factory).
- for (int i = 0; i < ARRAY_SIZE(kVideoFormats); ++i) {
- const VideoFormat fmt(kVideoFormats[i]);
- if ((in.width != 0 || in.height != 0) &&
- (fmt.width != in.width || fmt.height != in.height)) {
- continue;
- }
- for (size_t j = 0; j < video_codecs_.size(); ++j) {
- VideoCodec codec(video_codecs_[j].id, video_codecs_[j].name, 0, 0, 0, 0);
- if (codec.Matches(in)) {
- return true;
- }
+ for (size_t j = 0; j < video_codecs_.size(); ++j) {
+ VideoCodec codec(video_codecs_[j].id, video_codecs_[j].name, 0, 0, 0, 0);
+ if (codec.Matches(in)) {
+ return true;
}
}
return false;
@@ -406,7 +417,6 @@
const VideoCodec& current,
VideoCodec* out) {
assert(out != NULL);
- // TODO(pbos): Implement.
if (requested.width != requested.height &&
(requested.height == 0 || requested.width == 0)) {
@@ -420,37 +430,26 @@
return false;
}
- // Pick the best quality that is within their and our bounds and has the
- // correct aspect ratio.
- VideoFormat format;
- if (requested.width == 0 && requested.height == 0) {
- // Special case with resolution 0. The channel should not send frames.
- } else {
- int max_width = talk_base::_min(requested.width, matching_codec.width);
- int max_height = talk_base::_min(requested.height, matching_codec.height);
- int aspect_width = max_width;
- int aspect_height = max_height;
- if (current.width > 0 && current.height > 0) {
- aspect_width = current.width;
- aspect_height = current.height;
- }
- if (!FindBestVideoFormat(
- max_width, max_height, aspect_width, aspect_height, &format)) {
- return false;
- }
- }
-
out->id = requested.id;
out->name = requested.name;
out->preference = requested.preference;
out->params = requested.params;
out->framerate =
- talk_base::_min(requested.framerate, matching_codec.framerate);
- out->width = format.width;
- out->height = format.height;
+ rtc::_min(requested.framerate, matching_codec.framerate);
out->params = requested.params;
out->feedback_params = requested.feedback_params;
- return true;
+ out->width = requested.width;
+ out->height = requested.height;
+ if (requested.width == 0 && requested.height == 0) {
+ return true;
+ }
+
+ while (out->width > matching_codec.width) {
+ out->width /= 2;
+ out->height /= 2;
+ }
+
+ return out->width > 0 && out->height > 0;
}
bool WebRtcVideoEngine2::SetVoiceEngine(WebRtcVoiceEngine* voice_engine) {
@@ -560,11 +559,11 @@
virtual int64 GetElapsedTime() const OVERRIDE {
// Convert millisecond render time to ns timestamp.
- return frame_->render_time_ms() * talk_base::kNumNanosecsPerMillisec;
+ return frame_->render_time_ms() * rtc::kNumNanosecsPerMillisec;
}
virtual int64 GetTimeStamp() const OVERRIDE {
// Convert 90K rtp timestamp to ns timestamp.
- return (frame_->timestamp() / 90) * talk_base::kNumNanosecsPerMillisec;
+ return (frame_->timestamp() / 90) * rtc::kNumNanosecsPerMillisec;
}
virtual void SetElapsedTime(int64 elapsed_time) OVERRIDE { UNIMPLEMENTED; }
virtual void SetTimeStamp(int64 time_stamp) OVERRIDE { UNIMPLEMENTED; }
@@ -638,52 +637,6 @@
const webrtc::I420VideoFrame* const frame_;
};
-WebRtcVideoRenderer::WebRtcVideoRenderer()
- : last_width_(-1), last_height_(-1), renderer_(NULL) {}
-
-void WebRtcVideoRenderer::RenderFrame(const webrtc::I420VideoFrame& frame,
- int time_to_render_ms) {
- talk_base::CritScope crit(&lock_);
- if (renderer_ == NULL) {
- LOG(LS_WARNING) << "VideoReceiveStream not connected to a VideoRenderer.";
- return;
- }
-
- if (frame.width() != last_width_ || frame.height() != last_height_) {
- SetSize(frame.width(), frame.height());
- }
-
- LOG(LS_VERBOSE) << "RenderFrame: (" << frame.width() << "x" << frame.height()
- << ")";
-
- const WebRtcVideoRenderFrame render_frame(&frame);
- renderer_->RenderFrame(&render_frame);
-}
-
-void WebRtcVideoRenderer::SetRenderer(cricket::VideoRenderer* renderer) {
- talk_base::CritScope crit(&lock_);
- renderer_ = renderer;
- if (renderer_ != NULL && last_width_ != -1) {
- SetSize(last_width_, last_height_);
- }
-}
-
-VideoRenderer* WebRtcVideoRenderer::GetRenderer() {
- talk_base::CritScope crit(&lock_);
- return renderer_;
-}
-
-void WebRtcVideoRenderer::SetSize(int width, int height) {
- talk_base::CritScope crit(&lock_);
- if (!renderer_->SetSize(width, height, 0)) {
- LOG(LS_ERROR) << "Could not set renderer size.";
- }
- last_width_ = width;
- last_height_ = height;
-}
-
-// WebRtcVideoChannel2
-
WebRtcVideoChannel2::WebRtcVideoChannel2(
WebRtcVideoEngine2* engine,
VoiceMediaChannel* voice_channel,
@@ -710,6 +663,14 @@
default_renderer_ = NULL;
default_send_ssrc_ = 0;
default_recv_ssrc_ = 0;
+
+ SetDefaultOptions();
+}
+
+void WebRtcVideoChannel2::SetDefaultOptions() {
+ options_.video_noise_reduction.Set(true);
+ options_.use_payload_padding.Set(false);
+ options_.suspend_below_min_bitrate.Set(false);
}
WebRtcVideoChannel2::~WebRtcVideoChannel2() {
@@ -720,18 +681,10 @@
delete it->second;
}
- for (std::map<uint32, webrtc::VideoReceiveStream*>::iterator it =
+ for (std::map<uint32, WebRtcVideoReceiveStream*>::iterator it =
receive_streams_.begin();
it != receive_streams_.end();
++it) {
- assert(it->second != NULL);
- call_->DestroyVideoReceiveStream(it->second);
- }
-
- for (std::map<uint32, WebRtcVideoRenderer*>::iterator it = renderers_.begin();
- it != renderers_.end();
- ++it) {
- assert(it->second != NULL);
delete it->second;
}
}
@@ -788,8 +741,6 @@
} // namespace
bool WebRtcVideoChannel2::SetRecvCodecs(const std::vector<VideoCodec>& codecs) {
- // TODO(pbos): Must these receive codecs propagate to existing receive
- // streams?
LOG(LS_INFO) << "SetRecvCodecs: " << CodecVectorToString(codecs);
if (!ValidateCodecFormats(codecs)) {
return false;
@@ -812,6 +763,14 @@
}
recv_codecs_ = mapped_codecs;
+
+ for (std::map<uint32, WebRtcVideoReceiveStream*>::iterator it =
+ receive_streams_.begin();
+ it != receive_streams_.end();
+ ++it) {
+ it->second->SetRecvCodecs(recv_codecs_);
+ }
+
return true;
}
@@ -832,7 +791,13 @@
send_codec_.Set(supported_codecs.front());
LOG(LS_INFO) << "Using codec: " << supported_codecs.front().codec.ToString();
- SetCodecForAllSendStreams(supported_codecs.front());
+ for (std::map<uint32, WebRtcVideoSendStream*>::iterator it =
+ send_streams_.begin();
+ it != send_streams_.end();
+ ++it) {
+ assert(it->second != NULL);
+ it->second->SetCodec(supported_codecs.front());
+ }
return true;
}
@@ -878,52 +843,6 @@
return true;
}
-static bool ConfigureSendSsrcs(webrtc::VideoSendStream::Config* config,
- const StreamParams& sp) {
- if (!sp.has_ssrc_groups()) {
- config->rtp.ssrcs = sp.ssrcs;
- return true;
- }
-
- if (sp.get_ssrc_group(kFecSsrcGroupSemantics) != NULL) {
- LOG(LS_ERROR) << "Standalone FEC SSRCs not supported.";
- return false;
- }
-
- // Map RTX SSRCs.
- std::vector<uint32_t> ssrcs;
- std::vector<uint32_t> rtx_ssrcs;
- const SsrcGroup* sim_group = sp.get_ssrc_group(kSimSsrcGroupSemantics);
- if (sim_group == NULL) {
- ssrcs.push_back(sp.first_ssrc());
- uint32_t rtx_ssrc;
- if (!sp.GetFidSsrc(sp.first_ssrc(), &rtx_ssrc)) {
- LOG(LS_ERROR) << "Could not find FID ssrc for primary SSRC '"
- << sp.first_ssrc() << "':" << sp.ToString();
- return false;
- }
- rtx_ssrcs.push_back(rtx_ssrc);
- } else {
- ssrcs = sim_group->ssrcs;
- for (size_t i = 0; i < sim_group->ssrcs.size(); ++i) {
- uint32_t rtx_ssrc;
- if (!sp.GetFidSsrc(sim_group->ssrcs[i], &rtx_ssrc)) {
- continue;
- }
- rtx_ssrcs.push_back(rtx_ssrc);
- }
- }
- if (!rtx_ssrcs.empty() && ssrcs.size() != rtx_ssrcs.size()) {
- LOG(LS_ERROR)
- << "RTX SSRCs exist, but don't cover all SSRCs (unsupported): "
- << sp.ToString();
- return false;
- }
- config->rtp.rtx.ssrcs = rtx_ssrcs;
- config->rtp.ssrcs = ssrcs;
- return true;
-}
-
bool WebRtcVideoChannel2::AddSendStream(const StreamParams& sp) {
LOG(LS_INFO) << "AddSendStream: " << sp.ToString();
if (sp.ssrcs.empty()) {
@@ -940,58 +859,25 @@
return false;
}
- webrtc::VideoSendStream::Config config;
-
- if (!ConfigureSendSsrcs(&config, sp)) {
+ std::vector<uint32> primary_ssrcs;
+ sp.GetPrimarySsrcs(&primary_ssrcs);
+ std::vector<uint32> rtx_ssrcs;
+ sp.GetFidSsrcs(primary_ssrcs, &rtx_ssrcs);
+ if (!rtx_ssrcs.empty() && primary_ssrcs.size() != rtx_ssrcs.size()) {
+ LOG(LS_ERROR)
+ << "RTX SSRCs exist, but don't cover all SSRCs (unsupported): "
+ << sp.ToString();
return false;
}
- VideoCodecSettings codec_settings;
- if (!send_codec_.Get(&codec_settings)) {
- // TODO(pbos): Set up a temporary fake encoder for VideoSendStream instead
- // of setting default codecs not to break CreateEncoderSettings.
- SetSendCodecs(DefaultVideoCodecs());
- assert(send_codec_.IsSet());
- send_codec_.Get(&codec_settings);
- // This is only to bring up defaults to make VideoSendStream setup easier
- // and avoid complexity. We still don't want to allow sending with the
- // default codec.
- send_codec_.Clear();
- }
-
- // CreateEncoderSettings will allocate a suitable VideoEncoder instance
- // matching current settings.
- std::vector<webrtc::VideoStream> video_streams =
- encoder_factory_->CreateVideoStreams(
- codec_settings.codec, options_, config.rtp.ssrcs.size());
- if (video_streams.empty()) {
- return false;
- }
-
- config.encoder_settings.encoder =
- encoder_factory_->CreateVideoEncoder(codec_settings.codec, options_);
- config.encoder_settings.payload_name = codec_settings.codec.name;
- config.encoder_settings.payload_type = codec_settings.codec.id;
- config.rtp.c_name = sp.cname;
- config.rtp.fec = codec_settings.fec;
- if (!config.rtp.rtx.ssrcs.empty()) {
- config.rtp.rtx.payload_type = codec_settings.rtx_payload_type;
- }
-
- config.rtp.extensions = send_rtp_extensions_;
-
- if (IsNackEnabled(codec_settings.codec)) {
- config.rtp.nack.rtp_history_ms = kNackHistoryMs;
- }
- config.rtp.max_packet_size = kVideoMtu;
-
WebRtcVideoSendStream* stream =
new WebRtcVideoSendStream(call_.get(),
- config,
+ encoder_factory_,
options_,
- codec_settings.codec,
- video_streams,
- encoder_factory_);
+ send_codec_,
+ sp,
+ send_rtp_extensions_);
+
send_streams_[ssrc] = stream;
if (rtcp_receiver_report_ssrc_ == kDefaultRtcpReceiverReportSsrc) {
@@ -1053,86 +939,49 @@
}
webrtc::VideoReceiveStream::Config config;
- config.rtp.remote_ssrc = ssrc;
- config.rtp.local_ssrc = rtcp_receiver_report_ssrc_;
+ ConfigureReceiverRtp(&config, sp);
+ receive_streams_[ssrc] =
+ new WebRtcVideoReceiveStream(call_.get(), config, recv_codecs_);
- if (IsNackEnabled(recv_codecs_.begin()->codec)) {
- config.rtp.nack.rtp_history_ms = kNackHistoryMs;
- }
- config.rtp.remb = true;
- config.rtp.extensions = recv_rtp_extensions_;
+ return true;
+}
+
+void WebRtcVideoChannel2::ConfigureReceiverRtp(
+ webrtc::VideoReceiveStream::Config* config,
+ const StreamParams& sp) const {
+ uint32 ssrc = sp.first_ssrc();
+
+ config->rtp.remote_ssrc = ssrc;
+ config->rtp.local_ssrc = rtcp_receiver_report_ssrc_;
+
+ config->rtp.extensions = recv_rtp_extensions_;
+
// TODO(pbos): This protection is against setting the same local ssrc as
// remote which is not permitted by the lower-level API. RTCP requires a
// corresponding sender SSRC. Figure out what to do when we don't have
// (receive-only) or know a good local SSRC.
- if (config.rtp.remote_ssrc == config.rtp.local_ssrc) {
- if (config.rtp.local_ssrc != kDefaultRtcpReceiverReportSsrc) {
- config.rtp.local_ssrc = kDefaultRtcpReceiverReportSsrc;
+ if (config->rtp.remote_ssrc == config->rtp.local_ssrc) {
+ if (config->rtp.local_ssrc != kDefaultRtcpReceiverReportSsrc) {
+ config->rtp.local_ssrc = kDefaultRtcpReceiverReportSsrc;
} else {
- config.rtp.local_ssrc = kDefaultRtcpReceiverReportSsrc + 1;
+ config->rtp.local_ssrc = kDefaultRtcpReceiverReportSsrc + 1;
}
}
- bool default_renderer_used = false;
- for (std::map<uint32, WebRtcVideoRenderer*>::iterator it = renderers_.begin();
- it != renderers_.end();
- ++it) {
- if (it->second->GetRenderer() == default_renderer_) {
- default_renderer_used = true;
+
+ for (size_t i = 0; i < recv_codecs_.size(); ++i) {
+ if (recv_codecs_[i].codec.id == kDefaultVideoCodecPref.payload_type) {
+ config->rtp.fec = recv_codecs_[i].fec;
+ uint32 rtx_ssrc;
+ if (recv_codecs_[i].rtx_payload_type != -1 &&
+ sp.GetFidSsrc(ssrc, &rtx_ssrc)) {
+ config->rtp.rtx[kDefaultVideoCodecPref.payload_type].ssrc = rtx_ssrc;
+ config->rtp.rtx[kDefaultVideoCodecPref.payload_type].payload_type =
+ recv_codecs_[i].rtx_payload_type;
+ }
break;
}
}
- assert(renderers_[ssrc] == NULL);
- renderers_[ssrc] = new WebRtcVideoRenderer();
- if (!default_renderer_used) {
- renderers_[ssrc]->SetRenderer(default_renderer_);
- }
- config.renderer = renderers_[ssrc];
-
- {
- // TODO(pbos): Base receive codecs off recv_codecs_ and set up using a
- // DecoderFactory similar to send side. Pending webrtc:2854.
- // Also set up default codecs if there's nothing in recv_codecs_.
- webrtc::VideoCodec codec;
- memset(&codec, 0, sizeof(codec));
-
- codec.plType = kDefaultVideoCodecPref.payload_type;
- strcpy(codec.plName, kDefaultVideoCodecPref.name);
- codec.codecType = webrtc::kVideoCodecVP8;
- codec.codecSpecific.VP8.resilience = webrtc::kResilientStream;
- codec.codecSpecific.VP8.numberOfTemporalLayers = 1;
- codec.codecSpecific.VP8.denoisingOn = true;
- codec.codecSpecific.VP8.errorConcealmentOn = false;
- codec.codecSpecific.VP8.automaticResizeOn = false;
- codec.codecSpecific.VP8.frameDroppingOn = true;
- codec.codecSpecific.VP8.keyFrameInterval = 3000;
- // Bitrates don't matter and are ignored for the receiver. This is put in to
- // have the current underlying implementation accept the VideoCodec.
- codec.minBitrate = codec.startBitrate = codec.maxBitrate = 300;
- config.codecs.push_back(codec);
- for (size_t i = 0; i < recv_codecs_.size(); ++i) {
- if (recv_codecs_[i].codec.id == codec.plType) {
- config.rtp.fec = recv_codecs_[i].fec;
- uint32 rtx_ssrc;
- if (recv_codecs_[i].rtx_payload_type != -1 &&
- sp.GetFidSsrc(ssrc, &rtx_ssrc)) {
- config.rtp.rtx[codec.plType].ssrc = rtx_ssrc;
- config.rtp.rtx[codec.plType].payload_type =
- recv_codecs_[i].rtx_payload_type;
- }
- break;
- }
- }
- }
-
- webrtc::VideoReceiveStream* receive_stream =
- call_->CreateVideoReceiveStream(config);
- assert(receive_stream != NULL);
-
- receive_streams_[ssrc] = receive_stream;
- receive_stream->Start();
-
- return true;
}
bool WebRtcVideoChannel2::RemoveRecvStream(uint32 ssrc) {
@@ -1141,21 +990,15 @@
ssrc = default_recv_ssrc_;
}
- std::map<uint32, webrtc::VideoReceiveStream*>::iterator stream =
+ std::map<uint32, WebRtcVideoReceiveStream*>::iterator stream =
receive_streams_.find(ssrc);
if (stream == receive_streams_.end()) {
LOG(LS_ERROR) << "Stream not found for ssrc: " << ssrc;
return false;
}
- call_->DestroyVideoReceiveStream(stream->second);
+ delete stream->second;
receive_streams_.erase(stream);
- std::map<uint32, WebRtcVideoRenderer*>::iterator renderer =
- renderers_.find(ssrc);
- assert(renderer != renderers_.end());
- delete renderer->second;
- renderers_.erase(renderer);
-
if (ssrc == default_recv_ssrc_) {
default_recv_ssrc_ = 0;
}
@@ -1166,16 +1009,19 @@
bool WebRtcVideoChannel2::SetRenderer(uint32 ssrc, VideoRenderer* renderer) {
LOG(LS_INFO) << "SetRenderer: ssrc:" << ssrc << " "
<< (renderer ? "(ptr)" : "NULL");
- bool is_default_ssrc = false;
if (ssrc == 0) {
- is_default_ssrc = true;
+ if (default_recv_ssrc_!= 0) {
+ receive_streams_[default_recv_ssrc_]->SetRenderer(renderer);
+ }
ssrc = default_recv_ssrc_;
default_renderer_ = renderer;
+ return true;
}
- std::map<uint32, WebRtcVideoRenderer*>::iterator it = renderers_.find(ssrc);
- if (it == renderers_.end()) {
- return is_default_ssrc;
+ std::map<uint32, WebRtcVideoReceiveStream*>::iterator it =
+ receive_streams_.find(ssrc);
+ if (it == receive_streams_.end()) {
+ return false;
}
it->second->SetRenderer(renderer);
@@ -1191,8 +1037,9 @@
return true;
}
- std::map<uint32, WebRtcVideoRenderer*>::iterator it = renderers_.find(ssrc);
- if (it == renderers_.end()) {
+ std::map<uint32, WebRtcVideoReceiveStream*>::iterator it =
+ receive_streams_.find(ssrc);
+ if (it == receive_streams_.end()) {
return false;
}
*renderer = it->second->GetRenderer();
@@ -1201,10 +1048,36 @@
bool WebRtcVideoChannel2::GetStats(const StatsOptions& options,
VideoMediaInfo* info) {
- // TODO(pbos): Implement.
+ info->Clear();
+ FillSenderStats(info);
+ FillReceiverStats(info);
+ FillBandwidthEstimationStats(info);
return true;
}
+void WebRtcVideoChannel2::FillSenderStats(VideoMediaInfo* video_media_info) {
+ for (std::map<uint32, WebRtcVideoSendStream*>::iterator it =
+ send_streams_.begin();
+ it != send_streams_.end();
+ ++it) {
+ video_media_info->senders.push_back(it->second->GetVideoSenderInfo());
+ }
+}
+
+void WebRtcVideoChannel2::FillReceiverStats(VideoMediaInfo* video_media_info) {
+ for (std::map<uint32, WebRtcVideoReceiveStream*>::iterator it =
+ receive_streams_.begin();
+ it != receive_streams_.end();
+ ++it) {
+ video_media_info->receivers.push_back(it->second->GetVideoReceiverInfo());
+ }
+}
+
+void WebRtcVideoChannel2::FillBandwidthEstimationStats(
+ VideoMediaInfo* video_media_info) {
+ // TODO(pbos): Implement.
+}
+
bool WebRtcVideoChannel2::SetCapturer(uint32 ssrc, VideoCapturer* capturer) {
LOG(LS_INFO) << "SetCapturer: " << ssrc << " -> "
<< (capturer != NULL ? "(capturer)" : "NULL");
@@ -1229,8 +1102,8 @@
}
void WebRtcVideoChannel2::OnPacketReceived(
- talk_base::Buffer* packet,
- const talk_base::PacketTime& packet_time) {
+ rtc::Buffer* packet,
+ const rtc::PacketTime& packet_time) {
const webrtc::PacketReceiver::DeliveryStatus delivery_result =
call_->Receiver()->DeliverPacket(
reinterpret_cast<const uint8_t*>(packet->data()), packet->length());
@@ -1257,6 +1130,7 @@
sp.ssrcs.push_back(ssrc);
LOG(LS_INFO) << "Creating default receive stream for SSRC=" << ssrc << ".";
AddRecvStream(sp);
+ SetRenderer(0, default_renderer_);
if (call_->Receiver()->DeliverPacket(
reinterpret_cast<const uint8_t*>(packet->data()), packet->length()) !=
@@ -1268,8 +1142,8 @@
}
void WebRtcVideoChannel2::OnRtcpReceived(
- talk_base::Buffer* packet,
- const talk_base::PacketTime& packet_time) {
+ rtc::Buffer* packet,
+ const rtc::PacketTime& packet_time) {
if (call_->Receiver()->DeliverPacket(
reinterpret_cast<const uint8_t*>(packet->data()), packet->length()) !=
webrtc::PacketReceiver::DELIVERY_OK) {
@@ -1296,14 +1170,16 @@
const std::vector<RtpHeaderExtension>& extensions) {
LOG(LS_INFO) << "SetRecvRtpHeaderExtensions: "
<< RtpExtensionsToString(extensions);
- std::vector<webrtc::RtpExtension> webrtc_extensions;
- for (size_t i = 0; i < extensions.size(); ++i) {
- // TODO(pbos): Make sure we don't pass unsupported extensions!
- webrtc::RtpExtension webrtc_extension(extensions[i].uri.c_str(),
- extensions[i].id);
- webrtc_extensions.push_back(webrtc_extension);
+ if (!ValidateRtpHeaderExtensionIds(extensions))
+ return false;
+
+ recv_rtp_extensions_ = FilterRtpExtensions(extensions);
+ for (std::map<uint32, WebRtcVideoReceiveStream*>::iterator it =
+ receive_streams_.begin();
+ it != receive_streams_.end();
+ ++it) {
+ it->second->SetRtpExtensions(recv_rtp_extensions_);
}
- recv_rtp_extensions_ = webrtc_extensions;
return true;
}
@@ -1311,14 +1187,16 @@
const std::vector<RtpHeaderExtension>& extensions) {
LOG(LS_INFO) << "SetSendRtpHeaderExtensions: "
<< RtpExtensionsToString(extensions);
- std::vector<webrtc::RtpExtension> webrtc_extensions;
- for (size_t i = 0; i < extensions.size(); ++i) {
- // TODO(pbos): Make sure we don't pass unsupported extensions!
- webrtc::RtpExtension webrtc_extension(extensions[i].uri.c_str(),
- extensions[i].id);
- webrtc_extensions.push_back(webrtc_extension);
+ if (!ValidateRtpHeaderExtensionIds(extensions))
+ return false;
+
+ send_rtp_extensions_ = FilterRtpExtensions(extensions);
+ for (std::map<uint32, WebRtcVideoSendStream*>::iterator it =
+ send_streams_.begin();
+ it != send_streams_.end();
+ ++it) {
+ it->second->SetRtpExtensions(send_rtp_extensions_);
}
- send_rtp_extensions_ = webrtc_extensions;
return true;
}
@@ -1337,6 +1215,12 @@
bool WebRtcVideoChannel2::SetOptions(const VideoOptions& options) {
LOG(LS_VERBOSE) << "SetOptions: " << options.ToString();
options_.SetAll(options);
+ for (std::map<uint32, WebRtcVideoSendStream*>::iterator it =
+ send_streams_.begin();
+ it != send_streams_.end();
+ ++it) {
+ it->second->SetOptions(options_);
+ }
return true;
}
@@ -1344,14 +1228,14 @@
MediaChannel::SetInterface(iface);
// Set the RTP recv/send buffer to a bigger size
MediaChannel::SetOption(NetworkInterface::ST_RTP,
- talk_base::Socket::OPT_RCVBUF,
+ rtc::Socket::OPT_RCVBUF,
kVideoRtpBufferSize);
// TODO(sriniv): Remove or re-enable this.
// As part of b/8030474, send-buffer is size now controlled through
// portallocator flags.
// network_interface_->SetOption(NetworkInterface::ST_RTP,
- // talk_base::Socket::OPT_SNDBUF,
+ // rtc::Socket::OPT_SNDBUF,
// kVideoRtpBufferSize);
}
@@ -1359,17 +1243,17 @@
// TODO(pbos): Implement.
}
-void WebRtcVideoChannel2::OnMessage(talk_base::Message* msg) {
+void WebRtcVideoChannel2::OnMessage(rtc::Message* msg) {
// Ignored.
}
bool WebRtcVideoChannel2::SendRtp(const uint8_t* data, size_t len) {
- talk_base::Buffer packet(data, len, kMaxRtpPacketLen);
+ rtc::Buffer packet(data, len, kMaxRtpPacketLen);
return MediaChannel::SendPacket(&packet);
}
bool WebRtcVideoChannel2::SendRtcp(const uint8_t* data, size_t len) {
- talk_base::Buffer packet(data, len, kMaxRtpPacketLen);
+ rtc::Buffer packet(data, len, kMaxRtpPacketLen);
return MediaChannel::SendRtcp(&packet);
}
@@ -1391,53 +1275,47 @@
}
}
-void WebRtcVideoChannel2::SetCodecForAllSendStreams(
- const WebRtcVideoChannel2::VideoCodecSettings& codec) {
- for (std::map<uint32, WebRtcVideoSendStream*>::iterator it =
- send_streams_.begin();
- it != send_streams_.end();
- ++it) {
- assert(it->second != NULL);
- it->second->SetCodec(options_, codec);
- }
-}
-
WebRtcVideoChannel2::WebRtcVideoSendStream::VideoSendStreamParameters::
VideoSendStreamParameters(
const webrtc::VideoSendStream::Config& config,
const VideoOptions& options,
- const VideoCodec& codec,
- const std::vector<webrtc::VideoStream>& video_streams)
- : config(config),
- options(options),
- codec(codec),
- video_streams(video_streams) {
+ const Settable<VideoCodecSettings>& codec_settings)
+ : config(config), options(options), codec_settings(codec_settings) {
}
WebRtcVideoChannel2::WebRtcVideoSendStream::WebRtcVideoSendStream(
webrtc::Call* call,
- const webrtc::VideoSendStream::Config& config,
+ WebRtcVideoEncoderFactory2* encoder_factory,
const VideoOptions& options,
- const VideoCodec& codec,
- const std::vector<webrtc::VideoStream>& video_streams,
- WebRtcVideoEncoderFactory2* encoder_factory)
+ const Settable<VideoCodecSettings>& codec_settings,
+ const StreamParams& sp,
+ const std::vector<webrtc::RtpExtension>& rtp_extensions)
: call_(call),
- parameters_(config, options, codec, video_streams),
+ parameters_(webrtc::VideoSendStream::Config(), options, codec_settings),
encoder_factory_(encoder_factory),
capturer_(NULL),
stream_(NULL),
sending_(false),
- muted_(false),
- format_(static_cast<int>(video_streams.back().height),
- static_cast<int>(video_streams.back().width),
- VideoFormat::FpsToInterval(video_streams.back().max_framerate),
- FOURCC_I420) {
- RecreateWebRtcStream();
+ muted_(false) {
+ parameters_.config.rtp.max_packet_size = kVideoMtu;
+
+ sp.GetPrimarySsrcs(¶meters_.config.rtp.ssrcs);
+ sp.GetFidSsrcs(parameters_.config.rtp.ssrcs,
+ ¶meters_.config.rtp.rtx.ssrcs);
+ parameters_.config.rtp.c_name = sp.cname;
+ parameters_.config.rtp.extensions = rtp_extensions;
+
+ VideoCodecSettings params;
+ if (codec_settings.Get(¶ms)) {
+ SetCodec(params);
+ }
}
WebRtcVideoChannel2::WebRtcVideoSendStream::~WebRtcVideoSendStream() {
DisconnectCapturer();
- call_->DestroyVideoSendStream(stream_);
+ if (stream_ != NULL) {
+ call_->DestroyVideoSendStream(stream_);
+ }
delete parameters_.config.encoder_settings.encoder;
}
@@ -1485,7 +1363,7 @@
<< frame->GetHeight();
bool is_screencast = capturer->IsScreencast();
// Lock before copying, can be called concurrently when swapping input source.
- talk_base::CritScope frame_cs(&frame_lock_);
+ rtc::CritScope frame_cs(&frame_lock_);
if (!muted_) {
ConvertToI420VideoFrame(*frame, &video_frame_);
} else {
@@ -1493,7 +1371,12 @@
CreateBlackFrame(&video_frame_, 1, 1);
is_screencast = false;
}
- talk_base::CritScope cs(&lock_);
+ rtc::CritScope cs(&lock_);
+ if (stream_ == NULL) {
+ LOG(LS_WARNING) << "Capturer inputting frames before send codecs are "
+ "configured, dropping.";
+ return;
+ }
if (format_.width == 0) { // Dropping frames.
assert(format_.height == 0);
LOG(LS_VERBOSE) << "VideoFormat 0x0 set, Dropping frame.";
@@ -1517,20 +1400,22 @@
}
{
- talk_base::CritScope cs(&lock_);
+ rtc::CritScope cs(&lock_);
if (capturer == NULL) {
- LOG(LS_VERBOSE) << "Disabling capturer, sending black frame.";
- webrtc::I420VideoFrame black_frame;
+ if (stream_ != NULL) {
+ LOG(LS_VERBOSE) << "Disabling capturer, sending black frame.";
+ webrtc::I420VideoFrame black_frame;
- int width = format_.width;
- int height = format_.height;
- int half_width = (width + 1) / 2;
- black_frame.CreateEmptyFrame(
- width, height, width, half_width, half_width);
- SetWebRtcFrameToBlack(&black_frame);
- SetDimensions(width, height);
- stream_->Input()->SwapFrame(&black_frame);
+ int width = format_.width;
+ int height = format_.height;
+ int half_width = (width + 1) / 2;
+ black_frame.CreateEmptyFrame(
+ width, height, width, half_width, half_width);
+ SetWebRtcFrameToBlack(&black_frame);
+ SetDimensions(width, height);
+ stream_->Input()->SwapFrame(&black_frame);
+ }
capturer_ = NULL;
return true;
@@ -1553,7 +1438,7 @@
return false;
}
- talk_base::CritScope cs(&lock_);
+ rtc::CritScope cs(&lock_);
if (format.width == 0 && format.height == 0) {
LOG(LS_INFO)
<< "0x0 resolution selected. Captured frames will be dropped for ssrc: "
@@ -1570,14 +1455,14 @@
}
bool WebRtcVideoChannel2::WebRtcVideoSendStream::MuteStream(bool mute) {
- talk_base::CritScope cs(&lock_);
+ rtc::CritScope cs(&lock_);
bool was_muted = muted_;
muted_ = mute;
return was_muted != mute;
}
bool WebRtcVideoChannel2::WebRtcVideoSendStream::DisconnectCapturer() {
- talk_base::CritScope cs(&lock_);
+ rtc::CritScope cs(&lock_);
if (capturer_ == NULL) {
return false;
}
@@ -1586,35 +1471,73 @@
return true;
}
+void WebRtcVideoChannel2::WebRtcVideoSendStream::SetOptions(
+ const VideoOptions& options) {
+ rtc::CritScope cs(&lock_);
+ VideoCodecSettings codec_settings;
+ if (parameters_.codec_settings.Get(&codec_settings)) {
+ SetCodecAndOptions(codec_settings, options);
+ } else {
+ parameters_.options = options;
+ }
+}
void WebRtcVideoChannel2::WebRtcVideoSendStream::SetCodec(
- const VideoOptions& options,
- const VideoCodecSettings& codec) {
- talk_base::CritScope cs(&lock_);
-
+ const VideoCodecSettings& codec_settings) {
+ rtc::CritScope cs(&lock_);
+ SetCodecAndOptions(codec_settings, parameters_.options);
+}
+void WebRtcVideoChannel2::WebRtcVideoSendStream::SetCodecAndOptions(
+ const VideoCodecSettings& codec_settings,
+ const VideoOptions& options) {
std::vector<webrtc::VideoStream> video_streams =
encoder_factory_->CreateVideoStreams(
- codec.codec, options, parameters_.video_streams.size());
+ codec_settings.codec, options, parameters_.config.rtp.ssrcs.size());
if (video_streams.empty()) {
return;
}
parameters_.video_streams = video_streams;
- format_ = VideoFormat(codec.codec.width,
- codec.codec.height,
+ format_ = VideoFormat(codec_settings.codec.width,
+ codec_settings.codec.height,
VideoFormat::FpsToInterval(30),
FOURCC_I420);
webrtc::VideoEncoder* old_encoder =
parameters_.config.encoder_settings.encoder;
parameters_.config.encoder_settings.encoder =
- encoder_factory_->CreateVideoEncoder(codec.codec, options);
- parameters_.config.rtp.fec = codec.fec;
- // TODO(pbos): Should changing RTX payload type be allowed?
- parameters_.codec = codec.codec;
+ encoder_factory_->CreateVideoEncoder(codec_settings.codec, options);
+ parameters_.config.encoder_settings.payload_name = codec_settings.codec.name;
+ parameters_.config.encoder_settings.payload_type = codec_settings.codec.id;
+ parameters_.config.rtp.fec = codec_settings.fec;
+
+ // Set RTX payload type if RTX is enabled.
+ if (!parameters_.config.rtp.rtx.ssrcs.empty()) {
+ parameters_.config.rtp.rtx.payload_type = codec_settings.rtx_payload_type;
+
+ options.use_payload_padding.Get(
+ ¶meters_.config.rtp.rtx.pad_with_redundant_payloads);
+ }
+
+ if (IsNackEnabled(codec_settings.codec)) {
+ parameters_.config.rtp.nack.rtp_history_ms = kNackHistoryMs;
+ }
+
+ options.suspend_below_min_bitrate.Get(
+ ¶meters_.config.suspend_below_min_bitrate);
+
+ parameters_.codec_settings.Set(codec_settings);
parameters_.options = options;
+
RecreateWebRtcStream();
delete old_encoder;
}
+void WebRtcVideoChannel2::WebRtcVideoSendStream::SetRtpExtensions(
+ const std::vector<webrtc::RtpExtension>& rtp_extensions) {
+ rtc::CritScope cs(&lock_);
+ parameters_.config.rtp.extensions = rtp_extensions;
+ RecreateWebRtcStream();
+}
+
void WebRtcVideoChannel2::WebRtcVideoSendStream::SetDimensions(int width,
int height) {
assert(!parameters_.video_streams.empty());
@@ -1628,8 +1551,18 @@
parameters_.video_streams.back().width = width;
parameters_.video_streams.back().height = height;
- // TODO(pbos): Wire up encoder_parameters, webrtc:3424.
- if (!stream_->ReconfigureVideoEncoder(parameters_.video_streams, NULL)) {
+ VideoCodecSettings codec_settings;
+ parameters_.codec_settings.Get(&codec_settings);
+ void* encoder_settings = encoder_factory_->CreateVideoEncoderSettings(
+ codec_settings.codec, parameters_.options);
+
+ bool stream_reconfigured = stream_->ReconfigureVideoEncoder(
+ parameters_.video_streams, encoder_settings);
+
+ encoder_factory_->DestroyVideoEncoderSettings(codec_settings.codec,
+ encoder_settings);
+
+ if (!stream_reconfigured) {
LOG(LS_WARNING) << "Failed to reconfigure video encoder for dimensions: "
<< width << "x" << height;
return;
@@ -1637,30 +1570,231 @@
}
void WebRtcVideoChannel2::WebRtcVideoSendStream::Start() {
- talk_base::CritScope cs(&lock_);
+ rtc::CritScope cs(&lock_);
+ assert(stream_ != NULL);
stream_->Start();
sending_ = true;
}
void WebRtcVideoChannel2::WebRtcVideoSendStream::Stop() {
- talk_base::CritScope cs(&lock_);
- stream_->Stop();
+ rtc::CritScope cs(&lock_);
+ if (stream_ != NULL) {
+ stream_->Stop();
+ }
sending_ = false;
}
+VideoSenderInfo
+WebRtcVideoChannel2::WebRtcVideoSendStream::GetVideoSenderInfo() {
+ VideoSenderInfo info;
+ rtc::CritScope cs(&lock_);
+ for (size_t i = 0; i < parameters_.config.rtp.ssrcs.size(); ++i) {
+ info.add_ssrc(parameters_.config.rtp.ssrcs[i]);
+ }
+
+ webrtc::VideoSendStream::Stats stats = stream_->GetStats();
+ info.framerate_input = stats.input_frame_rate;
+ info.framerate_sent = stats.encode_frame_rate;
+
+ for (std::map<uint32_t, webrtc::StreamStats>::iterator it =
+ stats.substreams.begin();
+ it != stats.substreams.end();
+ ++it) {
+ // TODO(pbos): Wire up additional stats, such as padding bytes.
+ webrtc::StreamStats stream_stats = it->second;
+ info.bytes_sent += stream_stats.rtp_stats.bytes +
+ stream_stats.rtp_stats.header_bytes +
+ stream_stats.rtp_stats.padding_bytes;
+ info.packets_sent += stream_stats.rtp_stats.packets;
+ info.packets_lost += stream_stats.rtcp_stats.cumulative_lost;
+ }
+
+ if (!stats.substreams.empty()) {
+ // TODO(pbos): Report fraction lost per SSRC.
+ webrtc::StreamStats first_stream_stats = stats.substreams.begin()->second;
+ info.fraction_lost =
+ static_cast<float>(first_stream_stats.rtcp_stats.fraction_lost) /
+ (1 << 8);
+ }
+
+ if (capturer_ != NULL && !capturer_->IsMuted()) {
+ VideoFormat last_captured_frame_format;
+ capturer_->GetStats(&info.adapt_frame_drops,
+ &info.effects_frame_drops,
+ &info.capturer_frame_time,
+ &last_captured_frame_format);
+ info.input_frame_width = last_captured_frame_format.width;
+ info.input_frame_height = last_captured_frame_format.height;
+ info.send_frame_width =
+ static_cast<int>(parameters_.video_streams.front().width);
+ info.send_frame_height =
+ static_cast<int>(parameters_.video_streams.front().height);
+ }
+
+ // TODO(pbos): Support or remove the following stats.
+ info.packets_cached = -1;
+ info.rtt_ms = -1;
+
+ return info;
+}
+
void WebRtcVideoChannel2::WebRtcVideoSendStream::RecreateWebRtcStream() {
if (stream_ != NULL) {
call_->DestroyVideoSendStream(stream_);
}
- // TODO(pbos): Wire up encoder_parameters, webrtc:3424.
+ VideoCodecSettings codec_settings;
+ parameters_.codec_settings.Get(&codec_settings);
+ void* encoder_settings = encoder_factory_->CreateVideoEncoderSettings(
+ codec_settings.codec, parameters_.options);
+
stream_ = call_->CreateVideoSendStream(
- parameters_.config, parameters_.video_streams, NULL);
+ parameters_.config, parameters_.video_streams, encoder_settings);
+
+ encoder_factory_->DestroyVideoEncoderSettings(codec_settings.codec,
+ encoder_settings);
+
if (sending_) {
stream_->Start();
}
}
+WebRtcVideoChannel2::WebRtcVideoReceiveStream::WebRtcVideoReceiveStream(
+ webrtc::Call* call,
+ const webrtc::VideoReceiveStream::Config& config,
+ const std::vector<VideoCodecSettings>& recv_codecs)
+ : call_(call),
+ config_(config),
+ stream_(NULL),
+ last_width_(-1),
+ last_height_(-1),
+ renderer_(NULL) {
+ config_.renderer = this;
+ // SetRecvCodecs will also reset (start) the VideoReceiveStream.
+ SetRecvCodecs(recv_codecs);
+}
+
+WebRtcVideoChannel2::WebRtcVideoReceiveStream::~WebRtcVideoReceiveStream() {
+ call_->DestroyVideoReceiveStream(stream_);
+}
+
+void WebRtcVideoChannel2::WebRtcVideoReceiveStream::SetRecvCodecs(
+ const std::vector<VideoCodecSettings>& recv_codecs) {
+ // TODO(pbos): Reconfigure RTX based on incoming recv_codecs.
+ // TODO(pbos): Base receive codecs off recv_codecs_ and set up using a
+ // DecoderFactory similar to send side. Pending webrtc:2854.
+ // Also set up default codecs if there's nothing in recv_codecs_.
+ webrtc::VideoCodec codec;
+ memset(&codec, 0, sizeof(codec));
+
+ codec.plType = kDefaultVideoCodecPref.payload_type;
+ strcpy(codec.plName, kDefaultVideoCodecPref.name);
+ codec.codecType = webrtc::kVideoCodecVP8;
+ codec.codecSpecific.VP8.resilience = webrtc::kResilientStream;
+ codec.codecSpecific.VP8.numberOfTemporalLayers = 1;
+ codec.codecSpecific.VP8.denoisingOn = true;
+ codec.codecSpecific.VP8.errorConcealmentOn = false;
+ codec.codecSpecific.VP8.automaticResizeOn = false;
+ codec.codecSpecific.VP8.frameDroppingOn = true;
+ codec.codecSpecific.VP8.keyFrameInterval = 3000;
+ // Bitrates don't matter and are ignored for the receiver. This is put in to
+ // have the current underlying implementation accept the VideoCodec.
+ codec.minBitrate = codec.startBitrate = codec.maxBitrate = 300;
+ config_.codecs.clear();
+ config_.codecs.push_back(codec);
+
+ config_.rtp.fec = recv_codecs.front().fec;
+
+ config_.rtp.nack.rtp_history_ms =
+ IsNackEnabled(recv_codecs.begin()->codec) ? kNackHistoryMs : 0;
+ config_.rtp.remb = IsRembEnabled(recv_codecs.begin()->codec);
+
+ RecreateWebRtcStream();
+}
+
+void WebRtcVideoChannel2::WebRtcVideoReceiveStream::SetRtpExtensions(
+ const std::vector<webrtc::RtpExtension>& extensions) {
+ config_.rtp.extensions = extensions;
+ RecreateWebRtcStream();
+}
+
+void WebRtcVideoChannel2::WebRtcVideoReceiveStream::RecreateWebRtcStream() {
+ if (stream_ != NULL) {
+ call_->DestroyVideoReceiveStream(stream_);
+ }
+ stream_ = call_->CreateVideoReceiveStream(config_);
+ stream_->Start();
+}
+
+void WebRtcVideoChannel2::WebRtcVideoReceiveStream::RenderFrame(
+ const webrtc::I420VideoFrame& frame,
+ int time_to_render_ms) {
+ rtc::CritScope crit(&renderer_lock_);
+ if (renderer_ == NULL) {
+ LOG(LS_WARNING) << "VideoReceiveStream not connected to a VideoRenderer.";
+ return;
+ }
+
+ if (frame.width() != last_width_ || frame.height() != last_height_) {
+ SetSize(frame.width(), frame.height());
+ }
+
+ LOG(LS_VERBOSE) << "RenderFrame: (" << frame.width() << "x" << frame.height()
+ << ")";
+
+ const WebRtcVideoRenderFrame render_frame(&frame);
+ renderer_->RenderFrame(&render_frame);
+}
+
+void WebRtcVideoChannel2::WebRtcVideoReceiveStream::SetRenderer(
+ cricket::VideoRenderer* renderer) {
+ rtc::CritScope crit(&renderer_lock_);
+ renderer_ = renderer;
+ if (renderer_ != NULL && last_width_ != -1) {
+ SetSize(last_width_, last_height_);
+ }
+}
+
+VideoRenderer* WebRtcVideoChannel2::WebRtcVideoReceiveStream::GetRenderer() {
+ // TODO(pbos): Remove GetRenderer and all uses of it, it's thread-unsafe by
+ // design.
+ rtc::CritScope crit(&renderer_lock_);
+ return renderer_;
+}
+
+void WebRtcVideoChannel2::WebRtcVideoReceiveStream::SetSize(int width,
+ int height) {
+ rtc::CritScope crit(&renderer_lock_);
+ if (!renderer_->SetSize(width, height, 0)) {
+ LOG(LS_ERROR) << "Could not set renderer size.";
+ }
+ last_width_ = width;
+ last_height_ = height;
+}
+
+VideoReceiverInfo
+WebRtcVideoChannel2::WebRtcVideoReceiveStream::GetVideoReceiverInfo() {
+ VideoReceiverInfo info;
+ info.add_ssrc(config_.rtp.remote_ssrc);
+ webrtc::VideoReceiveStream::Stats stats = stream_->GetStats();
+ info.bytes_rcvd = stats.rtp_stats.bytes + stats.rtp_stats.header_bytes +
+ stats.rtp_stats.padding_bytes;
+ info.packets_rcvd = stats.rtp_stats.packets;
+
+ info.framerate_rcvd = stats.network_frame_rate;
+ info.framerate_decoded = stats.decode_frame_rate;
+ info.framerate_output = stats.render_frame_rate;
+
+ rtc::CritScope frame_cs(&renderer_lock_);
+ info.frame_width = last_width_;
+ info.frame_height = last_height_;
+
+ // TODO(pbos): Support or remove the following stats.
+ info.packets_concealed = -1;
+
+ return info;
+}
+
WebRtcVideoChannel2::VideoCodecSettings::VideoCodecSettings()
: rtx_payload_type(-1) {}
diff --git a/media/webrtc/webrtcvideoengine2.h b/media/webrtc/webrtcvideoengine2.h
index 81466eb..a718e9c 100644
--- a/media/webrtc/webrtcvideoengine2.h
+++ b/media/webrtc/webrtcvideoengine2.h
@@ -32,8 +32,8 @@
#include <vector>
#include <string>
-#include "talk/base/cpumonitor.h"
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/cpumonitor.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/media/base/mediaengine.h"
#include "talk/media/webrtc/webrtcvideochannelfactory.h"
#include "webrtc/common_video/interface/i420_video_frame.h"
@@ -41,6 +41,7 @@
#include "webrtc/transport.h"
#include "webrtc/video_renderer.h"
#include "webrtc/video_send_stream.h"
+#include "webrtc/video_receive_stream.h"
namespace webrtc {
class Call;
@@ -52,10 +53,10 @@
class VideoReceiveStream;
}
-namespace talk_base {
+namespace rtc {
class CpuMonitor;
class Thread;
-} // namespace talk_base
+} // namespace rtc
namespace cricket {
@@ -79,6 +80,7 @@
class WebRtcVideoEngine2;
class WebRtcVideoChannel2;
+class WebRtcVideoRenderer;
class WebRtcVideoEncoderFactory2 {
public:
@@ -92,6 +94,13 @@
const VideoCodec& codec,
const VideoOptions& options);
+ virtual void* CreateVideoEncoderSettings(
+ const VideoCodec& codec,
+ const VideoOptions& options);
+
+ virtual void DestroyVideoEncoderSettings(const VideoCodec& codec,
+ void* encoder_settings);
+
virtual bool SupportsCodec(const cricket::VideoCodec& codec);
};
@@ -105,7 +114,7 @@
~WebRtcVideoEngine2();
// Basic video engine implementation.
- bool Init(talk_base::Thread* worker_thread);
+ bool Init(rtc::Thread* worker_thread);
void Terminate();
int GetCapabilities();
@@ -142,16 +151,16 @@
VideoFormat GetStartCaptureFormat() const { return default_codec_format_; }
- talk_base::CpuMonitor* cpu_monitor() { return cpu_monitor_.get(); }
+ rtc::CpuMonitor* cpu_monitor() { return cpu_monitor_.get(); }
virtual WebRtcVideoEncoderFactory2* GetVideoEncoderFactory();
private:
void Construct(WebRtcVideoChannelFactory* channel_factory,
WebRtcVoiceEngine* voice_engine,
- talk_base::CpuMonitor* cpu_monitor);
+ rtc::CpuMonitor* cpu_monitor);
- talk_base::Thread* worker_thread_;
+ rtc::Thread* worker_thread_;
WebRtcVoiceEngine* voice_engine_;
std::vector<VideoCodec> video_codecs_;
std::vector<RtpHeaderExtension> rtp_header_extensions_;
@@ -163,37 +172,14 @@
// Critical section to protect the media processor register/unregister
// while processing a frame
- talk_base::CriticalSection signal_media_critical_;
+ rtc::CriticalSection signal_media_critical_;
- talk_base::scoped_ptr<talk_base::CpuMonitor> cpu_monitor_;
+ rtc::scoped_ptr<rtc::CpuMonitor> cpu_monitor_;
WebRtcVideoChannelFactory* channel_factory_;
WebRtcVideoEncoderFactory2 default_video_encoder_factory_;
};
-// Adapter between webrtc::VideoRenderer and cricket::VideoRenderer.
-// The webrtc::VideoRenderer is set once, whereas the cricket::VideoRenderer can
-// be set after initialization. This adapter will also convert the incoming
-// webrtc::I420VideoFrame to a frame type that cricket::VideoRenderer can
-// render.
-class WebRtcVideoRenderer : public webrtc::VideoRenderer {
- public:
- WebRtcVideoRenderer();
-
- virtual void RenderFrame(const webrtc::I420VideoFrame& frame,
- int time_to_render_ms) OVERRIDE;
-
- void SetRenderer(cricket::VideoRenderer* renderer);
- cricket::VideoRenderer* GetRenderer();
-
- private:
- void SetSize(int width, int height);
- int last_width_;
- int last_height_;
- talk_base::CriticalSection lock_;
- cricket::VideoRenderer* renderer_ GUARDED_BY(lock_);
-};
-
-class WebRtcVideoChannel2 : public talk_base::MessageHandler,
+class WebRtcVideoChannel2 : public rtc::MessageHandler,
public VideoMediaChannel,
public webrtc::newapi::Transport {
public:
@@ -228,11 +214,11 @@
virtual bool SendIntraFrame() OVERRIDE;
virtual bool RequestIntraFrame() OVERRIDE;
- virtual void OnPacketReceived(talk_base::Buffer* packet,
- const talk_base::PacketTime& packet_time)
+ virtual void OnPacketReceived(rtc::Buffer* packet,
+ const rtc::PacketTime& packet_time)
OVERRIDE;
- virtual void OnRtcpReceived(talk_base::Buffer* packet,
- const talk_base::PacketTime& packet_time)
+ virtual void OnRtcpReceived(rtc::Buffer* packet,
+ const rtc::PacketTime& packet_time)
OVERRIDE;
virtual void OnReadyToSend(bool ready) OVERRIDE;
virtual bool MuteStream(uint32 ssrc, bool mute) OVERRIDE;
@@ -253,7 +239,7 @@
virtual void SetInterface(NetworkInterface* iface) OVERRIDE;
virtual void UpdateAspectRatio(int ratio_w, int ratio_h) OVERRIDE;
- virtual void OnMessage(talk_base::Message* msg) OVERRIDE;
+ virtual void OnMessage(rtc::Message* msg) OVERRIDE;
// Implemented for VideoMediaChannelTest.
bool sending() const { return sending_; }
@@ -261,6 +247,9 @@
bool GetRenderer(uint32 ssrc, VideoRenderer** renderer);
private:
+ void ConfigureReceiverRtp(webrtc::VideoReceiveStream::Config* config,
+ const StreamParams& sp) const;
+
struct VideoCodecSettings {
VideoCodecSettings();
@@ -269,16 +258,23 @@
int rtx_payload_type;
};
+ // Wrapper for the sender part, this is where the capturer is connected and
+ // frames are then converted from cricket frames to webrtc frames.
class WebRtcVideoSendStream : public sigslot::has_slots<> {
public:
- WebRtcVideoSendStream(webrtc::Call* call,
- const webrtc::VideoSendStream::Config& config,
- const VideoOptions& options,
- const VideoCodec& codec,
- const std::vector<webrtc::VideoStream>& video_streams,
- WebRtcVideoEncoderFactory2* encoder_factory);
+ WebRtcVideoSendStream(
+ webrtc::Call* call,
+ WebRtcVideoEncoderFactory2* encoder_factory,
+ const VideoOptions& options,
+ const Settable<VideoCodecSettings>& codec_settings,
+ const StreamParams& sp,
+ const std::vector<webrtc::RtpExtension>& rtp_extensions);
+
~WebRtcVideoSendStream();
- void SetCodec(const VideoOptions& options, const VideoCodecSettings& codec);
+ void SetOptions(const VideoOptions& options);
+ void SetCodec(const VideoCodecSettings& codec);
+ void SetRtpExtensions(
+ const std::vector<webrtc::RtpExtension>& rtp_extensions);
void InputFrame(VideoCapturer* capturer, const VideoFrame* frame);
bool SetCapturer(VideoCapturer* capturer);
@@ -289,6 +285,8 @@
void Start();
void Stop();
+ VideoSenderInfo GetVideoSenderInfo();
+
private:
// Parameters needed to reconstruct the underlying stream.
// webrtc::VideoSendStream doesn't support setting a lot of options on the
@@ -298,24 +296,25 @@
VideoSendStreamParameters(
const webrtc::VideoSendStream::Config& config,
const VideoOptions& options,
- const VideoCodec& codec,
- const std::vector<webrtc::VideoStream>& video_streams);
+ const Settable<VideoCodecSettings>& codec_settings);
webrtc::VideoSendStream::Config config;
VideoOptions options;
- VideoCodec codec;
+ Settable<VideoCodecSettings> codec_settings;
// Sent resolutions + bitrates etc. by the underlying VideoSendStream,
// typically changes when setting a new resolution or reconfiguring
// bitrates.
std::vector<webrtc::VideoStream> video_streams;
};
+ void SetCodecAndOptions(const VideoCodecSettings& codec,
+ const VideoOptions& options);
void RecreateWebRtcStream();
void SetDimensions(int width, int height);
webrtc::Call* const call_;
WebRtcVideoEncoderFactory2* const encoder_factory_;
- talk_base::CriticalSection lock_;
+ rtc::CriticalSection lock_;
webrtc::VideoSendStream* stream_ GUARDED_BY(lock_);
VideoSendStreamParameters parameters_ GUARDED_BY(lock_);
@@ -324,34 +323,75 @@
bool muted_ GUARDED_BY(lock_);
VideoFormat format_ GUARDED_BY(lock_);
- talk_base::CriticalSection frame_lock_;
+ rtc::CriticalSection frame_lock_;
webrtc::I420VideoFrame video_frame_ GUARDED_BY(frame_lock_);
};
+ // Wrapper for the receiver part, contains configs etc. that are needed to
+ // reconstruct the underlying VideoReceiveStream. Also serves as a wrapper
+ // between webrtc::VideoRenderer and cricket::VideoRenderer.
+ class WebRtcVideoReceiveStream : public webrtc::VideoRenderer {
+ public:
+ WebRtcVideoReceiveStream(
+ webrtc::Call*,
+ const webrtc::VideoReceiveStream::Config& config,
+ const std::vector<VideoCodecSettings>& recv_codecs);
+ ~WebRtcVideoReceiveStream();
+
+ void SetRecvCodecs(const std::vector<VideoCodecSettings>& recv_codecs);
+ void SetRtpExtensions(const std::vector<webrtc::RtpExtension>& extensions);
+
+ virtual void RenderFrame(const webrtc::I420VideoFrame& frame,
+ int time_to_render_ms) OVERRIDE;
+
+ void SetRenderer(cricket::VideoRenderer* renderer);
+ cricket::VideoRenderer* GetRenderer();
+
+ VideoReceiverInfo GetVideoReceiverInfo();
+
+ private:
+ void SetSize(int width, int height);
+ void RecreateWebRtcStream();
+
+ webrtc::Call* const call_;
+
+ webrtc::VideoReceiveStream* stream_;
+ webrtc::VideoReceiveStream::Config config_;
+
+ rtc::CriticalSection renderer_lock_;
+ cricket::VideoRenderer* renderer_ GUARDED_BY(renderer_lock_);
+ int last_width_ GUARDED_BY(renderer_lock_);
+ int last_height_ GUARDED_BY(renderer_lock_);
+ };
+
void Construct(webrtc::Call* call, WebRtcVideoEngine2* engine);
+ void SetDefaultOptions();
virtual bool SendRtp(const uint8_t* data, size_t len) OVERRIDE;
virtual bool SendRtcp(const uint8_t* data, size_t len) OVERRIDE;
void StartAllSendStreams();
void StopAllSendStreams();
- void SetCodecForAllSendStreams(const VideoCodecSettings& codec);
+
static std::vector<VideoCodecSettings> MapCodecs(
const std::vector<VideoCodec>& codecs);
std::vector<VideoCodecSettings> FilterSupportedCodecs(
const std::vector<VideoCodecSettings>& mapped_codecs);
+ void FillSenderStats(VideoMediaInfo* info);
+ void FillReceiverStats(VideoMediaInfo* info);
+ void FillBandwidthEstimationStats(VideoMediaInfo* info);
+
uint32_t rtcp_receiver_report_ssrc_;
bool sending_;
- talk_base::scoped_ptr<webrtc::Call> call_;
- std::map<uint32, WebRtcVideoRenderer*> renderers_;
- VideoRenderer* default_renderer_;
+ rtc::scoped_ptr<webrtc::Call> call_;
uint32_t default_send_ssrc_;
uint32_t default_recv_ssrc_;
+ VideoRenderer* default_renderer_;
// Using primary-ssrc (first ssrc) as key.
std::map<uint32, WebRtcVideoSendStream*> send_streams_;
- std::map<uint32, webrtc::VideoReceiveStream*> receive_streams_;
+ std::map<uint32, WebRtcVideoReceiveStream*> receive_streams_;
Settable<VideoCodecSettings> send_codec_;
std::vector<webrtc::RtpExtension> send_rtp_extensions_;
diff --git a/media/webrtc/webrtcvideoengine2_unittest.cc b/media/webrtc/webrtcvideoengine2_unittest.cc
index 89c5cfc..1ce41a7 100644
--- a/media/webrtc/webrtcvideoengine2_unittest.cc
+++ b/media/webrtc/webrtcvideoengine2_unittest.cc
@@ -28,7 +28,8 @@
#include <map>
#include <vector>
-#include "talk/base/gunit.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/stringutils.h"
#include "talk/media/base/testutils.h"
#include "talk/media/base/videoengine_unittest.h"
#include "talk/media/webrtc/webrtcvideoengine2.h"
@@ -48,6 +49,8 @@
static const uint32 kSsrcs1[] = {1};
static const uint32 kRtxSsrcs1[] = {4};
+static const char kUnsupportedExtensionName[] =
+ "urn:ietf:params:rtp-hdrext:unsupported";
void VerifyCodecHasDefaultFeedbackParams(const cricket::VideoCodec& codec) {
EXPECT_TRUE(codec.HasFeedbackParam(cricket::FeedbackParam(
@@ -65,8 +68,13 @@
namespace cricket {
FakeVideoSendStream::FakeVideoSendStream(
const webrtc::VideoSendStream::Config& config,
- const std::vector<webrtc::VideoStream>& video_streams)
- : sending_(false), config_(config), video_streams_(video_streams) {
+ const std::vector<webrtc::VideoStream>& video_streams,
+ const void* encoder_settings)
+ : sending_(false),
+ config_(config),
+ codec_settings_set_(false) {
+ assert(config.encoder_settings.encoder != NULL);
+ ReconfigureVideoEncoder(video_streams, encoder_settings);
}
webrtc::VideoSendStream::Config FakeVideoSendStream::GetConfig() {
@@ -77,10 +85,20 @@
return video_streams_;
}
-bool FakeVideoSendStream::IsSending() {
+bool FakeVideoSendStream::IsSending() const {
return sending_;
}
+bool FakeVideoSendStream::GetVp8Settings(
+ webrtc::VideoCodecVP8* settings) const {
+ if (!codec_settings_set_) {
+ return false;
+ }
+
+ *settings = vp8_settings_;
+ return true;
+}
+
webrtc::VideoSendStream::Stats FakeVideoSendStream::GetStats() const {
return webrtc::VideoSendStream::Stats();
}
@@ -89,6 +107,12 @@
const std::vector<webrtc::VideoStream>& streams,
const void* encoder_specific) {
video_streams_ = streams;
+ if (encoder_specific != NULL) {
+ assert(config_.encoder_settings.payload_name == "VP8");
+ vp8_settings_ =
+ *reinterpret_cast<const webrtc::VideoCodecVP8*>(encoder_specific);
+ }
+ codec_settings_set_ = encoder_specific != NULL;
return true;
}
@@ -114,6 +138,10 @@
return config_;
}
+bool FakeVideoReceiveStream::IsReceiving() const {
+ return receiving_;
+}
+
webrtc::VideoReceiveStream::Stats FakeVideoReceiveStream::GetStats() const {
return webrtc::VideoReceiveStream::Stats();
}
@@ -121,9 +149,11 @@
void FakeVideoReceiveStream::Start() {
receiving_ = true;
}
+
void FakeVideoReceiveStream::Stop() {
receiving_ = false;
}
+
void FakeVideoReceiveStream::GetCurrentReceiveCodec(webrtc::VideoCodec* codec) {
}
@@ -162,7 +192,8 @@
webrtc::VideoCodec FakeCall::GetVideoCodecVp8() {
webrtc::VideoCodec vp8_codec = GetEmptyVideoCodec();
vp8_codec.codecType = webrtc::kVideoCodecVP8;
- strcpy(vp8_codec.plName, kVp8Codec.name.c_str());
+ rtc::strcpyn(vp8_codec.plName, ARRAY_SIZE(vp8_codec.plName),
+ kVp8Codec.name.c_str());
vp8_codec.plType = kVp8Codec.id;
return vp8_codec;
@@ -172,7 +203,8 @@
webrtc::VideoCodec vp9_codec = GetEmptyVideoCodec();
// TODO(pbos): Add a correct codecType when webrtc has one.
vp9_codec.codecType = webrtc::kVideoCodecVP8;
- strcpy(vp9_codec.plName, kVp9Codec.name.c_str());
+ rtc::strcpyn(vp9_codec.plName, ARRAY_SIZE(vp9_codec.plName),
+ kVp9Codec.name.c_str());
vp9_codec.plType = kVp9Codec.id;
return vp9_codec;
@@ -191,7 +223,7 @@
const std::vector<webrtc::VideoStream>& video_streams,
const void* encoder_settings) {
FakeVideoSendStream* fake_stream =
- new FakeVideoSendStream(config, video_streams);
+ new FakeVideoSendStream(config, video_streams, encoder_settings);
video_send_streams_.push_back(fake_stream);
return fake_stream;
}
@@ -307,7 +339,7 @@
};
TEST_F(WebRtcVideoEngine2Test, CreateChannel) {
- talk_base::scoped_ptr<VideoMediaChannel> channel(engine_.CreateChannel(NULL));
+ rtc::scoped_ptr<VideoMediaChannel> channel(engine_.CreateChannel(NULL));
ASSERT_TRUE(channel.get() != NULL) << "Could not create channel.";
EXPECT_TRUE(factory_.GetFakeChannel(channel.get()) != NULL)
<< "Channel not created through factory.";
@@ -315,7 +347,7 @@
TEST_F(WebRtcVideoEngine2Test, CreateChannelWithVoiceEngine) {
VoiceMediaChannel* voice_channel = reinterpret_cast<VoiceMediaChannel*>(0x42);
- talk_base::scoped_ptr<VideoMediaChannel> channel(
+ rtc::scoped_ptr<VideoMediaChannel> channel(
engine_.CreateChannel(voice_channel));
ASSERT_TRUE(channel.get() != NULL) << "Could not create channel.";
@@ -347,8 +379,10 @@
vp8_diff_id.id = 97;
EXPECT_TRUE(engine_.FindCodec(vp8_diff_id));
+ // FindCodec ignores the codec size.
+ // Test that FindCodec can accept uncommon codec size.
cricket::VideoCodec vp8_diff_res(104, "VP8", 320, 111, 30, 0);
- EXPECT_FALSE(engine_.FindCodec(vp8_diff_res));
+ EXPECT_TRUE(engine_.FindCodec(vp8_diff_res));
// PeerConnection doesn't negotiate the resolution at this point.
// Test that FindCodec can handle the case when width/height is 0.
@@ -410,6 +444,28 @@
FAIL() << "Absolute Sender Time extension not in header-extension list.";
}
+TEST_F(WebRtcVideoEngine2Test, SetSendFailsBeforeSettingCodecs) {
+ rtc::scoped_ptr<VideoMediaChannel> channel(engine_.CreateChannel(NULL));
+
+ EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(123)));
+
+ EXPECT_FALSE(channel->SetSend(true))
+ << "Channel should not start without codecs.";
+ EXPECT_TRUE(channel->SetSend(false))
+ << "Channel should be stoppable even without set codecs.";
+}
+
+class WebRtcVideoEngine2BaseTest
+ : public VideoEngineTest<cricket::WebRtcVideoEngine2> {
+ protected:
+ typedef VideoEngineTest<cricket::WebRtcVideoEngine2> Base;
+};
+
+#define WEBRTC_ENGINE_BASE_TEST(test) \
+ TEST_F(WebRtcVideoEngine2BaseTest, test) { Base::test##Body(); }
+
+WEBRTC_ENGINE_BASE_TEST(ConstrainNewCodec2);
+
class WebRtcVideoChannel2BaseTest
: public VideoMediaChannelTest<WebRtcVideoEngine2, WebRtcVideoChannel2> {
protected:
@@ -417,119 +473,85 @@
typedef VideoMediaChannelTest<WebRtcVideoEngine2, WebRtcVideoChannel2> Base;
};
+#define WEBRTC_BASE_TEST(test) \
+ TEST_F(WebRtcVideoChannel2BaseTest, test) { Base::test(); }
+
+#define WEBRTC_DISABLED_BASE_TEST(test) \
+ TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_ ## test) { Base::test(); }
+
// TODO(pbos): Fix WebRtcVideoEngine2BaseTest, where we want CheckCoInitialize.
#if 0
// TODO(juberti): Figure out why ViE is munging the COM refcount.
#ifdef WIN32
-TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_CheckCoInitialize) {
+WEBRTC_DISABLED_BASE_TEST(CheckCoInitialize) {
Base::CheckCoInitialize();
}
#endif
#endif
-TEST_F(WebRtcVideoChannel2BaseTest, SetSend) { Base::SetSend(); }
+WEBRTC_BASE_TEST(SetSend);
+WEBRTC_BASE_TEST(SetSendWithoutCodecs);
+WEBRTC_BASE_TEST(SetSendSetsTransportBufferSizes);
-TEST_F(WebRtcVideoChannel2BaseTest, SetSendWithoutCodecs) {
- Base::SetSendWithoutCodecs();
-}
+WEBRTC_BASE_TEST(GetStats);
+WEBRTC_BASE_TEST(GetStatsMultipleRecvStreams);
+WEBRTC_BASE_TEST(GetStatsMultipleSendStreams);
-TEST_F(WebRtcVideoChannel2BaseTest, SetSendSetsTransportBufferSizes) {
- Base::SetSendSetsTransportBufferSizes();
-}
+WEBRTC_BASE_TEST(SetSendBandwidth);
-// TODO(juberti): Fix this test to tolerate missing stats.
-TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_GetStats) { Base::GetStats(); }
+WEBRTC_BASE_TEST(SetSendSsrc);
+WEBRTC_BASE_TEST(SetSendSsrcAfterSetCodecs);
-// TODO(juberti): Fix this test to tolerate missing stats.
-TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_GetStatsMultipleRecvStreams) {
- Base::GetStatsMultipleRecvStreams();
-}
+WEBRTC_BASE_TEST(SetRenderer);
+WEBRTC_BASE_TEST(AddRemoveRecvStreams);
-TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_GetStatsMultipleSendStreams) {
- Base::GetStatsMultipleSendStreams();
-}
+WEBRTC_DISABLED_BASE_TEST(AddRemoveRecvStreamAndRender);
-TEST_F(WebRtcVideoChannel2BaseTest, SetSendBandwidth) {
- Base::SetSendBandwidth();
-}
-TEST_F(WebRtcVideoChannel2BaseTest, SetSendSsrc) { Base::SetSendSsrc(); }
-TEST_F(WebRtcVideoChannel2BaseTest, SetSendSsrcAfterSetCodecs) {
- Base::SetSendSsrcAfterSetCodecs();
-}
+WEBRTC_BASE_TEST(AddRemoveRecvStreamsNoConference);
-TEST_F(WebRtcVideoChannel2BaseTest, SetRenderer) { Base::SetRenderer(); }
+WEBRTC_BASE_TEST(AddRemoveSendStreams);
-TEST_F(WebRtcVideoChannel2BaseTest, AddRemoveRecvStreams) {
- Base::AddRemoveRecvStreams();
-}
+WEBRTC_BASE_TEST(SimulateConference);
-TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_AddRemoveRecvStreamAndRender) {
- Base::AddRemoveRecvStreamAndRender();
-}
+WEBRTC_BASE_TEST(AddRemoveCapturer);
-TEST_F(WebRtcVideoChannel2BaseTest, AddRemoveRecvStreamsNoConference) {
- Base::AddRemoveRecvStreamsNoConference();
-}
+WEBRTC_BASE_TEST(RemoveCapturerWithoutAdd);
-TEST_F(WebRtcVideoChannel2BaseTest, AddRemoveSendStreams) {
- Base::AddRemoveSendStreams();
-}
-
-TEST_F(WebRtcVideoChannel2BaseTest, SimulateConference) {
- Base::SimulateConference();
-}
-
-TEST_F(WebRtcVideoChannel2BaseTest, AddRemoveCapturer) {
- Base::AddRemoveCapturer();
-}
-
-TEST_F(WebRtcVideoChannel2BaseTest, RemoveCapturerWithoutAdd) {
- Base::RemoveCapturerWithoutAdd();
-}
-
-TEST_F(WebRtcVideoChannel2BaseTest, AddRemoveCapturerMultipleSources) {
- Base::AddRemoveCapturerMultipleSources();
-}
+WEBRTC_BASE_TEST(AddRemoveCapturerMultipleSources);
// TODO(pbos): Figure out why this fails so often.
-TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_HighAspectHighHeightCapturer) {
- Base::HighAspectHighHeightCapturer();
-}
+WEBRTC_DISABLED_BASE_TEST(HighAspectHighHeightCapturer);
-TEST_F(WebRtcVideoChannel2BaseTest, RejectEmptyStreamParams) {
- Base::RejectEmptyStreamParams();
-}
+WEBRTC_BASE_TEST(RejectEmptyStreamParams);
-TEST_F(WebRtcVideoChannel2BaseTest, AdaptResolution16x10) {
- Base::AdaptResolution16x10();
-}
+WEBRTC_BASE_TEST(AdaptResolution16x10);
-TEST_F(WebRtcVideoChannel2BaseTest, AdaptResolution4x3) {
- Base::AdaptResolution4x3();
-}
+WEBRTC_BASE_TEST(AdaptResolution4x3);
-TEST_F(WebRtcVideoChannel2BaseTest, MuteStream) { Base::MuteStream(); }
+WEBRTC_BASE_TEST(MuteStream);
-TEST_F(WebRtcVideoChannel2BaseTest, MultipleSendStreams) {
- Base::MultipleSendStreams();
-}
+WEBRTC_BASE_TEST(MultipleSendStreams);
// TODO(juberti): Restore this test once we support sending 0 fps.
-TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_AdaptDropAllFrames) {
- Base::AdaptDropAllFrames();
-}
+WEBRTC_DISABLED_BASE_TEST(AdaptDropAllFrames);
// TODO(juberti): Understand why we get decode errors on this test.
-TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_AdaptFramerate) {
- Base::AdaptFramerate();
-}
+WEBRTC_DISABLED_BASE_TEST(AdaptFramerate);
-TEST_F(WebRtcVideoChannel2BaseTest, SetSendStreamFormat0x0) {
- Base::SetSendStreamFormat0x0();
-}
+WEBRTC_BASE_TEST(SetSendStreamFormat0x0);
// TODO(zhurunz): Fix the flakey test.
-TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_SetSendStreamFormat) {
- Base::SetSendStreamFormat();
+WEBRTC_DISABLED_BASE_TEST(SetSendStreamFormat);
+
+TEST_F(WebRtcVideoChannel2BaseTest, SendAndReceiveVp8Vga) {
+ SendAndReceive(cricket::VideoCodec(100, "VP8", 640, 400, 30, 0));
+}
+
+TEST_F(WebRtcVideoChannel2BaseTest, SendAndReceiveVp8Qvga) {
+ SendAndReceive(cricket::VideoCodec(100, "VP8", 320, 200, 30, 0));
+}
+
+TEST_F(WebRtcVideoChannel2BaseTest, SendAndReceiveVp8SvcQqvga) {
+ SendAndReceive(cricket::VideoCodec(100, "VP8", 160, 100, 30, 0));
}
TEST_F(WebRtcVideoChannel2BaseTest, TwoStreamsSendAndReceive) {
@@ -540,6 +562,32 @@
Base::TwoStreamsReUseFirstStream(kVp8Codec);
}
+WEBRTC_BASE_TEST(SendManyResizeOnce);
+
+// TODO(pbos): Enable and figure out why this fails (or should work).
+TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_SendVp8HdAndReceiveAdaptedVp8Vga) {
+ EXPECT_TRUE(channel_->SetCapturer(kSsrc, NULL));
+ EXPECT_TRUE(channel_->SetRenderer(kDefaultReceiveSsrc, &renderer_));
+ channel_->UpdateAspectRatio(1280, 720);
+ video_capturer_.reset(new cricket::FakeVideoCapturer);
+ const std::vector<cricket::VideoFormat>* formats =
+ video_capturer_->GetSupportedFormats();
+ cricket::VideoFormat capture_format_hd = (*formats)[0];
+ EXPECT_EQ(cricket::CS_RUNNING, video_capturer_->Start(capture_format_hd));
+ EXPECT_TRUE(channel_->SetCapturer(kSsrc, video_capturer_.get()));
+
+ // Capture format HD -> adapt (OnOutputFormatRequest VGA) -> VGA.
+ cricket::VideoCodec codec(100, "VP8", 1280, 720, 30, 0);
+ EXPECT_TRUE(SetOneCodec(codec));
+ codec.width /= 2;
+ codec.height /= 2;
+ EXPECT_TRUE(SetSend(true));
+ EXPECT_TRUE(channel_->SetRender(true));
+ EXPECT_EQ(0, renderer_.num_rendered_frames());
+ EXPECT_TRUE(SendFrame());
+ EXPECT_FRAME_WAIT(1, codec.width, codec.height, kTimeout);
+}
+
class WebRtcVideoChannel2Test : public WebRtcVideoEngine2Test {
public:
virtual void SetUp() OVERRIDE {
@@ -548,6 +596,7 @@
last_ssrc_ = 123;
ASSERT_TRUE(fake_channel_ != NULL)
<< "Channel not created through factory.";
+ EXPECT_TRUE(fake_channel_->SetSendCodecs(engine_.codecs()));
}
protected:
@@ -606,6 +655,7 @@
void TestSetSendRtpHeaderExtensions(const std::string& cricket_ext,
const std::string& webrtc_ext) {
+ FakeCall* call = fake_channel_->GetFakeCall();
// Enable extension.
const int id = 1;
std::vector<cricket::RtpHeaderExtension> extensions;
@@ -627,15 +677,25 @@
->GetConfig()
.rtp.extensions.empty());
- // Remove the extension id, verify that this doesn't reset extensions as
- // they should be set before creating channels.
+ // Verify that existing RTP header extensions can be removed.
std::vector<cricket::RtpHeaderExtension> empty_extensions;
EXPECT_TRUE(channel_->SetSendRtpHeaderExtensions(empty_extensions));
- EXPECT_FALSE(send_stream->GetConfig().rtp.extensions.empty());
+ ASSERT_EQ(1u, call->GetVideoSendStreams().size());
+ send_stream = call->GetVideoSendStreams()[0];
+ EXPECT_TRUE(send_stream->GetConfig().rtp.extensions.empty());
+
+ // Verify that adding receive RTP header extensions adds them for existing
+ // streams.
+ EXPECT_TRUE(channel_->SetSendRtpHeaderExtensions(extensions));
+ send_stream = call->GetVideoSendStreams()[0];
+ ASSERT_EQ(1u, send_stream->GetConfig().rtp.extensions.size());
+ EXPECT_EQ(id, send_stream->GetConfig().rtp.extensions[0].id);
+ EXPECT_EQ(webrtc_ext, send_stream->GetConfig().rtp.extensions[0].name);
}
void TestSetRecvRtpHeaderExtensions(const std::string& cricket_ext,
const std::string& webrtc_ext) {
+ FakeCall* call = fake_channel_->GetFakeCall();
// Enable extension.
const int id = 1;
std::vector<cricket::RtpHeaderExtension> extensions;
@@ -651,20 +711,30 @@
EXPECT_EQ(webrtc_ext, recv_stream->GetConfig().rtp.extensions[0].name);
// Verify call with same set of extensions returns true.
EXPECT_TRUE(channel_->SetRecvRtpHeaderExtensions(extensions));
+
// Verify that SetRecvRtpHeaderExtensions doesn't implicitly add them for
// senders.
EXPECT_TRUE(AddSendStream(cricket::StreamParams::CreateLegacy(123))
->GetConfig()
.rtp.extensions.empty());
- // Remove the extension id, verify that this doesn't reset extensions as
- // they should be set before creating channels.
+ // Verify that existing RTP header extensions can be removed.
std::vector<cricket::RtpHeaderExtension> empty_extensions;
- EXPECT_TRUE(channel_->SetSendRtpHeaderExtensions(empty_extensions));
- EXPECT_FALSE(recv_stream->GetConfig().rtp.extensions.empty());
+ EXPECT_TRUE(channel_->SetRecvRtpHeaderExtensions(empty_extensions));
+ ASSERT_EQ(1u, call->GetVideoReceiveStreams().size());
+ recv_stream = call->GetVideoReceiveStreams()[0];
+ EXPECT_TRUE(recv_stream->GetConfig().rtp.extensions.empty());
+
+ // Verify that adding receive RTP header extensions adds them for existing
+ // streams.
+ EXPECT_TRUE(channel_->SetRecvRtpHeaderExtensions(extensions));
+ recv_stream = call->GetVideoReceiveStreams()[0];
+ ASSERT_EQ(1u, recv_stream->GetConfig().rtp.extensions.size());
+ EXPECT_EQ(id, recv_stream->GetConfig().rtp.extensions[0].id);
+ EXPECT_EQ(webrtc_ext, recv_stream->GetConfig().rtp.extensions[0].name);
}
- talk_base::scoped_ptr<VideoMediaChannel> channel_;
+ rtc::scoped_ptr<VideoMediaChannel> channel_;
FakeWebRtcVideoChannel2* fake_channel_;
uint32 last_ssrc_;
};
@@ -723,24 +793,6 @@
#endif
}
-TEST_F(WebRtcVideoChannel2Test, DISABLED_RtcpEnabled) {
- // Note(pbos): This is a receiver-side setting, dumbo.
- FAIL() << "Not implemented."; // TODO(pbos): Implement.
-}
-
-TEST_F(WebRtcVideoChannel2Test, DISABLED_KeyFrameRequestEnabled) {
- FAIL() << "Not implemented."; // TODO(pbos): Implement.
-}
-
-TEST_F(WebRtcVideoChannel2Test, RembIsEnabledByDefault) {
- FakeVideoReceiveStream* stream = AddRecvStream();
- EXPECT_TRUE(stream->GetConfig().rtp.remb);
-}
-
-TEST_F(WebRtcVideoChannel2Test, DISABLED_RembEnabledOnReceiveChannels) {
- FAIL() << "Not implemented."; // TODO(pbos): Implement.
-}
-
TEST_F(WebRtcVideoChannel2Test, RecvStreamWithSimAndRtx) {
EXPECT_TRUE(channel_->SetSendCodecs(engine_.codecs()));
EXPECT_TRUE(channel_->SetSend(true));
@@ -819,6 +871,110 @@
webrtc::RtpExtension::kAbsSendTime);
}
+TEST_F(WebRtcVideoChannel2Test,
+ SetSendRtpHeaderExtensionsExcludeUnsupportedExtensions) {
+ const int kUnsupportedId = 1;
+ const int kTOffsetId = 2;
+
+ std::vector<cricket::RtpHeaderExtension> extensions;
+ extensions.push_back(cricket::RtpHeaderExtension(
+ kUnsupportedExtensionName, kUnsupportedId));
+ extensions.push_back(cricket::RtpHeaderExtension(
+ webrtc::RtpExtension::kTOffset, kTOffsetId));
+ EXPECT_TRUE(channel_->SetSendRtpHeaderExtensions(extensions));
+ FakeVideoSendStream* send_stream =
+ AddSendStream(cricket::StreamParams::CreateLegacy(123));
+
+ // Only timestamp offset extension is set to send stream,
+ // unsupported rtp extension is ignored.
+ ASSERT_EQ(1u, send_stream->GetConfig().rtp.extensions.size());
+ EXPECT_STREQ(webrtc::RtpExtension::kTOffset,
+ send_stream->GetConfig().rtp.extensions[0].name.c_str());
+}
+
+TEST_F(WebRtcVideoChannel2Test,
+ SetRecvRtpHeaderExtensionsExcludeUnsupportedExtensions) {
+ const int kUnsupportedId = 1;
+ const int kTOffsetId = 2;
+
+ std::vector<cricket::RtpHeaderExtension> extensions;
+ extensions.push_back(cricket::RtpHeaderExtension(
+ kUnsupportedExtensionName, kUnsupportedId));
+ extensions.push_back(cricket::RtpHeaderExtension(
+ webrtc::RtpExtension::kTOffset, kTOffsetId));
+ EXPECT_TRUE(channel_->SetRecvRtpHeaderExtensions(extensions));
+ FakeVideoReceiveStream* recv_stream =
+ AddRecvStream(cricket::StreamParams::CreateLegacy(123));
+
+ // Only timestamp offset extension is set to receive stream,
+ // unsupported rtp extension is ignored.
+ ASSERT_EQ(1u, recv_stream->GetConfig().rtp.extensions.size());
+ EXPECT_STREQ(webrtc::RtpExtension::kTOffset,
+ recv_stream->GetConfig().rtp.extensions[0].name.c_str());
+}
+
+TEST_F(WebRtcVideoChannel2Test,
+ SetSendRtpHeaderExtensionsRejectsIncorrectIds) {
+ const size_t kNumIncorrectIds = 4;
+ const int kIncorrectIds[kNumIncorrectIds] = {-2, -1, 15, 16};
+ for (size_t i = 0; i < kNumIncorrectIds; ++i) {
+ std::vector<cricket::RtpHeaderExtension> extensions;
+ extensions.push_back(cricket::RtpHeaderExtension(
+ webrtc::RtpExtension::kTOffset, kIncorrectIds[i]));
+ EXPECT_FALSE(channel_->SetSendRtpHeaderExtensions(extensions))
+ << "Bad extension id '" << kIncorrectIds[i] << "' accepted.";
+ }
+}
+
+TEST_F(WebRtcVideoChannel2Test,
+ SetRecvRtpHeaderExtensionsRejectsIncorrectIds) {
+ const size_t kNumIncorrectIds = 4;
+ const int kIncorrectIds[kNumIncorrectIds] = {-2, -1, 15, 16};
+ for (size_t i = 0; i < kNumIncorrectIds; ++i) {
+ std::vector<cricket::RtpHeaderExtension> extensions;
+ extensions.push_back(cricket::RtpHeaderExtension(
+ webrtc::RtpExtension::kTOffset, kIncorrectIds[i]));
+ EXPECT_FALSE(channel_->SetRecvRtpHeaderExtensions(extensions))
+ << "Bad extension id '" << kIncorrectIds[i] << "' accepted.";
+ }
+}
+
+TEST_F(WebRtcVideoChannel2Test,
+ SetSendRtpHeaderExtensionsRejectsDuplicateIds) {
+ const int id = 1;
+ std::vector<cricket::RtpHeaderExtension> extensions;
+ extensions.push_back(cricket::RtpHeaderExtension(
+ webrtc::RtpExtension::kTOffset, id));
+ extensions.push_back(cricket::RtpHeaderExtension(
+ kRtpAbsoluteSenderTimeHeaderExtension, id));
+ EXPECT_FALSE(channel_->SetSendRtpHeaderExtensions(extensions));
+
+ // Duplicate entries are also not supported.
+ extensions.clear();
+ extensions.push_back(cricket::RtpHeaderExtension(
+ webrtc::RtpExtension::kTOffset, id));
+ extensions.push_back(extensions.back());
+ EXPECT_FALSE(channel_->SetSendRtpHeaderExtensions(extensions));
+}
+
+TEST_F(WebRtcVideoChannel2Test,
+ SetRecvRtpHeaderExtensionsRejectsDuplicateIds) {
+ const int id = 1;
+ std::vector<cricket::RtpHeaderExtension> extensions;
+ extensions.push_back(cricket::RtpHeaderExtension(
+ webrtc::RtpExtension::kTOffset, id));
+ extensions.push_back(cricket::RtpHeaderExtension(
+ kRtpAbsoluteSenderTimeHeaderExtension, id));
+ EXPECT_FALSE(channel_->SetRecvRtpHeaderExtensions(extensions));
+
+ // Duplicate entries are also not supported.
+ extensions.clear();
+ extensions.push_back(cricket::RtpHeaderExtension(
+ webrtc::RtpExtension::kTOffset, id));
+ extensions.push_back(extensions.back());
+ EXPECT_FALSE(channel_->SetRecvRtpHeaderExtensions(extensions));
+}
+
TEST_F(WebRtcVideoChannel2Test, DISABLED_LeakyBucketTest) {
FAIL() << "Not implemented."; // TODO(pbos): Implement.
}
@@ -836,12 +992,28 @@
EXPECT_EQ(1u, fake_channel_->GetFakeCall()->GetVideoReceiveStreams().size());
}
-TEST_F(WebRtcVideoChannel2Test, DISABLED_NoRembChangeAfterAddRecvStream) {
- FAIL() << "Not implemented."; // TODO(pbos): Implement.
+TEST_F(WebRtcVideoChannel2Test, RembIsEnabledByDefault) {
+ FakeVideoReceiveStream* stream = AddRecvStream();
+ EXPECT_TRUE(stream->GetConfig().rtp.remb);
}
-TEST_F(WebRtcVideoChannel2Test, DISABLED_RembOnOff) {
- FAIL() << "Not implemented."; // TODO(pbos): Implement.
+TEST_F(WebRtcVideoChannel2Test, RembCanBeEnabledAndDisabled) {
+ FakeVideoReceiveStream* stream = AddRecvStream();
+ EXPECT_TRUE(stream->GetConfig().rtp.remb);
+
+ // Verify that REMB is turned off when codecs without REMB are set.
+ std::vector<VideoCodec> codecs;
+ codecs.push_back(kVp8Codec);
+ EXPECT_TRUE(codecs[0].feedback_params.params().empty());
+ EXPECT_TRUE(channel_->SetRecvCodecs(codecs));
+ stream = fake_channel_->GetFakeCall()->GetVideoReceiveStreams()[0];
+ EXPECT_FALSE(stream->GetConfig().rtp.remb);
+
+ // Verify that REMB is turned on when setting default codecs since the
+ // default codecs have REMB enabled.
+ EXPECT_TRUE(channel_->SetRecvCodecs(engine_.codecs()));
+ stream = fake_channel_->GetFakeCall()->GetVideoReceiveStreams()[0];
+ EXPECT_TRUE(stream->GetConfig().rtp.remb);
}
TEST_F(WebRtcVideoChannel2Test, NackIsEnabledByDefault) {
@@ -931,15 +1103,82 @@
FAIL() << "Not implemented."; // TODO(pbos): Implement.
}
-TEST_F(WebRtcVideoChannel2Test, DISABLED_SetOptionsWithDenoising) {
- FAIL() << "Not implemented."; // TODO(pbos): Implement.
+TEST_F(WebRtcVideoChannel2Test, SuspendBelowMinBitrateDisabledByDefault) {
+ FakeVideoSendStream* stream = AddSendStream();
+ EXPECT_FALSE(stream->GetConfig().suspend_below_min_bitrate);
+}
+
+TEST_F(WebRtcVideoChannel2Test, SetOptionsWithSuspendBelowMinBitrate) {
+ VideoOptions options;
+ options.suspend_below_min_bitrate.Set(true);
+ channel_->SetOptions(options);
+
+ FakeVideoSendStream* stream = AddSendStream();
+ EXPECT_TRUE(stream->GetConfig().suspend_below_min_bitrate);
+
+ options.suspend_below_min_bitrate.Set(false);
+ channel_->SetOptions(options);
+
+ stream = fake_channel_->GetFakeCall()->GetVideoSendStreams()[0];
+ EXPECT_FALSE(stream->GetConfig().suspend_below_min_bitrate);
+}
+
+TEST_F(WebRtcVideoChannel2Test, RedundantPayloadsDisabledByDefault) {
+ const std::vector<uint32> ssrcs = MAKE_VECTOR(kSsrcs1);
+ const std::vector<uint32> rtx_ssrcs = MAKE_VECTOR(kRtxSsrcs1);
+ FakeVideoSendStream* stream = AddSendStream(
+ cricket::CreateSimWithRtxStreamParams("cname", ssrcs, rtx_ssrcs));
+ EXPECT_FALSE(stream->GetConfig().rtp.rtx.pad_with_redundant_payloads);
+}
+
+TEST_F(WebRtcVideoChannel2Test, SetOptionsWithPayloadPadding) {
+ VideoOptions options;
+ options.use_payload_padding.Set(true);
+ channel_->SetOptions(options);
+
+ const std::vector<uint32> ssrcs = MAKE_VECTOR(kSsrcs1);
+ const std::vector<uint32> rtx_ssrcs = MAKE_VECTOR(kRtxSsrcs1);
+ FakeVideoSendStream* stream = AddSendStream(
+ cricket::CreateSimWithRtxStreamParams("cname", ssrcs, rtx_ssrcs));
+ EXPECT_TRUE(stream->GetConfig().rtp.rtx.pad_with_redundant_payloads);
+
+ options.use_payload_padding.Set(false);
+ channel_->SetOptions(options);
+
+ stream = fake_channel_->GetFakeCall()->GetVideoSendStreams()[0];
+ EXPECT_FALSE(stream->GetConfig().rtp.rtx.pad_with_redundant_payloads);
+}
+
+TEST_F(WebRtcVideoChannel2Test, Vp8DenoisingEnabledByDefault) {
+ FakeVideoSendStream* stream = AddSendStream();
+ webrtc::VideoCodecVP8 vp8_settings;
+ ASSERT_TRUE(stream->GetVp8Settings(&vp8_settings)) << "No VP8 config set.";
+ EXPECT_TRUE(vp8_settings.denoisingOn);
+}
+
+TEST_F(WebRtcVideoChannel2Test, SetOptionsWithDenoising) {
+ VideoOptions options;
+ options.video_noise_reduction.Set(false);
+ channel_->SetOptions(options);
+
+ FakeVideoSendStream* stream = AddSendStream();
+ webrtc::VideoCodecVP8 vp8_settings;
+ ASSERT_TRUE(stream->GetVp8Settings(&vp8_settings)) << "No VP8 config set.";
+ EXPECT_FALSE(vp8_settings.denoisingOn);
+
+ options.video_noise_reduction.Set(true);
+ channel_->SetOptions(options);
+
+ stream = fake_channel_->GetFakeCall()->GetVideoSendStreams()[0];
+ ASSERT_TRUE(stream->GetVp8Settings(&vp8_settings)) << "No VP8 config set.";
+ EXPECT_TRUE(vp8_settings.denoisingOn);
}
TEST_F(WebRtcVideoChannel2Test, DISABLED_MultipleSendStreamsWithOneCapturer) {
FAIL() << "Not implemented."; // TODO(pbos): Implement.
}
-TEST_F(WebRtcVideoChannel2Test, DISABLED_DISABLED_SendReceiveBitratesStats) {
+TEST_F(WebRtcVideoChannel2Test, DISABLED_SendReceiveBitratesStats) {
FAIL() << "Not implemented."; // TODO(pbos): Implement.
}
@@ -1047,14 +1286,23 @@
<< "SetSendCodec without FEC should disable current FEC.";
}
-TEST_F(WebRtcVideoChannel2Test, DISABLED_SetSendCodecsChangesExistingStreams) {
- FAIL(); // TODO(pbos): Implement, make sure that it's changing running
- // streams. Should it?
-}
+TEST_F(WebRtcVideoChannel2Test, SetSendCodecsChangesExistingStreams) {
+ std::vector<VideoCodec> codecs;
+ codecs.push_back(kVp8Codec720p);
+ ASSERT_TRUE(channel_->SetSendCodecs(codecs));
-TEST_F(WebRtcVideoChannel2Test,
- DISABLED_ConstrainsSetCodecsAccordingToEncoderConfig) {
- FAIL() << "Not implemented."; // TODO(pbos): Implement.
+ std::vector<webrtc::VideoStream> streams =
+ AddSendStream()->GetVideoStreams();
+ EXPECT_EQ(kVp8Codec720p.width, streams[0].width);
+ EXPECT_EQ(kVp8Codec720p.height, streams[0].height);
+
+ codecs.clear();
+ codecs.push_back(kVp8Codec360p);
+ ASSERT_TRUE(channel_->SetSendCodecs(codecs));
+ streams = fake_channel_->GetFakeCall()->GetVideoSendStreams()[0]
+ ->GetVideoStreams();
+ EXPECT_EQ(kVp8Codec360p.width, streams[0].width);
+ EXPECT_EQ(kVp8Codec360p.height, streams[0].height);
}
TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithMinMaxBitrate) {
@@ -1201,8 +1449,24 @@
FAIL(); // TODO(pbos): Verify that the FEC parameters are set for all codecs.
}
-TEST_F(WebRtcVideoChannel2Test, DISABLED_SetRecvCodecsWithoutFecDisablesFec) {
- FAIL() << "Not implemented."; // TODO(pbos): Implement.
+TEST_F(WebRtcVideoChannel2Test, SetRecvCodecsWithoutFecDisablesFec) {
+ std::vector<VideoCodec> codecs;
+ codecs.push_back(kVp8Codec);
+ codecs.push_back(kUlpfecCodec);
+ ASSERT_TRUE(channel_->SetSendCodecs(codecs));
+
+ FakeVideoReceiveStream* stream = AddRecvStream();
+ webrtc::VideoReceiveStream::Config config = stream->GetConfig();
+
+ EXPECT_EQ(kUlpfecCodec.id, config.rtp.fec.ulpfec_payload_type);
+
+ codecs.pop_back();
+ ASSERT_TRUE(channel_->SetRecvCodecs(codecs));
+ stream = fake_channel_->GetFakeCall()->GetVideoReceiveStreams()[0];
+ ASSERT_TRUE(stream != NULL);
+ config = stream->GetConfig();
+ EXPECT_EQ(-1, config.rtp.fec.ulpfec_payload_type)
+ << "SetSendCodec without FEC should disable current FEC.";
}
TEST_F(WebRtcVideoChannel2Test, SetSendCodecsRejectDuplicateFecPayloads) {
@@ -1234,25 +1498,12 @@
EXPECT_FALSE(AddSendStream()->IsSending());
}
-TEST_F(WebRtcVideoChannel2Test, DISABLED_ReceiveStreamReceivingByDefault) {
- // Is this test correct though? Auto-receive? Enable receive on first packet?
- FAIL() << "Not implemented."; // TODO(pbos): Implement.
+TEST_F(WebRtcVideoChannel2Test, ReceiveStreamReceivingByDefault) {
+ EXPECT_TRUE(AddRecvStream()->IsReceiving());
}
TEST_F(WebRtcVideoChannel2Test, SetSend) {
- AddSendStream();
- EXPECT_FALSE(channel_->SetSend(true))
- << "Channel should not start without codecs.";
- EXPECT_TRUE(channel_->SetSend(false))
- << "Channel should be stoppable even without set codecs.";
-
- std::vector<cricket::VideoCodec> codecs;
- codecs.push_back(kVp8Codec);
- channel_->SetSendCodecs(codecs);
- std::vector<FakeVideoSendStream*> streams = GetFakeSendStreams();
- ASSERT_EQ(1u, streams.size());
- FakeVideoSendStream* stream = streams.back();
-
+ FakeVideoSendStream* stream = AddSendStream();
EXPECT_FALSE(stream->IsSending());
// false->true
@@ -1274,26 +1525,6 @@
<< "Send stream created after SetSend(true) not sending initially.";
}
-TEST_F(WebRtcVideoChannel2Test, DISABLED_SendAndReceiveVp8Vga) {
- FAIL() << "Not implemented."; // TODO(pbos): Implement.
-}
-
-TEST_F(WebRtcVideoChannel2Test, DISABLED_SendAndReceiveVp8Qvga) {
- FAIL() << "Not implemented."; // TODO(pbos): Implement.
-}
-
-TEST_F(WebRtcVideoChannel2Test, DISABLED_SendAndReceiveH264SvcQqvga) {
- FAIL() << "Not implemented."; // TODO(pbos): Implement.
-}
-
-TEST_F(WebRtcVideoChannel2Test, DISABLED_SendManyResizeOnce) {
- FAIL() << "Not implemented."; // TODO(pbos): Implement.
-}
-
-TEST_F(WebRtcVideoChannel2Test, DISABLED_SendVp8HdAndReceiveAdaptedVp8Vga) {
- FAIL() << "Not implemented."; // TODO(pbos): Implement.
-}
-
TEST_F(WebRtcVideoChannel2Test, DISABLED_TestSetDscpOptions) {
FAIL() << "Not implemented."; // TODO(pbos): Implement.
}
diff --git a/media/webrtc/webrtcvideoengine2_unittest.h b/media/webrtc/webrtcvideoengine2_unittest.h
index 3671167..54e6f06 100644
--- a/media/webrtc/webrtcvideoengine2_unittest.h
+++ b/media/webrtc/webrtcvideoengine2_unittest.h
@@ -39,11 +39,13 @@
class FakeVideoSendStream : public webrtc::VideoSendStream {
public:
FakeVideoSendStream(const webrtc::VideoSendStream::Config& config,
- const std::vector<webrtc::VideoStream>& video_streams);
+ const std::vector<webrtc::VideoStream>& video_streams,
+ const void* encoder_settings);
webrtc::VideoSendStream::Config GetConfig();
std::vector<webrtc::VideoStream> GetVideoStreams();
- bool IsSending();
+ bool IsSending() const;
+ bool GetVp8Settings(webrtc::VideoCodecVP8* settings) const;
private:
virtual webrtc::VideoSendStream::Stats GetStats() const OVERRIDE;
@@ -60,6 +62,8 @@
bool sending_;
webrtc::VideoSendStream::Config config_;
std::vector<webrtc::VideoStream> video_streams_;
+ bool codec_settings_set_;
+ webrtc::VideoCodecVP8 vp8_settings_;
};
class FakeVideoReceiveStream : public webrtc::VideoReceiveStream {
@@ -69,6 +73,8 @@
webrtc::VideoReceiveStream::Config GetConfig();
+ bool IsReceiving() const;
+
private:
virtual webrtc::VideoReceiveStream::Stats GetStats() const OVERRIDE;
diff --git a/media/webrtc/webrtcvideoengine_unittest.cc b/media/webrtc/webrtcvideoengine_unittest.cc
index 68bbfe6..8533a51 100644
--- a/media/webrtc/webrtcvideoengine_unittest.cc
+++ b/media/webrtc/webrtcvideoengine_unittest.cc
@@ -25,11 +25,11 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/fakecpumonitor.h"
-#include "talk/base/gunit.h"
-#include "talk/base/logging.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/stream.h"
+#include "webrtc/base/fakecpumonitor.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/stream.h"
#include "talk/media/base/constants.h"
#include "talk/media/base/fakemediaprocessor.h"
#include "talk/media/base/fakenetworkinterface.h"
@@ -59,6 +59,7 @@
static const cricket::VideoCodec kVP8Codec180p(100, "VP8", 320, 180, 30, 0);
static const cricket::VideoCodec kVP8Codec(100, "VP8", 640, 400, 30, 0);
+static const cricket::VideoCodec kH264Codec(127, "H264", 640, 400, 30, 0);
static const cricket::VideoCodec kRedCodec(101, "red", 0, 0, 0, 0);
static const cricket::VideoCodec kUlpFecCodec(102, "ulpfec", 0, 0, 0, 0);
static const cricket::VideoCodec* const kVideoCodecs[] = {
@@ -68,7 +69,7 @@
};
static const unsigned int kStartBandwidthKbps = 300;
-static const unsigned int kMinBandwidthKbps = 50;
+static const unsigned int kMinBandwidthKbps = 30;
static const unsigned int kMaxBandwidthKbps = 2000;
static const uint32 kSsrcs1[] = {1};
@@ -99,8 +100,8 @@
public:
WebRtcVideoEngineTestFake()
: vie_(kVideoCodecs, ARRAY_SIZE(kVideoCodecs)),
- cpu_monitor_(new talk_base::FakeCpuMonitor(
- talk_base::Thread::Current())),
+ cpu_monitor_(new rtc::FakeCpuMonitor(
+ rtc::Thread::Current())),
engine_(NULL, // cricket::WebRtcVoiceEngine
new FakeViEWrapper(&vie_), cpu_monitor_),
channel_(NULL),
@@ -108,7 +109,7 @@
last_error_(cricket::VideoMediaChannel::ERROR_NONE) {
}
bool SetupEngine() {
- bool result = engine_.Init(talk_base::Thread::Current());
+ bool result = engine_.Init(rtc::Thread::Current());
if (result) {
channel_ = engine_.CreateChannel(voice_channel_);
channel_->SignalMediaError.connect(this,
@@ -252,7 +253,7 @@
EXPECT_EQ(100, gcodec.plType);
EXPECT_EQ(width, gcodec.width);
EXPECT_EQ(height, gcodec.height);
- EXPECT_EQ(talk_base::_min(start_bitrate, max_bitrate), gcodec.startBitrate);
+ EXPECT_EQ(rtc::_min(start_bitrate, max_bitrate), gcodec.startBitrate);
EXPECT_EQ(max_bitrate, gcodec.maxBitrate);
EXPECT_EQ(min_bitrate, gcodec.minBitrate);
EXPECT_EQ(fps, gcodec.maxFramerate);
@@ -272,7 +273,7 @@
cricket::FakeWebRtcVideoEngine vie_;
cricket::FakeWebRtcVideoDecoderFactory decoder_factory_;
cricket::FakeWebRtcVideoEncoderFactory encoder_factory_;
- talk_base::FakeCpuMonitor* cpu_monitor_;
+ rtc::FakeCpuMonitor* cpu_monitor_;
cricket::WebRtcVideoEngine engine_;
cricket::WebRtcVideoMediaChannel* channel_;
cricket::WebRtcVoiceMediaChannel* voice_channel_;
@@ -307,7 +308,7 @@
// Tests that our stub library "works".
TEST_F(WebRtcVideoEngineTestFake, StartupShutdown) {
EXPECT_FALSE(vie_.IsInited());
- EXPECT_TRUE(engine_.Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
EXPECT_TRUE(vie_.IsInited());
engine_.Terminate();
}
@@ -315,16 +316,16 @@
// Tests that webrtc logs are logged when they should be.
TEST_F(WebRtcVideoEngineTest, WebRtcShouldLog) {
const char webrtc_log[] = "WebRtcVideoEngineTest.WebRtcShouldLog";
- EXPECT_TRUE(engine_.Init(talk_base::Thread::Current()));
- engine_.SetLogging(talk_base::LS_INFO, "");
+ EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
+ engine_.SetLogging(rtc::LS_INFO, "");
std::string str;
- talk_base::StringStream stream(str);
- talk_base::LogMessage::AddLogToStream(&stream, talk_base::LS_INFO);
- EXPECT_EQ(talk_base::LS_INFO, talk_base::LogMessage::GetLogToStream(&stream));
+ rtc::StringStream stream(str);
+ rtc::LogMessage::AddLogToStream(&stream, rtc::LS_INFO);
+ EXPECT_EQ(rtc::LS_INFO, rtc::LogMessage::GetLogToStream(&stream));
webrtc::Trace::Add(webrtc::kTraceStateInfo, webrtc::kTraceUndefined, 0,
webrtc_log);
- talk_base::Thread::Current()->ProcessMessages(100);
- talk_base::LogMessage::RemoveLogToStream(&stream);
+ rtc::Thread::Current()->ProcessMessages(100);
+ rtc::LogMessage::RemoveLogToStream(&stream);
// Access |str| after LogMessage is done with it to avoid data racing.
EXPECT_NE(std::string::npos, str.find(webrtc_log));
}
@@ -332,25 +333,25 @@
// Tests that webrtc logs are not logged when they should't be.
TEST_F(WebRtcVideoEngineTest, WebRtcShouldNotLog) {
const char webrtc_log[] = "WebRtcVideoEngineTest.WebRtcShouldNotLog";
- EXPECT_TRUE(engine_.Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
// WebRTC should never be logged lower than LS_INFO.
- engine_.SetLogging(talk_base::LS_WARNING, "");
+ engine_.SetLogging(rtc::LS_WARNING, "");
std::string str;
- talk_base::StringStream stream(str);
+ rtc::StringStream stream(str);
// Make sure that WebRTC is not logged, even at lowest severity
- talk_base::LogMessage::AddLogToStream(&stream, talk_base::LS_SENSITIVE);
- EXPECT_EQ(talk_base::LS_SENSITIVE,
- talk_base::LogMessage::GetLogToStream(&stream));
+ rtc::LogMessage::AddLogToStream(&stream, rtc::LS_SENSITIVE);
+ EXPECT_EQ(rtc::LS_SENSITIVE,
+ rtc::LogMessage::GetLogToStream(&stream));
webrtc::Trace::Add(webrtc::kTraceStateInfo, webrtc::kTraceUndefined, 0,
webrtc_log);
- talk_base::Thread::Current()->ProcessMessages(10);
+ rtc::Thread::Current()->ProcessMessages(10);
EXPECT_EQ(std::string::npos, str.find(webrtc_log));
- talk_base::LogMessage::RemoveLogToStream(&stream);
+ rtc::LogMessage::RemoveLogToStream(&stream);
}
// Tests that we can create and destroy a channel.
TEST_F(WebRtcVideoEngineTestFake, CreateChannel) {
- EXPECT_TRUE(engine_.Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
channel_ = engine_.CreateChannel(voice_channel_);
EXPECT_TRUE(channel_ != NULL);
EXPECT_EQ(1, engine_.GetNumOfChannels());
@@ -362,7 +363,7 @@
// Tests that we properly handle failures in CreateChannel.
TEST_F(WebRtcVideoEngineTestFake, CreateChannelFail) {
vie_.set_fail_create_channel(true);
- EXPECT_TRUE(engine_.Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
channel_ = engine_.CreateChannel(voice_channel_);
EXPECT_TRUE(channel_ == NULL);
}
@@ -370,7 +371,7 @@
// Tests that we properly handle failures in AllocateExternalCaptureDevice.
TEST_F(WebRtcVideoEngineTestFake, AllocateExternalCaptureDeviceFail) {
vie_.set_fail_alloc_capturer(true);
- EXPECT_TRUE(engine_.Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
channel_ = engine_.CreateChannel(voice_channel_);
EXPECT_TRUE(channel_ == NULL);
}
@@ -430,8 +431,13 @@
codecs[0].params[cricket::kCodecParamStartBitrate] = "450";
EXPECT_TRUE(channel_->SetSendCodecs(codecs));
- VerifyVP8SendCodec(
- channel_num, kVP8Codec.width, kVP8Codec.height, 0, 2000, 50, 450);
+ VerifyVP8SendCodec(channel_num,
+ kVP8Codec.width,
+ kVP8Codec.height,
+ 0,
+ kMaxBandwidthKbps,
+ kMinBandwidthKbps,
+ 450);
cricket::VideoCodec codec;
EXPECT_TRUE(channel_->GetSendCodec(&codec));
@@ -470,11 +476,11 @@
int channel_num = vie_.GetLastChannel();
std::vector<cricket::VideoCodec> codecs(engine_.codecs());
codecs[0].params[cricket::kCodecParamMinBitrate] = "1000";
- codecs[0].params[cricket::kCodecParamMaxBitrate] = "2000";
+ codecs[0].params[cricket::kCodecParamMaxBitrate] = "3000";
EXPECT_TRUE(channel_->SetSendCodecs(codecs));
VerifyVP8SendCodec(
- channel_num, kVP8Codec.width, kVP8Codec.height, 0, 2000, 1000,
+ channel_num, kVP8Codec.width, kVP8Codec.height, 0, 3000, 1000,
1000);
}
@@ -485,9 +491,15 @@
codecs[0].params[cricket::kCodecParamMaxQuantization] = "21";
EXPECT_TRUE(channel_->SetSendCodecs(codecs));
- VerifyVP8SendCodec(
- channel_num, kVP8Codec.width, kVP8Codec.height, 0, 2000, 50, 300,
- 30, 21);
+ VerifyVP8SendCodec(channel_num,
+ kVP8Codec.width,
+ kVP8Codec.height,
+ 0,
+ kMaxBandwidthKbps,
+ kMinBandwidthKbps,
+ 300,
+ 30,
+ 21);
cricket::VideoCodec codec;
EXPECT_TRUE(channel_->GetSendCodec(&codec));
@@ -519,25 +531,6 @@
channel_num, kVP8Codec.width, kVP8Codec.height, 0, 20, 10, 20);
}
-TEST_F(WebRtcVideoEngineTestFake, SetOptionsWithLoweredBitrate) {
- EXPECT_TRUE(SetupEngine());
- int channel_num = vie_.GetLastChannel();
- std::vector<cricket::VideoCodec> codecs(engine_.codecs());
- codecs[0].params[cricket::kCodecParamMinBitrate] = "50";
- codecs[0].params[cricket::kCodecParamMaxBitrate] = "100";
- EXPECT_TRUE(channel_->SetSendCodecs(codecs));
-
- VerifyVP8SendCodec(
- channel_num, kVP8Codec.width, kVP8Codec.height, 0, 100, 50, 100);
-
- // Verify that min bitrate changes after SetOptions().
- cricket::VideoOptions options;
- options.lower_min_bitrate.Set(true);
- EXPECT_TRUE(channel_->SetOptions(options));
- VerifyVP8SendCodec(
- channel_num, kVP8Codec.width, kVP8Codec.height, 0, 100, 30, 100);
-}
-
TEST_F(WebRtcVideoEngineTestFake, MaxBitrateResetWithConferenceMode) {
EXPECT_TRUE(SetupEngine());
int channel_num = vie_.GetLastChannel();
@@ -570,36 +563,33 @@
std::vector<cricket::VideoCodec> codec_list;
codec_list.push_back(codec);
EXPECT_TRUE(channel_->SetSendCodecs(codec_list));
- const unsigned int kVideoMaxSendBitrateKbps = 2000;
- const unsigned int kVideoMinSendBitrateKbps = 50;
- const unsigned int kVideoDefaultStartSendBitrateKbps = 300;
VerifyVP8SendCodec(send_channel, kVP8Codec.width, kVP8Codec.height, 0,
- kVideoMaxSendBitrateKbps, kVideoMinSendBitrateKbps,
- kVideoDefaultStartSendBitrateKbps);
+ kMaxBandwidthKbps, kMinBandwidthKbps,
+ kStartBandwidthKbps);
EXPECT_EQ(0, vie_.StartSend(send_channel));
// Increase the send bitrate and verify it is used as start bitrate.
- const unsigned int kVideoSendBitrateBps = 768000;
- vie_.SetSendBitrates(send_channel, kVideoSendBitrateBps, 0, 0);
+ const unsigned int kIncreasedSendBitrateBps = 768000;
+ vie_.SetSendBitrates(send_channel, kIncreasedSendBitrateBps, 0, 0);
EXPECT_TRUE(channel_->SetSendCodecs(codec_list));
VerifyVP8SendCodec(send_channel, kVP8Codec.width, kVP8Codec.height, 0,
- kVideoMaxSendBitrateKbps, kVideoMinSendBitrateKbps,
- kVideoSendBitrateBps / 1000);
+ kMaxBandwidthKbps, kMinBandwidthKbps,
+ kIncreasedSendBitrateBps / 1000);
// Never set a start bitrate higher than the max bitrate.
- vie_.SetSendBitrates(send_channel, kVideoMaxSendBitrateKbps + 500, 0, 0);
+ vie_.SetSendBitrates(send_channel, kMaxBandwidthKbps + 500, 0, 0);
EXPECT_TRUE(channel_->SetSendCodecs(codec_list));
VerifyVP8SendCodec(send_channel, kVP8Codec.width, kVP8Codec.height, 0,
- kVideoMaxSendBitrateKbps, kVideoMinSendBitrateKbps,
- kVideoDefaultStartSendBitrateKbps);
+ kMaxBandwidthKbps, kMinBandwidthKbps,
+ kStartBandwidthKbps);
// Use the default start bitrate if the send bitrate is lower.
- vie_.SetSendBitrates(send_channel, kVideoDefaultStartSendBitrateKbps - 50, 0,
+ vie_.SetSendBitrates(send_channel, kStartBandwidthKbps - 50, 0,
0);
EXPECT_TRUE(channel_->SetSendCodecs(codec_list));
VerifyVP8SendCodec(send_channel, kVP8Codec.width, kVP8Codec.height, 0,
- kVideoMaxSendBitrateKbps, kVideoMinSendBitrateKbps,
- kVideoDefaultStartSendBitrateKbps);
+ kMaxBandwidthKbps, kMinBandwidthKbps,
+ kStartBandwidthKbps);
}
@@ -778,9 +768,9 @@
memset(data, 0, sizeof(data));
data[0] = 0x80;
data[1] = rtx_codec.id;
- talk_base::SetBE32(&data[8], kRtxSsrcs1[0]);
- talk_base::Buffer packet(data, kDataLength);
- talk_base::PacketTime packet_time;
+ rtc::SetBE32(&data[8], kRtxSsrcs1[0]);
+ rtc::Buffer packet(data, kDataLength);
+ rtc::PacketTime packet_time;
channel_->OnPacketReceived(&packet, packet_time);
EXPECT_EQ(rtx_codec.id, vie_.GetLastRecvdPayloadType(channel_num));
}
@@ -814,9 +804,9 @@
memset(data, 0, sizeof(data));
data[0] = 0x80;
data[1] = rtx_codec.id;
- talk_base::SetBE32(&data[8], kRtxSsrcs3[1]);
- talk_base::Buffer packet(data, kDataLength);
- talk_base::PacketTime packet_time;
+ rtc::SetBE32(&data[8], kRtxSsrcs3[1]);
+ rtc::Buffer packet(data, kDataLength);
+ rtc::PacketTime packet_time;
channel_->OnPacketReceived(&packet, packet_time);
EXPECT_NE(rtx_codec.id, vie_.GetLastRecvdPayloadType(channel_num[0]));
EXPECT_EQ(rtx_codec.id, vie_.GetLastRecvdPayloadType(channel_num[1]));
@@ -2125,6 +2115,144 @@
EXPECT_TRUE(channel_->RemoveSendStream(kSsrc));
}
+#ifdef USE_WEBRTC_DEV_BRANCH
+TEST_F(WebRtcVideoEngineTestFake, SetSendCodecsWithExternalH264) {
+ encoder_factory_.AddSupportedVideoCodecType(webrtc::kVideoCodecH264, "H264");
+ engine_.SetExternalEncoderFactory(&encoder_factory_);
+ EXPECT_TRUE(SetupEngine());
+ int channel_num = vie_.GetLastChannel();
+
+ std::vector<cricket::VideoCodec> codecs;
+ codecs.push_back(kH264Codec);
+ cricket::VideoCodec rtx_codec(96, "rtx", 0, 0, 0, 0);
+ rtx_codec.SetParam("apt", kH264Codec.id);
+ codecs.push_back(rtx_codec);
+ EXPECT_TRUE(channel_->SetSendCodecs(codecs));
+
+ EXPECT_EQ(96, vie_.GetRtxSendPayloadType(channel_num));
+
+ cricket::StreamParams params =
+ cricket::StreamParams::CreateLegacy(kSsrcs1[0]);
+ params.AddFidSsrc(kSsrcs1[0], kRtxSsrcs1[0]);
+ EXPECT_TRUE(channel_->AddSendStream(params));
+
+ EXPECT_EQ(1, vie_.GetNumSsrcs(channel_num));
+ EXPECT_EQ(1, vie_.GetNumRtxSsrcs(channel_num));
+ EXPECT_EQ(static_cast<int>(kRtxSsrcs1[0]), vie_.GetRtxSsrc(channel_num, 0));
+
+ EXPECT_TRUE(vie_.ExternalEncoderRegistered(channel_num, 127));
+ EXPECT_EQ(1, vie_.GetNumExternalEncoderRegistered(channel_num));
+ EXPECT_EQ(1, encoder_factory_.GetNumCreatedEncoders());
+
+ EXPECT_TRUE(channel_->RemoveSendStream(kSsrcs1[0]));
+}
+
+TEST_F(WebRtcVideoEngineTestFake, SetSendCodecsWithVP8AndExternalH264) {
+ encoder_factory_.AddSupportedVideoCodecType(webrtc::kVideoCodecH264, "H264");
+ engine_.SetExternalEncoderFactory(&encoder_factory_);
+ EXPECT_TRUE(SetupEngine());
+ int channel_num = vie_.GetLastChannel();
+
+ std::vector<cricket::VideoCodec> codecs;
+ codecs.push_back(kH264Codec);
+ cricket::VideoCodec rtx_codec(96, "rtx", 0, 0, 0, 0);
+ rtx_codec.SetParam("apt", kH264Codec.id);
+ codecs.push_back(rtx_codec);
+ codecs.push_back(kVP8Codec);
+ cricket::VideoCodec rtx_codec2(97, "rtx", 0, 0, 0, 0);
+ rtx_codec2.SetParam("apt", kVP8Codec.id);
+ codecs.push_back(rtx_codec2);
+
+ EXPECT_TRUE(channel_->SetSendCodecs(codecs));
+
+ // The first matched codec should be set, i.e., H.264.
+
+ EXPECT_EQ(96, vie_.GetRtxSendPayloadType(channel_num));
+
+ cricket::StreamParams params =
+ cricket::StreamParams::CreateLegacy(kSsrcs1[0]);
+ params.AddFidSsrc(kSsrcs1[0], kRtxSsrcs1[0]);
+ EXPECT_TRUE(channel_->AddSendStream(params));
+
+ EXPECT_EQ(1, vie_.GetNumSsrcs(channel_num));
+ EXPECT_EQ(1, vie_.GetNumRtxSsrcs(channel_num));
+ EXPECT_EQ(static_cast<int>(kRtxSsrcs1[0]), vie_.GetRtxSsrc(channel_num, 0));
+
+ EXPECT_TRUE(vie_.ExternalEncoderRegistered(channel_num, 127));
+ EXPECT_EQ(1, vie_.GetNumExternalEncoderRegistered(channel_num));
+ EXPECT_EQ(1, encoder_factory_.GetNumCreatedEncoders());
+
+ EXPECT_TRUE(channel_->RemoveSendStream(kSsrcs1[0]));
+}
+
+TEST_F(WebRtcVideoEngineTestFake, SetRecvCodecsWithExternalH264) {
+ // WebRtcVideoEngine assumes that if we have encode support for a codec, we
+ // also have decode support. It doesn't support decode only support. Therefore
+ // we here have to register both an encoder and a decoder factory with H264
+ // support, to be able to test the decoder factory.
+ encoder_factory_.AddSupportedVideoCodecType(webrtc::kVideoCodecH264, "H264");
+ decoder_factory_.AddSupportedVideoCodecType(webrtc::kVideoCodecH264);
+ EXPECT_TRUE(SetupEngine());
+ engine_.SetExternalEncoderFactory(&encoder_factory_);
+ engine_.SetExternalDecoderFactory(&decoder_factory_);
+ int channel_num = vie_.GetLastChannel();
+
+ std::vector<cricket::VideoCodec> codecs;
+ codecs.push_back(kH264Codec);
+ cricket::VideoCodec rtx_codec(96, "rtx", 0, 0, 0, 0);
+ rtx_codec.SetParam("apt", kH264Codec.id);
+ codecs.push_back(rtx_codec);
+ EXPECT_TRUE(channel_->SetRecvCodecs(codecs));
+
+ EXPECT_EQ(96, vie_.GetRtxRecvPayloadType(channel_num));
+
+ cricket::StreamParams params =
+ cricket::StreamParams::CreateLegacy(kSsrcs1[0]);
+ params.AddFidSsrc(kSsrcs1[0], kRtxSsrcs1[0]);
+ EXPECT_TRUE(channel_->AddRecvStream(params));
+
+ EXPECT_EQ(1, vie_.GetNumSsrcs(channel_num));
+ EXPECT_EQ(static_cast<int>(kRtxSsrcs1[0]),
+ vie_.GetRemoteRtxSsrc(channel_num));
+
+ EXPECT_TRUE(vie_.ExternalDecoderRegistered(channel_num, 127));
+ EXPECT_EQ(1, vie_.GetNumExternalDecoderRegistered(channel_num));
+ EXPECT_EQ(1, decoder_factory_.GetNumCreatedDecoders());
+
+ EXPECT_TRUE(channel_->RemoveRecvStream(kSsrcs1[0]));
+}
+
+TEST_F(WebRtcVideoEngineTestFake, SetRecvCodecsWithVP8AndExternalH264) {
+ encoder_factory_.AddSupportedVideoCodecType(webrtc::kVideoCodecH264, "H264");
+ decoder_factory_.AddSupportedVideoCodecType(webrtc::kVideoCodecH264);
+ EXPECT_TRUE(SetupEngine());
+ engine_.SetExternalEncoderFactory(&encoder_factory_);
+ engine_.SetExternalDecoderFactory(&decoder_factory_);
+ int channel_num = vie_.GetLastChannel();
+
+ std::vector<cricket::VideoCodec> codecs;
+ cricket::VideoCodec rtx_codec(97, "rtx", 0, 0, 0, 0);
+ rtx_codec.SetParam("apt", kH264Codec.id);
+ codecs.push_back(kH264Codec);
+ codecs.push_back(rtx_codec);
+
+ cricket::VideoCodec rtx_codec2(96, "rtx", 0, 0, 0, 0);
+ rtx_codec2.SetParam("apt", kVP8Codec.id);
+ codecs.push_back(kVP8Codec);
+ codecs.push_back(rtx_codec);
+ // Should fail since WebRTC only supports one RTX codec at a time.
+ EXPECT_FALSE(channel_->SetRecvCodecs(codecs));
+
+ codecs.pop_back();
+
+ // One RTX codec should be fine.
+ EXPECT_TRUE(channel_->SetRecvCodecs(codecs));
+
+ // The RTX payload type should have been set.
+ EXPECT_EQ(rtx_codec.id, vie_.GetRtxRecvPayloadType(channel_num));
+}
+#endif
+
// Tests that OnReadyToSend will be propagated into ViE.
TEST_F(WebRtcVideoEngineTestFake, OnReadyToSend) {
EXPECT_TRUE(SetupEngine());
@@ -2152,10 +2280,10 @@
EXPECT_TRUE(channel_->SetSendCodecs(codec_list));
EXPECT_TRUE(channel_->SetSend(true));
- int64 timestamp = time(NULL) * talk_base::kNumNanosecsPerSec;
+ int64 timestamp = time(NULL) * rtc::kNumNanosecsPerSec;
SendI420ScreencastFrameWithTimestamp(
kVP8Codec.width, kVP8Codec.height, timestamp);
- EXPECT_EQ(talk_base::UnixTimestampNanosecsToNtpMillisecs(timestamp),
+ EXPECT_EQ(rtc::UnixTimestampNanosecsToNtpMillisecs(timestamp),
vie_.GetCaptureLastTimestamp(capture_id));
SendI420ScreencastFrameWithTimestamp(kVP8Codec.width, kVP8Codec.height, 0);
@@ -2230,7 +2358,7 @@
}
TEST_F(WebRtcVideoEngineTest, StartupShutdown) {
- EXPECT_TRUE(engine_.Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
engine_.Terminate();
}
@@ -2245,7 +2373,7 @@
#endif
TEST_F(WebRtcVideoEngineTest, CreateChannel) {
- EXPECT_TRUE(engine_.Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
cricket::VideoMediaChannel* channel = engine_.CreateChannel(NULL);
EXPECT_TRUE(channel != NULL);
delete channel;
@@ -2394,20 +2522,20 @@
// This test verifies DSCP settings are properly applied on video media channel.
TEST_F(WebRtcVideoMediaChannelTest, TestSetDscpOptions) {
- talk_base::scoped_ptr<cricket::FakeNetworkInterface> network_interface(
+ rtc::scoped_ptr<cricket::FakeNetworkInterface> network_interface(
new cricket::FakeNetworkInterface);
channel_->SetInterface(network_interface.get());
cricket::VideoOptions options;
options.dscp.Set(true);
EXPECT_TRUE(channel_->SetOptions(options));
- EXPECT_EQ(talk_base::DSCP_AF41, network_interface->dscp());
+ EXPECT_EQ(rtc::DSCP_AF41, network_interface->dscp());
// Verify previous value is not modified if dscp option is not set.
cricket::VideoOptions options1;
EXPECT_TRUE(channel_->SetOptions(options1));
- EXPECT_EQ(talk_base::DSCP_AF41, network_interface->dscp());
+ EXPECT_EQ(rtc::DSCP_AF41, network_interface->dscp());
options.dscp.Set(false);
EXPECT_TRUE(channel_->SetOptions(options));
- EXPECT_EQ(talk_base::DSCP_DEFAULT, network_interface->dscp());
+ EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface->dscp());
channel_->SetInterface(NULL);
}
diff --git a/media/webrtc/webrtcvideoframe.cc b/media/webrtc/webrtcvideoframe.cc
index 1cc6fe9..ff52ec6 100644
--- a/media/webrtc/webrtcvideoframe.cc
+++ b/media/webrtc/webrtcvideoframe.cc
@@ -30,7 +30,7 @@
#include "libyuv/convert.h"
#include "libyuv/convert_from.h"
#include "libyuv/planar_functions.h"
-#include "talk/base/logging.h"
+#include "webrtc/base/logging.h"
#include "talk/media/base/videocapturer.h"
#include "talk/media/base/videocommon.h"
@@ -56,7 +56,7 @@
const webrtc::VideoFrame* frame() const;
private:
- talk_base::scoped_ptr<uint8[]> owned_data_;
+ rtc::scoped_ptr<uint8[]> owned_data_;
webrtc::VideoFrame video_frame_;
};
@@ -157,7 +157,7 @@
void WebRtcVideoFrame::Alias(
uint8* buffer, size_t buffer_size, int w, int h, size_t pixel_width,
size_t pixel_height, int64 elapsed_time, int64 time_stamp, int rotation) {
- talk_base::scoped_refptr<RefCountedBuffer> video_buffer(
+ rtc::scoped_refptr<RefCountedBuffer> video_buffer(
new RefCountedBuffer());
video_buffer->Alias(buffer, buffer_size);
Attach(video_buffer.get(), buffer_size, w, h, pixel_width, pixel_height,
@@ -324,7 +324,7 @@
}
size_t desired_size = SizeOf(new_width, new_height);
- talk_base::scoped_refptr<RefCountedBuffer> video_buffer(
+ rtc::scoped_refptr<RefCountedBuffer> video_buffer(
new RefCountedBuffer(desired_size));
// Since the libyuv::ConvertToI420 will handle the rotation, so the
// new frame's rotation should always be 0.
@@ -368,7 +368,7 @@
size_t pixel_height,
int64 elapsed_time, int64 time_stamp) {
size_t buffer_size = VideoFrame::SizeOf(w, h);
- talk_base::scoped_refptr<RefCountedBuffer> video_buffer(
+ rtc::scoped_refptr<RefCountedBuffer> video_buffer(
new RefCountedBuffer(buffer_size));
Attach(video_buffer.get(), buffer_size, w, h, pixel_width, pixel_height,
elapsed_time, time_stamp, 0);
diff --git a/media/webrtc/webrtcvideoframe.h b/media/webrtc/webrtcvideoframe.h
index 4ba7ab6..faa14f7 100644
--- a/media/webrtc/webrtcvideoframe.h
+++ b/media/webrtc/webrtcvideoframe.h
@@ -28,9 +28,9 @@
#ifndef TALK_MEDIA_WEBRTCVIDEOFRAME_H_
#define TALK_MEDIA_WEBRTCVIDEOFRAME_H_
-#include "talk/base/buffer.h"
-#include "talk/base/refcount.h"
-#include "talk/base/scoped_ref_ptr.h"
+#include "webrtc/base/buffer.h"
+#include "webrtc/base/refcount.h"
+#include "webrtc/base/scoped_ref_ptr.h"
#include "talk/media/base/videoframe.h"
#include "webrtc/common_types.h"
#include "webrtc/modules/interface/module_common_types.h"
@@ -108,7 +108,7 @@
private:
class FrameBuffer;
- typedef talk_base::RefCountedObject<FrameBuffer> RefCountedBuffer;
+ typedef rtc::RefCountedObject<FrameBuffer> RefCountedBuffer;
void Attach(RefCountedBuffer* video_buffer, size_t buffer_size, int w, int h,
size_t pixel_width, size_t pixel_height, int64 elapsed_time,
@@ -120,7 +120,7 @@
void InitToEmptyBuffer(int w, int h, size_t pixel_width, size_t pixel_height,
int64 elapsed_time, int64 time_stamp);
- talk_base::scoped_refptr<RefCountedBuffer> video_buffer_;
+ rtc::scoped_refptr<RefCountedBuffer> video_buffer_;
bool is_black_;
size_t pixel_width_;
size_t pixel_height_;
diff --git a/media/webrtc/webrtcvideoframe_unittest.cc b/media/webrtc/webrtcvideoframe_unittest.cc
index e63c5d5..42b106c 100644
--- a/media/webrtc/webrtcvideoframe_unittest.cc
+++ b/media/webrtc/webrtcvideoframe_unittest.cc
@@ -25,7 +25,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/flags.h"
+#include "webrtc/base/flags.h"
#include "talk/media/base/videoframe_unittest.h"
#include "talk/media/webrtc/webrtcvideoframe.h"
@@ -53,7 +53,7 @@
captured_frame.height = frame_height;
captured_frame.data_size = (frame_width * frame_height) +
((frame_width + 1) / 2) * ((frame_height + 1) / 2) * 2;
- talk_base::scoped_ptr<uint8[]> captured_frame_buffer(
+ rtc::scoped_ptr<uint8[]> captured_frame_buffer(
new uint8[captured_frame.data_size]);
captured_frame.data = captured_frame_buffer.get();
diff --git a/media/webrtc/webrtcvie.h b/media/webrtc/webrtcvie.h
index 9550962..bb1bd80 100644
--- a/media/webrtc/webrtcvie.h
+++ b/media/webrtc/webrtcvie.h
@@ -29,7 +29,7 @@
#ifndef TALK_MEDIA_WEBRTCVIE_H_
#define TALK_MEDIA_WEBRTCVIE_H_
-#include "talk/base/common.h"
+#include "webrtc/base/common.h"
#include "talk/media/webrtc/webrtccommon.h"
#include "webrtc/common_types.h"
#include "webrtc/modules/interface/module_common_types.h"
diff --git a/media/webrtc/webrtcvoe.h b/media/webrtc/webrtcvoe.h
index bc8358d..1bb8504 100644
--- a/media/webrtc/webrtcvoe.h
+++ b/media/webrtc/webrtcvoe.h
@@ -29,7 +29,7 @@
#ifndef TALK_MEDIA_WEBRTCVOE_H_
#define TALK_MEDIA_WEBRTCVOE_H_
-#include "talk/base/common.h"
+#include "webrtc/base/common.h"
#include "talk/media/webrtc/webrtccommon.h"
#include "webrtc/common_types.h"
diff --git a/media/webrtc/webrtcvoiceengine.cc b/media/webrtc/webrtcvoiceengine.cc
index 1735dd8..470c1ce 100644
--- a/media/webrtc/webrtcvoiceengine.cc
+++ b/media/webrtc/webrtcvoiceengine.cc
@@ -38,13 +38,13 @@
#include <string>
#include <vector>
-#include "talk/base/base64.h"
-#include "talk/base/byteorder.h"
-#include "talk/base/common.h"
-#include "talk/base/helpers.h"
-#include "talk/base/logging.h"
-#include "talk/base/stringencode.h"
-#include "talk/base/stringutils.h"
+#include "webrtc/base/base64.h"
+#include "webrtc/base/byteorder.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/stringencode.h"
+#include "webrtc/base/stringutils.h"
#include "talk/media/base/audiorenderer.h"
#include "talk/media/base/constants.h"
#include "talk/media/base/streamparams.h"
@@ -122,7 +122,7 @@
// Default audio dscp value.
// See http://tools.ietf.org/html/rfc2474 for details.
// See also http://tools.ietf.org/html/draft-jennings-rtcweb-qos-00
-static const talk_base::DiffServCodePoint kAudioDscpValue = talk_base::DSCP_EF;
+static const rtc::DiffServCodePoint kAudioDscpValue = rtc::DSCP_EF;
// Ensure we open the file in a writeable path on ChromeOS and Android. This
// workaround can be removed when it's possible to specify a filename for audio
@@ -155,7 +155,7 @@
return ss.str();
}
-static void LogMultiline(talk_base::LoggingSeverity sev, char* text) {
+static void LogMultiline(rtc::LoggingSeverity sev, char* text) {
const char* delim = "\r\n";
for (char* tok = strtok(text, delim); tok; tok = strtok(NULL, delim)) {
LOG_V(sev) << tok;
@@ -166,13 +166,13 @@
static int SeverityToFilter(int severity) {
int filter = webrtc::kTraceNone;
switch (severity) {
- case talk_base::LS_VERBOSE:
+ case rtc::LS_VERBOSE:
filter |= webrtc::kTraceAll;
- case talk_base::LS_INFO:
+ case rtc::LS_INFO:
filter |= (webrtc::kTraceStateInfo | webrtc::kTraceInfo);
- case talk_base::LS_WARNING:
+ case rtc::LS_WARNING:
filter |= (webrtc::kTraceTerseInfo | webrtc::kTraceWarning);
- case talk_base::LS_ERROR:
+ case rtc::LS_ERROR:
filter |= (webrtc::kTraceError | webrtc::kTraceCritical);
}
return filter;
@@ -328,7 +328,7 @@
private:
WebRtcVoiceEngine *engine_;
int webrtc_channel_;
- talk_base::scoped_ptr<WebRtcSoundclipStream> stream_;
+ rtc::scoped_ptr<WebRtcSoundclipStream> stream_;
};
WebRtcVoiceEngine::WebRtcVoiceEngine()
@@ -475,11 +475,11 @@
// Only add fmtp parameters that differ from the spec.
if (kPreferredMinPTime != kOpusDefaultMinPTime) {
codec.params[kCodecParamMinPTime] =
- talk_base::ToString(kPreferredMinPTime);
+ rtc::ToString(kPreferredMinPTime);
}
if (kPreferredMaxPTime != kOpusDefaultMaxPTime) {
codec.params[kCodecParamMaxPTime] =
- talk_base::ToString(kPreferredMaxPTime);
+ rtc::ToString(kPreferredMaxPTime);
}
// TODO(hellner): Add ptime, sprop-stereo, stereo and useinbandfec
// when they can be set to values other than the default.
@@ -518,7 +518,7 @@
tracing_->SetTraceCallback(NULL);
}
-bool WebRtcVoiceEngine::Init(talk_base::Thread* worker_thread) {
+bool WebRtcVoiceEngine::Init(rtc::Thread* worker_thread) {
LOG(LS_INFO) << "WebRtcVoiceEngine::Init";
bool res = InitInternal();
if (res) {
@@ -533,7 +533,7 @@
bool WebRtcVoiceEngine::InitInternal() {
// Temporarily turn logging level up for the Init call
int old_filter = log_filter_;
- int extended_filter = log_filter_ | SeverityToFilter(talk_base::LS_INFO);
+ int extended_filter = log_filter_ | SeverityToFilter(rtc::LS_INFO);
SetTraceFilter(extended_filter);
SetTraceOptions("");
@@ -551,7 +551,7 @@
char buffer[1024] = "";
voe_wrapper_->base()->GetVersion(buffer);
LOG(LS_INFO) << "WebRtc VoiceEngine Version:";
- LogMultiline(talk_base::LS_INFO, buffer);
+ LogMultiline(rtc::LS_INFO, buffer);
// Save the default AGC configuration settings. This must happen before
// calling SetOptions or the default will be overwritten.
@@ -820,6 +820,12 @@
if (options.experimental_ns.Get(&experimental_ns)) {
webrtc::AudioProcessing* audioproc =
voe_wrapper_->base()->audio_processing();
+#ifdef USE_WEBRTC_DEV_BRANCH
+ webrtc::Config config;
+ config.Set<webrtc::ExperimentalNs>(new webrtc::ExperimentalNs(
+ experimental_ns));
+ audioproc->SetExtraOptions(config);
+#else
// We check audioproc for the benefit of tests, since FakeWebRtcVoiceEngine
// returns NULL on audio_processing().
if (audioproc) {
@@ -831,6 +837,7 @@
LOG(LS_VERBOSE) << "Experimental noise suppression set to "
<< experimental_ns;
}
+#endif
}
bool highpass_filter;
@@ -949,9 +956,9 @@
bool WebRtcVoiceEngine::SetDevices(const Device* in_device,
const Device* out_device) {
#if !defined(IOS)
- int in_id = in_device ? talk_base::FromString<int>(in_device->id) :
+ int in_id = in_device ? rtc::FromString<int>(in_device->id) :
kDefaultAudioDeviceId;
- int out_id = out_device ? talk_base::FromString<int>(out_device->id) :
+ int out_id = out_device ? rtc::FromString<int>(out_device->id) :
kDefaultAudioDeviceId;
// The device manager uses -1 as the default device, which was the case for
// VoE 3.5. VoE 4.0, however, uses 0 as the default in Linux and Mac.
@@ -1002,6 +1009,9 @@
LOG_RTCERR2(SetRecordingDevice, in_name, in_id);
ret = false;
}
+ webrtc::AudioProcessing* ap = voe()->base()->audio_processing();
+ if (ap)
+ ap->Initialize();
}
// Find the playout device id in VoiceEngine and set playout device.
@@ -1244,7 +1254,7 @@
void WebRtcVoiceEngine::SetTraceOptions(const std::string& options) {
// Set encrypted trace file.
std::vector<std::string> opts;
- talk_base::tokenize(options, ' ', '"', '"', &opts);
+ rtc::tokenize(options, ' ', '"', '"', &opts);
std::vector<std::string>::iterator tracefile =
std::find(opts.begin(), opts.end(), "tracefile");
if (tracefile != opts.end() && ++tracefile != opts.end()) {
@@ -1262,7 +1272,7 @@
std::vector<std::string>::iterator tracefilter =
std::find(opts.begin(), opts.end(), "tracefilter");
if (tracefilter != opts.end() && ++tracefilter != opts.end()) {
- if (!tracing_->SetTraceFilter(talk_base::FromString<int>(*tracefilter))) {
+ if (!tracing_->SetTraceFilter(rtc::FromString<int>(*tracefilter))) {
LOG_RTCERR1(SetTraceFilter, *tracefilter);
}
}
@@ -1309,15 +1319,15 @@
void WebRtcVoiceEngine::Print(webrtc::TraceLevel level, const char* trace,
int length) {
- talk_base::LoggingSeverity sev = talk_base::LS_VERBOSE;
+ rtc::LoggingSeverity sev = rtc::LS_VERBOSE;
if (level == webrtc::kTraceError || level == webrtc::kTraceCritical)
- sev = talk_base::LS_ERROR;
+ sev = rtc::LS_ERROR;
else if (level == webrtc::kTraceWarning)
- sev = talk_base::LS_WARNING;
+ sev = rtc::LS_WARNING;
else if (level == webrtc::kTraceStateInfo || level == webrtc::kTraceInfo)
- sev = talk_base::LS_INFO;
+ sev = rtc::LS_INFO;
else if (level == webrtc::kTraceTerseInfo)
- sev = talk_base::LS_INFO;
+ sev = rtc::LS_INFO;
// Skip past boilerplate prefix text
if (length < 72) {
@@ -1333,7 +1343,7 @@
}
void WebRtcVoiceEngine::CallbackOnError(int channel_num, int err_code) {
- talk_base::CritScope lock(&channels_cs_);
+ rtc::CritScope lock(&channels_cs_);
WebRtcVoiceMediaChannel* channel = NULL;
uint32 ssrc = 0;
LOG(LS_WARNING) << "VoiceEngine error " << err_code << " reported on channel "
@@ -1393,12 +1403,12 @@
}
void WebRtcVoiceEngine::RegisterChannel(WebRtcVoiceMediaChannel *channel) {
- talk_base::CritScope lock(&channels_cs_);
+ rtc::CritScope lock(&channels_cs_);
channels_.push_back(channel);
}
void WebRtcVoiceEngine::UnregisterChannel(WebRtcVoiceMediaChannel *channel) {
- talk_base::CritScope lock(&channels_cs_);
+ rtc::CritScope lock(&channels_cs_);
ChannelList::iterator i = std::find(channels_.begin(),
channels_.end(),
channel);
@@ -1464,11 +1474,11 @@
return true;
}
-bool WebRtcVoiceEngine::StartAecDump(talk_base::PlatformFile file) {
- FILE* aec_dump_file_stream = talk_base::FdopenPlatformFileForWriting(file);
+bool WebRtcVoiceEngine::StartAecDump(rtc::PlatformFile file) {
+ FILE* aec_dump_file_stream = rtc::FdopenPlatformFileForWriting(file);
if (!aec_dump_file_stream) {
LOG(LS_ERROR) << "Could not open AEC dump file stream.";
- if (!talk_base::ClosePlatformFile(file))
+ if (!rtc::ClosePlatformFile(file))
LOG(LS_WARNING) << "Could not close file.";
return false;
}
@@ -1500,7 +1510,7 @@
webrtc::ProcessingTypes processing_type;
{
- talk_base::CritScope cs(&signal_media_critical_);
+ rtc::CritScope cs(&signal_media_critical_);
if (direction == MPD_RX) {
processing_type = webrtc::kPlaybackAllChannelsMixed;
if (SignalRxMediaFrame.is_empty()) {
@@ -1565,7 +1575,7 @@
int deregister_id = -1;
{
- talk_base::CritScope cs(&signal_media_critical_);
+ rtc::CritScope cs(&signal_media_critical_);
if ((processor_direction & channel_direction) != 0 && !signal->is_empty()) {
signal->disconnect(voice_processor);
int channel_id = -1;
@@ -1621,7 +1631,7 @@
int length,
int sampling_freq,
bool is_stereo) {
- talk_base::CritScope cs(&signal_media_critical_);
+ rtc::CritScope cs(&signal_media_critical_);
AudioFrame frame(audio10ms, length, sampling_freq, is_stereo);
if (type == webrtc::kPlaybackAllChannelsMixed) {
SignalRxMediaFrame(rx_processor_ssrc_, MPD_RX, &frame);
@@ -1688,7 +1698,7 @@
// This method is called on the libjingle worker thread.
// TODO(xians): Make sure Start() is called only once.
void Start(AudioRenderer* renderer) {
- talk_base::CritScope lock(&lock_);
+ rtc::CritScope lock(&lock_);
ASSERT(renderer != NULL);
if (renderer_ != NULL) {
ASSERT(renderer_ == renderer);
@@ -1706,7 +1716,7 @@
// callback will be received after this method.
// This method is called on the libjingle worker thread.
void Stop() {
- talk_base::CritScope lock(&lock_);
+ rtc::CritScope lock(&lock_);
if (renderer_ == NULL)
return;
@@ -1733,7 +1743,7 @@
// Callback from the |renderer_| when it is going away. In case Start() has
// never been called, this callback won't be triggered.
virtual void OnClose() OVERRIDE {
- talk_base::CritScope lock(&lock_);
+ rtc::CritScope lock(&lock_);
// Set |renderer_| to NULL to make sure no more callback will get into
// the renderer.
renderer_ = NULL;
@@ -1752,7 +1762,7 @@
AudioRenderer* renderer_;
// Protects |renderer_| in Start(), Stop() and OnClose().
- talk_base::CriticalSection lock_;
+ rtc::CriticalSection lock_;
};
// WebRtcVoiceMediaChannel
@@ -1873,7 +1883,7 @@
}
}
if (dscp_option_changed) {
- talk_base::DiffServCodePoint dscp = talk_base::DSCP_DEFAULT;
+ rtc::DiffServCodePoint dscp = rtc::DSCP_DEFAULT;
if (options_.dscp.GetWithDefaultIfUnset(false))
dscp = kAudioDscpValue;
if (MediaChannel::SetDscp(dscp) != 0) {
@@ -2588,7 +2598,7 @@
}
bool WebRtcVoiceMediaChannel::AddRecvStream(const StreamParams& sp) {
- talk_base::CritScope lock(&receive_channels_cs_);
+ rtc::CritScope lock(&receive_channels_cs_);
if (!VERIFY(sp.ssrcs.size() == 1))
return false;
@@ -2706,7 +2716,7 @@
}
bool WebRtcVoiceMediaChannel::RemoveRecvStream(uint32 ssrc) {
- talk_base::CritScope lock(&receive_channels_cs_);
+ rtc::CritScope lock(&receive_channels_cs_);
ChannelMap::iterator it = receive_channels_.find(ssrc);
if (it == receive_channels_.end()) {
LOG(LS_WARNING) << "Try to remove stream with ssrc " << ssrc
@@ -2824,7 +2834,7 @@
for (ChannelMap::iterator it = receive_channels_.begin();
it != receive_channels_.end(); ++it) {
int level = GetOutputLevel(it->second->channel());
- highest = talk_base::_max(level, highest);
+ highest = rtc::_max(level, highest);
}
return highest;
}
@@ -2856,7 +2866,7 @@
bool WebRtcVoiceMediaChannel::SetOutputScaling(
uint32 ssrc, double left, double right) {
- talk_base::CritScope lock(&receive_channels_cs_);
+ rtc::CritScope lock(&receive_channels_cs_);
// Collect the channels to scale the output volume.
std::vector<int> channels;
if (0 == ssrc) { // Collect all channels, including the default one.
@@ -2879,7 +2889,7 @@
// Scale the output volume for the collected channels. We first normalize to
// scale the volume and then set the left and right pan.
- float scale = static_cast<float>(talk_base::_max(left, right));
+ float scale = static_cast<float>(rtc::_max(left, right));
if (scale > 0.0001f) {
left /= scale;
right /= scale;
@@ -2908,7 +2918,7 @@
uint32 ssrc, double* left, double* right) {
if (!left || !right) return false;
- talk_base::CritScope lock(&receive_channels_cs_);
+ rtc::CritScope lock(&receive_channels_cs_);
// Determine which channel based on ssrc.
int channel = (0 == ssrc) ? voe_channel() : GetReceiveChannelNum(ssrc);
if (channel == -1) {
@@ -3041,7 +3051,7 @@
}
void WebRtcVoiceMediaChannel::OnPacketReceived(
- talk_base::Buffer* packet, const talk_base::PacketTime& packet_time) {
+ rtc::Buffer* packet, const rtc::PacketTime& packet_time) {
// Pick which channel to send this packet to. If this packet doesn't match
// any multiplexed streams, just send it to the default channel. Otherwise,
// send it to the specific decoder instance for that stream.
@@ -3075,7 +3085,7 @@
}
void WebRtcVoiceMediaChannel::OnRtcpReceived(
- talk_base::Buffer* packet, const talk_base::PacketTime& packet_time) {
+ rtc::Buffer* packet, const rtc::PacketTime& packet_time) {
// Sending channels need all RTCP packets with feedback information.
// Even sender reports can contain attached report blocks.
// Receiving channels need sender reports in order to create
@@ -3129,6 +3139,23 @@
LOG_RTCERR2(SetInputMute, channel, muted);
return false;
}
+ // We set the AGC to mute state only when all the channels are muted.
+ // This implementation is not ideal, instead we should signal the AGC when
+ // the mic channel is muted/unmuted. We can't do it today because there
+ // is no good way to know which stream is mapping to the mic channel.
+ bool all_muted = muted;
+ for (ChannelMap::const_iterator iter = send_channels_.begin();
+ iter != send_channels_.end() && all_muted; ++iter) {
+ if (engine()->voe()->volume()->GetInputMute(iter->second->channel(),
+ all_muted)) {
+ LOG_RTCERR1(GetInputMute, iter->second->channel());
+ return false;
+ }
+ }
+
+ webrtc::AudioProcessing* ap = engine()->voe()->base()->audio_processing();
+ if (ap)
+ ap->set_output_will_be_muted(all_muted);
return true;
}
@@ -3381,7 +3408,7 @@
}
bool WebRtcVoiceMediaChannel::FindSsrc(int channel_num, uint32* ssrc) {
- talk_base::CritScope lock(&receive_channels_cs_);
+ rtc::CritScope lock(&receive_channels_cs_);
ASSERT(ssrc != NULL);
if (channel_num == -1 && send_ != SEND_NOTHING) {
// Sometimes the VoiceEngine core will throw error with channel_num = -1.
@@ -3463,9 +3490,9 @@
if (it != red_codec.params.end()) {
red_params = it->second;
std::vector<std::string> red_pts;
- if (talk_base::split(red_params, '/', &red_pts) != 2 ||
+ if (rtc::split(red_params, '/', &red_pts) != 2 ||
red_pts[0] != red_pts[1] ||
- !talk_base::FromString(red_pts[0], &red_pt)) {
+ !rtc::FromString(red_pts[0], &red_pt)) {
LOG(LS_WARNING) << "RED params " << red_params << " not supported.";
return false;
}
@@ -3542,7 +3569,7 @@
size_t ssrc_pos = (!rtcp) ? 8 : 4;
uint32 ssrc = 0;
if (len >= (ssrc_pos + sizeof(ssrc))) {
- ssrc = talk_base::GetBE32(static_cast<const char*>(data) + ssrc_pos);
+ ssrc = rtc::GetBE32(static_cast<const char*>(data) + ssrc_pos);
}
return ssrc;
}
diff --git a/media/webrtc/webrtcvoiceengine.h b/media/webrtc/webrtcvoiceengine.h
index efc388f..38c4e18 100644
--- a/media/webrtc/webrtcvoiceengine.h
+++ b/media/webrtc/webrtcvoiceengine.h
@@ -33,11 +33,11 @@
#include <string>
#include <vector>
-#include "talk/base/buffer.h"
-#include "talk/base/byteorder.h"
-#include "talk/base/logging.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/stream.h"
+#include "webrtc/base/buffer.h"
+#include "webrtc/base/byteorder.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/stream.h"
#include "talk/media/base/rtputils.h"
#include "talk/media/webrtc/webrtccommon.h"
#include "talk/media/webrtc/webrtcexport.h"
@@ -47,6 +47,10 @@
#if !defined(LIBPEERCONNECTION_LIB) && \
!defined(LIBPEERCONNECTION_IMPLEMENTATION)
+// If you hit this, then you've tried to include this header from outside
+// the shared library. An instance of this class must only be created from
+// within the library that actually implements it. Otherwise use the
+// WebRtcMediaEngine to construct an instance.
#error "Bogus include."
#endif
@@ -64,7 +68,7 @@
virtual int Rewind();
private:
- talk_base::MemoryStream mem_;
+ rtc::MemoryStream mem_;
bool loop_;
};
@@ -97,7 +101,7 @@
VoEWrapper* voe_wrapper_sc,
VoETraceWrapper* tracing);
~WebRtcVoiceEngine();
- bool Init(talk_base::Thread* worker_thread);
+ bool Init(rtc::Thread* worker_thread);
void Terminate();
int GetCapabilities();
@@ -173,7 +177,7 @@
webrtc::AudioDeviceModule* adm_sc);
// Starts AEC dump using existing file.
- bool StartAecDump(talk_base::PlatformFile file);
+ bool StartAecDump(rtc::PlatformFile file);
// Check whether the supplied trace should be ignored.
bool ShouldIgnoreTrace(const std::string& trace);
@@ -230,14 +234,14 @@
FrameSignal SignalRxMediaFrame;
FrameSignal SignalTxMediaFrame;
- static const int kDefaultLogSeverity = talk_base::LS_WARNING;
+ static const int kDefaultLogSeverity = rtc::LS_WARNING;
// The primary instance of WebRtc VoiceEngine.
- talk_base::scoped_ptr<VoEWrapper> voe_wrapper_;
+ rtc::scoped_ptr<VoEWrapper> voe_wrapper_;
// A secondary instance, for playing out soundclips (on the 'ring' device).
- talk_base::scoped_ptr<VoEWrapper> voe_wrapper_sc_;
+ rtc::scoped_ptr<VoEWrapper> voe_wrapper_sc_;
bool voe_wrapper_sc_initialized_;
- talk_base::scoped_ptr<VoETraceWrapper> tracing_;
+ rtc::scoped_ptr<VoETraceWrapper> tracing_;
// The external audio device manager
webrtc::AudioDeviceModule* adm_;
webrtc::AudioDeviceModule* adm_sc_;
@@ -247,12 +251,12 @@
std::vector<AudioCodec> codecs_;
std::vector<RtpHeaderExtension> rtp_header_extensions_;
bool desired_local_monitor_enable_;
- talk_base::scoped_ptr<WebRtcMonitorStream> monitor_;
+ rtc::scoped_ptr<WebRtcMonitorStream> monitor_;
SoundclipList soundclips_;
ChannelList channels_;
// channels_ can be read from WebRtc callback thread. We need a lock on that
// callback as well as the RegisterChannel/UnregisterChannel.
- talk_base::CriticalSection channels_cs_;
+ rtc::CriticalSection channels_cs_;
webrtc::AgcConfig default_agc_config_;
webrtc::Config voe_config_;
@@ -275,7 +279,7 @@
uint32 tx_processor_ssrc_;
uint32 rx_processor_ssrc_;
- talk_base::CriticalSection signal_media_critical_;
+ rtc::CriticalSection signal_media_critical_;
};
// WebRtcMediaChannel is a class that implements the common WebRtc channel
@@ -292,7 +296,7 @@
protected:
// implements Transport interface
virtual int SendPacket(int channel, const void *data, int len) {
- talk_base::Buffer packet(data, len, kMaxRtpPacketLen);
+ rtc::Buffer packet(data, len, kMaxRtpPacketLen);
if (!T::SendPacket(&packet)) {
return -1;
}
@@ -300,7 +304,7 @@
}
virtual int SendRTCPPacket(int channel, const void *data, int len) {
- talk_base::Buffer packet(data, len, kMaxRtpPacketLen);
+ rtc::Buffer packet(data, len, kMaxRtpPacketLen);
return T::SendRtcp(&packet) ? len : -1;
}
@@ -353,10 +357,10 @@
virtual bool CanInsertDtmf();
virtual bool InsertDtmf(uint32 ssrc, int event, int duration, int flags);
- virtual void OnPacketReceived(talk_base::Buffer* packet,
- const talk_base::PacketTime& packet_time);
- virtual void OnRtcpReceived(talk_base::Buffer* packet,
- const talk_base::PacketTime& packet_time);
+ virtual void OnPacketReceived(rtc::Buffer* packet,
+ const rtc::PacketTime& packet_time);
+ virtual void OnRtcpReceived(rtc::Buffer* packet,
+ const rtc::PacketTime& packet_time);
virtual void OnReadyToSend(bool ready) {}
virtual bool MuteStream(uint32 ssrc, bool on);
virtual bool SetStartSendBandwidth(int bps);
@@ -423,11 +427,11 @@
int channel_id,
const std::vector<RtpHeaderExtension>& extensions);
- talk_base::scoped_ptr<WebRtcSoundclipStream> ringback_tone_;
+ rtc::scoped_ptr<WebRtcSoundclipStream> ringback_tone_;
std::set<int> ringback_channels_; // channels playing ringback
std::vector<AudioCodec> recv_codecs_;
std::vector<AudioCodec> send_codecs_;
- talk_base::scoped_ptr<webrtc::CodecInst> send_codec_;
+ rtc::scoped_ptr<webrtc::CodecInst> send_codec_;
bool send_bw_setting_;
int send_bw_bps_;
AudioOptions options_;
@@ -456,7 +460,7 @@
std::vector<RtpHeaderExtension> receive_extensions_;
// Do not lock this on the VoE media processor thread; potential for deadlock
// exists.
- mutable talk_base::CriticalSection receive_channels_cs_;
+ mutable rtc::CriticalSection receive_channels_cs_;
};
} // namespace cricket
diff --git a/media/webrtc/webrtcvoiceengine_unittest.cc b/media/webrtc/webrtcvoiceengine_unittest.cc
index 55d54ed..1798d1d 100644
--- a/media/webrtc/webrtcvoiceengine_unittest.cc
+++ b/media/webrtc/webrtcvoiceengine_unittest.cc
@@ -26,12 +26,12 @@
*/
#ifdef WIN32
-#include "talk/base/win32.h"
+#include "webrtc/base/win32.h"
#include <objbase.h>
#endif
-#include "talk/base/byteorder.h"
-#include "talk/base/gunit.h"
+#include "webrtc/base/byteorder.h"
+#include "webrtc/base/gunit.h"
#include "talk/media/base/constants.h"
#include "talk/media/base/fakemediaengine.h"
#include "talk/media/base/fakemediaprocessor.h"
@@ -140,7 +140,7 @@
options_adjust_agc_.adjust_agc_delta.Set(-10);
}
bool SetupEngineWithoutStream() {
- if (!engine_.Init(talk_base::Thread::Current())) {
+ if (!engine_.Init(rtc::Thread::Current())) {
return false;
}
channel_ = engine_.CreateChannel();
@@ -166,8 +166,8 @@
EXPECT_EQ(0, voe_.GetLocalSSRC(default_channel_num, default_send_ssrc));
}
void DeliverPacket(const void* data, int len) {
- talk_base::Buffer packet(data, len);
- channel_->OnPacketReceived(&packet, talk_base::PacketTime());
+ rtc::Buffer packet(data, len);
+ channel_->OnPacketReceived(&packet, rtc::PacketTime());
}
virtual void TearDown() {
delete soundclip_;
@@ -176,7 +176,7 @@
}
void TestInsertDtmf(uint32 ssrc, bool caller) {
- EXPECT_TRUE(engine_.Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
channel_ = engine_.CreateChannel();
EXPECT_TRUE(channel_ != NULL);
if (caller) {
@@ -351,7 +351,7 @@
TEST_F(WebRtcVoiceEngineTestFake, StartupShutdown) {
EXPECT_FALSE(voe_.IsInited());
EXPECT_FALSE(voe_sc_.IsInited());
- EXPECT_TRUE(engine_.Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
EXPECT_TRUE(voe_.IsInited());
// The soundclip engine is lazily initialized.
EXPECT_FALSE(voe_sc_.IsInited());
@@ -362,7 +362,7 @@
// Tests that we can create and destroy a channel.
TEST_F(WebRtcVoiceEngineTestFake, CreateChannel) {
- EXPECT_TRUE(engine_.Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
channel_ = engine_.CreateChannel();
EXPECT_TRUE(channel_ != NULL);
}
@@ -370,7 +370,7 @@
// Tests that we properly handle failures in CreateChannel.
TEST_F(WebRtcVoiceEngineTestFake, CreateChannelFail) {
voe_.set_fail_create_channel(true);
- EXPECT_TRUE(engine_.Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
channel_ = engine_.CreateChannel();
EXPECT_TRUE(channel_ == NULL);
}
@@ -439,13 +439,13 @@
codecs[2].id = 126;
EXPECT_TRUE(channel_->SetRecvCodecs(codecs));
webrtc::CodecInst gcodec;
- talk_base::strcpyn(gcodec.plname, ARRAY_SIZE(gcodec.plname), "ISAC");
+ rtc::strcpyn(gcodec.plname, ARRAY_SIZE(gcodec.plname), "ISAC");
gcodec.plfreq = 16000;
gcodec.channels = 1;
EXPECT_EQ(0, voe_.GetRecPayloadType(channel_num, gcodec));
EXPECT_EQ(106, gcodec.pltype);
EXPECT_STREQ("ISAC", gcodec.plname);
- talk_base::strcpyn(gcodec.plname, ARRAY_SIZE(gcodec.plname),
+ rtc::strcpyn(gcodec.plname, ARRAY_SIZE(gcodec.plname),
"telephone-event");
gcodec.plfreq = 8000;
EXPECT_EQ(0, voe_.GetRecPayloadType(channel_num, gcodec));
@@ -557,13 +557,13 @@
cricket::StreamParams::CreateLegacy(kSsrc1)));
int channel_num2 = voe_.GetLastChannel();
webrtc::CodecInst gcodec;
- talk_base::strcpyn(gcodec.plname, ARRAY_SIZE(gcodec.plname), "ISAC");
+ rtc::strcpyn(gcodec.plname, ARRAY_SIZE(gcodec.plname), "ISAC");
gcodec.plfreq = 16000;
gcodec.channels = 1;
EXPECT_EQ(0, voe_.GetRecPayloadType(channel_num2, gcodec));
EXPECT_EQ(106, gcodec.pltype);
EXPECT_STREQ("ISAC", gcodec.plname);
- talk_base::strcpyn(gcodec.plname, ARRAY_SIZE(gcodec.plname),
+ rtc::strcpyn(gcodec.plname, ARRAY_SIZE(gcodec.plname),
"telephone-event");
gcodec.plfreq = 8000;
gcodec.channels = 1;
@@ -585,7 +585,7 @@
int channel_num2 = voe_.GetLastChannel();
webrtc::CodecInst gcodec;
- talk_base::strcpyn(gcodec.plname, ARRAY_SIZE(gcodec.plname), "ISAC");
+ rtc::strcpyn(gcodec.plname, ARRAY_SIZE(gcodec.plname), "ISAC");
gcodec.plfreq = 16000;
gcodec.channels = 1;
EXPECT_EQ(0, voe_.GetRecPayloadType(channel_num2, gcodec));
@@ -686,7 +686,7 @@
}
TEST_F(WebRtcVoiceEngineTestFake, SetMaxSendBandwidthMultiRateAsCallee) {
- EXPECT_TRUE(engine_.Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
channel_ = engine_.CreateChannel();
EXPECT_TRUE(channel_ != NULL);
EXPECT_TRUE(channel_->SetSendCodecs(engine_.codecs()));
@@ -1048,7 +1048,7 @@
// Test that we can enable NACK with opus as callee.
TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecEnableNackAsCallee) {
- EXPECT_TRUE(engine_.Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
channel_ = engine_.CreateChannel();
EXPECT_TRUE(channel_ != NULL);
@@ -1434,7 +1434,7 @@
// Test that we set VAD and DTMF types correctly as callee.
TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsCNandDTMFAsCallee) {
- EXPECT_TRUE(engine_.Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
channel_ = engine_.CreateChannel();
EXPECT_TRUE(channel_ != NULL);
@@ -1551,7 +1551,7 @@
// Test that we set up RED correctly as callee.
TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsREDAsCallee) {
- EXPECT_TRUE(engine_.Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
channel_ = engine_.CreateChannel();
EXPECT_TRUE(channel_ != NULL);
@@ -2127,7 +2127,7 @@
TEST_F(WebRtcVoiceEngineTestFake, TraceFilterViaTraceOptions) {
EXPECT_TRUE(SetupEngine());
- engine_.SetLogging(talk_base::LS_INFO, "");
+ engine_.SetLogging(rtc::LS_INFO, "");
EXPECT_EQ(
// Info:
webrtc::kTraceStateInfo | webrtc::kTraceInfo |
@@ -2138,8 +2138,8 @@
static_cast<int>(trace_wrapper_->filter_));
// Now set it explicitly
std::string filter =
- "tracefilter " + talk_base::ToString(webrtc::kTraceDefault);
- engine_.SetLogging(talk_base::LS_VERBOSE, filter.c_str());
+ "tracefilter " + rtc::ToString(webrtc::kTraceDefault);
+ engine_.SetLogging(rtc::LS_VERBOSE, filter.c_str());
EXPECT_EQ(static_cast<unsigned int>(webrtc::kTraceDefault),
trace_wrapper_->filter_);
}
@@ -2222,7 +2222,7 @@
// Test that the local SSRC is the same on sending and receiving channels if the
// receive channel is created before the send channel.
TEST_F(WebRtcVoiceEngineTestFake, SetSendSsrcAfterCreatingReceiveChannel) {
- EXPECT_TRUE(engine_.Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
channel_ = engine_.CreateChannel();
EXPECT_TRUE(channel_->SetOptions(options_conference_));
@@ -2263,7 +2263,7 @@
char packets[4][sizeof(kPcmuFrame)];
for (size_t i = 0; i < ARRAY_SIZE(packets); ++i) {
memcpy(packets[i], kPcmuFrame, sizeof(kPcmuFrame));
- talk_base::SetBE32(packets[i] + 8, static_cast<uint32>(i));
+ rtc::SetBE32(packets[i] + 8, static_cast<uint32>(i));
}
EXPECT_TRUE(voe_.CheckNoPacket(channel_num1));
EXPECT_TRUE(voe_.CheckNoPacket(channel_num2));
@@ -2327,7 +2327,7 @@
cricket::StreamParams::CreateLegacy(kSsrc1)));
int channel_num2 = voe_.GetLastChannel();
webrtc::CodecInst gcodec;
- talk_base::strcpyn(gcodec.plname, ARRAY_SIZE(gcodec.plname), "CELT");
+ rtc::strcpyn(gcodec.plname, ARRAY_SIZE(gcodec.plname), "CELT");
gcodec.plfreq = 32000;
gcodec.channels = 2;
EXPECT_EQ(-1, voe_.GetRecPayloadType(channel_num2, gcodec));
@@ -2438,14 +2438,14 @@
// Send a packet with SSRC 2; the tone should stop.
char packet[sizeof(kPcmuFrame)];
memcpy(packet, kPcmuFrame, sizeof(kPcmuFrame));
- talk_base::SetBE32(packet + 8, 2);
+ rtc::SetBE32(packet + 8, 2);
DeliverPacket(packet, sizeof(packet));
EXPECT_EQ(0, voe_.IsPlayingFileLocally(channel_num));
}
// Tests creating soundclips, and make sure they come from the right engine.
TEST_F(WebRtcVoiceEngineTestFake, CreateSoundclip) {
- EXPECT_TRUE(engine_.Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
EXPECT_FALSE(voe_sc_.IsInited());
soundclip_ = engine_.CreateSoundclip();
EXPECT_TRUE(voe_sc_.IsInited());
@@ -2466,14 +2466,14 @@
// Tests playing out a fake sound.
TEST_F(WebRtcVoiceEngineTestFake, PlaySoundclip) {
static const char kZeroes[16000] = {};
- EXPECT_TRUE(engine_.Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
soundclip_ = engine_.CreateSoundclip();
ASSERT_TRUE(soundclip_ != NULL);
EXPECT_TRUE(soundclip_->PlaySound(kZeroes, sizeof(kZeroes), 0));
}
TEST_F(WebRtcVoiceEngineTestFake, MediaEngineCallbackOnError) {
- talk_base::scoped_ptr<ChannelErrorListener> listener;
+ rtc::scoped_ptr<ChannelErrorListener> listener;
cricket::WebRtcVoiceMediaChannel* media_channel;
unsigned int ssrc = 0;
@@ -2779,7 +2779,7 @@
set_config.digitalCompressionGaindB = 9;
set_config.limiterEnable = true;
EXPECT_EQ(0, voe_.SetAgcConfig(set_config));
- EXPECT_TRUE(engine_.Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
webrtc::AgcConfig config = {0};
EXPECT_EQ(0, voe_.GetAgcConfig(config));
@@ -2791,9 +2791,9 @@
TEST_F(WebRtcVoiceEngineTestFake, SetOptionOverridesViaChannels) {
EXPECT_TRUE(SetupEngine());
- talk_base::scoped_ptr<cricket::VoiceMediaChannel> channel1(
+ rtc::scoped_ptr<cricket::VoiceMediaChannel> channel1(
engine_.CreateChannel());
- talk_base::scoped_ptr<cricket::VoiceMediaChannel> channel2(
+ rtc::scoped_ptr<cricket::VoiceMediaChannel> channel2(
engine_.CreateChannel());
// Have to add a stream to make SetSend work.
@@ -2911,22 +2911,22 @@
// This test verifies DSCP settings are properly applied on voice media channel.
TEST_F(WebRtcVoiceEngineTestFake, TestSetDscpOptions) {
EXPECT_TRUE(SetupEngine());
- talk_base::scoped_ptr<cricket::VoiceMediaChannel> channel(
+ rtc::scoped_ptr<cricket::VoiceMediaChannel> channel(
engine_.CreateChannel());
- talk_base::scoped_ptr<cricket::FakeNetworkInterface> network_interface(
+ rtc::scoped_ptr<cricket::FakeNetworkInterface> network_interface(
new cricket::FakeNetworkInterface);
channel->SetInterface(network_interface.get());
cricket::AudioOptions options;
options.dscp.Set(true);
EXPECT_TRUE(channel->SetOptions(options));
- EXPECT_EQ(talk_base::DSCP_EF, network_interface->dscp());
+ EXPECT_EQ(rtc::DSCP_EF, network_interface->dscp());
// Verify previous value is not modified if dscp option is not set.
cricket::AudioOptions options1;
EXPECT_TRUE(channel->SetOptions(options1));
- EXPECT_EQ(talk_base::DSCP_EF, network_interface->dscp());
+ EXPECT_EQ(rtc::DSCP_EF, network_interface->dscp());
options.dscp.Set(false);
EXPECT_TRUE(channel->SetOptions(options));
- EXPECT_EQ(talk_base::DSCP_DEFAULT, network_interface->dscp());
+ EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface->dscp());
}
TEST(WebRtcVoiceEngineTest, TestDefaultOptionsBeforeInit) {
@@ -2993,31 +2993,31 @@
// Tests that the library initializes and shuts down properly.
TEST(WebRtcVoiceEngineTest, StartupShutdown) {
cricket::WebRtcVoiceEngine engine;
- EXPECT_TRUE(engine.Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine.Init(rtc::Thread::Current()));
cricket::VoiceMediaChannel* channel = engine.CreateChannel();
EXPECT_TRUE(channel != NULL);
delete channel;
engine.Terminate();
// Reinit to catch regression where VoiceEngineObserver reference is lost
- EXPECT_TRUE(engine.Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine.Init(rtc::Thread::Current()));
engine.Terminate();
}
// Tests that the logging from the library is cleartext.
TEST(WebRtcVoiceEngineTest, DISABLED_HasUnencryptedLogging) {
cricket::WebRtcVoiceEngine engine;
- talk_base::scoped_ptr<talk_base::MemoryStream> stream(
- new talk_base::MemoryStream);
+ rtc::scoped_ptr<rtc::MemoryStream> stream(
+ new rtc::MemoryStream);
size_t size = 0;
bool cleartext = true;
- talk_base::LogMessage::AddLogToStream(stream.get(), talk_base::LS_VERBOSE);
- engine.SetLogging(talk_base::LS_VERBOSE, "");
- EXPECT_TRUE(engine.Init(talk_base::Thread::Current()));
+ rtc::LogMessage::AddLogToStream(stream.get(), rtc::LS_VERBOSE);
+ engine.SetLogging(rtc::LS_VERBOSE, "");
+ EXPECT_TRUE(engine.Init(rtc::Thread::Current()));
EXPECT_TRUE(stream->GetSize(&size));
EXPECT_GT(size, 0U);
engine.Terminate();
- talk_base::LogMessage::RemoveLogToStream(stream.get());
+ rtc::LogMessage::RemoveLogToStream(stream.get());
const char* buf = stream->GetBuffer();
for (size_t i = 0; i < size && cleartext; ++i) {
int ch = static_cast<int>(buf[i]);
@@ -3032,13 +3032,13 @@
// when initiating the engine.
TEST(WebRtcVoiceEngineTest, HasNoMonitorThread) {
cricket::WebRtcVoiceEngine engine;
- talk_base::scoped_ptr<talk_base::MemoryStream> stream(
- new talk_base::MemoryStream);
- talk_base::LogMessage::AddLogToStream(stream.get(), talk_base::LS_VERBOSE);
- engine.SetLogging(talk_base::LS_VERBOSE, "");
- EXPECT_TRUE(engine.Init(talk_base::Thread::Current()));
+ rtc::scoped_ptr<rtc::MemoryStream> stream(
+ new rtc::MemoryStream);
+ rtc::LogMessage::AddLogToStream(stream.get(), rtc::LS_VERBOSE);
+ engine.SetLogging(rtc::LS_VERBOSE, "");
+ EXPECT_TRUE(engine.Init(rtc::Thread::Current()));
engine.Terminate();
- talk_base::LogMessage::RemoveLogToStream(stream.get());
+ rtc::LogMessage::RemoveLogToStream(stream.get());
size_t size = 0;
EXPECT_TRUE(stream->GetSize(&size));
@@ -3128,7 +3128,7 @@
// Tests that VoE supports at least 32 channels
TEST(WebRtcVoiceEngineTest, Has32Channels) {
cricket::WebRtcVoiceEngine engine;
- EXPECT_TRUE(engine.Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine.Init(rtc::Thread::Current()));
cricket::VoiceMediaChannel* channels[32];
int num_channels = 0;
@@ -3154,7 +3154,7 @@
// Test that we set our preferred codecs properly.
TEST(WebRtcVoiceEngineTest, SetRecvCodecs) {
cricket::WebRtcVoiceEngine engine;
- EXPECT_TRUE(engine.Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine.Init(rtc::Thread::Current()));
cricket::WebRtcVoiceMediaChannel channel(&engine);
EXPECT_TRUE(channel.SetRecvCodecs(engine.codecs()));
}
@@ -3168,9 +3168,9 @@
EXPECT_EQ(S_OK, CoInitializeEx(NULL, COINIT_MULTITHREADED));
// Engine should start even with COM already inited.
- EXPECT_TRUE(engine->Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine->Init(rtc::Thread::Current()));
engine->Terminate();
- EXPECT_TRUE(engine->Init(talk_base::Thread::Current()));
+ EXPECT_TRUE(engine->Init(rtc::Thread::Current()));
engine->Terminate();
// Refcount after terminate should be 1 (in reality 3); test if it is nonzero.
@@ -3185,4 +3185,3 @@
CoUninitialize();
}
#endif
-
diff --git a/p2p/base/asyncstuntcpsocket.cc b/p2p/base/asyncstuntcpsocket.cc
index 8bcfa3a..74288f8 100644
--- a/p2p/base/asyncstuntcpsocket.cc
+++ b/p2p/base/asyncstuntcpsocket.cc
@@ -29,8 +29,8 @@
#include <string.h>
-#include "talk/base/common.h"
-#include "talk/base/logging.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/logging.h"
#include "talk/p2p/base/stun.h"
namespace cricket {
@@ -53,20 +53,20 @@
// it. Takes ownership of |socket|. Returns NULL if bind() or
// connect() fail (|socket| is destroyed in that case).
AsyncStunTCPSocket* AsyncStunTCPSocket::Create(
- talk_base::AsyncSocket* socket,
- const talk_base::SocketAddress& bind_address,
- const talk_base::SocketAddress& remote_address) {
+ rtc::AsyncSocket* socket,
+ const rtc::SocketAddress& bind_address,
+ const rtc::SocketAddress& remote_address) {
return new AsyncStunTCPSocket(AsyncTCPSocketBase::ConnectSocket(
socket, bind_address, remote_address), false);
}
AsyncStunTCPSocket::AsyncStunTCPSocket(
- talk_base::AsyncSocket* socket, bool listen)
- : talk_base::AsyncTCPSocketBase(socket, listen, kBufSize) {
+ rtc::AsyncSocket* socket, bool listen)
+ : rtc::AsyncTCPSocketBase(socket, listen, kBufSize) {
}
int AsyncStunTCPSocket::Send(const void *pv, size_t cb,
- const talk_base::PacketOptions& options) {
+ const rtc::PacketOptions& options) {
if (cb > kBufSize || cb < kPacketLenSize + kPacketLenOffset) {
SetError(EMSGSIZE);
return -1;
@@ -101,7 +101,7 @@
}
void AsyncStunTCPSocket::ProcessInput(char* data, size_t* len) {
- talk_base::SocketAddress remote_addr(GetRemoteAddress());
+ rtc::SocketAddress remote_addr(GetRemoteAddress());
// STUN packet - First 4 bytes. Total header size is 20 bytes.
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// |0 0| STUN Message Type | Message Length |
@@ -126,7 +126,7 @@
}
SignalReadPacket(this, data, expected_pkt_len, remote_addr,
- talk_base::CreatePacketTime(0));
+ rtc::CreatePacketTime(0));
*len -= actual_length;
if (*len > 0) {
@@ -136,7 +136,7 @@
}
void AsyncStunTCPSocket::HandleIncomingConnection(
- talk_base::AsyncSocket* socket) {
+ rtc::AsyncSocket* socket) {
SignalNewConnection(this, new AsyncStunTCPSocket(socket, false));
}
@@ -144,9 +144,9 @@
int* pad_bytes) {
*pad_bytes = 0;
PacketLength pkt_len =
- talk_base::GetBE16(static_cast<const char*>(data) + kPacketLenOffset);
+ rtc::GetBE16(static_cast<const char*>(data) + kPacketLenOffset);
size_t expected_pkt_len;
- uint16 msg_type = talk_base::GetBE16(data);
+ uint16 msg_type = rtc::GetBE16(data);
if (IsStunMessage(msg_type)) {
// STUN message.
expected_pkt_len = kStunHeaderSize + pkt_len;
diff --git a/p2p/base/asyncstuntcpsocket.h b/p2p/base/asyncstuntcpsocket.h
index bef8e98..b63c0b5 100644
--- a/p2p/base/asyncstuntcpsocket.h
+++ b/p2p/base/asyncstuntcpsocket.h
@@ -28,29 +28,29 @@
#ifndef TALK_BASE_ASYNCSTUNTCPSOCKET_H_
#define TALK_BASE_ASYNCSTUNTCPSOCKET_H_
-#include "talk/base/asynctcpsocket.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/socketfactory.h"
+#include "webrtc/base/asynctcpsocket.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/socketfactory.h"
namespace cricket {
-class AsyncStunTCPSocket : public talk_base::AsyncTCPSocketBase {
+class AsyncStunTCPSocket : public rtc::AsyncTCPSocketBase {
public:
// Binds and connects |socket| and creates AsyncTCPSocket for
// it. Takes ownership of |socket|. Returns NULL if bind() or
// connect() fail (|socket| is destroyed in that case).
static AsyncStunTCPSocket* Create(
- talk_base::AsyncSocket* socket,
- const talk_base::SocketAddress& bind_address,
- const talk_base::SocketAddress& remote_address);
+ rtc::AsyncSocket* socket,
+ const rtc::SocketAddress& bind_address,
+ const rtc::SocketAddress& remote_address);
- AsyncStunTCPSocket(talk_base::AsyncSocket* socket, bool listen);
+ AsyncStunTCPSocket(rtc::AsyncSocket* socket, bool listen);
virtual ~AsyncStunTCPSocket() {}
virtual int Send(const void* pv, size_t cb,
- const talk_base::PacketOptions& options);
+ const rtc::PacketOptions& options);
virtual void ProcessInput(char* data, size_t* len);
- virtual void HandleIncomingConnection(talk_base::AsyncSocket* socket);
+ virtual void HandleIncomingConnection(rtc::AsyncSocket* socket);
private:
// This method returns the message hdr + length written in the header.
diff --git a/p2p/base/asyncstuntcpsocket_unittest.cc b/p2p/base/asyncstuntcpsocket_unittest.cc
index f3261df..3796c51 100644
--- a/p2p/base/asyncstuntcpsocket_unittest.cc
+++ b/p2p/base/asyncstuntcpsocket_unittest.cc
@@ -25,10 +25,10 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/asyncsocket.h"
-#include "talk/base/gunit.h"
-#include "talk/base/physicalsocketserver.h"
-#include "talk/base/virtualsocketserver.h"
+#include "webrtc/base/asyncsocket.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/physicalsocketserver.h"
+#include "webrtc/base/virtualsocketserver.h"
#include "talk/p2p/base/asyncstuntcpsocket.h"
namespace cricket {
@@ -77,14 +77,14 @@
};
-static const talk_base::SocketAddress kClientAddr("11.11.11.11", 0);
-static const talk_base::SocketAddress kServerAddr("22.22.22.22", 0);
+static const rtc::SocketAddress kClientAddr("11.11.11.11", 0);
+static const rtc::SocketAddress kServerAddr("22.22.22.22", 0);
class AsyncStunTCPSocketTest : public testing::Test,
public sigslot::has_slots<> {
protected:
AsyncStunTCPSocketTest()
- : vss_(new talk_base::VirtualSocketServer(NULL)),
+ : vss_(new rtc::VirtualSocketServer(NULL)),
ss_scope_(vss_.get()) {
}
@@ -93,14 +93,14 @@
}
void CreateSockets() {
- talk_base::AsyncSocket* server = vss_->CreateAsyncSocket(
+ rtc::AsyncSocket* server = vss_->CreateAsyncSocket(
kServerAddr.family(), SOCK_STREAM);
server->Bind(kServerAddr);
recv_socket_.reset(new AsyncStunTCPSocket(server, true));
recv_socket_->SignalNewConnection.connect(
this, &AsyncStunTCPSocketTest::OnNewConnection);
- talk_base::AsyncSocket* client = vss_->CreateAsyncSocket(
+ rtc::AsyncSocket* client = vss_->CreateAsyncSocket(
kClientAddr.family(), SOCK_STREAM);
send_socket_.reset(AsyncStunTCPSocket::Create(
client, kClientAddr, recv_socket_->GetLocalAddress()));
@@ -108,21 +108,21 @@
vss_->ProcessMessagesUntilIdle();
}
- void OnReadPacket(talk_base::AsyncPacketSocket* socket, const char* data,
- size_t len, const talk_base::SocketAddress& remote_addr,
- const talk_base::PacketTime& packet_time) {
+ void OnReadPacket(rtc::AsyncPacketSocket* socket, const char* data,
+ size_t len, const rtc::SocketAddress& remote_addr,
+ const rtc::PacketTime& packet_time) {
recv_packets_.push_back(std::string(data, len));
}
- void OnNewConnection(talk_base::AsyncPacketSocket* server,
- talk_base::AsyncPacketSocket* new_socket) {
+ void OnNewConnection(rtc::AsyncPacketSocket* server,
+ rtc::AsyncPacketSocket* new_socket) {
listen_socket_.reset(new_socket);
new_socket->SignalReadPacket.connect(
this, &AsyncStunTCPSocketTest::OnReadPacket);
}
bool Send(const void* data, size_t len) {
- talk_base::PacketOptions options;
+ rtc::PacketOptions options;
size_t ret = send_socket_->Send(
reinterpret_cast<const char*>(data), len, options);
vss_->ProcessMessagesUntilIdle();
@@ -139,11 +139,11 @@
return ret;
}
- talk_base::scoped_ptr<talk_base::VirtualSocketServer> vss_;
- talk_base::SocketServerScope ss_scope_;
- talk_base::scoped_ptr<AsyncStunTCPSocket> send_socket_;
- talk_base::scoped_ptr<AsyncStunTCPSocket> recv_socket_;
- talk_base::scoped_ptr<talk_base::AsyncPacketSocket> listen_socket_;
+ rtc::scoped_ptr<rtc::VirtualSocketServer> vss_;
+ rtc::SocketServerScope ss_scope_;
+ rtc::scoped_ptr<AsyncStunTCPSocket> send_socket_;
+ rtc::scoped_ptr<AsyncStunTCPSocket> recv_socket_;
+ rtc::scoped_ptr<rtc::AsyncPacketSocket> listen_socket_;
std::list<std::string> recv_packets_;
};
diff --git a/p2p/base/basicpacketsocketfactory.cc b/p2p/base/basicpacketsocketfactory.cc
index 758d492..75a7055 100644
--- a/p2p/base/basicpacketsocketfactory.cc
+++ b/p2p/base/basicpacketsocketfactory.cc
@@ -27,18 +27,18 @@
#include "talk/p2p/base/basicpacketsocketfactory.h"
-#include "talk/base/asyncudpsocket.h"
-#include "talk/base/asynctcpsocket.h"
-#include "talk/base/logging.h"
-#include "talk/base/nethelpers.h"
-#include "talk/base/physicalsocketserver.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/socketadapters.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/asyncudpsocket.h"
+#include "webrtc/base/asynctcpsocket.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/nethelpers.h"
+#include "webrtc/base/physicalsocketserver.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/socketadapters.h"
+#include "webrtc/base/thread.h"
#include "talk/p2p/base/asyncstuntcpsocket.h"
#include "talk/p2p/base/stun.h"
-namespace talk_base {
+namespace rtc {
BasicPacketSocketFactory::BasicPacketSocketFactory()
: thread_(Thread::Current()),
@@ -62,7 +62,7 @@
AsyncPacketSocket* BasicPacketSocketFactory::CreateUdpSocket(
const SocketAddress& address, int min_port, int max_port) {
// UDP sockets are simple.
- talk_base::AsyncSocket* socket =
+ rtc::AsyncSocket* socket =
socket_factory()->CreateAsyncSocket(
address.family(), SOCK_DGRAM);
if (!socket) {
@@ -74,7 +74,7 @@
delete socket;
return NULL;
}
- return new talk_base::AsyncUDPSocket(socket);
+ return new rtc::AsyncUDPSocket(socket);
}
AsyncPacketSocket* BasicPacketSocketFactory::CreateServerTcpSocket(
@@ -86,7 +86,7 @@
return NULL;
}
- talk_base::AsyncSocket* socket =
+ rtc::AsyncSocket* socket =
socket_factory()->CreateAsyncSocket(local_address.family(),
SOCK_STREAM);
if (!socket) {
@@ -103,17 +103,17 @@
// If using SSLTCP, wrap the TCP socket in a pseudo-SSL socket.
if (opts & PacketSocketFactory::OPT_SSLTCP) {
ASSERT(!(opts & PacketSocketFactory::OPT_TLS));
- socket = new talk_base::AsyncSSLSocket(socket);
+ socket = new rtc::AsyncSSLSocket(socket);
}
// Set TCP_NODELAY (via OPT_NODELAY) for improved performance.
// See http://go/gtalktcpnodelayexperiment
- socket->SetOption(talk_base::Socket::OPT_NODELAY, 1);
+ socket->SetOption(rtc::Socket::OPT_NODELAY, 1);
if (opts & PacketSocketFactory::OPT_STUN)
return new cricket::AsyncStunTCPSocket(socket, true);
- return new talk_base::AsyncTCPSocket(socket, true);
+ return new rtc::AsyncTCPSocket(socket, true);
}
AsyncPacketSocket* BasicPacketSocketFactory::CreateClientTcpSocket(
@@ -126,7 +126,7 @@
return NULL;
}
- talk_base::AsyncSocket* socket =
+ rtc::AsyncSocket* socket =
socket_factory()->CreateAsyncSocket(local_address.family(), SOCK_STREAM);
if (!socket) {
return NULL;
@@ -140,11 +140,11 @@
}
// If using a proxy, wrap the socket in a proxy socket.
- if (proxy_info.type == talk_base::PROXY_SOCKS5) {
- socket = new talk_base::AsyncSocksProxySocket(
+ if (proxy_info.type == rtc::PROXY_SOCKS5) {
+ socket = new rtc::AsyncSocksProxySocket(
socket, proxy_info.address, proxy_info.username, proxy_info.password);
- } else if (proxy_info.type == talk_base::PROXY_HTTPS) {
- socket = new talk_base::AsyncHttpsProxySocket(
+ } else if (proxy_info.type == rtc::PROXY_HTTPS) {
+ socket = new rtc::AsyncHttpsProxySocket(
socket, user_agent, proxy_info.address,
proxy_info.username, proxy_info.password);
}
@@ -152,7 +152,7 @@
// If using SSLTCP, wrap the TCP socket in a pseudo-SSL socket.
if (opts & PacketSocketFactory::OPT_SSLTCP) {
ASSERT(!(opts & PacketSocketFactory::OPT_TLS));
- socket = new talk_base::AsyncSSLSocket(socket);
+ socket = new rtc::AsyncSSLSocket(socket);
}
if (socket->Connect(remote_address) < 0) {
@@ -167,18 +167,18 @@
if (opts & PacketSocketFactory::OPT_STUN) {
tcp_socket = new cricket::AsyncStunTCPSocket(socket, false);
} else {
- tcp_socket = new talk_base::AsyncTCPSocket(socket, false);
+ tcp_socket = new rtc::AsyncTCPSocket(socket, false);
}
// Set TCP_NODELAY (via OPT_NODELAY) for improved performance.
// See http://go/gtalktcpnodelayexperiment
- tcp_socket->SetOption(talk_base::Socket::OPT_NODELAY, 1);
+ tcp_socket->SetOption(rtc::Socket::OPT_NODELAY, 1);
return tcp_socket;
}
AsyncResolverInterface* BasicPacketSocketFactory::CreateAsyncResolver() {
- return new talk_base::AsyncResolver();
+ return new rtc::AsyncResolver();
}
int BasicPacketSocketFactory::BindSocket(
@@ -191,7 +191,7 @@
} else {
// Otherwise, try to find a port in the provided range.
for (int port = min_port; ret < 0 && port <= max_port; ++port) {
- ret = socket->Bind(talk_base::SocketAddress(local_address.ipaddr(),
+ ret = socket->Bind(rtc::SocketAddress(local_address.ipaddr(),
port));
}
}
@@ -207,4 +207,4 @@
}
}
-} // namespace talk_base
+} // namespace rtc
diff --git a/p2p/base/basicpacketsocketfactory.h b/p2p/base/basicpacketsocketfactory.h
index 27963c9..b1bae35 100644
--- a/p2p/base/basicpacketsocketfactory.h
+++ b/p2p/base/basicpacketsocketfactory.h
@@ -30,7 +30,7 @@
#include "talk/p2p/base/packetsocketfactory.h"
-namespace talk_base {
+namespace rtc {
class AsyncSocket;
class SocketFactory;
@@ -63,6 +63,6 @@
SocketFactory* socket_factory_;
};
-} // namespace talk_base
+} // namespace rtc
#endif // TALK_BASE_BASICPACKETSOCKETFACTORY_H_
diff --git a/p2p/base/candidate.h b/p2p/base/candidate.h
index 547725d..56174bd 100644
--- a/p2p/base/candidate.h
+++ b/p2p/base/candidate.h
@@ -35,8 +35,8 @@
#include <sstream>
#include <iomanip>
-#include "talk/base/basictypes.h"
-#include "talk/base/socketaddress.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/socketaddress.h"
#include "talk/p2p/base/constants.h"
namespace cricket {
@@ -49,7 +49,7 @@
// candidate-attribute syntax. http://tools.ietf.org/html/rfc5245#section-15.1
Candidate() : component_(0), priority_(0), generation_(0) {}
Candidate(const std::string& id, int component, const std::string& protocol,
- const talk_base::SocketAddress& address, uint32 priority,
+ const rtc::SocketAddress& address, uint32 priority,
const std::string& username, const std::string& password,
const std::string& type, const std::string& network_name,
uint32 generation, const std::string& foundation)
@@ -68,8 +68,8 @@
const std::string & protocol() const { return protocol_; }
void set_protocol(const std::string & protocol) { protocol_ = protocol; }
- const talk_base::SocketAddress & address() const { return address_; }
- void set_address(const talk_base::SocketAddress & address) {
+ const rtc::SocketAddress & address() const { return address_; }
+ void set_address(const rtc::SocketAddress & address) {
address_ = address;
}
@@ -94,7 +94,7 @@
// This can happen for e.g. when preference = 3.
uint64 prio_val = static_cast<uint64>(preference * 127) << 24;
priority_ = static_cast<uint32>(
- talk_base::_min(prio_val, static_cast<uint64>(UINT_MAX)));
+ rtc::_min(prio_val, static_cast<uint64>(UINT_MAX)));
}
const std::string & username() const { return username_; }
@@ -132,11 +132,11 @@
foundation_ = foundation;
}
- const talk_base::SocketAddress & related_address() const {
+ const rtc::SocketAddress & related_address() const {
return related_address_;
}
void set_related_address(
- const talk_base::SocketAddress & related_address) {
+ const rtc::SocketAddress & related_address) {
related_address_ = related_address;
}
@@ -166,7 +166,8 @@
}
uint32 GetPriority(uint32 type_preference,
- int network_adapter_preference) const {
+ int network_adapter_preference,
+ int relay_preference) const {
// RFC 5245 - 4.1.2.1.
// priority = (2^24)*(type preference) +
// (2^8)*(local preference) +
@@ -181,10 +182,11 @@
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// NIC Type - Type of the network adapter e.g. 3G/Wifi/Wired.
// Addr Pref - Address preference value as per RFC 3484.
- // local preference is calculated as - NIC Type << 8 | Addr_Pref.
+ // local preference = (NIC Type << 8 | Addr_Pref) - relay preference.
int addr_pref = IPAddressPrecedence(address_.ipaddr());
- int local_preference = (network_adapter_preference << 8) | addr_pref;
+ int local_preference = ((network_adapter_preference << 8) | addr_pref) +
+ relay_preference;
return (type_preference << 24) |
(local_preference << 8) |
@@ -206,7 +208,7 @@
std::string id_;
int component_;
std::string protocol_;
- talk_base::SocketAddress address_;
+ rtc::SocketAddress address_;
uint32 priority_;
std::string username_;
std::string password_;
@@ -214,7 +216,7 @@
std::string network_name_;
uint32 generation_;
std::string foundation_;
- talk_base::SocketAddress related_address_;
+ rtc::SocketAddress related_address_;
};
} // namespace cricket
diff --git a/p2p/base/common.h b/p2p/base/common.h
index 5a38180..a33e9e0 100644
--- a/p2p/base/common.h
+++ b/p2p/base/common.h
@@ -28,7 +28,7 @@
#ifndef TALK_P2P_BASE_COMMON_H_
#define TALK_P2P_BASE_COMMON_H_
-#include "talk/base/logging.h"
+#include "webrtc/base/logging.h"
// Common log description format for jingle messages
#define LOG_J(sev, obj) LOG(sev) << "Jingle:" << obj->ToString() << ": "
diff --git a/p2p/base/dtlstransport.h b/p2p/base/dtlstransport.h
index 641f572..318c14a 100644
--- a/p2p/base/dtlstransport.h
+++ b/p2p/base/dtlstransport.h
@@ -31,7 +31,7 @@
#include "talk/p2p/base/dtlstransportchannel.h"
#include "talk/p2p/base/transport.h"
-namespace talk_base {
+namespace rtc {
class SSLIdentity;
}
@@ -43,23 +43,23 @@
template<class Base>
class DtlsTransport : public Base {
public:
- DtlsTransport(talk_base::Thread* signaling_thread,
- talk_base::Thread* worker_thread,
+ DtlsTransport(rtc::Thread* signaling_thread,
+ rtc::Thread* worker_thread,
const std::string& content_name,
PortAllocator* allocator,
- talk_base::SSLIdentity* identity)
+ rtc::SSLIdentity* identity)
: Base(signaling_thread, worker_thread, content_name, allocator),
identity_(identity),
- secure_role_(talk_base::SSL_CLIENT) {
+ secure_role_(rtc::SSL_CLIENT) {
}
~DtlsTransport() {
Base::DestroyAllChannels();
}
- virtual void SetIdentity_w(talk_base::SSLIdentity* identity) {
+ virtual void SetIdentity_w(rtc::SSLIdentity* identity) {
identity_ = identity;
}
- virtual bool GetIdentity_w(talk_base::SSLIdentity** identity) {
+ virtual bool GetIdentity_w(rtc::SSLIdentity** identity) {
if (!identity_)
return false;
@@ -69,14 +69,14 @@
virtual bool ApplyLocalTransportDescription_w(TransportChannelImpl* channel,
std::string* error_desc) {
- talk_base::SSLFingerprint* local_fp =
+ rtc::SSLFingerprint* local_fp =
Base::local_description()->identity_fingerprint.get();
if (local_fp) {
// Sanity check local fingerprint.
if (identity_) {
- talk_base::scoped_ptr<talk_base::SSLFingerprint> local_fp_tmp(
- talk_base::SSLFingerprint::Create(local_fp->algorithm,
+ rtc::scoped_ptr<rtc::SSLFingerprint> local_fp_tmp(
+ rtc::SSLFingerprint::Create(local_fp->algorithm,
identity_));
ASSERT(local_fp_tmp.get() != NULL);
if (!(*local_fp_tmp == *local_fp)) {
@@ -112,13 +112,13 @@
return BadTransportDescription(msg, error_desc);
}
- talk_base::SSLFingerprint* local_fp =
+ rtc::SSLFingerprint* local_fp =
Base::local_description()->identity_fingerprint.get();
- talk_base::SSLFingerprint* remote_fp =
+ rtc::SSLFingerprint* remote_fp =
Base::remote_description()->identity_fingerprint.get();
if (remote_fp && local_fp) {
- remote_fingerprint_.reset(new talk_base::SSLFingerprint(*remote_fp));
+ remote_fingerprint_.reset(new rtc::SSLFingerprint(*remote_fp));
// From RFC 4145, section-4.1, The following are the values that the
// 'setup' attribute can take in an offer/answer exchange:
@@ -188,8 +188,8 @@
// If local is passive, local will act as server.
}
- secure_role_ = is_remote_server ? talk_base::SSL_CLIENT :
- talk_base::SSL_SERVER;
+ secure_role_ = is_remote_server ? rtc::SSL_CLIENT :
+ rtc::SSL_SERVER;
} else if (local_fp && (local_role == CA_ANSWER)) {
return BadTransportDescription(
@@ -197,7 +197,7 @@
error_desc);
} else {
// We are not doing DTLS
- remote_fingerprint_.reset(new talk_base::SSLFingerprint(
+ remote_fingerprint_.reset(new rtc::SSLFingerprint(
"", NULL, 0));
}
@@ -219,7 +219,7 @@
Base::DestroyTransportChannel(base_channel);
}
- virtual bool GetSslRole_w(talk_base::SSLRole* ssl_role) const {
+ virtual bool GetSslRole_w(rtc::SSLRole* ssl_role) const {
ASSERT(ssl_role != NULL);
*ssl_role = secure_role_;
return true;
@@ -247,9 +247,9 @@
return Base::ApplyNegotiatedTransportDescription_w(channel, error_desc);
}
- talk_base::SSLIdentity* identity_;
- talk_base::SSLRole secure_role_;
- talk_base::scoped_ptr<talk_base::SSLFingerprint> remote_fingerprint_;
+ rtc::SSLIdentity* identity_;
+ rtc::SSLRole secure_role_;
+ rtc::scoped_ptr<rtc::SSLFingerprint> remote_fingerprint_;
};
} // namespace cricket
diff --git a/p2p/base/dtlstransportchannel.cc b/p2p/base/dtlstransportchannel.cc
index 416e6e9..85da4a9 100644
--- a/p2p/base/dtlstransportchannel.cc
+++ b/p2p/base/dtlstransportchannel.cc
@@ -28,12 +28,12 @@
#include "talk/p2p/base/dtlstransportchannel.h"
-#include "talk/base/buffer.h"
-#include "talk/base/dscp.h"
-#include "talk/base/messagequeue.h"
-#include "talk/base/stream.h"
-#include "talk/base/sslstreamadapter.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/buffer.h"
+#include "webrtc/base/dscp.h"
+#include "webrtc/base/messagequeue.h"
+#include "webrtc/base/stream.h"
+#include "webrtc/base/sslstreamadapter.h"
+#include "webrtc/base/thread.h"
#include "talk/p2p/base/common.h"
namespace cricket {
@@ -52,45 +52,45 @@
return (len >= kMinRtpPacketLen && (u[0] & 0xC0) == 0x80);
}
-talk_base::StreamResult StreamInterfaceChannel::Read(void* buffer,
+rtc::StreamResult StreamInterfaceChannel::Read(void* buffer,
size_t buffer_len,
size_t* read,
int* error) {
- if (state_ == talk_base::SS_CLOSED)
- return talk_base::SR_EOS;
- if (state_ == talk_base::SS_OPENING)
- return talk_base::SR_BLOCK;
+ if (state_ == rtc::SS_CLOSED)
+ return rtc::SR_EOS;
+ if (state_ == rtc::SS_OPENING)
+ return rtc::SR_BLOCK;
return fifo_.Read(buffer, buffer_len, read, error);
}
-talk_base::StreamResult StreamInterfaceChannel::Write(const void* data,
+rtc::StreamResult StreamInterfaceChannel::Write(const void* data,
size_t data_len,
size_t* written,
int* error) {
// Always succeeds, since this is an unreliable transport anyway.
// TODO: Should this block if channel_'s temporarily unwritable?
- talk_base::PacketOptions packet_options;
+ rtc::PacketOptions packet_options;
channel_->SendPacket(static_cast<const char*>(data), data_len,
packet_options);
if (written) {
*written = data_len;
}
- return talk_base::SR_SUCCESS;
+ return rtc::SR_SUCCESS;
}
bool StreamInterfaceChannel::OnPacketReceived(const char* data, size_t size) {
// We force a read event here to ensure that we don't overflow our FIFO.
// Under high packet rate this can occur if we wait for the FIFO to post its
// own SE_READ.
- bool ret = (fifo_.WriteAll(data, size, NULL, NULL) == talk_base::SR_SUCCESS);
+ bool ret = (fifo_.WriteAll(data, size, NULL, NULL) == rtc::SR_SUCCESS);
if (ret) {
- SignalEvent(this, talk_base::SE_READ, 0);
+ SignalEvent(this, rtc::SE_READ, 0);
}
return ret;
}
-void StreamInterfaceChannel::OnEvent(talk_base::StreamInterface* stream,
+void StreamInterfaceChannel::OnEvent(rtc::StreamInterface* stream,
int sig, int err) {
SignalEvent(this, sig, err);
}
@@ -100,12 +100,12 @@
TransportChannelImpl* channel)
: TransportChannelImpl(channel->content_name(), channel->component()),
transport_(transport),
- worker_thread_(talk_base::Thread::Current()),
+ worker_thread_(rtc::Thread::Current()),
channel_(channel),
downward_(NULL),
dtls_state_(STATE_NONE),
local_identity_(NULL),
- ssl_role_(talk_base::SSL_CLIENT) {
+ ssl_role_(rtc::SSL_CLIENT) {
channel_->SignalReadableState.connect(this,
&DtlsTransportChannelWrapper::OnReadableState);
channel_->SignalWritableState.connect(this,
@@ -155,7 +155,7 @@
}
bool DtlsTransportChannelWrapper::SetLocalIdentity(
- talk_base::SSLIdentity* identity) {
+ rtc::SSLIdentity* identity) {
if (dtls_state_ != STATE_NONE) {
if (identity == local_identity_) {
// This may happen during renegotiation.
@@ -178,7 +178,7 @@
}
bool DtlsTransportChannelWrapper::GetLocalIdentity(
- talk_base::SSLIdentity** identity) const {
+ rtc::SSLIdentity** identity) const {
if (!local_identity_)
return false;
@@ -186,7 +186,7 @@
return true;
}
-bool DtlsTransportChannelWrapper::SetSslRole(talk_base::SSLRole role) {
+bool DtlsTransportChannelWrapper::SetSslRole(rtc::SSLRole role) {
if (dtls_state_ == STATE_OPEN) {
if (ssl_role_ != role) {
LOG(LS_ERROR) << "SSL Role can't be reversed after the session is setup.";
@@ -199,7 +199,7 @@
return true;
}
-bool DtlsTransportChannelWrapper::GetSslRole(talk_base::SSLRole* role) const {
+bool DtlsTransportChannelWrapper::GetSslRole(rtc::SSLRole* role) const {
*role = ssl_role_;
return true;
}
@@ -209,7 +209,7 @@
const uint8* digest,
size_t digest_len) {
- talk_base::Buffer remote_fingerprint_value(digest, digest_len);
+ rtc::Buffer remote_fingerprint_value(digest, digest_len);
if (dtls_state_ != STATE_NONE &&
remote_fingerprint_value_ == remote_fingerprint_value &&
@@ -247,7 +247,7 @@
}
bool DtlsTransportChannelWrapper::GetRemoteCertificate(
- talk_base::SSLCertificate** cert) const {
+ rtc::SSLCertificate** cert) const {
if (!dtls_)
return false;
@@ -258,7 +258,7 @@
StreamInterfaceChannel* downward =
new StreamInterfaceChannel(worker_thread_, channel_);
- dtls_.reset(talk_base::SSLStreamAdapter::Create(downward));
+ dtls_.reset(rtc::SSLStreamAdapter::Create(downward));
if (!dtls_) {
LOG_J(LS_ERROR, this) << "Failed to create DTLS adapter.";
delete downward;
@@ -268,7 +268,7 @@
downward_ = downward;
dtls_->SetIdentity(local_identity_->GetReference());
- dtls_->SetMode(talk_base::SSL_MODE_DTLS);
+ dtls_->SetMode(rtc::SSL_MODE_DTLS);
dtls_->SetServerRole(ssl_role_);
dtls_->SignalEvent.connect(this, &DtlsTransportChannelWrapper::OnDtlsEvent);
if (!dtls_->SetPeerCertificateDigest(
@@ -347,7 +347,7 @@
// Called from upper layers to send a media packet.
int DtlsTransportChannelWrapper::SendPacket(
const char* data, size_t size,
- const talk_base::PacketOptions& options, int flags) {
+ const rtc::PacketOptions& options, int flags) {
int result = -1;
switch (dtls_state_) {
@@ -374,7 +374,7 @@
result = channel_->SendPacket(data, size, options);
} else {
result = (dtls_->WriteAll(data, size, NULL, NULL) ==
- talk_base::SR_SUCCESS) ? static_cast<int>(size) : -1;
+ rtc::SR_SUCCESS) ? static_cast<int>(size) : -1;
}
break;
// Not doing DTLS.
@@ -400,7 +400,7 @@
// - Once the DTLS handshake completes, the state is that of the
// impl again
void DtlsTransportChannelWrapper::OnReadableState(TransportChannel* channel) {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ ASSERT(rtc::Thread::Current() == worker_thread_);
ASSERT(channel == channel_);
LOG_J(LS_VERBOSE, this)
<< "DTLSTransportChannelWrapper: channel readable state changed.";
@@ -412,7 +412,7 @@
}
void DtlsTransportChannelWrapper::OnWritableState(TransportChannel* channel) {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ ASSERT(rtc::Thread::Current() == worker_thread_);
ASSERT(channel == channel_);
LOG_J(LS_VERBOSE, this)
<< "DTLSTransportChannelWrapper: channel writable state changed.";
@@ -454,8 +454,8 @@
void DtlsTransportChannelWrapper::OnReadPacket(
TransportChannel* channel, const char* data, size_t size,
- const talk_base::PacketTime& packet_time, int flags) {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ const rtc::PacketTime& packet_time, int flags) {
+ ASSERT(rtc::Thread::Current() == worker_thread_);
ASSERT(channel == channel_);
ASSERT(flags == 0);
@@ -521,14 +521,14 @@
}
}
-void DtlsTransportChannelWrapper::OnDtlsEvent(talk_base::StreamInterface* dtls,
+void DtlsTransportChannelWrapper::OnDtlsEvent(rtc::StreamInterface* dtls,
int sig, int err) {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ ASSERT(rtc::Thread::Current() == worker_thread_);
ASSERT(dtls == dtls_.get());
- if (sig & talk_base::SE_OPEN) {
+ if (sig & rtc::SE_OPEN) {
// This is the first time.
LOG_J(LS_INFO, this) << "DTLS handshake complete.";
- if (dtls_->GetState() == talk_base::SS_OPEN) {
+ if (dtls_->GetState() == rtc::SS_OPEN) {
// The check for OPEN shouldn't be necessary but let's make
// sure we don't accidentally frob the state if it's closed.
dtls_state_ = STATE_OPEN;
@@ -537,15 +537,15 @@
set_writable(true);
}
}
- if (sig & talk_base::SE_READ) {
+ if (sig & rtc::SE_READ) {
char buf[kMaxDtlsPacketLen];
size_t read;
- if (dtls_->Read(buf, sizeof(buf), &read, NULL) == talk_base::SR_SUCCESS) {
- SignalReadPacket(this, buf, read, talk_base::CreatePacketTime(0), 0);
+ if (dtls_->Read(buf, sizeof(buf), &read, NULL) == rtc::SR_SUCCESS) {
+ SignalReadPacket(this, buf, read, rtc::CreatePacketTime(0), 0);
}
}
- if (sig & talk_base::SE_CLOSE) {
- ASSERT(sig == talk_base::SE_CLOSE); // SE_CLOSE should be by itself.
+ if (sig & rtc::SE_CLOSE) {
+ ASSERT(sig == rtc::SE_CLOSE); // SE_CLOSE should be by itself.
if (!err) {
LOG_J(LS_INFO, this) << "DTLS channel closed";
} else {
diff --git a/p2p/base/dtlstransportchannel.h b/p2p/base/dtlstransportchannel.h
index 232d400..c4082d3 100644
--- a/p2p/base/dtlstransportchannel.h
+++ b/p2p/base/dtlstransportchannel.h
@@ -32,22 +32,22 @@
#include <string>
#include <vector>
-#include "talk/base/buffer.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/sslstreamadapter.h"
-#include "talk/base/stream.h"
+#include "webrtc/base/buffer.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/sslstreamadapter.h"
+#include "webrtc/base/stream.h"
#include "talk/p2p/base/transportchannelimpl.h"
namespace cricket {
// A bridge between a packet-oriented/channel-type interface on
// the bottom and a StreamInterface on the top.
-class StreamInterfaceChannel : public talk_base::StreamInterface,
+class StreamInterfaceChannel : public rtc::StreamInterface,
public sigslot::has_slots<> {
public:
- StreamInterfaceChannel(talk_base::Thread* owner, TransportChannel* channel)
+ StreamInterfaceChannel(rtc::Thread* owner, TransportChannel* channel)
: channel_(channel),
- state_(talk_base::SS_OPEN),
+ state_(rtc::SS_OPEN),
fifo_(kFifoSize, owner) {
fifo_.SignalEvent.connect(this, &StreamInterfaceChannel::OnEvent);
}
@@ -56,22 +56,22 @@
bool OnPacketReceived(const char* data, size_t size);
// Implementations of StreamInterface
- virtual talk_base::StreamState GetState() const { return state_; }
- virtual void Close() { state_ = talk_base::SS_CLOSED; }
- virtual talk_base::StreamResult Read(void* buffer, size_t buffer_len,
+ virtual rtc::StreamState GetState() const { return state_; }
+ virtual void Close() { state_ = rtc::SS_CLOSED; }
+ virtual rtc::StreamResult Read(void* buffer, size_t buffer_len,
size_t* read, int* error);
- virtual talk_base::StreamResult Write(const void* data, size_t data_len,
+ virtual rtc::StreamResult Write(const void* data, size_t data_len,
size_t* written, int* error);
private:
static const size_t kFifoSize = 8192;
// Forward events
- virtual void OnEvent(talk_base::StreamInterface* stream, int sig, int err);
+ virtual void OnEvent(rtc::StreamInterface* stream, int sig, int err);
TransportChannel* channel_; // owned by DtlsTransportChannelWrapper
- talk_base::StreamState state_;
- talk_base::FifoBuffer fifo_;
+ rtc::StreamState state_;
+ rtc::FifoBuffer fifo_;
DISALLOW_COPY_AND_ASSIGN(StreamInterfaceChannel);
};
@@ -130,8 +130,8 @@
virtual size_t GetConnectionCount() const {
return channel_->GetConnectionCount();
}
- virtual bool SetLocalIdentity(talk_base::SSLIdentity *identity);
- virtual bool GetLocalIdentity(talk_base::SSLIdentity** identity) const;
+ virtual bool SetLocalIdentity(rtc::SSLIdentity *identity);
+ virtual bool GetLocalIdentity(rtc::SSLIdentity** identity) const;
virtual bool SetRemoteFingerprint(const std::string& digest_alg,
const uint8* digest,
@@ -140,11 +140,11 @@
// Called to send a packet (via DTLS, if turned on).
virtual int SendPacket(const char* data, size_t size,
- const talk_base::PacketOptions& options,
+ const rtc::PacketOptions& options,
int flags);
// TransportChannel calls that we forward to the wrapped transport.
- virtual int SetOption(talk_base::Socket::Option opt, int value) {
+ virtual int SetOption(rtc::Socket::Option opt, int value) {
return channel_->SetOption(opt, value);
}
virtual int GetError() {
@@ -165,12 +165,12 @@
// Find out which DTLS-SRTP cipher was negotiated
virtual bool GetSrtpCipher(std::string* cipher);
- virtual bool GetSslRole(talk_base::SSLRole* role) const;
- virtual bool SetSslRole(talk_base::SSLRole role);
+ virtual bool GetSslRole(rtc::SSLRole* role) const;
+ virtual bool SetSslRole(rtc::SSLRole role);
// Once DTLS has been established, this method retrieves the certificate in
// use by the remote peer, for use in external identity verification.
- virtual bool GetRemoteCertificate(talk_base::SSLCertificate** cert) const;
+ virtual bool GetRemoteCertificate(rtc::SSLCertificate** cert) const;
// Once DTLS has established (i.e., this channel is writable), this method
// extracts the keys negotiated during the DTLS handshake, for use in external
@@ -231,9 +231,9 @@
void OnReadableState(TransportChannel* channel);
void OnWritableState(TransportChannel* channel);
void OnReadPacket(TransportChannel* channel, const char* data, size_t size,
- const talk_base::PacketTime& packet_time, int flags);
+ const rtc::PacketTime& packet_time, int flags);
void OnReadyToSend(TransportChannel* channel);
- void OnDtlsEvent(talk_base::StreamInterface* stream_, int sig, int err);
+ void OnDtlsEvent(rtc::StreamInterface* stream_, int sig, int err);
bool SetupDtls();
bool MaybeStartDtls();
bool HandleDtlsPacket(const char* data, size_t size);
@@ -245,15 +245,15 @@
void OnConnectionRemoved(TransportChannelImpl* channel);
Transport* transport_; // The transport_ that created us.
- talk_base::Thread* worker_thread_; // Everything should occur on this thread.
+ rtc::Thread* worker_thread_; // Everything should occur on this thread.
TransportChannelImpl* channel_; // Underlying channel, owned by transport_.
- talk_base::scoped_ptr<talk_base::SSLStreamAdapter> dtls_; // The DTLS stream
+ rtc::scoped_ptr<rtc::SSLStreamAdapter> dtls_; // The DTLS stream
StreamInterfaceChannel* downward_; // Wrapper for channel_, owned by dtls_.
std::vector<std::string> srtp_ciphers_; // SRTP ciphers to use with DTLS.
State dtls_state_;
- talk_base::SSLIdentity* local_identity_;
- talk_base::SSLRole ssl_role_;
- talk_base::Buffer remote_fingerprint_value_;
+ rtc::SSLIdentity* local_identity_;
+ rtc::SSLRole ssl_role_;
+ rtc::Buffer remote_fingerprint_value_;
std::string remote_fingerprint_algorithm_;
DISALLOW_COPY_AND_ASSIGN(DtlsTransportChannelWrapper);
diff --git a/p2p/base/dtlstransportchannel_unittest.cc b/p2p/base/dtlstransportchannel_unittest.cc
index 5727ac4..ce4951a 100644
--- a/p2p/base/dtlstransportchannel_unittest.cc
+++ b/p2p/base/dtlstransportchannel_unittest.cc
@@ -28,21 +28,21 @@
#include <set>
-#include "talk/base/common.h"
-#include "talk/base/dscp.h"
-#include "talk/base/gunit.h"
-#include "talk/base/helpers.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/stringutils.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/dscp.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/stringutils.h"
+#include "webrtc/base/thread.h"
#include "talk/p2p/base/fakesession.h"
-#include "talk/base/ssladapter.h"
-#include "talk/base/sslidentity.h"
-#include "talk/base/sslstreamadapter.h"
+#include "webrtc/base/ssladapter.h"
+#include "webrtc/base/sslidentity.h"
+#include "webrtc/base/sslstreamadapter.h"
#include "talk/p2p/base/dtlstransport.h"
#define MAYBE_SKIP_TEST(feature) \
- if (!(talk_base::SSLStreamAdapter::feature())) { \
+ if (!(rtc::SSLStreamAdapter::feature())) { \
LOG(LS_INFO) << "Feature disabled... skipping"; \
return; \
}
@@ -64,8 +64,8 @@
class DtlsTestClient : public sigslot::has_slots<> {
public:
DtlsTestClient(const std::string& name,
- talk_base::Thread* signaling_thread,
- talk_base::Thread* worker_thread) :
+ rtc::Thread* signaling_thread,
+ rtc::Thread* worker_thread) :
name_(name),
signaling_thread_(signaling_thread),
worker_thread_(worker_thread),
@@ -80,9 +80,9 @@
protocol_ = proto;
}
void CreateIdentity() {
- identity_.reset(talk_base::SSLIdentity::Generate(name_));
+ identity_.reset(rtc::SSLIdentity::Generate(name_));
}
- talk_base::SSLIdentity* identity() { return identity_.get(); }
+ rtc::SSLIdentity* identity() { return identity_.get(); }
void SetupSrtp() {
ASSERT(identity_.get() != NULL);
use_dtls_srtp_ = true;
@@ -135,22 +135,22 @@
}
// Allow any DTLS configuration to be specified (including invalid ones).
- void Negotiate(talk_base::SSLIdentity* local_identity,
- talk_base::SSLIdentity* remote_identity,
+ void Negotiate(rtc::SSLIdentity* local_identity,
+ rtc::SSLIdentity* remote_identity,
cricket::ContentAction action,
ConnectionRole local_role,
ConnectionRole remote_role,
int flags) {
- talk_base::scoped_ptr<talk_base::SSLFingerprint> local_fingerprint;
- talk_base::scoped_ptr<talk_base::SSLFingerprint> remote_fingerprint;
+ rtc::scoped_ptr<rtc::SSLFingerprint> local_fingerprint;
+ rtc::scoped_ptr<rtc::SSLFingerprint> remote_fingerprint;
if (local_identity) {
- local_fingerprint.reset(talk_base::SSLFingerprint::Create(
- talk_base::DIGEST_SHA_1, local_identity));
+ local_fingerprint.reset(rtc::SSLFingerprint::Create(
+ rtc::DIGEST_SHA_1, local_identity));
ASSERT_TRUE(local_fingerprint.get() != NULL);
}
if (remote_identity) {
- remote_fingerprint.reset(talk_base::SSLFingerprint::Create(
- talk_base::DIGEST_SHA_1, remote_identity));
+ remote_fingerprint.reset(rtc::SSLFingerprint::Create(
+ rtc::DIGEST_SHA_1, remote_identity));
ASSERT_TRUE(remote_fingerprint.get() != NULL);
}
@@ -205,8 +205,8 @@
bool writable() const { return transport_->writable(); }
- void CheckRole(talk_base::SSLRole role) {
- if (role == talk_base::SSL_CLIENT) {
+ void CheckRole(rtc::SSLRole role) {
+ if (role == rtc::SSL_CLIENT) {
ASSERT_FALSE(received_dtls_client_hello_);
ASSERT_TRUE(received_dtls_server_hello_);
} else {
@@ -233,19 +233,19 @@
void SendPackets(size_t channel, size_t size, size_t count, bool srtp) {
ASSERT(channel < channels_.size());
- talk_base::scoped_ptr<char[]> packet(new char[size]);
+ rtc::scoped_ptr<char[]> packet(new char[size]);
size_t sent = 0;
do {
// Fill the packet with a known value and a sequence number to check
// against, and make sure that it doesn't look like DTLS.
memset(packet.get(), sent & 0xff, size);
packet[0] = (srtp) ? 0x80 : 0x00;
- talk_base::SetBE32(packet.get() + kPacketNumOffset,
+ rtc::SetBE32(packet.get() + kPacketNumOffset,
static_cast<uint32>(sent));
// Only set the bypass flag if we've activated DTLS.
int flags = (identity_.get() && srtp) ? cricket::PF_SRTP_BYPASS : 0;
- talk_base::PacketOptions packet_options;
+ rtc::PacketOptions packet_options;
int rv = channels_[channel]->SendPacket(
packet.get(), size, packet_options, flags);
ASSERT_GT(rv, 0);
@@ -256,11 +256,11 @@
int SendInvalidSrtpPacket(size_t channel, size_t size) {
ASSERT(channel < channels_.size());
- talk_base::scoped_ptr<char[]> packet(new char[size]);
+ rtc::scoped_ptr<char[]> packet(new char[size]);
// Fill the packet with 0 to form an invalid SRTP packet.
memset(packet.get(), 0, size);
- talk_base::PacketOptions packet_options;
+ rtc::PacketOptions packet_options;
return channels_[channel]->SendPacket(
packet.get(), size, packet_options, cricket::PF_SRTP_BYPASS);
}
@@ -279,7 +279,7 @@
(data[0] != 0 && static_cast<uint8>(data[0]) != 0x80)) {
return false;
}
- uint32 packet_num = talk_base::GetBE32(data + kPacketNumOffset);
+ uint32 packet_num = rtc::GetBE32(data + kPacketNumOffset);
for (size_t i = kPacketHeaderLen; i < size; ++i) {
if (static_cast<uint8>(data[i]) != (packet_num & 0xff)) {
return false;
@@ -296,7 +296,7 @@
if (size <= packet_size_) {
return false;
}
- uint32 packet_num = talk_base::GetBE32(data + kPacketNumOffset);
+ uint32 packet_num = rtc::GetBE32(data + kPacketNumOffset);
int num_matches = 0;
for (size_t i = kPacketNumOffset; i < size; ++i) {
if (static_cast<uint8>(data[i]) == (packet_num & 0xff)) {
@@ -319,7 +319,7 @@
void OnTransportChannelReadPacket(cricket::TransportChannel* channel,
const char* data, size_t size,
- const talk_base::PacketTime& packet_time,
+ const rtc::PacketTime& packet_time,
int flags) {
uint32 packet_num = 0;
ASSERT_TRUE(VerifyPacket(data, size, &packet_num));
@@ -333,7 +333,7 @@
// Hook into the raw packet stream to make sure DTLS packets are encrypted.
void OnFakeTransportChannelReadPacket(cricket::TransportChannel* channel,
const char* data, size_t size,
- const talk_base::PacketTime& time,
+ const rtc::PacketTime& time,
int flags) {
// Flags shouldn't be set on the underlying TransportChannel packets.
ASSERT_EQ(0, flags);
@@ -360,11 +360,11 @@
private:
std::string name_;
- talk_base::Thread* signaling_thread_;
- talk_base::Thread* worker_thread_;
+ rtc::Thread* signaling_thread_;
+ rtc::Thread* worker_thread_;
cricket::TransportProtocol protocol_;
- talk_base::scoped_ptr<talk_base::SSLIdentity> identity_;
- talk_base::scoped_ptr<cricket::FakeTransport> transport_;
+ rtc::scoped_ptr<rtc::SSLIdentity> identity_;
+ rtc::scoped_ptr<cricket::FakeTransport> transport_;
std::vector<cricket::DtlsTransportChannelWrapper*> channels_;
size_t packet_size_;
std::set<int> received_;
@@ -378,18 +378,18 @@
class DtlsTransportChannelTest : public testing::Test {
public:
static void SetUpTestCase() {
- talk_base::InitializeSSL();
+ rtc::InitializeSSL();
}
static void TearDownTestCase() {
- talk_base::CleanupSSL();
+ rtc::CleanupSSL();
}
DtlsTransportChannelTest() :
- client1_("P1", talk_base::Thread::Current(),
- talk_base::Thread::Current()),
- client2_("P2", talk_base::Thread::Current(),
- talk_base::Thread::Current()),
+ client1_("P1", rtc::Thread::Current(),
+ rtc::Thread::Current()),
+ client2_("P2", rtc::Thread::Current(),
+ rtc::Thread::Current()),
channel_ct_(1),
use_dtls_(false),
use_dtls_srtp_(false) {
@@ -435,17 +435,17 @@
// Check that we used the right roles.
if (use_dtls_) {
- talk_base::SSLRole client1_ssl_role =
+ rtc::SSLRole client1_ssl_role =
(client1_role == cricket::CONNECTIONROLE_ACTIVE ||
(client2_role == cricket::CONNECTIONROLE_PASSIVE &&
client1_role == cricket::CONNECTIONROLE_ACTPASS)) ?
- talk_base::SSL_CLIENT : talk_base::SSL_SERVER;
+ rtc::SSL_CLIENT : rtc::SSL_SERVER;
- talk_base::SSLRole client2_ssl_role =
+ rtc::SSLRole client2_ssl_role =
(client2_role == cricket::CONNECTIONROLE_ACTIVE ||
(client1_role == cricket::CONNECTIONROLE_PASSIVE &&
client2_role == cricket::CONNECTIONROLE_ACTPASS)) ?
- talk_base::SSL_CLIENT : talk_base::SSL_SERVER;
+ rtc::SSL_CLIENT : rtc::SSL_SERVER;
client1_.CheckRole(client1_ssl_role);
client2_.CheckRole(client2_ssl_role);
@@ -701,12 +701,12 @@
MAYBE_SKIP_TEST(HaveDtlsSrtp);
PrepareDtls(true, true);
NegotiateWithLegacy();
- talk_base::SSLRole channel1_role;
- talk_base::SSLRole channel2_role;
+ rtc::SSLRole channel1_role;
+ rtc::SSLRole channel2_role;
EXPECT_TRUE(client1_.transport()->GetSslRole(&channel1_role));
EXPECT_TRUE(client2_.transport()->GetSslRole(&channel2_role));
- EXPECT_EQ(talk_base::SSL_SERVER, channel1_role);
- EXPECT_EQ(talk_base::SSL_CLIENT, channel2_role);
+ EXPECT_EQ(rtc::SSL_SERVER, channel1_role);
+ EXPECT_EQ(rtc::SSL_CLIENT, channel2_role);
}
// Testing re offer/answer after the session is estbalished. Roles will be
@@ -801,10 +801,10 @@
PrepareDtls(true, true);
Negotiate();
- talk_base::scoped_ptr<talk_base::SSLIdentity> identity1;
- talk_base::scoped_ptr<talk_base::SSLIdentity> identity2;
- talk_base::scoped_ptr<talk_base::SSLCertificate> remote_cert1;
- talk_base::scoped_ptr<talk_base::SSLCertificate> remote_cert2;
+ rtc::scoped_ptr<rtc::SSLIdentity> identity1;
+ rtc::scoped_ptr<rtc::SSLIdentity> identity2;
+ rtc::scoped_ptr<rtc::SSLCertificate> remote_cert1;
+ rtc::scoped_ptr<rtc::SSLCertificate> remote_cert2;
// After negotiation, each side has a distinct local certificate, but still no
// remote certificate, because connection has not yet occurred.
@@ -826,10 +826,10 @@
PrepareDtls(true, true);
ASSERT_TRUE(Connect());
- talk_base::scoped_ptr<talk_base::SSLIdentity> identity1;
- talk_base::scoped_ptr<talk_base::SSLIdentity> identity2;
- talk_base::scoped_ptr<talk_base::SSLCertificate> remote_cert1;
- talk_base::scoped_ptr<talk_base::SSLCertificate> remote_cert2;
+ rtc::scoped_ptr<rtc::SSLIdentity> identity1;
+ rtc::scoped_ptr<rtc::SSLIdentity> identity2;
+ rtc::scoped_ptr<rtc::SSLCertificate> remote_cert1;
+ rtc::scoped_ptr<rtc::SSLCertificate> remote_cert2;
// After connection, each side has a distinct local certificate.
ASSERT_TRUE(client1_.transport()->GetIdentity(identity1.accept()));
diff --git a/p2p/base/fakesession.h b/p2p/base/fakesession.h
index f2c5b84..67b4cd9 100644
--- a/p2p/base/fakesession.h
+++ b/p2p/base/fakesession.h
@@ -32,11 +32,11 @@
#include <string>
#include <vector>
-#include "talk/base/buffer.h"
-#include "talk/base/fakesslidentity.h"
-#include "talk/base/sigslot.h"
-#include "talk/base/sslfingerprint.h"
-#include "talk/base/messagequeue.h"
+#include "webrtc/base/buffer.h"
+#include "webrtc/base/fakesslidentity.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/sslfingerprint.h"
+#include "webrtc/base/messagequeue.h"
#include "talk/p2p/base/session.h"
#include "talk/p2p/base/transport.h"
#include "talk/p2p/base/transportchannel.h"
@@ -46,17 +46,17 @@
class FakeTransport;
-struct PacketMessageData : public talk_base::MessageData {
+struct PacketMessageData : public rtc::MessageData {
PacketMessageData(const char* data, size_t len) : packet(data, len) {
}
- talk_base::Buffer packet;
+ rtc::Buffer packet;
};
// Fake transport channel class, which can be passed to anything that needs a
// transport channel. Can be informed of another FakeTransportChannel via
// SetDestination.
class FakeTransportChannel : public TransportChannelImpl,
- public talk_base::MessageHandler {
+ public rtc::MessageHandler {
public:
explicit FakeTransportChannel(Transport* transport,
const std::string& content_name,
@@ -73,7 +73,7 @@
ice_proto_(ICEPROTO_HYBRID),
remote_ice_mode_(ICEMODE_FULL),
dtls_fingerprint_("", NULL, 0),
- ssl_role_(talk_base::SSL_CLIENT),
+ ssl_role_(rtc::SSL_CLIENT),
connection_count_(0) {
}
~FakeTransportChannel() {
@@ -87,7 +87,7 @@
const std::string& ice_pwd() const { return ice_pwd_; }
const std::string& remote_ice_ufrag() const { return remote_ice_ufrag_; }
const std::string& remote_ice_pwd() const { return remote_ice_pwd_; }
- const talk_base::SSLFingerprint& dtls_fingerprint() const {
+ const rtc::SSLFingerprint& dtls_fingerprint() const {
return dtls_fingerprint_;
}
@@ -122,14 +122,14 @@
virtual void SetRemoteIceMode(IceMode mode) { remote_ice_mode_ = mode; }
virtual bool SetRemoteFingerprint(const std::string& alg, const uint8* digest,
size_t digest_len) {
- dtls_fingerprint_ = talk_base::SSLFingerprint(alg, digest, digest_len);
+ dtls_fingerprint_ = rtc::SSLFingerprint(alg, digest, digest_len);
return true;
}
- virtual bool SetSslRole(talk_base::SSLRole role) {
+ virtual bool SetSslRole(rtc::SSLRole role) {
ssl_role_ = role;
return true;
}
- virtual bool GetSslRole(talk_base::SSLRole* role) const {
+ virtual bool GetSslRole(rtc::SSLRole* role) const {
*role = ssl_role_;
return true;
}
@@ -184,7 +184,7 @@
}
virtual int SendPacket(const char* data, size_t len,
- const talk_base::PacketOptions& options, int flags) {
+ const rtc::PacketOptions& options, int flags) {
if (state_ != STATE_CONNECTED) {
return -1;
}
@@ -195,13 +195,13 @@
PacketMessageData* packet = new PacketMessageData(data, len);
if (async_) {
- talk_base::Thread::Current()->Post(this, 0, packet);
+ rtc::Thread::Current()->Post(this, 0, packet);
} else {
- talk_base::Thread::Current()->Send(this, 0, packet);
+ rtc::Thread::Current()->Send(this, 0, packet);
}
return static_cast<int>(len);
}
- virtual int SetOption(talk_base::Socket::Option opt, int value) {
+ virtual int SetOption(rtc::Socket::Option opt, int value) {
return true;
}
virtual int GetError() {
@@ -213,22 +213,22 @@
virtual void OnCandidate(const Candidate& candidate) {
}
- virtual void OnMessage(talk_base::Message* msg) {
+ virtual void OnMessage(rtc::Message* msg) {
PacketMessageData* data = static_cast<PacketMessageData*>(
msg->pdata);
dest_->SignalReadPacket(dest_, data->packet.data(),
data->packet.length(),
- talk_base::CreatePacketTime(0), 0);
+ rtc::CreatePacketTime(0), 0);
delete data;
}
- bool SetLocalIdentity(talk_base::SSLIdentity* identity) {
+ bool SetLocalIdentity(rtc::SSLIdentity* identity) {
identity_ = identity;
return true;
}
- void SetRemoteCertificate(talk_base::FakeSSLCertificate* cert) {
+ void SetRemoteCertificate(rtc::FakeSSLCertificate* cert) {
remote_cert_ = cert;
}
@@ -249,7 +249,7 @@
return false;
}
- virtual bool GetLocalIdentity(talk_base::SSLIdentity** identity) const {
+ virtual bool GetLocalIdentity(rtc::SSLIdentity** identity) const {
if (!identity_)
return false;
@@ -257,7 +257,7 @@
return true;
}
- virtual bool GetRemoteCertificate(talk_base::SSLCertificate** cert) const {
+ virtual bool GetRemoteCertificate(rtc::SSLCertificate** cert) const {
if (!remote_cert_)
return false;
@@ -307,8 +307,8 @@
FakeTransportChannel* dest_;
State state_;
bool async_;
- talk_base::SSLIdentity* identity_;
- talk_base::FakeSSLCertificate* remote_cert_;
+ rtc::SSLIdentity* identity_;
+ rtc::FakeSSLCertificate* remote_cert_;
bool do_dtls_;
std::vector<std::string> srtp_ciphers_;
std::string chosen_srtp_cipher_;
@@ -320,8 +320,8 @@
std::string remote_ice_ufrag_;
std::string remote_ice_pwd_;
IceMode remote_ice_mode_;
- talk_base::SSLFingerprint dtls_fingerprint_;
- talk_base::SSLRole ssl_role_;
+ rtc::SSLFingerprint dtls_fingerprint_;
+ rtc::SSLRole ssl_role_;
size_t connection_count_;
};
@@ -331,8 +331,8 @@
class FakeTransport : public Transport {
public:
typedef std::map<int, FakeTransportChannel*> ChannelMap;
- FakeTransport(talk_base::Thread* signaling_thread,
- talk_base::Thread* worker_thread,
+ FakeTransport(rtc::Thread* signaling_thread,
+ rtc::Thread* worker_thread,
const std::string& content_name,
PortAllocator* alllocator = NULL)
: Transport(signaling_thread, worker_thread,
@@ -364,7 +364,7 @@
}
}
- void set_identity(talk_base::SSLIdentity* identity) {
+ void set_identity(rtc::SSLIdentity* identity) {
identity_ = identity;
}
@@ -387,10 +387,10 @@
channels_.erase(channel->component());
delete channel;
}
- virtual void SetIdentity_w(talk_base::SSLIdentity* identity) {
+ virtual void SetIdentity_w(rtc::SSLIdentity* identity) {
identity_ = identity;
}
- virtual bool GetIdentity_w(talk_base::SSLIdentity** identity) {
+ virtual bool GetIdentity_w(rtc::SSLIdentity** identity) {
if (!identity_)
return false;
@@ -420,7 +420,7 @@
ChannelMap channels_;
FakeTransport* dest_;
bool async_;
- talk_base::SSLIdentity* identity_;
+ rtc::SSLIdentity* identity_;
};
// Fake session class, which can be passed into a BaseChannel object for
@@ -428,19 +428,19 @@
class FakeSession : public BaseSession {
public:
explicit FakeSession()
- : BaseSession(talk_base::Thread::Current(),
- talk_base::Thread::Current(),
+ : BaseSession(rtc::Thread::Current(),
+ rtc::Thread::Current(),
NULL, "", "", true),
fail_create_channel_(false) {
}
explicit FakeSession(bool initiator)
- : BaseSession(talk_base::Thread::Current(),
- talk_base::Thread::Current(),
+ : BaseSession(rtc::Thread::Current(),
+ rtc::Thread::Current(),
NULL, "", "", initiator),
fail_create_channel_(false) {
}
- FakeSession(talk_base::Thread* worker_thread, bool initiator)
- : BaseSession(talk_base::Thread::Current(),
+ FakeSession(rtc::Thread* worker_thread, bool initiator)
+ : BaseSession(rtc::Thread::Current(),
worker_thread,
NULL, "", "", initiator),
fail_create_channel_(false) {
@@ -477,7 +477,7 @@
}
// TODO: Hoist this into Session when we re-work the Session code.
- void set_ssl_identity(talk_base::SSLIdentity* identity) {
+ void set_ssl_identity(rtc::SSLIdentity* identity) {
for (TransportMap::const_iterator it = transport_proxies().begin();
it != transport_proxies().end(); ++it) {
// We know that we have a FakeTransport*
diff --git a/p2p/base/p2ptransport.cc b/p2p/base/p2ptransport.cc
index 7f53cff..89d2564 100644
--- a/p2p/base/p2ptransport.cc
+++ b/p2p/base/p2ptransport.cc
@@ -30,10 +30,10 @@
#include <string>
#include <vector>
-#include "talk/base/base64.h"
-#include "talk/base/common.h"
-#include "talk/base/stringencode.h"
-#include "talk/base/stringutils.h"
+#include "webrtc/base/base64.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/stringencode.h"
+#include "webrtc/base/stringutils.h"
#include "talk/p2p/base/constants.h"
#include "talk/p2p/base/p2ptransportchannel.h"
#include "talk/p2p/base/parsing.h"
@@ -57,8 +57,8 @@
return new buzz::XmlElement(buzz::QName(name, LN_TRANSPORT), true);
}
-P2PTransport::P2PTransport(talk_base::Thread* signaling_thread,
- talk_base::Thread* worker_thread,
+P2PTransport::P2PTransport(rtc::Thread* signaling_thread,
+ rtc::Thread* worker_thread,
const std::string& content_name,
PortAllocator* allocator)
: Transport(signaling_thread, worker_thread,
@@ -112,7 +112,7 @@
buzz::XmlElement** out_elem,
WriteError* error) {
TransportProtocol proto = TransportProtocolFromDescription(&desc);
- talk_base::scoped_ptr<buzz::XmlElement> trans_elem(
+ rtc::scoped_ptr<buzz::XmlElement> trans_elem(
NewTransportElement(desc.transport_type));
// Fail if we get HYBRID or ICE right now.
@@ -124,7 +124,7 @@
for (std::vector<Candidate>::const_iterator iter = desc.candidates.begin();
iter != desc.candidates.end(); ++iter) {
- talk_base::scoped_ptr<buzz::XmlElement> cand_elem(
+ rtc::scoped_ptr<buzz::XmlElement> cand_elem(
new buzz::XmlElement(QN_GINGLE_P2P_CANDIDATE));
if (!WriteCandidate(proto, *iter, translator, cand_elem.get(), error)) {
return false;
@@ -149,7 +149,7 @@
const CandidateTranslator* translator,
buzz::XmlElement** out_elem,
WriteError* error) {
- talk_base::scoped_ptr<buzz::XmlElement> elem(
+ rtc::scoped_ptr<buzz::XmlElement> elem(
new buzz::XmlElement(QN_GINGLE_CANDIDATE));
bool ret = WriteCandidate(ICEPROTO_GOOGLE, candidate, translator, elem.get(),
error);
@@ -165,7 +165,7 @@
if (proto == ICEPROTO_GOOGLE || proto == ICEPROTO_HYBRID) {
if (username.size() > kMaxGiceUsernameSize)
return BadParse("candidate username is too long", error);
- if (!talk_base::Base64::IsBase64Encoded(username))
+ if (!rtc::Base64::IsBase64Encoded(username))
return BadParse("candidate username has non-base64 encoded characters",
error);
} else if (proto == ICEPROTO_RFC5245) {
@@ -192,7 +192,7 @@
return BadParse("candidate missing required attribute", error);
}
- talk_base::SocketAddress address;
+ rtc::SocketAddress address;
if (!ParseAddress(elem, QN_ADDRESS, QN_PORT, &address, error))
return false;
diff --git a/p2p/base/p2ptransport.h b/p2p/base/p2ptransport.h
index f2b10f8..500bb9b 100644
--- a/p2p/base/p2ptransport.h
+++ b/p2p/base/p2ptransport.h
@@ -36,8 +36,8 @@
class P2PTransport : public Transport {
public:
- P2PTransport(talk_base::Thread* signaling_thread,
- talk_base::Thread* worker_thread,
+ P2PTransport(rtc::Thread* signaling_thread,
+ rtc::Thread* worker_thread,
const std::string& content_name,
PortAllocator* allocator);
virtual ~P2PTransport();
diff --git a/p2p/base/p2ptransportchannel.cc b/p2p/base/p2ptransportchannel.cc
index 8a3ec7f..8e56f15 100644
--- a/p2p/base/p2ptransportchannel.cc
+++ b/p2p/base/p2ptransportchannel.cc
@@ -28,10 +28,10 @@
#include "talk/p2p/base/p2ptransportchannel.h"
#include <set>
-#include "talk/base/common.h"
-#include "talk/base/crc32.h"
-#include "talk/base/logging.h"
-#include "talk/base/stringencode.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/crc32.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/stringencode.h"
#include "talk/p2p/base/common.h"
#include "talk/p2p/base/relayport.h" // For RELAY_PORT_TYPE.
#include "talk/p2p/base/stunport.h" // For STUN_PORT_TYPE.
@@ -159,7 +159,7 @@
TransportChannelImpl(content_name, component),
transport_(transport),
allocator_(allocator),
- worker_thread_(talk_base::Thread::Current()),
+ worker_thread_(rtc::Thread::Current()),
incoming_only_(false),
waiting_for_signaling_(false),
error_(0),
@@ -175,7 +175,7 @@
}
P2PTransportChannel::~P2PTransportChannel() {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
for (uint32 i = 0; i < allocator_sessions_.size(); ++i)
delete allocator_sessions_[i];
@@ -216,7 +216,7 @@
}
void P2PTransportChannel::SetIceRole(IceRole ice_role) {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
if (ice_role_ != ice_role) {
ice_role_ = ice_role;
for (std::vector<PortInterface *>::iterator it = ports_.begin();
@@ -227,7 +227,7 @@
}
void P2PTransportChannel::SetIceTiebreaker(uint64 tiebreaker) {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
if (!ports_.empty()) {
LOG(LS_ERROR)
<< "Attempt to change tiebreaker after Port has been allocated.";
@@ -243,7 +243,7 @@
}
void P2PTransportChannel::SetIceProtocolType(IceProtocolType type) {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
protocol_type_ = type;
for (std::vector<PortInterface *>::iterator it = ports_.begin();
@@ -254,7 +254,7 @@
void P2PTransportChannel::SetIceCredentials(const std::string& ice_ufrag,
const std::string& ice_pwd) {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
bool ice_restart = false;
if (!ice_ufrag_.empty() && !ice_pwd_.empty()) {
// Restart candidate allocation if there is any change in either
@@ -274,7 +274,7 @@
void P2PTransportChannel::SetRemoteIceCredentials(const std::string& ice_ufrag,
const std::string& ice_pwd) {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
bool ice_restart = false;
if (!remote_ice_ufrag_.empty() && !remote_ice_pwd_.empty()) {
ice_restart = (remote_ice_ufrag_ != ice_ufrag) ||
@@ -298,7 +298,7 @@
// Go into the state of processing candidates, and running in general
void P2PTransportChannel::Connect() {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
if (ice_ufrag_.empty() || ice_pwd_.empty()) {
ASSERT(false);
LOG(LS_ERROR) << "P2PTransportChannel::Connect: The ice_ufrag_ and the "
@@ -315,7 +315,7 @@
// Reset the socket, clear up any previous allocations and start over
void P2PTransportChannel::Reset() {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
// Get rid of all the old allocators. This should clean up everything.
for (uint32 i = 0; i < allocator_sessions_.size(); ++i)
@@ -349,7 +349,7 @@
// A new port is available, attempt to make connections for it
void P2PTransportChannel::OnPortReady(PortAllocatorSession *session,
PortInterface* port) {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
// Set in-effect options on the new port
for (OptionMap::const_iterator it = options_.begin();
@@ -392,7 +392,7 @@
// A new candidate is available, let listeners know
void P2PTransportChannel::OnCandidatesReady(
PortAllocatorSession *session, const std::vector<Candidate>& candidates) {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
for (size_t i = 0; i < candidates.size(); ++i) {
SignalCandidateReady(this, candidates[i]);
}
@@ -400,17 +400,17 @@
void P2PTransportChannel::OnCandidatesAllocationDone(
PortAllocatorSession* session) {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
SignalCandidatesAllocationDone(this);
}
// Handle stun packets
void P2PTransportChannel::OnUnknownAddress(
PortInterface* port,
- const talk_base::SocketAddress& address, ProtocolType proto,
+ const rtc::SocketAddress& address, ProtocolType proto,
IceMessage* stun_msg, const std::string &remote_username,
bool port_muxed) {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
// Port has received a valid stun packet from an address that no Connection
// is currently available for. See if we already have a candidate with the
@@ -486,15 +486,15 @@
}
}
- std::string id = talk_base::CreateRandomString(8);
+ std::string id = rtc::CreateRandomString(8);
new_remote_candidate = Candidate(
id, component(), ProtoToString(proto), address,
0, remote_username, remote_password, type,
port->Network()->name(), 0U,
- talk_base::ToString<uint32>(talk_base::ComputeCrc32(id)));
+ rtc::ToString<uint32>(rtc::ComputeCrc32(id)));
new_remote_candidate.set_priority(
new_remote_candidate.GetPriority(ICE_TYPE_PREFERENCE_SRFLX,
- port->Network()->preference()));
+ port->Network()->preference(), 0));
}
if (port->IceProtocol() == ICEPROTO_RFC5245) {
@@ -591,7 +591,7 @@
// When the signalling channel is ready, we can really kick off the allocator
void P2PTransportChannel::OnSignalingReady() {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
if (waiting_for_signaling_) {
waiting_for_signaling_ = false;
AddAllocatorSession(allocator_->CreateSession(
@@ -600,7 +600,7 @@
}
void P2PTransportChannel::OnUseCandidate(Connection* conn) {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
ASSERT(ice_role_ == ICEROLE_CONTROLLED);
ASSERT(protocol_type_ == ICEPROTO_RFC5245);
if (conn->write_state() == Connection::STATE_WRITABLE) {
@@ -617,7 +617,7 @@
}
void P2PTransportChannel::OnCandidate(const Candidate& candidate) {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
// Create connections to this remote candidate.
CreateConnections(candidate, NULL, false);
@@ -632,7 +632,7 @@
bool P2PTransportChannel::CreateConnections(const Candidate& remote_candidate,
PortInterface* origin_port,
bool readable) {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
Candidate new_remote_candidate(remote_candidate);
new_remote_candidate.set_generation(
@@ -794,7 +794,7 @@
// Set options on ourselves is simply setting options on all of our available
// port objects.
-int P2PTransportChannel::SetOption(talk_base::Socket::Option opt, int value) {
+int P2PTransportChannel::SetOption(rtc::Socket::Option opt, int value) {
OptionMap::iterator it = options_.find(opt);
if (it == options_.end()) {
options_.insert(std::make_pair(opt, value));
@@ -818,9 +818,9 @@
// Send data to the other side, using our best connection.
int P2PTransportChannel::SendPacket(const char *data, size_t len,
- const talk_base::PacketOptions& options,
+ const rtc::PacketOptions& options,
int flags) {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
if (flags != 0) {
error_ = EINVAL;
return -1;
@@ -839,7 +839,7 @@
}
bool P2PTransportChannel::GetStats(ConnectionInfos *infos) {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
// Gather connection infos.
infos->clear();
@@ -870,12 +870,12 @@
return true;
}
-talk_base::DiffServCodePoint P2PTransportChannel::DefaultDscpValue() const {
- OptionMap::const_iterator it = options_.find(talk_base::Socket::OPT_DSCP);
+rtc::DiffServCodePoint P2PTransportChannel::DefaultDscpValue() const {
+ OptionMap::const_iterator it = options_.find(rtc::Socket::OPT_DSCP);
if (it == options_.end()) {
- return talk_base::DSCP_NO_CHANGE;
+ return rtc::DSCP_NO_CHANGE;
}
- return static_cast<talk_base::DiffServCodePoint> (it->second);
+ return static_cast<rtc::DiffServCodePoint> (it->second);
}
// Begin allocate (or immediately re-allocate, if MSG_ALLOCATE pending)
@@ -888,7 +888,7 @@
// Monitor connection states.
void P2PTransportChannel::UpdateConnectionStates() {
- uint32 now = talk_base::Time();
+ uint32 now = rtc::Time();
// We need to copy the list of connections since some may delete themselves
// when we call UpdateState.
@@ -907,7 +907,7 @@
// Sort the available connections to find the best one. We also monitor
// the number of available connections and the current state.
void P2PTransportChannel::SortConnections() {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
// Make sure the connection states are up-to-date since this affects how they
// will be sorted.
@@ -926,7 +926,7 @@
sort_dirty_ = false;
// Get a list of the networks that we are using.
- std::set<talk_base::Network*> networks;
+ std::set<rtc::Network*> networks;
for (uint32 i = 0; i < connections_.size(); ++i)
networks.insert(connections_[i]->port()->Network());
@@ -962,7 +962,7 @@
// we would prune out the current best connection). We leave connections on
// other networks because they may not be using the same resources and they
// may represent very distinct paths over which we can switch.
- std::set<talk_base::Network*>::iterator network;
+ std::set<rtc::Network*>::iterator network;
for (network = networks.begin(); network != networks.end(); ++network) {
Connection* primier = GetBestConnectionOnNetwork(*network);
if (!primier || (primier->write_state() != Connection::STATE_WRITABLE))
@@ -1044,7 +1044,7 @@
// We checked the status of our connections and we had at least one that
// was writable, go into the writable state.
void P2PTransportChannel::HandleWritable() {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
if (!writable()) {
for (uint32 i = 0; i < allocator_sessions_.size(); ++i) {
if (allocator_sessions_[i]->IsGettingPorts()) {
@@ -1059,7 +1059,7 @@
// Notify upper layer about channel not writable state, if it was before.
void P2PTransportChannel::HandleNotWritable() {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
if (was_writable_) {
was_writable_ = false;
set_writable(false);
@@ -1074,7 +1074,7 @@
// If we have a best connection, return it, otherwise return top one in the
// list (later we will mark it best).
Connection* P2PTransportChannel::GetBestConnectionOnNetwork(
- talk_base::Network* network) {
+ rtc::Network* network) {
// If the best connection is on this network, then it wins.
if (best_connection_ && (best_connection_->port()->Network() == network))
return best_connection_;
@@ -1089,7 +1089,7 @@
}
// Handle any queued up requests
-void P2PTransportChannel::OnMessage(talk_base::Message *pmsg) {
+void P2PTransportChannel::OnMessage(rtc::Message *pmsg) {
switch (pmsg->message_id) {
case MSG_SORT:
OnSort();
@@ -1151,7 +1151,7 @@
// pingable connection unless we have a writable connection that is past the
// maximum acceptable ping delay.
Connection* P2PTransportChannel::FindNextPingableConnection() {
- uint32 now = talk_base::Time();
+ uint32 now = rtc::Time();
if (best_connection_ &&
(best_connection_->write_state() == Connection::STATE_WRITABLE) &&
(best_connection_->last_ping_sent()
@@ -1197,13 +1197,13 @@
}
}
conn->set_use_candidate_attr(use_candidate);
- conn->Ping(talk_base::Time());
+ conn->Ping(rtc::Time());
}
// When a connection's state changes, we need to figure out who to use as
// the best connection again. It could have become usable, or become unusable.
void P2PTransportChannel::OnConnectionStateChange(Connection* connection) {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
// Update the best connection if the state change is from pending best
// connection and role is controlled.
@@ -1222,7 +1222,7 @@
// When a connection is removed, edit it out, and then update our best
// connection.
void P2PTransportChannel::OnConnectionDestroyed(Connection* connection) {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
// Note: the previous best_connection_ may be destroyed by now, so don't
// use it.
@@ -1256,7 +1256,7 @@
// When a port is destroyed remove it from our list of ports to use for
// connection attempts.
void P2PTransportChannel::OnPortDestroyed(PortInterface* port) {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
// Remove this port from the list (if we didn't drop it already).
std::vector<PortInterface*>::iterator iter =
@@ -1271,8 +1271,8 @@
// We data is available, let listeners know
void P2PTransportChannel::OnReadPacket(
Connection *connection, const char *data, size_t len,
- const talk_base::PacketTime& packet_time) {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ const rtc::PacketTime& packet_time) {
+ ASSERT(worker_thread_ == rtc::Thread::Current());
// Do not deliver, if packet doesn't belong to the correct transport channel.
if (!FindConnection(connection))
diff --git a/p2p/base/p2ptransportchannel.h b/p2p/base/p2ptransportchannel.h
index 09dabd5..b1c1607 100644
--- a/p2p/base/p2ptransportchannel.h
+++ b/p2p/base/p2ptransportchannel.h
@@ -40,8 +40,8 @@
#include <map>
#include <vector>
#include <string>
-#include "talk/base/asyncpacketsocket.h"
-#include "talk/base/sigslot.h"
+#include "webrtc/base/asyncpacketsocket.h"
+#include "webrtc/base/sigslot.h"
#include "talk/p2p/base/candidate.h"
#include "talk/p2p/base/portinterface.h"
#include "talk/p2p/base/portallocator.h"
@@ -66,7 +66,7 @@
// P2PTransportChannel manages the candidates and connection process to keep
// two P2P clients connected to each other.
class P2PTransportChannel : public TransportChannelImpl,
- public talk_base::MessageHandler {
+ public rtc::MessageHandler {
public:
P2PTransportChannel(const std::string& content_name,
int component,
@@ -94,8 +94,8 @@
// From TransportChannel:
virtual int SendPacket(const char *data, size_t len,
- const talk_base::PacketOptions& options, int flags);
- virtual int SetOption(talk_base::Socket::Option opt, int value);
+ const rtc::PacketOptions& options, int flags);
+ virtual int SetOption(rtc::Socket::Option opt, int value);
virtual int GetError() { return error_; }
virtual bool GetStats(std::vector<ConnectionInfo>* stats);
@@ -112,11 +112,11 @@
virtual bool IsDtlsActive() const { return false; }
// Default implementation.
- virtual bool GetSslRole(talk_base::SSLRole* role) const {
+ virtual bool GetSslRole(rtc::SSLRole* role) const {
return false;
}
- virtual bool SetSslRole(talk_base::SSLRole role) {
+ virtual bool SetSslRole(rtc::SSLRole role) {
return false;
}
@@ -131,11 +131,11 @@
}
// Returns false because the channel is not encrypted by default.
- virtual bool GetLocalIdentity(talk_base::SSLIdentity** identity) const {
+ virtual bool GetLocalIdentity(rtc::SSLIdentity** identity) const {
return false;
}
- virtual bool GetRemoteCertificate(talk_base::SSLCertificate** cert) const {
+ virtual bool GetRemoteCertificate(rtc::SSLCertificate** cert) const {
return false;
}
@@ -150,7 +150,7 @@
return false;
}
- virtual bool SetLocalIdentity(talk_base::SSLIdentity* identity) {
+ virtual bool SetLocalIdentity(rtc::SSLIdentity* identity) {
return false;
}
@@ -163,10 +163,10 @@
}
// Helper method used only in unittest.
- talk_base::DiffServCodePoint DefaultDscpValue() const;
+ rtc::DiffServCodePoint DefaultDscpValue() const;
private:
- talk_base::Thread* thread() { return worker_thread_; }
+ rtc::Thread* thread() { return worker_thread_; }
PortAllocatorSession* allocator_session() {
return allocator_sessions_.back();
}
@@ -181,7 +181,7 @@
void HandleNotWritable();
void HandleAllTimedOut();
- Connection* GetBestConnectionOnNetwork(talk_base::Network* network);
+ Connection* GetBestConnectionOnNetwork(rtc::Network* network);
bool CreateConnections(const Candidate &remote_candidate,
PortInterface* origin_port, bool readable);
bool CreateConnection(PortInterface* port, const Candidate& remote_candidate,
@@ -203,7 +203,7 @@
const std::vector<Candidate>& candidates);
void OnCandidatesAllocationDone(PortAllocatorSession* session);
void OnUnknownAddress(PortInterface* port,
- const talk_base::SocketAddress& addr,
+ const rtc::SocketAddress& addr,
ProtocolType proto,
IceMessage* stun_msg,
const std::string& remote_username,
@@ -213,19 +213,19 @@
void OnConnectionStateChange(Connection* connection);
void OnReadPacket(Connection *connection, const char *data, size_t len,
- const talk_base::PacketTime& packet_time);
+ const rtc::PacketTime& packet_time);
void OnReadyToSend(Connection* connection);
void OnConnectionDestroyed(Connection *connection);
void OnUseCandidate(Connection* conn);
- virtual void OnMessage(talk_base::Message *pmsg);
+ virtual void OnMessage(rtc::Message *pmsg);
void OnSort();
void OnPing();
P2PTransport* transport_;
PortAllocator *allocator_;
- talk_base::Thread *worker_thread_;
+ rtc::Thread *worker_thread_;
bool incoming_only_;
bool waiting_for_signaling_;
int error_;
@@ -239,7 +239,7 @@
std::vector<RemoteCandidate> remote_candidates_;
bool sort_dirty_; // indicates whether another sort is needed right now
bool was_writable_;
- typedef std::map<talk_base::Socket::Option, int> OptionMap;
+ typedef std::map<rtc::Socket::Option, int> OptionMap;
OptionMap options_;
std::string ice_ufrag_;
std::string ice_pwd_;
diff --git a/p2p/base/p2ptransportchannel_unittest.cc b/p2p/base/p2ptransportchannel_unittest.cc
index 498fde9..79796cf 100644
--- a/p2p/base/p2ptransportchannel_unittest.cc
+++ b/p2p/base/p2ptransportchannel_unittest.cc
@@ -25,20 +25,20 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/dscp.h"
-#include "talk/base/fakenetwork.h"
-#include "talk/base/firewallsocketserver.h"
-#include "talk/base/gunit.h"
-#include "talk/base/helpers.h"
-#include "talk/base/logging.h"
-#include "talk/base/natserver.h"
-#include "talk/base/natsocketfactory.h"
-#include "talk/base/physicalsocketserver.h"
-#include "talk/base/proxyserver.h"
-#include "talk/base/socketaddress.h"
-#include "talk/base/ssladapter.h"
-#include "talk/base/thread.h"
-#include "talk/base/virtualsocketserver.h"
+#include "webrtc/base/dscp.h"
+#include "webrtc/base/fakenetwork.h"
+#include "webrtc/base/firewallsocketserver.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/natserver.h"
+#include "webrtc/base/natsocketfactory.h"
+#include "webrtc/base/physicalsocketserver.h"
+#include "webrtc/base/proxyserver.h"
+#include "webrtc/base/socketaddress.h"
+#include "webrtc/base/ssladapter.h"
+#include "webrtc/base/thread.h"
+#include "webrtc/base/virtualsocketserver.h"
#include "talk/p2p/base/p2ptransportchannel.h"
#include "talk/p2p/base/testrelayserver.h"
#include "talk/p2p/base/teststunserver.h"
@@ -50,7 +50,8 @@
using cricket::kDefaultStepDelay;
using cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG;
using cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET;
-using talk_base::SocketAddress;
+using cricket::ServerAddresses;
+using rtc::SocketAddress;
static const int kDefaultTimeout = 1000;
static const int kOnlyLocalPorts = cricket::PORTALLOCATOR_DISABLE_STUN |
@@ -128,15 +129,15 @@
// Note that this class is a base class for use by other tests, who will provide
// specialized test behavior.
class P2PTransportChannelTestBase : public testing::Test,
- public talk_base::MessageHandler,
+ public rtc::MessageHandler,
public sigslot::has_slots<> {
public:
P2PTransportChannelTestBase()
- : main_(talk_base::Thread::Current()),
- pss_(new talk_base::PhysicalSocketServer),
- vss_(new talk_base::VirtualSocketServer(pss_.get())),
- nss_(new talk_base::NATSocketServer(vss_.get())),
- ss_(new talk_base::FirewallSocketServer(nss_.get())),
+ : main_(rtc::Thread::Current()),
+ pss_(new rtc::PhysicalSocketServer),
+ vss_(new rtc::VirtualSocketServer(pss_.get())),
+ nss_(new rtc::NATSocketServer(vss_.get())),
+ ss_(new rtc::FirewallSocketServer(nss_.get())),
ss_scope_(ss_.get()),
stun_server_(main_, kStunAddr),
turn_server_(main_, kTurnUdpIntAddr, kTurnUdpExtAddr),
@@ -152,12 +153,14 @@
ep1_.role_ = cricket::ICEROLE_CONTROLLING;
ep2_.role_ = cricket::ICEROLE_CONTROLLED;
+ ServerAddresses stun_servers;
+ stun_servers.insert(kStunAddr);
ep1_.allocator_.reset(new cricket::BasicPortAllocator(
- &ep1_.network_manager_, kStunAddr, kRelayUdpIntAddr,
- kRelayTcpIntAddr, kRelaySslTcpIntAddr));
+ &ep1_.network_manager_,
+ stun_servers, kRelayUdpIntAddr, kRelayTcpIntAddr, kRelaySslTcpIntAddr));
ep2_.allocator_.reset(new cricket::BasicPortAllocator(
- &ep2_.network_manager_, kStunAddr, kRelayUdpIntAddr,
- kRelayTcpIntAddr, kRelaySslTcpIntAddr));
+ &ep2_.network_manager_,
+ stun_servers, kRelayUdpIntAddr, kRelayTcpIntAddr, kRelaySslTcpIntAddr));
}
protected:
@@ -210,7 +213,7 @@
std::string name_; // TODO - Currently not used.
std::list<std::string> ch_packets_;
- talk_base::scoped_ptr<cricket::P2PTransportChannel> ch_;
+ rtc::scoped_ptr<cricket::P2PTransportChannel> ch_;
};
struct Endpoint {
@@ -246,8 +249,8 @@
allocator_->set_allow_tcp_listen(allow_tcp_listen);
}
- talk_base::FakeNetworkManager network_manager_;
- talk_base::scoped_ptr<cricket::BasicPortAllocator> allocator_;
+ rtc::FakeNetworkManager network_manager_;
+ rtc::scoped_ptr<cricket::BasicPortAllocator> allocator_;
ChannelData cd1_;
ChannelData cd2_;
int signaling_delay_;
@@ -257,7 +260,7 @@
cricket::IceProtocolType protocol_type_;
};
- struct CandidateData : public talk_base::MessageData {
+ struct CandidateData : public rtc::MessageData {
CandidateData(cricket::TransportChannel* ch, const cricket::Candidate& c)
: channel(ch), candidate(c) {
}
@@ -364,15 +367,15 @@
static const Result kPrflxTcpToLocalTcp;
static void SetUpTestCase() {
- talk_base::InitializeSSL();
+ rtc::InitializeSSL();
}
static void TearDownTestCase() {
- talk_base::CleanupSSL();
+ rtc::CleanupSSL();
}
- talk_base::NATSocketServer* nat() { return nss_.get(); }
- talk_base::FirewallSocketServer* fw() { return ss_.get(); }
+ rtc::NATSocketServer* nat() { return nss_.get(); }
+ rtc::FirewallSocketServer* fw() { return ss_.get(); }
Endpoint* GetEndpoint(int endpoint) {
if (endpoint == 0) {
@@ -392,10 +395,10 @@
void RemoveAddress(int endpoint, const SocketAddress& addr) {
GetEndpoint(endpoint)->network_manager_.RemoveInterface(addr);
}
- void SetProxy(int endpoint, talk_base::ProxyType type) {
- talk_base::ProxyInfo info;
+ void SetProxy(int endpoint, rtc::ProxyType type) {
+ rtc::ProxyInfo info;
info.type = type;
- info.address = (type == talk_base::PROXY_HTTPS) ?
+ info.address = (type == rtc::PROXY_HTTPS) ?
kHttpsProxyAddrs[endpoint] : kSocksProxyAddrs[endpoint];
GetAllocator(endpoint)->set_proxy("unittest/1.0", info);
}
@@ -425,7 +428,7 @@
}
void Test(const Result& expected) {
- int32 connect_start = talk_base::Time(), connect_time;
+ int32 connect_start = rtc::Time(), connect_time;
// Create the channels and wait for them to connect.
CreateChannels(1);
@@ -437,7 +440,7 @@
ep2_ch1()->writable(),
expected.connect_wait,
1000);
- connect_time = talk_base::TimeSince(connect_start);
+ connect_time = rtc::TimeSince(connect_start);
if (connect_time < expected.connect_wait) {
LOG(LS_INFO) << "Connect time: " << connect_time << " ms";
} else {
@@ -449,7 +452,7 @@
// This may take up to 2 seconds.
if (ep1_ch1()->best_connection() &&
ep2_ch1()->best_connection()) {
- int32 converge_start = talk_base::Time(), converge_time;
+ int32 converge_start = rtc::Time(), converge_time;
int converge_wait = 2000;
EXPECT_TRUE_WAIT_MARGIN(
LocalCandidate(ep1_ch1())->type() == expected.local_type &&
@@ -501,7 +504,7 @@
}
}
- converge_time = talk_base::TimeSince(converge_start);
+ converge_time = rtc::TimeSince(converge_start);
if (converge_time < converge_wait) {
LOG(LS_INFO) << "Converge time: " << converge_time << " ms";
} else {
@@ -654,8 +657,8 @@
main_->PostDelayed(GetEndpoint(ch)->signaling_delay_, this, 0,
new CandidateData(ch, c));
}
- void OnMessage(talk_base::Message* msg) {
- talk_base::scoped_ptr<CandidateData> data(
+ void OnMessage(rtc::Message* msg) {
+ rtc::scoped_ptr<CandidateData> data(
static_cast<CandidateData*>(msg->pdata));
cricket::P2PTransportChannel* rch = GetRemoteChannel(data->channel);
cricket::Candidate c = data->candidate;
@@ -670,7 +673,7 @@
rch->OnCandidate(c);
}
void OnReadPacket(cricket::TransportChannel* channel, const char* data,
- size_t len, const talk_base::PacketTime& packet_time,
+ size_t len, const rtc::PacketTime& packet_time,
int flags) {
std::list<std::string>& packets = GetPacketList(channel);
packets.push_front(std::string(data, len));
@@ -684,7 +687,7 @@
}
int SendData(cricket::TransportChannel* channel,
const char* data, size_t len) {
- talk_base::PacketOptions options;
+ rtc::PacketOptions options;
return channel->SendPacket(data, len, options, 0);
}
bool CheckDataOnChannel(cricket::TransportChannel* channel,
@@ -736,17 +739,17 @@
}
private:
- talk_base::Thread* main_;
- talk_base::scoped_ptr<talk_base::PhysicalSocketServer> pss_;
- talk_base::scoped_ptr<talk_base::VirtualSocketServer> vss_;
- talk_base::scoped_ptr<talk_base::NATSocketServer> nss_;
- talk_base::scoped_ptr<talk_base::FirewallSocketServer> ss_;
- talk_base::SocketServerScope ss_scope_;
+ rtc::Thread* main_;
+ rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_;
+ rtc::scoped_ptr<rtc::VirtualSocketServer> vss_;
+ rtc::scoped_ptr<rtc::NATSocketServer> nss_;
+ rtc::scoped_ptr<rtc::FirewallSocketServer> ss_;
+ rtc::SocketServerScope ss_scope_;
cricket::TestStunServer stun_server_;
cricket::TestTurnServer turn_server_;
cricket::TestRelayServer relay_server_;
- talk_base::SocksProxyServer socks_server1_;
- talk_base::SocksProxyServer socks_server2_;
+ rtc::SocksProxyServer socks_server1_;
+ rtc::SocksProxyServer socks_server2_;
Endpoint ep1_;
Endpoint ep2_;
bool clear_remote_candidates_ufrag_pwd_;
@@ -806,14 +809,18 @@
// Ideally we want to use TURN server for both GICE and ICE, but in case
// of GICE, TURN server usage is not producing results reliabally.
// TODO(mallinath): Remove Relay and use TURN server for all tests.
+ ServerAddresses stun_servers;
+ stun_servers.insert(kStunAddr);
GetEndpoint(0)->allocator_.reset(
new cricket::BasicPortAllocator(&(GetEndpoint(0)->network_manager_),
- kStunAddr, talk_base::SocketAddress(), talk_base::SocketAddress(),
- talk_base::SocketAddress()));
+ stun_servers,
+ rtc::SocketAddress(), rtc::SocketAddress(),
+ rtc::SocketAddress()));
GetEndpoint(1)->allocator_.reset(
new cricket::BasicPortAllocator(&(GetEndpoint(1)->network_manager_),
- kStunAddr, talk_base::SocketAddress(), talk_base::SocketAddress(),
- talk_base::SocketAddress()));
+ stun_servers,
+ rtc::SocketAddress(), rtc::SocketAddress(),
+ rtc::SocketAddress()));
cricket::RelayServerConfig relay_server(cricket::RELAY_GTURN);
if (type == cricket::ICEPROTO_RFC5245) {
@@ -853,7 +860,7 @@
AddAddress(endpoint, kPrivateAddrs[endpoint]);
// Add a single NAT of the desired type
nat()->AddTranslator(kPublicAddrs[endpoint], kNatAddrs[endpoint],
- static_cast<talk_base::NATType>(config - NAT_FULL_CONE))->
+ static_cast<rtc::NATType>(config - NAT_FULL_CONE))->
AddClient(kPrivateAddrs[endpoint]);
break;
case NAT_DOUBLE_CONE:
@@ -862,9 +869,9 @@
// Add a two cascaded NATs of the desired types
nat()->AddTranslator(kPublicAddrs[endpoint], kNatAddrs[endpoint],
(config == NAT_DOUBLE_CONE) ?
- talk_base::NAT_OPEN_CONE : talk_base::NAT_SYMMETRIC)->
+ rtc::NAT_OPEN_CONE : rtc::NAT_SYMMETRIC)->
AddTranslator(kPrivateAddrs[endpoint], kCascadedNatAddrs[endpoint],
- talk_base::NAT_OPEN_CONE)->
+ rtc::NAT_OPEN_CONE)->
AddClient(kCascadedPrivateAddrs[endpoint]);
break;
case BLOCK_UDP:
@@ -874,34 +881,34 @@
case PROXY_SOCKS:
AddAddress(endpoint, kPublicAddrs[endpoint]);
// Block all UDP
- fw()->AddRule(false, talk_base::FP_UDP, talk_base::FD_ANY,
+ fw()->AddRule(false, rtc::FP_UDP, rtc::FD_ANY,
kPublicAddrs[endpoint]);
if (config == BLOCK_UDP_AND_INCOMING_TCP) {
// Block TCP inbound to the endpoint
- fw()->AddRule(false, talk_base::FP_TCP, SocketAddress(),
+ fw()->AddRule(false, rtc::FP_TCP, SocketAddress(),
kPublicAddrs[endpoint]);
} else if (config == BLOCK_ALL_BUT_OUTGOING_HTTP) {
// Block all TCP to/from the endpoint except 80/443 out
- fw()->AddRule(true, talk_base::FP_TCP, kPublicAddrs[endpoint],
- SocketAddress(talk_base::IPAddress(INADDR_ANY), 80));
- fw()->AddRule(true, talk_base::FP_TCP, kPublicAddrs[endpoint],
- SocketAddress(talk_base::IPAddress(INADDR_ANY), 443));
- fw()->AddRule(false, talk_base::FP_TCP, talk_base::FD_ANY,
+ fw()->AddRule(true, rtc::FP_TCP, kPublicAddrs[endpoint],
+ SocketAddress(rtc::IPAddress(INADDR_ANY), 80));
+ fw()->AddRule(true, rtc::FP_TCP, kPublicAddrs[endpoint],
+ SocketAddress(rtc::IPAddress(INADDR_ANY), 443));
+ fw()->AddRule(false, rtc::FP_TCP, rtc::FD_ANY,
kPublicAddrs[endpoint]);
} else if (config == PROXY_HTTPS) {
// Block all TCP to/from the endpoint except to the proxy server
- fw()->AddRule(true, talk_base::FP_TCP, kPublicAddrs[endpoint],
+ fw()->AddRule(true, rtc::FP_TCP, kPublicAddrs[endpoint],
kHttpsProxyAddrs[endpoint]);
- fw()->AddRule(false, talk_base::FP_TCP, talk_base::FD_ANY,
+ fw()->AddRule(false, rtc::FP_TCP, rtc::FD_ANY,
kPublicAddrs[endpoint]);
- SetProxy(endpoint, talk_base::PROXY_HTTPS);
+ SetProxy(endpoint, rtc::PROXY_HTTPS);
} else if (config == PROXY_SOCKS) {
// Block all TCP to/from the endpoint except to the proxy server
- fw()->AddRule(true, talk_base::FP_TCP, kPublicAddrs[endpoint],
+ fw()->AddRule(true, rtc::FP_TCP, kPublicAddrs[endpoint],
kSocksProxyAddrs[endpoint]);
- fw()->AddRule(false, talk_base::FP_TCP, talk_base::FD_ANY,
+ fw()->AddRule(false, rtc::FP_TCP, rtc::FD_ANY,
kPublicAddrs[endpoint]);
- SetProxy(endpoint, talk_base::PROXY_SOCKS5);
+ SetProxy(endpoint, rtc::PROXY_SOCKS5);
}
break;
default:
@@ -1303,7 +1310,7 @@
ep1_ch1()->set_incoming_only(true);
// Pump for 1 second and verify that the channels are not connected.
- talk_base::Thread::Current()->ProcessMessages(1000);
+ rtc::Thread::Current()->ProcessMessages(1000);
EXPECT_FALSE(ep1_ch1()->readable());
EXPECT_FALSE(ep1_ch1()->writable());
@@ -1507,25 +1514,25 @@
AddAddress(1, kPublicAddrs[1]);
CreateChannels(1);
- EXPECT_EQ(talk_base::DSCP_NO_CHANGE,
+ EXPECT_EQ(rtc::DSCP_NO_CHANGE,
GetEndpoint(0)->cd1_.ch_->DefaultDscpValue());
- EXPECT_EQ(talk_base::DSCP_NO_CHANGE,
+ EXPECT_EQ(rtc::DSCP_NO_CHANGE,
GetEndpoint(1)->cd1_.ch_->DefaultDscpValue());
GetEndpoint(0)->cd1_.ch_->SetOption(
- talk_base::Socket::OPT_DSCP, talk_base::DSCP_CS6);
+ rtc::Socket::OPT_DSCP, rtc::DSCP_CS6);
GetEndpoint(1)->cd1_.ch_->SetOption(
- talk_base::Socket::OPT_DSCP, talk_base::DSCP_CS6);
- EXPECT_EQ(talk_base::DSCP_CS6,
+ rtc::Socket::OPT_DSCP, rtc::DSCP_CS6);
+ EXPECT_EQ(rtc::DSCP_CS6,
GetEndpoint(0)->cd1_.ch_->DefaultDscpValue());
- EXPECT_EQ(talk_base::DSCP_CS6,
+ EXPECT_EQ(rtc::DSCP_CS6,
GetEndpoint(1)->cd1_.ch_->DefaultDscpValue());
GetEndpoint(0)->cd1_.ch_->SetOption(
- talk_base::Socket::OPT_DSCP, talk_base::DSCP_AF41);
+ rtc::Socket::OPT_DSCP, rtc::DSCP_AF41);
GetEndpoint(1)->cd1_.ch_->SetOption(
- talk_base::Socket::OPT_DSCP, talk_base::DSCP_AF41);
- EXPECT_EQ(talk_base::DSCP_AF41,
+ rtc::Socket::OPT_DSCP, rtc::DSCP_AF41);
+ EXPECT_EQ(rtc::DSCP_AF41,
GetEndpoint(0)->cd1_.ch_->DefaultDscpValue());
- EXPECT_EQ(talk_base::DSCP_AF41,
+ EXPECT_EQ(rtc::DSCP_AF41,
GetEndpoint(1)->cd1_.ch_->DefaultDscpValue());
}
@@ -1601,13 +1608,13 @@
protected:
void ConfigureEndpoints(Config nat_type, Config config1, Config config2) {
ASSERT(nat_type >= NAT_FULL_CONE && nat_type <= NAT_SYMMETRIC);
- talk_base::NATSocketServer::Translator* outer_nat =
+ rtc::NATSocketServer::Translator* outer_nat =
nat()->AddTranslator(kPublicAddrs[0], kNatAddrs[0],
- static_cast<talk_base::NATType>(nat_type - NAT_FULL_CONE));
+ static_cast<rtc::NATType>(nat_type - NAT_FULL_CONE));
ConfigureEndpoint(outer_nat, 0, config1);
ConfigureEndpoint(outer_nat, 1, config2);
}
- void ConfigureEndpoint(talk_base::NATSocketServer::Translator* nat,
+ void ConfigureEndpoint(rtc::NATSocketServer::Translator* nat,
int endpoint, Config config) {
ASSERT(config <= NAT_SYMMETRIC);
if (config == OPEN) {
@@ -1616,7 +1623,7 @@
} else {
AddAddress(endpoint, kCascadedPrivateAddrs[endpoint]);
nat->AddTranslator(kPrivateAddrs[endpoint], kCascadedNatAddrs[endpoint],
- static_cast<talk_base::NATType>(config - NAT_FULL_CONE))->AddClient(
+ static_cast<rtc::NATType>(config - NAT_FULL_CONE))->AddClient(
kCascadedPrivateAddrs[endpoint]);
}
}
@@ -1666,7 +1673,7 @@
// Blackhole any traffic to or from the public addrs.
LOG(LS_INFO) << "Failing over...";
- fw()->AddRule(false, talk_base::FP_ANY, talk_base::FD_ANY,
+ fw()->AddRule(false, rtc::FP_ANY, rtc::FD_ANY,
kPublicAddrs[1]);
// We should detect loss of connectivity within 5 seconds or so.
diff --git a/p2p/base/packetsocketfactory.h b/p2p/base/packetsocketfactory.h
index e985b37..6b82682 100644
--- a/p2p/base/packetsocketfactory.h
+++ b/p2p/base/packetsocketfactory.h
@@ -28,9 +28,9 @@
#ifndef TALK_BASE_PACKETSOCKETFACTORY_H_
#define TALK_BASE_PACKETSOCKETFACTORY_H_
-#include "talk/base/proxyinfo.h"
+#include "webrtc/base/proxyinfo.h"
-namespace talk_base {
+namespace rtc {
class AsyncPacketSocket;
class AsyncResolverInterface;
@@ -64,6 +64,6 @@
DISALLOW_EVIL_CONSTRUCTORS(PacketSocketFactory);
};
-} // namespace talk_base
+} // namespace rtc
#endif // TALK_BASE_PACKETSOCKETFACTORY_H_
diff --git a/p2p/base/parsing.cc b/p2p/base/parsing.cc
index ebe0596..1d7bf3e 100644
--- a/p2p/base/parsing.cc
+++ b/p2p/base/parsing.cc
@@ -29,7 +29,7 @@
#include <algorithm>
#include <stdlib.h>
-#include "talk/base/stringutils.h"
+#include "webrtc/base/stringutils.h"
namespace {
static const char kTrue[] = "true";
diff --git a/p2p/base/parsing.h b/p2p/base/parsing.h
index c820056..fc6862d 100644
--- a/p2p/base/parsing.h
+++ b/p2p/base/parsing.h
@@ -30,8 +30,8 @@
#include <string>
#include <vector>
-#include "talk/base/basictypes.h"
-#include "talk/base/stringencode.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/stringencode.h"
#include "talk/xmllite/xmlelement.h" // Needed to delete ParseError.extra.
namespace cricket {
@@ -97,7 +97,7 @@
return false;
}
std::string unparsed = elem->Attr(name);
- return talk_base::FromString(unparsed, val_out);
+ return rtc::FromString(unparsed, val_out);
}
template <class T>
@@ -116,7 +116,7 @@
bool AddXmlAttr(buzz::XmlElement* elem,
const buzz::QName& name, const T& val) {
std::string buf;
- if (!talk_base::ToString(val, &buf)) {
+ if (!rtc::ToString(val, &buf)) {
return false;
}
elem->AddAttr(name, buf);
@@ -126,7 +126,7 @@
template <class T>
bool SetXmlBody(buzz::XmlElement* elem, const T& val) {
std::string buf;
- if (!talk_base::ToString(val, &buf)) {
+ if (!rtc::ToString(val, &buf)) {
return false;
}
elem->SetBodyText(buf);
diff --git a/p2p/base/port.cc b/p2p/base/port.cc
index ad692ce..0d3a5cd 100644
--- a/p2p/base/port.cc
+++ b/p2p/base/port.cc
@@ -30,14 +30,14 @@
#include <algorithm>
#include <vector>
-#include "talk/base/base64.h"
-#include "talk/base/crc32.h"
-#include "talk/base/helpers.h"
-#include "talk/base/logging.h"
-#include "talk/base/messagedigest.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/stringencode.h"
-#include "talk/base/stringutils.h"
+#include "webrtc/base/base64.h"
+#include "webrtc/base/crc32.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/messagedigest.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/stringencode.h"
+#include "webrtc/base/stringutils.h"
#include "talk/p2p/base/common.h"
namespace {
@@ -81,7 +81,7 @@
}
// Change the last character to the one next to it in the base64 table.
char new_last_char;
- if (!talk_base::Base64::GetNextBase64Char(rtp_ufrag[rtp_ufrag.size() - 1],
+ if (!rtc::Base64::GetNextBase64Char(rtp_ufrag[rtp_ufrag.size() - 1],
&new_last_char)) {
// Should not be here.
ASSERT(false);
@@ -103,7 +103,7 @@
// Computes our estimate of the RTT given the current estimate.
inline uint32 ConservativeRTTEstimate(uint32 rtt) {
- return talk_base::_max(MINIMUM_RTT, talk_base::_min(MAXIMUM_RTT, 2 * rtt));
+ return rtc::_max(MINIMUM_RTT, rtc::_min(MAXIMUM_RTT, 2 * rtt));
}
// Weighting of the old rtt value to new data.
@@ -156,14 +156,14 @@
static std::string ComputeFoundation(
const std::string& type,
const std::string& protocol,
- const talk_base::SocketAddress& base_address) {
+ const rtc::SocketAddress& base_address) {
std::ostringstream ost;
ost << type << base_address.ipaddr().ToString() << protocol;
- return talk_base::ToString<uint32>(talk_base::ComputeCrc32(ost.str()));
+ return rtc::ToString<uint32>(rtc::ComputeCrc32(ost.str()));
}
-Port::Port(talk_base::Thread* thread, talk_base::PacketSocketFactory* factory,
- talk_base::Network* network, const talk_base::IPAddress& ip,
+Port::Port(rtc::Thread* thread, rtc::PacketSocketFactory* factory,
+ rtc::Network* network, const rtc::IPAddress& ip,
const std::string& username_fragment, const std::string& password)
: thread_(thread),
factory_(factory),
@@ -185,9 +185,9 @@
Construct();
}
-Port::Port(talk_base::Thread* thread, const std::string& type,
- talk_base::PacketSocketFactory* factory,
- talk_base::Network* network, const talk_base::IPAddress& ip,
+Port::Port(rtc::Thread* thread, const std::string& type,
+ rtc::PacketSocketFactory* factory,
+ rtc::Network* network, const rtc::IPAddress& ip,
int min_port, int max_port, const std::string& username_fragment,
const std::string& password)
: thread_(thread),
@@ -216,8 +216,8 @@
// If the username_fragment and password are empty, we should just create one.
if (ice_username_fragment_.empty()) {
ASSERT(password_.empty());
- ice_username_fragment_ = talk_base::CreateRandomString(ICE_UFRAG_LENGTH);
- password_ = talk_base::CreateRandomString(ICE_PWD_LENGTH);
+ ice_username_fragment_ = rtc::CreateRandomString(ICE_UFRAG_LENGTH);
+ password_ = rtc::CreateRandomString(ICE_PWD_LENGTH);
}
LOG_J(LS_INFO, this) << "Port created";
}
@@ -238,7 +238,7 @@
delete list[i];
}
-Connection* Port::GetConnection(const talk_base::SocketAddress& remote_addr) {
+Connection* Port::GetConnection(const rtc::SocketAddress& remote_addr) {
AddressMap::const_iterator iter = connections_.find(remote_addr);
if (iter != connections_.end())
return iter->second;
@@ -246,20 +246,33 @@
return NULL;
}
-void Port::AddAddress(const talk_base::SocketAddress& address,
- const talk_base::SocketAddress& base_address,
- const talk_base::SocketAddress& related_address,
+void Port::AddAddress(const rtc::SocketAddress& address,
+ const rtc::SocketAddress& base_address,
+ const rtc::SocketAddress& related_address,
const std::string& protocol,
const std::string& type,
uint32 type_preference,
bool final) {
+ AddAddress(address, base_address, related_address, protocol,
+ type, type_preference, 0, final);
+}
+
+void Port::AddAddress(const rtc::SocketAddress& address,
+ const rtc::SocketAddress& base_address,
+ const rtc::SocketAddress& related_address,
+ const std::string& protocol,
+ const std::string& type,
+ uint32 type_preference,
+ uint32 relay_preference,
+ bool final) {
Candidate c;
- c.set_id(talk_base::CreateRandomString(8));
+ c.set_id(rtc::CreateRandomString(8));
c.set_component(component_);
c.set_type(type);
c.set_protocol(protocol);
c.set_address(address);
- c.set_priority(c.GetPriority(type_preference, network_->preference()));
+ c.set_priority(c.GetPriority(type_preference, network_->preference(),
+ relay_preference));
c.set_username(username_fragment());
c.set_password(password_);
c.set_network_name(network_->name());
@@ -281,7 +294,7 @@
}
void Port::OnReadPacket(
- const char* data, size_t size, const talk_base::SocketAddress& addr,
+ const char* data, size_t size, const rtc::SocketAddress& addr,
ProtocolType proto) {
// If the user has enabled port packets, just hand this over.
if (enable_port_packets_) {
@@ -291,7 +304,7 @@
// If this is an authenticated STUN request, then signal unknown address and
// send back a proper binding response.
- talk_base::scoped_ptr<IceMessage> msg;
+ rtc::scoped_ptr<IceMessage> msg;
std::string remote_username;
if (!GetStunMessage(data, size, addr, msg.accept(), &remote_username)) {
LOG_J(LS_ERROR, this) << "Received non-STUN packet from unknown address ("
@@ -345,7 +358,7 @@
}
bool Port::GetStunMessage(const char* data, size_t size,
- const talk_base::SocketAddress& addr,
+ const rtc::SocketAddress& addr,
IceMessage** out_msg, std::string* out_username) {
// NOTE: This could clearly be optimized to avoid allocating any memory.
// However, at the data rates we'll be looking at on the client side,
@@ -363,8 +376,8 @@
// Parse the request message. If the packet is not a complete and correct
// STUN message, then ignore it.
- talk_base::scoped_ptr<IceMessage> stun_msg(new IceMessage());
- talk_base::ByteBuffer buf(data, size);
+ rtc::scoped_ptr<IceMessage> stun_msg(new IceMessage());
+ rtc::ByteBuffer buf(data, size);
if (!stun_msg->Read(&buf) || (buf.Length() > 0)) {
return false;
}
@@ -452,7 +465,7 @@
return true;
}
-bool Port::IsCompatibleAddress(const talk_base::SocketAddress& addr) {
+bool Port::IsCompatibleAddress(const rtc::SocketAddress& addr) {
int family = ip().family();
// We use single-stack sockets, so families must match.
if (addr.family() != family) {
@@ -511,7 +524,7 @@
}
bool Port::MaybeIceRoleConflict(
- const talk_base::SocketAddress& addr, IceMessage* stun_msg,
+ const rtc::SocketAddress& addr, IceMessage* stun_msg,
const std::string& remote_ufrag) {
// Validate ICE_CONTROLLING or ICE_CONTROLLED attributes.
bool ret = true;
@@ -583,7 +596,7 @@
}
void Port::SendBindingResponse(StunMessage* request,
- const talk_base::SocketAddress& addr) {
+ const rtc::SocketAddress& addr) {
ASSERT(request->type() == STUN_BINDING_REQUEST);
// Retrieve the username from the request.
@@ -629,9 +642,9 @@
}
// Send the response message.
- talk_base::ByteBuffer buf;
+ rtc::ByteBuffer buf;
response.Write(&buf);
- talk_base::PacketOptions options(DefaultDscpValue());
+ rtc::PacketOptions options(DefaultDscpValue());
if (SendTo(buf.Data(), buf.Length(), addr, options, false) < 0) {
LOG_J(LS_ERROR, this) << "Failed to send STUN ping response to "
<< addr.ToSensitiveString();
@@ -646,7 +659,7 @@
}
void Port::SendBindingErrorResponse(StunMessage* request,
- const talk_base::SocketAddress& addr,
+ const rtc::SocketAddress& addr,
int error_code, const std::string& reason) {
ASSERT(request->type() == STUN_BINDING_REQUEST);
@@ -684,15 +697,15 @@
}
// Send the response message.
- talk_base::ByteBuffer buf;
+ rtc::ByteBuffer buf;
response.Write(&buf);
- talk_base::PacketOptions options(DefaultDscpValue());
+ rtc::PacketOptions options(DefaultDscpValue());
SendTo(buf.Data(), buf.Length(), addr, options, false);
LOG_J(LS_INFO, this) << "Sending STUN binding error: reason=" << reason
<< " to " << addr.ToSensitiveString();
}
-void Port::OnMessage(talk_base::Message *pmsg) {
+void Port::OnMessage(rtc::Message *pmsg) {
ASSERT(pmsg->message_id == MSG_CHECKTIMEOUT);
CheckTimeout();
}
@@ -886,9 +899,9 @@
g = remote_candidate_.priority();
d = local_candidate().priority();
}
- priority = talk_base::_min(g, d);
+ priority = rtc::_min(g, d);
priority = priority << 32;
- priority += 2 * talk_base::_max(g, d) + (g > d ? 1 : 0);
+ priority += 2 * rtc::_max(g, d) + (g > d ? 1 : 0);
}
return priority;
}
@@ -935,7 +948,7 @@
void Connection::OnSendStunPacket(const void* data, size_t size,
StunRequest* req) {
- talk_base::PacketOptions options(port_->DefaultDscpValue());
+ rtc::PacketOptions options(port_->DefaultDscpValue());
if (port_->SendTo(data, size, remote_candidate_.address(),
options, false) < 0) {
LOG_J(LS_WARNING, this) << "Failed to send STUN ping " << req->id();
@@ -943,10 +956,10 @@
}
void Connection::OnReadPacket(
- const char* data, size_t size, const talk_base::PacketTime& packet_time) {
- talk_base::scoped_ptr<IceMessage> msg;
+ const char* data, size_t size, const rtc::PacketTime& packet_time) {
+ rtc::scoped_ptr<IceMessage> msg;
std::string remote_ufrag;
- const talk_base::SocketAddress& addr(remote_candidate_.address());
+ const rtc::SocketAddress& addr(remote_candidate_.address());
if (!port_->GetStunMessage(data, size, addr, msg.accept(), &remote_ufrag)) {
// The packet did not parse as a valid STUN message
@@ -955,7 +968,7 @@
// readable means data from this address is acceptable
// Send it on!
- last_data_received_ = talk_base::Time();
+ last_data_received_ = rtc::Time();
recv_rate_tracker_.Update(size);
SignalReadPacket(this, data, size, packet_time);
@@ -1078,7 +1091,7 @@
std::string pings;
for (size_t i = 0; i < pings_since_last_response_.size(); ++i) {
char buf[32];
- talk_base::sprintfn(buf, sizeof(buf), "%u",
+ rtc::sprintfn(buf, sizeof(buf), "%u",
pings_since_last_response_[i]);
pings.append(buf).append(" ");
}
@@ -1163,7 +1176,7 @@
}
void Connection::ReceivedPing() {
- last_ping_received_ = talk_base::Time();
+ last_ping_received_ = rtc::Time();
set_read_state(STATE_READABLE);
}
@@ -1238,21 +1251,21 @@
std::string pings;
for (size_t i = 0; i < pings_since_last_response_.size(); ++i) {
char buf[32];
- talk_base::sprintfn(buf, sizeof(buf), "%u",
+ rtc::sprintfn(buf, sizeof(buf), "%u",
pings_since_last_response_[i]);
pings.append(buf).append(" ");
}
- talk_base::LoggingSeverity level =
+ rtc::LoggingSeverity level =
(pings_since_last_response_.size() > CONNECTION_WRITE_CONNECT_FAILURES) ?
- talk_base::LS_INFO : talk_base::LS_VERBOSE;
+ rtc::LS_INFO : rtc::LS_VERBOSE;
LOG_JV(level, this) << "Received STUN ping response " << request->id()
<< ", pings_since_last_response_=" << pings
<< ", rtt=" << rtt;
pings_since_last_response_.clear();
- last_ping_response_received_ = talk_base::Time();
+ last_ping_response_received_ = rtc::Time();
rtt_ = (RTT_RATIO * rtt_ + rtt) / (RTT_RATIO + 1);
// Peer reflexive candidate is only for RFC 5245 ICE.
@@ -1294,8 +1307,8 @@
void Connection::OnConnectionRequestTimeout(ConnectionRequest* request) {
// Log at LS_INFO if we miss a ping on a writable connection.
- talk_base::LoggingSeverity sev = (write_state_ == STATE_WRITABLE) ?
- talk_base::LS_INFO : talk_base::LS_VERBOSE;
+ rtc::LoggingSeverity sev = (write_state_ == STATE_WRITABLE) ?
+ rtc::LS_INFO : rtc::LS_VERBOSE;
LOG_JV(sev, this) << "Timing-out STUN ping " << request->id()
<< " after " << request->Elapsed() << " ms";
}
@@ -1317,7 +1330,7 @@
port_->SignalRoleConflict(port_);
}
-void Connection::OnMessage(talk_base::Message *pmsg) {
+void Connection::OnMessage(rtc::Message *pmsg) {
ASSERT(pmsg->message_id == MSG_DELETE);
LOG_J(LS_INFO, this) << "Connection deleted";
@@ -1380,7 +1393,7 @@
return;
}
const uint32 priority = priority_attr->value();
- std::string id = talk_base::CreateRandomString(8);
+ std::string id = rtc::CreateRandomString(8);
Candidate new_local_candidate;
new_local_candidate.set_id(id);
@@ -1411,7 +1424,7 @@
}
int ProxyConnection::Send(const void* data, size_t size,
- const talk_base::PacketOptions& options) {
+ const rtc::PacketOptions& options) {
if (write_state_ == STATE_WRITE_INIT || write_state_ == STATE_WRITE_TIMEOUT) {
error_ = EWOULDBLOCK;
return SOCKET_ERROR;
diff --git a/p2p/base/port.h b/p2p/base/port.h
index 6e5c383..0071a03 100644
--- a/p2p/base/port.h
+++ b/p2p/base/port.h
@@ -31,14 +31,15 @@
#include <string>
#include <vector>
#include <map>
+#include <set>
-#include "talk/base/asyncpacketsocket.h"
-#include "talk/base/network.h"
-#include "talk/base/proxyinfo.h"
-#include "talk/base/ratetracker.h"
-#include "talk/base/sigslot.h"
-#include "talk/base/socketaddress.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/asyncpacketsocket.h"
+#include "webrtc/base/network.h"
+#include "webrtc/base/proxyinfo.h"
+#include "webrtc/base/ratetracker.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/socketaddress.h"
+#include "webrtc/base/thread.h"
#include "talk/p2p/base/candidate.h"
#include "talk/p2p/base/packetsocketfactory.h"
#include "talk/p2p/base/portinterface.h"
@@ -99,34 +100,36 @@
bool StringToProto(const char* value, ProtocolType* proto);
struct ProtocolAddress {
- talk_base::SocketAddress address;
+ rtc::SocketAddress address;
ProtocolType proto;
bool secure;
- ProtocolAddress(const talk_base::SocketAddress& a, ProtocolType p)
+ ProtocolAddress(const rtc::SocketAddress& a, ProtocolType p)
: address(a), proto(p), secure(false) { }
- ProtocolAddress(const talk_base::SocketAddress& a, ProtocolType p, bool sec)
+ ProtocolAddress(const rtc::SocketAddress& a, ProtocolType p, bool sec)
: address(a), proto(p), secure(sec) { }
};
+typedef std::set<rtc::SocketAddress> ServerAddresses;
+
// Represents a local communication mechanism that can be used to create
// connections to similar mechanisms of the other client. Subclasses of this
// one add support for specific mechanisms like local UDP ports.
-class Port : public PortInterface, public talk_base::MessageHandler,
+class Port : public PortInterface, public rtc::MessageHandler,
public sigslot::has_slots<> {
public:
- Port(talk_base::Thread* thread, talk_base::PacketSocketFactory* factory,
- talk_base::Network* network, const talk_base::IPAddress& ip,
+ Port(rtc::Thread* thread, rtc::PacketSocketFactory* factory,
+ rtc::Network* network, const rtc::IPAddress& ip,
const std::string& username_fragment, const std::string& password);
- Port(talk_base::Thread* thread, const std::string& type,
- talk_base::PacketSocketFactory* factory,
- talk_base::Network* network, const talk_base::IPAddress& ip,
+ Port(rtc::Thread* thread, const std::string& type,
+ rtc::PacketSocketFactory* factory,
+ rtc::Network* network, const rtc::IPAddress& ip,
int min_port, int max_port, const std::string& username_fragment,
const std::string& password);
virtual ~Port();
virtual const std::string& Type() const { return type_; }
- virtual talk_base::Network* Network() const { return network_; }
+ virtual rtc::Network* Network() const { return network_; }
// This method will set the flag which enables standard ICE/STUN procedures
// in STUN connectivity checks. Currently this method does
@@ -148,11 +151,11 @@
virtual bool SharedSocket() const { return shared_socket_; }
// The thread on which this port performs its I/O.
- talk_base::Thread* thread() { return thread_; }
+ rtc::Thread* thread() { return thread_; }
// The factory used to create the sockets of this port.
- talk_base::PacketSocketFactory* socket_factory() const { return factory_; }
- void set_socket_factory(talk_base::PacketSocketFactory* factory) {
+ rtc::PacketSocketFactory* socket_factory() const { return factory_; }
+ void set_socket_factory(rtc::PacketSocketFactory* factory) {
factory_ = factory;
}
@@ -214,12 +217,12 @@
// Returns a map containing all of the connections of this port, keyed by the
// remote address.
- typedef std::map<talk_base::SocketAddress, Connection*> AddressMap;
+ typedef std::map<rtc::SocketAddress, Connection*> AddressMap;
const AddressMap& connections() { return connections_; }
// Returns the connection to the given address or NULL if none exists.
virtual Connection* GetConnection(
- const talk_base::SocketAddress& remote_addr);
+ const rtc::SocketAddress& remote_addr);
// Called each time a connection is created.
sigslot::signal2<Port*, Connection*> SignalConnectionCreated;
@@ -229,9 +232,9 @@
// port implemented this method.
// TODO(mallinath) - Make it pure virtual.
virtual bool HandleIncomingPacket(
- talk_base::AsyncPacketSocket* socket, const char* data, size_t size,
- const talk_base::SocketAddress& remote_addr,
- const talk_base::PacketTime& packet_time) {
+ rtc::AsyncPacketSocket* socket, const char* data, size_t size,
+ const rtc::SocketAddress& remote_addr,
+ const rtc::PacketTime& packet_time) {
ASSERT(false);
return false;
}
@@ -240,29 +243,29 @@
// these methods should be called as a response to SignalUnknownAddress.
// NOTE: You MUST call CreateConnection BEFORE SendBindingResponse.
virtual void SendBindingResponse(StunMessage* request,
- const talk_base::SocketAddress& addr);
+ const rtc::SocketAddress& addr);
virtual void SendBindingErrorResponse(
- StunMessage* request, const talk_base::SocketAddress& addr,
+ StunMessage* request, const rtc::SocketAddress& addr,
int error_code, const std::string& reason);
void set_proxy(const std::string& user_agent,
- const talk_base::ProxyInfo& proxy) {
+ const rtc::ProxyInfo& proxy) {
user_agent_ = user_agent;
proxy_ = proxy;
}
const std::string& user_agent() { return user_agent_; }
- const talk_base::ProxyInfo& proxy() { return proxy_; }
+ const rtc::ProxyInfo& proxy() { return proxy_; }
virtual void EnablePortPackets();
// Called if the port has no connections and is no longer useful.
void Destroy();
- virtual void OnMessage(talk_base::Message *pmsg);
+ virtual void OnMessage(rtc::Message *pmsg);
// Debugging description of this port
virtual std::string ToString() const;
- talk_base::IPAddress& ip() { return ip_; }
+ rtc::IPAddress& ip() { return ip_; }
int min_port() { return min_port_; }
int max_port() { return max_port_; }
@@ -278,7 +281,7 @@
void CreateStunUsername(const std::string& remote_username,
std::string* stun_username_attr_str) const;
- bool MaybeIceRoleConflict(const talk_base::SocketAddress& addr,
+ bool MaybeIceRoleConflict(const rtc::SocketAddress& addr,
IceMessage* stun_msg,
const std::string& remote_ufrag);
@@ -306,12 +309,18 @@
void set_type(const std::string& type) { type_ = type; }
// Fills in the local address of the port.
- void AddAddress(const talk_base::SocketAddress& address,
- const talk_base::SocketAddress& base_address,
- const talk_base::SocketAddress& related_address,
+ void AddAddress(const rtc::SocketAddress& address,
+ const rtc::SocketAddress& base_address,
+ const rtc::SocketAddress& related_address,
const std::string& protocol, const std::string& type,
uint32 type_preference, bool final);
+ void AddAddress(const rtc::SocketAddress& address,
+ const rtc::SocketAddress& base_address,
+ const rtc::SocketAddress& related_address,
+ const std::string& protocol, const std::string& type,
+ uint32 type_preference, uint32 relay_preference, bool final);
+
// Adds the given connection to the list. (Deleting removes them.)
void AddConnection(Connection* conn);
@@ -319,7 +328,7 @@
// currently a connection. If this is an authenticated STUN binding request,
// then we will signal the client.
void OnReadPacket(const char* data, size_t size,
- const talk_base::SocketAddress& addr,
+ const rtc::SocketAddress& addr,
ProtocolType proto);
// If the given data comprises a complete and correct STUN message then the
@@ -328,16 +337,16 @@
// message. Otherwise, the function may send a STUN response internally.
// remote_username contains the remote fragment of the STUN username.
bool GetStunMessage(const char* data, size_t size,
- const talk_base::SocketAddress& addr,
+ const rtc::SocketAddress& addr,
IceMessage** out_msg, std::string* out_username);
// Checks if the address in addr is compatible with the port's ip.
- bool IsCompatibleAddress(const talk_base::SocketAddress& addr);
+ bool IsCompatibleAddress(const rtc::SocketAddress& addr);
// Returns default DSCP value.
- talk_base::DiffServCodePoint DefaultDscpValue() const {
+ rtc::DiffServCodePoint DefaultDscpValue() const {
// No change from what MediaChannel set.
- return talk_base::DSCP_NO_CHANGE;
+ return rtc::DSCP_NO_CHANGE;
}
private:
@@ -348,12 +357,12 @@
// Checks if this port is useless, and hence, should be destroyed.
void CheckTimeout();
- talk_base::Thread* thread_;
- talk_base::PacketSocketFactory* factory_;
+ rtc::Thread* thread_;
+ rtc::PacketSocketFactory* factory_;
std::string type_;
bool send_retransmit_count_attribute_;
- talk_base::Network* network_;
- talk_base::IPAddress ip_;
+ rtc::Network* network_;
+ rtc::IPAddress ip_;
int min_port_;
int max_port_;
std::string content_name_;
@@ -379,14 +388,14 @@
bool shared_socket_;
// Information to use when going through a proxy.
std::string user_agent_;
- talk_base::ProxyInfo proxy_;
+ rtc::ProxyInfo proxy_;
friend class Connection;
};
// Represents a communication link between a port on the local client and a
// port on the remote client.
-class Connection : public talk_base::MessageHandler,
+class Connection : public rtc::MessageHandler,
public sigslot::has_slots<> {
public:
// States are from RFC 5245. http://tools.ietf.org/html/rfc5245#section-5.7.4
@@ -452,19 +461,19 @@
// the interface of AsyncPacketSocket, which may use UDP or TCP under the
// covers.
virtual int Send(const void* data, size_t size,
- const talk_base::PacketOptions& options) = 0;
+ const rtc::PacketOptions& options) = 0;
// Error if Send() returns < 0
virtual int GetError() = 0;
sigslot::signal4<Connection*, const char*, size_t,
- const talk_base::PacketTime&> SignalReadPacket;
+ const rtc::PacketTime&> SignalReadPacket;
sigslot::signal1<Connection*> SignalReadyToSend;
// Called when a packet is received on this connection.
void OnReadPacket(const char* data, size_t size,
- const talk_base::PacketTime& packet_time);
+ const rtc::PacketTime& packet_time);
// Called when the socket is currently able to send.
void OnReadyToSend();
@@ -540,7 +549,7 @@
// Checks if this connection is useless, and hence, should be destroyed.
void CheckTimeout();
- void OnMessage(talk_base::Message *pmsg);
+ void OnMessage(rtc::Message *pmsg);
Port* port_;
size_t local_candidate_index_;
@@ -564,8 +573,8 @@
uint32 last_ping_response_received_;
std::vector<uint32> pings_since_last_response_;
- talk_base::RateTracker recv_rate_tracker_;
- talk_base::RateTracker send_rate_tracker_;
+ rtc::RateTracker recv_rate_tracker_;
+ rtc::RateTracker send_rate_tracker_;
private:
void MaybeAddPrflxCandidate(ConnectionRequest* request,
@@ -584,7 +593,7 @@
ProxyConnection(Port* port, size_t index, const Candidate& candidate);
virtual int Send(const void* data, size_t size,
- const talk_base::PacketOptions& options);
+ const rtc::PacketOptions& options);
virtual int GetError() { return error_; }
private:
diff --git a/p2p/base/port_unittest.cc b/p2p/base/port_unittest.cc
index fc6d48c..e4f37a9 100644
--- a/p2p/base/port_unittest.cc
+++ b/p2p/base/port_unittest.cc
@@ -25,19 +25,19 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/crc32.h"
-#include "talk/base/gunit.h"
-#include "talk/base/helpers.h"
-#include "talk/base/logging.h"
-#include "talk/base/natserver.h"
-#include "talk/base/natsocketfactory.h"
-#include "talk/base/physicalsocketserver.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/socketaddress.h"
-#include "talk/base/ssladapter.h"
-#include "talk/base/stringutils.h"
-#include "talk/base/thread.h"
-#include "talk/base/virtualsocketserver.h"
+#include "webrtc/base/crc32.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/natserver.h"
+#include "webrtc/base/natsocketfactory.h"
+#include "webrtc/base/physicalsocketserver.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/socketaddress.h"
+#include "webrtc/base/ssladapter.h"
+#include "webrtc/base/stringutils.h"
+#include "webrtc/base/thread.h"
+#include "webrtc/base/virtualsocketserver.h"
#include "talk/p2p/base/basicpacketsocketfactory.h"
#include "talk/p2p/base/portproxy.h"
#include "talk/p2p/base/relayport.h"
@@ -49,24 +49,24 @@
#include "talk/p2p/base/transport.h"
#include "talk/p2p/base/turnport.h"
-using talk_base::AsyncPacketSocket;
-using talk_base::ByteBuffer;
-using talk_base::NATType;
-using talk_base::NAT_OPEN_CONE;
-using talk_base::NAT_ADDR_RESTRICTED;
-using talk_base::NAT_PORT_RESTRICTED;
-using talk_base::NAT_SYMMETRIC;
-using talk_base::PacketSocketFactory;
-using talk_base::scoped_ptr;
-using talk_base::Socket;
-using talk_base::SocketAddress;
+using rtc::AsyncPacketSocket;
+using rtc::ByteBuffer;
+using rtc::NATType;
+using rtc::NAT_OPEN_CONE;
+using rtc::NAT_ADDR_RESTRICTED;
+using rtc::NAT_PORT_RESTRICTED;
+using rtc::NAT_SYMMETRIC;
+using rtc::PacketSocketFactory;
+using rtc::scoped_ptr;
+using rtc::Socket;
+using rtc::SocketAddress;
using namespace cricket;
static const int kTimeout = 1000;
static const SocketAddress kLocalAddr1("192.168.1.2", 0);
static const SocketAddress kLocalAddr2("192.168.1.3", 0);
-static const SocketAddress kNatAddr1("77.77.77.77", talk_base::NAT_SERVER_PORT);
-static const SocketAddress kNatAddr2("88.88.88.88", talk_base::NAT_SERVER_PORT);
+static const SocketAddress kNatAddr1("77.77.77.77", rtc::NAT_SERVER_PORT);
+static const SocketAddress kNatAddr2("88.88.88.88", rtc::NAT_SERVER_PORT);
static const SocketAddress kStunAddr("99.99.99.1", STUN_SERVER_PORT);
static const SocketAddress kRelayUdpIntAddr("99.99.99.2", 5000);
static const SocketAddress kRelayUdpExtAddr("99.99.99.3", 5001);
@@ -117,9 +117,9 @@
// Stub port class for testing STUN generation and processing.
class TestPort : public Port {
public:
- TestPort(talk_base::Thread* thread, const std::string& type,
- talk_base::PacketSocketFactory* factory, talk_base::Network* network,
- const talk_base::IPAddress& ip, int min_port, int max_port,
+ TestPort(rtc::Thread* thread, const std::string& type,
+ rtc::PacketSocketFactory* factory, rtc::Network* network,
+ const rtc::IPAddress& ip, int min_port, int max_port,
const std::string& username_fragment, const std::string& password)
: Port(thread, type, factory, network, ip,
min_port, max_port, username_fragment, password) {
@@ -145,22 +145,22 @@
}
virtual void PrepareAddress() {
- talk_base::SocketAddress addr(ip(), min_port());
- AddAddress(addr, addr, talk_base::SocketAddress(), "udp", Type(),
+ rtc::SocketAddress addr(ip(), min_port());
+ AddAddress(addr, addr, rtc::SocketAddress(), "udp", Type(),
ICE_TYPE_PREFERENCE_HOST, true);
}
// Exposed for testing candidate building.
- void AddCandidateAddress(const talk_base::SocketAddress& addr) {
- AddAddress(addr, addr, talk_base::SocketAddress(), "udp", Type(),
+ void AddCandidateAddress(const rtc::SocketAddress& addr) {
+ AddAddress(addr, addr, rtc::SocketAddress(), "udp", Type(),
type_preference_, false);
}
- void AddCandidateAddress(const talk_base::SocketAddress& addr,
- const talk_base::SocketAddress& base_address,
+ void AddCandidateAddress(const rtc::SocketAddress& addr,
+ const rtc::SocketAddress& base_address,
const std::string& type,
int type_preference,
bool final) {
- AddAddress(addr, base_address, talk_base::SocketAddress(), "udp", type,
+ AddAddress(addr, base_address, rtc::SocketAddress(), "udp", type,
type_preference, final);
}
@@ -174,8 +174,8 @@
return conn;
}
virtual int SendTo(
- const void* data, size_t size, const talk_base::SocketAddress& addr,
- const talk_base::PacketOptions& options, bool payload) {
+ const void* data, size_t size, const rtc::SocketAddress& addr,
+ const rtc::PacketOptions& options, bool payload) {
if (!payload) {
IceMessage* msg = new IceMessage;
ByteBuffer* buf = new ByteBuffer(static_cast<const char*>(data), size);
@@ -191,10 +191,10 @@
}
return static_cast<int>(size);
}
- virtual int SetOption(talk_base::Socket::Option opt, int value) {
+ virtual int SetOption(rtc::Socket::Option opt, int value) {
return 0;
}
- virtual int GetOption(talk_base::Socket::Option opt, int* value) {
+ virtual int GetOption(rtc::Socket::Option opt, int* value) {
return -1;
}
virtual int GetError() {
@@ -209,8 +209,8 @@
}
private:
- talk_base::scoped_ptr<ByteBuffer> last_stun_buf_;
- talk_base::scoped_ptr<IceMessage> last_stun_msg_;
+ rtc::scoped_ptr<ByteBuffer> last_stun_buf_;
+ rtc::scoped_ptr<IceMessage> last_stun_msg_;
int type_preference_;
};
@@ -319,13 +319,13 @@
private:
IceMode ice_mode_;
- talk_base::scoped_ptr<Port> src_;
+ rtc::scoped_ptr<Port> src_;
Port* dst_;
int complete_count_;
Connection* conn_;
SocketAddress remote_address_;
- talk_base::scoped_ptr<StunMessage> remote_request_;
+ rtc::scoped_ptr<StunMessage> remote_request_;
std::string remote_frag_;
bool nominated_;
};
@@ -333,12 +333,12 @@
class PortTest : public testing::Test, public sigslot::has_slots<> {
public:
PortTest()
- : main_(talk_base::Thread::Current()),
- pss_(new talk_base::PhysicalSocketServer),
- ss_(new talk_base::VirtualSocketServer(pss_.get())),
+ : main_(rtc::Thread::Current()),
+ pss_(new rtc::PhysicalSocketServer),
+ ss_(new rtc::VirtualSocketServer(pss_.get())),
ss_scope_(ss_.get()),
- network_("unittest", "unittest", talk_base::IPAddress(INADDR_ANY), 32),
- socket_factory_(talk_base::Thread::Current()),
+ network_("unittest", "unittest", rtc::IPAddress(INADDR_ANY), 32),
+ socket_factory_(rtc::Thread::Current()),
nat_factory1_(ss_.get(), kNatAddr1),
nat_factory2_(ss_.get(), kNatAddr2),
nat_socket_factory1_(&nat_factory1_),
@@ -348,21 +348,21 @@
relay_server_(main_, kRelayUdpIntAddr, kRelayUdpExtAddr,
kRelayTcpIntAddr, kRelayTcpExtAddr,
kRelaySslTcpIntAddr, kRelaySslTcpExtAddr),
- username_(talk_base::CreateRandomString(ICE_UFRAG_LENGTH)),
- password_(talk_base::CreateRandomString(ICE_PWD_LENGTH)),
+ username_(rtc::CreateRandomString(ICE_UFRAG_LENGTH)),
+ password_(rtc::CreateRandomString(ICE_PWD_LENGTH)),
ice_protocol_(cricket::ICEPROTO_GOOGLE),
role_conflict_(false),
destroyed_(false) {
- network_.AddIP(talk_base::IPAddress(INADDR_ANY));
+ network_.AddIP(rtc::IPAddress(INADDR_ANY));
}
protected:
static void SetUpTestCase() {
- talk_base::InitializeSSL();
+ rtc::InitializeSSL();
}
static void TearDownTestCase() {
- talk_base::CleanupSSL();
+ rtc::CleanupSSL();
}
@@ -452,10 +452,12 @@
return port;
}
StunPort* CreateStunPort(const SocketAddress& addr,
- talk_base::PacketSocketFactory* factory) {
+ rtc::PacketSocketFactory* factory) {
+ ServerAddresses stun_servers;
+ stun_servers.insert(kStunAddr);
StunPort* port = StunPort::Create(main_, factory, &network_,
addr.ipaddr(), 0, 0,
- username_, password_, kStunAddr);
+ username_, password_, stun_servers);
port->SetIceProtocolType(ice_protocol_);
return port;
}
@@ -476,12 +478,12 @@
TurnPort* CreateTurnPort(const SocketAddress& addr,
PacketSocketFactory* socket_factory,
ProtocolType int_proto, ProtocolType ext_proto,
- const talk_base::SocketAddress& server_addr) {
+ const rtc::SocketAddress& server_addr) {
TurnPort* port = TurnPort::Create(main_, socket_factory, &network_,
addr.ipaddr(), 0, 0,
username_, password_, ProtocolAddress(
server_addr, PROTO_UDP),
- kRelayCredentials);
+ kRelayCredentials, 0);
port->SetIceProtocolType(ice_protocol_);
return port;
}
@@ -502,9 +504,9 @@
port->SetIceProtocolType(ice_protocol_);
return port;
}
- talk_base::NATServer* CreateNatServer(const SocketAddress& addr,
- talk_base::NATType type) {
- return new talk_base::NATServer(type, ss_.get(), addr, ss_.get(), addr);
+ rtc::NATServer* CreateNatServer(const SocketAddress& addr,
+ rtc::NATType type) {
+ return new rtc::NATServer(type, ss_.get(), addr, ss_.get(), addr);
}
static const char* StunName(NATType type) {
switch (type) {
@@ -563,7 +565,7 @@
new StunByteStringAttribute(STUN_ATTR_USERNAME, username));
return msg;
}
- TestPort* CreateTestPort(const talk_base::SocketAddress& addr,
+ TestPort* CreateTestPort(const rtc::SocketAddress& addr,
const std::string& username,
const std::string& password) {
TestPort* port = new TestPort(main_, "test", &socket_factory_, &network_,
@@ -571,7 +573,7 @@
port->SignalRoleConflict.connect(this, &PortTest::OnRoleConflict);
return port;
}
- TestPort* CreateTestPort(const talk_base::SocketAddress& addr,
+ TestPort* CreateTestPort(const rtc::SocketAddress& addr,
const std::string& username,
const std::string& password,
cricket::IceProtocolType type,
@@ -598,23 +600,23 @@
}
bool destroyed() const { return destroyed_; }
- talk_base::BasicPacketSocketFactory* nat_socket_factory1() {
+ rtc::BasicPacketSocketFactory* nat_socket_factory1() {
return &nat_socket_factory1_;
}
private:
- talk_base::Thread* main_;
- talk_base::scoped_ptr<talk_base::PhysicalSocketServer> pss_;
- talk_base::scoped_ptr<talk_base::VirtualSocketServer> ss_;
- talk_base::SocketServerScope ss_scope_;
- talk_base::Network network_;
- talk_base::BasicPacketSocketFactory socket_factory_;
- talk_base::scoped_ptr<talk_base::NATServer> nat_server1_;
- talk_base::scoped_ptr<talk_base::NATServer> nat_server2_;
- talk_base::NATSocketFactory nat_factory1_;
- talk_base::NATSocketFactory nat_factory2_;
- talk_base::BasicPacketSocketFactory nat_socket_factory1_;
- talk_base::BasicPacketSocketFactory nat_socket_factory2_;
+ rtc::Thread* main_;
+ rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_;
+ rtc::scoped_ptr<rtc::VirtualSocketServer> ss_;
+ rtc::SocketServerScope ss_scope_;
+ rtc::Network network_;
+ rtc::BasicPacketSocketFactory socket_factory_;
+ rtc::scoped_ptr<rtc::NATServer> nat_server1_;
+ rtc::scoped_ptr<rtc::NATServer> nat_server2_;
+ rtc::NATSocketFactory nat_factory1_;
+ rtc::NATSocketFactory nat_factory2_;
+ rtc::BasicPacketSocketFactory nat_socket_factory1_;
+ rtc::BasicPacketSocketFactory nat_socket_factory2_;
TestStunServer stun_server_;
TestTurnServer turn_server_;
TestRelayServer relay_server_;
@@ -779,7 +781,7 @@
ch2->Stop();
}
-class FakePacketSocketFactory : public talk_base::PacketSocketFactory {
+class FakePacketSocketFactory : public rtc::PacketSocketFactory {
public:
FakePacketSocketFactory()
: next_udp_socket_(NULL),
@@ -809,7 +811,7 @@
// per-factory and not when socket is created.
virtual AsyncPacketSocket* CreateClientTcpSocket(
const SocketAddress& local_address, const SocketAddress& remote_address,
- const talk_base::ProxyInfo& proxy_info,
+ const rtc::ProxyInfo& proxy_info,
const std::string& user_agent, int opts) {
EXPECT_TRUE(next_client_tcp_socket_ != NULL);
AsyncPacketSocket* result = next_client_tcp_socket_;
@@ -826,7 +828,7 @@
void set_next_client_tcp_socket(AsyncPacketSocket* next_client_tcp_socket) {
next_client_tcp_socket_ = next_client_tcp_socket;
}
- talk_base::AsyncResolverInterface* CreateAsyncResolver() {
+ rtc::AsyncResolverInterface* CreateAsyncResolver() {
return NULL;
}
@@ -851,11 +853,11 @@
// Send a packet.
virtual int Send(const void *pv, size_t cb,
- const talk_base::PacketOptions& options) {
+ const rtc::PacketOptions& options) {
return static_cast<int>(cb);
}
virtual int SendTo(const void *pv, size_t cb, const SocketAddress& addr,
- const talk_base::PacketOptions& options) {
+ const rtc::PacketOptions& options) {
return static_cast<int>(cb);
}
virtual int Close() {
@@ -1095,7 +1097,7 @@
// should remain equal to the request generated by the port and role of port
// must be in controlling.
TEST_F(PortTest, TestLoopbackCallAsIce) {
- talk_base::scoped_ptr<TestPort> lport(
+ rtc::scoped_ptr<TestPort> lport(
CreateTestPort(kLocalAddr1, "lfrag", "lpass"));
lport->SetIceProtocolType(ICEPROTO_RFC5245);
lport->SetIceRole(cricket::ICEROLE_CONTROLLING);
@@ -1111,7 +1113,7 @@
EXPECT_EQ(STUN_BINDING_REQUEST, msg->type());
conn->OnReadPacket(lport->last_stun_buf()->Data(),
lport->last_stun_buf()->Length(),
- talk_base::PacketTime());
+ rtc::PacketTime());
ASSERT_TRUE_WAIT(lport->last_stun_msg() != NULL, 1000);
msg = lport->last_stun_msg();
EXPECT_EQ(STUN_BINDING_RESPONSE, msg->type());
@@ -1128,7 +1130,7 @@
ASSERT_TRUE_WAIT(lport->last_stun_msg() != NULL, 1000);
msg = lport->last_stun_msg();
EXPECT_EQ(STUN_BINDING_REQUEST, msg->type());
- talk_base::scoped_ptr<IceMessage> modified_req(
+ rtc::scoped_ptr<IceMessage> modified_req(
CreateStunMessage(STUN_BINDING_REQUEST));
const StunByteStringAttribute* username_attr = msg->GetByteString(
STUN_ATTR_USERNAME);
@@ -1142,9 +1144,9 @@
modified_req->AddFingerprint();
lport->Reset();
- talk_base::scoped_ptr<ByteBuffer> buf(new ByteBuffer());
+ rtc::scoped_ptr<ByteBuffer> buf(new ByteBuffer());
WriteStunMessage(modified_req.get(), buf.get());
- conn1->OnReadPacket(buf->Data(), buf->Length(), talk_base::PacketTime());
+ conn1->OnReadPacket(buf->Data(), buf->Length(), rtc::PacketTime());
ASSERT_TRUE_WAIT(lport->last_stun_msg() != NULL, 1000);
msg = lport->last_stun_msg();
EXPECT_EQ(STUN_BINDING_ERROR_RESPONSE, msg->type());
@@ -1156,12 +1158,12 @@
// value of tiebreaker, when it receives ping request from |rport| it will
// send role conflict signal.
TEST_F(PortTest, TestIceRoleConflict) {
- talk_base::scoped_ptr<TestPort> lport(
+ rtc::scoped_ptr<TestPort> lport(
CreateTestPort(kLocalAddr1, "lfrag", "lpass"));
lport->SetIceProtocolType(ICEPROTO_RFC5245);
lport->SetIceRole(cricket::ICEROLE_CONTROLLING);
lport->SetIceTiebreaker(kTiebreaker1);
- talk_base::scoped_ptr<TestPort> rport(
+ rtc::scoped_ptr<TestPort> rport(
CreateTestPort(kLocalAddr2, "rfrag", "rpass"));
rport->SetIceProtocolType(ICEPROTO_RFC5245);
rport->SetIceRole(cricket::ICEROLE_CONTROLLING);
@@ -1183,7 +1185,7 @@
// Send rport binding request to lport.
lconn->OnReadPacket(rport->last_stun_buf()->Data(),
rport->last_stun_buf()->Length(),
- talk_base::PacketTime());
+ rtc::PacketTime());
ASSERT_TRUE_WAIT(lport->last_stun_msg() != NULL, 1000);
EXPECT_EQ(STUN_BINDING_RESPONSE, lport->last_stun_msg()->type());
@@ -1193,7 +1195,7 @@
TEST_F(PortTest, TestTcpNoDelay) {
TCPPort* port1 = CreateTcpPort(kLocalAddr1);
int option_value = -1;
- int success = port1->GetOption(talk_base::Socket::OPT_NODELAY,
+ int success = port1->GetOption(rtc::Socket::OPT_NODELAY,
&option_value);
ASSERT_EQ(0, success); // GetOption() should complete successfully w/ 0
ASSERT_EQ(1, option_value);
@@ -1296,43 +1298,43 @@
// get through DefaultDscpValue.
TEST_F(PortTest, TestDefaultDscpValue) {
int dscp;
- talk_base::scoped_ptr<UDPPort> udpport(CreateUdpPort(kLocalAddr1));
- EXPECT_EQ(0, udpport->SetOption(talk_base::Socket::OPT_DSCP,
- talk_base::DSCP_CS6));
- EXPECT_EQ(0, udpport->GetOption(talk_base::Socket::OPT_DSCP, &dscp));
- talk_base::scoped_ptr<TCPPort> tcpport(CreateTcpPort(kLocalAddr1));
- EXPECT_EQ(0, tcpport->SetOption(talk_base::Socket::OPT_DSCP,
- talk_base::DSCP_AF31));
- EXPECT_EQ(0, tcpport->GetOption(talk_base::Socket::OPT_DSCP, &dscp));
- EXPECT_EQ(talk_base::DSCP_AF31, dscp);
- talk_base::scoped_ptr<StunPort> stunport(
+ rtc::scoped_ptr<UDPPort> udpport(CreateUdpPort(kLocalAddr1));
+ EXPECT_EQ(0, udpport->SetOption(rtc::Socket::OPT_DSCP,
+ rtc::DSCP_CS6));
+ EXPECT_EQ(0, udpport->GetOption(rtc::Socket::OPT_DSCP, &dscp));
+ rtc::scoped_ptr<TCPPort> tcpport(CreateTcpPort(kLocalAddr1));
+ EXPECT_EQ(0, tcpport->SetOption(rtc::Socket::OPT_DSCP,
+ rtc::DSCP_AF31));
+ EXPECT_EQ(0, tcpport->GetOption(rtc::Socket::OPT_DSCP, &dscp));
+ EXPECT_EQ(rtc::DSCP_AF31, dscp);
+ rtc::scoped_ptr<StunPort> stunport(
CreateStunPort(kLocalAddr1, nat_socket_factory1()));
- EXPECT_EQ(0, stunport->SetOption(talk_base::Socket::OPT_DSCP,
- talk_base::DSCP_AF41));
- EXPECT_EQ(0, stunport->GetOption(talk_base::Socket::OPT_DSCP, &dscp));
- EXPECT_EQ(talk_base::DSCP_AF41, dscp);
- talk_base::scoped_ptr<TurnPort> turnport1(CreateTurnPort(
+ EXPECT_EQ(0, stunport->SetOption(rtc::Socket::OPT_DSCP,
+ rtc::DSCP_AF41));
+ EXPECT_EQ(0, stunport->GetOption(rtc::Socket::OPT_DSCP, &dscp));
+ EXPECT_EQ(rtc::DSCP_AF41, dscp);
+ rtc::scoped_ptr<TurnPort> turnport1(CreateTurnPort(
kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP));
// Socket is created in PrepareAddress.
turnport1->PrepareAddress();
- EXPECT_EQ(0, turnport1->SetOption(talk_base::Socket::OPT_DSCP,
- talk_base::DSCP_CS7));
- EXPECT_EQ(0, turnport1->GetOption(talk_base::Socket::OPT_DSCP, &dscp));
- EXPECT_EQ(talk_base::DSCP_CS7, dscp);
+ EXPECT_EQ(0, turnport1->SetOption(rtc::Socket::OPT_DSCP,
+ rtc::DSCP_CS7));
+ EXPECT_EQ(0, turnport1->GetOption(rtc::Socket::OPT_DSCP, &dscp));
+ EXPECT_EQ(rtc::DSCP_CS7, dscp);
// This will verify correct value returned without the socket.
- talk_base::scoped_ptr<TurnPort> turnport2(CreateTurnPort(
+ rtc::scoped_ptr<TurnPort> turnport2(CreateTurnPort(
kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP));
- EXPECT_EQ(0, turnport2->SetOption(talk_base::Socket::OPT_DSCP,
- talk_base::DSCP_CS6));
- EXPECT_EQ(0, turnport2->GetOption(talk_base::Socket::OPT_DSCP, &dscp));
- EXPECT_EQ(talk_base::DSCP_CS6, dscp);
+ EXPECT_EQ(0, turnport2->SetOption(rtc::Socket::OPT_DSCP,
+ rtc::DSCP_CS6));
+ EXPECT_EQ(0, turnport2->GetOption(rtc::Socket::OPT_DSCP, &dscp));
+ EXPECT_EQ(rtc::DSCP_CS6, dscp);
}
// Test sending STUN messages in GICE format.
TEST_F(PortTest, TestSendStunMessageAsGice) {
- talk_base::scoped_ptr<TestPort> lport(
+ rtc::scoped_ptr<TestPort> lport(
CreateTestPort(kLocalAddr1, "lfrag", "lpass"));
- talk_base::scoped_ptr<TestPort> rport(
+ rtc::scoped_ptr<TestPort> rport(
CreateTestPort(kLocalAddr2, "rfrag", "rpass"));
lport->SetIceProtocolType(ICEPROTO_GOOGLE);
rport->SetIceProtocolType(ICEPROTO_GOOGLE);
@@ -1360,7 +1362,7 @@
EXPECT_TRUE(msg->GetByteString(STUN_ATTR_FINGERPRINT) == NULL);
// Save a copy of the BINDING-REQUEST for use below.
- talk_base::scoped_ptr<IceMessage> request(CopyStunMessage(msg));
+ rtc::scoped_ptr<IceMessage> request(CopyStunMessage(msg));
// Respond with a BINDING-RESPONSE.
rport->SendBindingResponse(request.get(), lport->Candidates()[0].address());
@@ -1407,9 +1409,9 @@
// Test sending STUN messages in ICE format.
TEST_F(PortTest, TestSendStunMessageAsIce) {
- talk_base::scoped_ptr<TestPort> lport(
+ rtc::scoped_ptr<TestPort> lport(
CreateTestPort(kLocalAddr1, "lfrag", "lpass"));
- talk_base::scoped_ptr<TestPort> rport(
+ rtc::scoped_ptr<TestPort> rport(
CreateTestPort(kLocalAddr2, "rfrag", "rpass"));
lport->SetIceProtocolType(ICEPROTO_RFC5245);
lport->SetIceRole(cricket::ICEROLE_CONTROLLING);
@@ -1458,7 +1460,7 @@
ASSERT_TRUE(msg->GetUInt32(STUN_ATTR_RETRANSMIT_COUNT) == NULL);
// Save a copy of the BINDING-REQUEST for use below.
- talk_base::scoped_ptr<IceMessage> request(CopyStunMessage(msg));
+ rtc::scoped_ptr<IceMessage> request(CopyStunMessage(msg));
// Respond with a BINDING-RESPONSE.
rport->SendBindingResponse(request.get(), lport->Candidates()[0].address());
@@ -1549,9 +1551,9 @@
}
TEST_F(PortTest, TestUseCandidateAttribute) {
- talk_base::scoped_ptr<TestPort> lport(
+ rtc::scoped_ptr<TestPort> lport(
CreateTestPort(kLocalAddr1, "lfrag", "lpass"));
- talk_base::scoped_ptr<TestPort> rport(
+ rtc::scoped_ptr<TestPort> rport(
CreateTestPort(kLocalAddr2, "rfrag", "rpass"));
lport->SetIceProtocolType(ICEPROTO_RFC5245);
lport->SetIceRole(cricket::ICEROLE_CONTROLLING);
@@ -1580,13 +1582,13 @@
// Test handling STUN messages in GICE format.
TEST_F(PortTest, TestHandleStunMessageAsGice) {
// Our port will act as the "remote" port.
- talk_base::scoped_ptr<TestPort> port(
+ rtc::scoped_ptr<TestPort> port(
CreateTestPort(kLocalAddr2, "rfrag", "rpass"));
port->SetIceProtocolType(ICEPROTO_GOOGLE);
- talk_base::scoped_ptr<IceMessage> in_msg, out_msg;
- talk_base::scoped_ptr<ByteBuffer> buf(new ByteBuffer());
- talk_base::SocketAddress addr(kLocalAddr1);
+ rtc::scoped_ptr<IceMessage> in_msg, out_msg;
+ rtc::scoped_ptr<ByteBuffer> buf(new ByteBuffer());
+ rtc::SocketAddress addr(kLocalAddr1);
std::string username;
// BINDING-REQUEST from local to remote with valid GICE username and no M-I.
@@ -1647,13 +1649,13 @@
// Test handling STUN messages in ICE format.
TEST_F(PortTest, TestHandleStunMessageAsIce) {
// Our port will act as the "remote" port.
- talk_base::scoped_ptr<TestPort> port(
+ rtc::scoped_ptr<TestPort> port(
CreateTestPort(kLocalAddr2, "rfrag", "rpass"));
port->SetIceProtocolType(ICEPROTO_RFC5245);
- talk_base::scoped_ptr<IceMessage> in_msg, out_msg;
- talk_base::scoped_ptr<ByteBuffer> buf(new ByteBuffer());
- talk_base::SocketAddress addr(kLocalAddr1);
+ rtc::scoped_ptr<IceMessage> in_msg, out_msg;
+ rtc::scoped_ptr<ByteBuffer> buf(new ByteBuffer());
+ rtc::SocketAddress addr(kLocalAddr1);
std::string username;
// BINDING-REQUEST from local to remote with valid ICE username,
@@ -1700,13 +1702,13 @@
// ICEPROTO_RFC5245 mode after successfully handling the message.
TEST_F(PortTest, TestHandleStunMessageAsIceInHybridMode) {
// Our port will act as the "remote" port.
- talk_base::scoped_ptr<TestPort> port(
+ rtc::scoped_ptr<TestPort> port(
CreateTestPort(kLocalAddr2, "rfrag", "rpass"));
port->SetIceProtocolType(ICEPROTO_HYBRID);
- talk_base::scoped_ptr<IceMessage> in_msg, out_msg;
- talk_base::scoped_ptr<ByteBuffer> buf(new ByteBuffer());
- talk_base::SocketAddress addr(kLocalAddr1);
+ rtc::scoped_ptr<IceMessage> in_msg, out_msg;
+ rtc::scoped_ptr<ByteBuffer> buf(new ByteBuffer());
+ rtc::SocketAddress addr(kLocalAddr1);
std::string username;
// BINDING-REQUEST from local to remote with valid ICE username,
@@ -1727,13 +1729,13 @@
// ICEPROTO_GOOGLE mode after successfully handling the message.
TEST_F(PortTest, TestHandleStunMessageAsGiceInHybridMode) {
// Our port will act as the "remote" port.
- talk_base::scoped_ptr<TestPort> port(
+ rtc::scoped_ptr<TestPort> port(
CreateTestPort(kLocalAddr2, "rfrag", "rpass"));
port->SetIceProtocolType(ICEPROTO_HYBRID);
- talk_base::scoped_ptr<IceMessage> in_msg, out_msg;
- talk_base::scoped_ptr<ByteBuffer> buf(new ByteBuffer());
- talk_base::SocketAddress addr(kLocalAddr1);
+ rtc::scoped_ptr<IceMessage> in_msg, out_msg;
+ rtc::scoped_ptr<ByteBuffer> buf(new ByteBuffer());
+ rtc::SocketAddress addr(kLocalAddr1);
std::string username;
// BINDING-REQUEST from local to remote with valid GICE username and no M-I.
@@ -1751,13 +1753,13 @@
// in that mode.
TEST_F(PortTest, TestHandleStunMessageAsGiceInIceMode) {
// Our port will act as the "remote" port.
- talk_base::scoped_ptr<TestPort> port(
+ rtc::scoped_ptr<TestPort> port(
CreateTestPort(kLocalAddr2, "rfrag", "rpass"));
port->SetIceProtocolType(ICEPROTO_RFC5245);
- talk_base::scoped_ptr<IceMessage> in_msg, out_msg;
- talk_base::scoped_ptr<ByteBuffer> buf(new ByteBuffer());
- talk_base::SocketAddress addr(kLocalAddr1);
+ rtc::scoped_ptr<IceMessage> in_msg, out_msg;
+ rtc::scoped_ptr<ByteBuffer> buf(new ByteBuffer());
+ rtc::SocketAddress addr(kLocalAddr1);
std::string username;
// BINDING-REQUEST from local to remote with valid GICE username and no M-I.
@@ -1773,13 +1775,13 @@
// Tests handling of GICE binding requests with missing or incorrect usernames.
TEST_F(PortTest, TestHandleStunMessageAsGiceBadUsername) {
- talk_base::scoped_ptr<TestPort> port(
+ rtc::scoped_ptr<TestPort> port(
CreateTestPort(kLocalAddr2, "rfrag", "rpass"));
port->SetIceProtocolType(ICEPROTO_GOOGLE);
- talk_base::scoped_ptr<IceMessage> in_msg, out_msg;
- talk_base::scoped_ptr<ByteBuffer> buf(new ByteBuffer());
- talk_base::SocketAddress addr(kLocalAddr1);
+ rtc::scoped_ptr<IceMessage> in_msg, out_msg;
+ rtc::scoped_ptr<ByteBuffer> buf(new ByteBuffer());
+ rtc::SocketAddress addr(kLocalAddr1);
std::string username;
// BINDING-REQUEST with no username.
@@ -1832,13 +1834,13 @@
// Tests handling of ICE binding requests with missing or incorrect usernames.
TEST_F(PortTest, TestHandleStunMessageAsIceBadUsername) {
- talk_base::scoped_ptr<TestPort> port(
+ rtc::scoped_ptr<TestPort> port(
CreateTestPort(kLocalAddr2, "rfrag", "rpass"));
port->SetIceProtocolType(ICEPROTO_RFC5245);
- talk_base::scoped_ptr<IceMessage> in_msg, out_msg;
- talk_base::scoped_ptr<ByteBuffer> buf(new ByteBuffer());
- talk_base::SocketAddress addr(kLocalAddr1);
+ rtc::scoped_ptr<IceMessage> in_msg, out_msg;
+ rtc::scoped_ptr<ByteBuffer> buf(new ByteBuffer());
+ rtc::SocketAddress addr(kLocalAddr1);
std::string username;
// BINDING-REQUEST with no username.
@@ -1902,13 +1904,13 @@
// Test handling STUN messages (as ICE) with missing or malformed M-I.
TEST_F(PortTest, TestHandleStunMessageAsIceBadMessageIntegrity) {
// Our port will act as the "remote" port.
- talk_base::scoped_ptr<TestPort> port(
+ rtc::scoped_ptr<TestPort> port(
CreateTestPort(kLocalAddr2, "rfrag", "rpass"));
port->SetIceProtocolType(ICEPROTO_RFC5245);
- talk_base::scoped_ptr<IceMessage> in_msg, out_msg;
- talk_base::scoped_ptr<ByteBuffer> buf(new ByteBuffer());
- talk_base::SocketAddress addr(kLocalAddr1);
+ rtc::scoped_ptr<IceMessage> in_msg, out_msg;
+ rtc::scoped_ptr<ByteBuffer> buf(new ByteBuffer());
+ rtc::SocketAddress addr(kLocalAddr1);
std::string username;
// BINDING-REQUEST from local to remote with valid ICE username and
@@ -1944,13 +1946,13 @@
// Test handling STUN messages (as ICE) with missing or malformed FINGERPRINT.
TEST_F(PortTest, TestHandleStunMessageAsIceBadFingerprint) {
// Our port will act as the "remote" port.
- talk_base::scoped_ptr<TestPort> port(
+ rtc::scoped_ptr<TestPort> port(
CreateTestPort(kLocalAddr2, "rfrag", "rpass"));
port->SetIceProtocolType(ICEPROTO_RFC5245);
- talk_base::scoped_ptr<IceMessage> in_msg, out_msg;
- talk_base::scoped_ptr<ByteBuffer> buf(new ByteBuffer());
- talk_base::SocketAddress addr(kLocalAddr1);
+ rtc::scoped_ptr<IceMessage> in_msg, out_msg;
+ rtc::scoped_ptr<ByteBuffer> buf(new ByteBuffer());
+ rtc::SocketAddress addr(kLocalAddr1);
std::string username;
// BINDING-REQUEST from local to remote with valid ICE username and
@@ -2011,16 +2013,16 @@
// Test handling of STUN binding indication messages (as ICE). STUN binding
// indications are allowed only to the connection which is in read mode.
TEST_F(PortTest, TestHandleStunBindingIndication) {
- talk_base::scoped_ptr<TestPort> lport(
+ rtc::scoped_ptr<TestPort> lport(
CreateTestPort(kLocalAddr2, "lfrag", "lpass"));
lport->SetIceProtocolType(ICEPROTO_RFC5245);
lport->SetIceRole(cricket::ICEROLE_CONTROLLING);
lport->SetIceTiebreaker(kTiebreaker1);
// Verifying encoding and decoding STUN indication message.
- talk_base::scoped_ptr<IceMessage> in_msg, out_msg;
- talk_base::scoped_ptr<ByteBuffer> buf(new ByteBuffer());
- talk_base::SocketAddress addr(kLocalAddr1);
+ rtc::scoped_ptr<IceMessage> in_msg, out_msg;
+ rtc::scoped_ptr<ByteBuffer> buf(new ByteBuffer());
+ rtc::SocketAddress addr(kLocalAddr1);
std::string username;
in_msg.reset(CreateStunMessage(STUN_BINDING_INDICATION));
@@ -2034,7 +2036,7 @@
// Verify connection can handle STUN indication and updates
// last_ping_received.
- talk_base::scoped_ptr<TestPort> rport(
+ rtc::scoped_ptr<TestPort> rport(
CreateTestPort(kLocalAddr2, "rfrag", "rpass"));
rport->SetIceProtocolType(ICEPROTO_RFC5245);
rport->SetIceRole(cricket::ICEROLE_CONTROLLED);
@@ -2057,21 +2059,21 @@
// Send rport binding request to lport.
lconn->OnReadPacket(rport->last_stun_buf()->Data(),
rport->last_stun_buf()->Length(),
- talk_base::PacketTime());
+ rtc::PacketTime());
ASSERT_TRUE_WAIT(lport->last_stun_msg() != NULL, 1000);
EXPECT_EQ(STUN_BINDING_RESPONSE, lport->last_stun_msg()->type());
uint32 last_ping_received1 = lconn->last_ping_received();
// Adding a delay of 100ms.
- talk_base::Thread::Current()->ProcessMessages(100);
+ rtc::Thread::Current()->ProcessMessages(100);
// Pinging lconn using stun indication message.
- lconn->OnReadPacket(buf->Data(), buf->Length(), talk_base::PacketTime());
+ lconn->OnReadPacket(buf->Data(), buf->Length(), rtc::PacketTime());
uint32 last_ping_received2 = lconn->last_ping_received();
EXPECT_GT(last_ping_received2, last_ping_received1);
}
TEST_F(PortTest, TestComputeCandidatePriority) {
- talk_base::scoped_ptr<TestPort> port(
+ rtc::scoped_ptr<TestPort> port(
CreateTestPort(kLocalAddr1, "name", "pass"));
port->set_type_preference(90);
port->set_component(177);
@@ -2107,13 +2109,13 @@
}
TEST_F(PortTest, TestPortProxyProperties) {
- talk_base::scoped_ptr<TestPort> port(
+ rtc::scoped_ptr<TestPort> port(
CreateTestPort(kLocalAddr1, "name", "pass"));
port->SetIceRole(cricket::ICEROLE_CONTROLLING);
port->SetIceTiebreaker(kTiebreaker1);
// Create a proxy port.
- talk_base::scoped_ptr<PortProxy> proxy(new PortProxy());
+ rtc::scoped_ptr<PortProxy> proxy(new PortProxy());
proxy->set_impl(port.get());
EXPECT_EQ(port->Type(), proxy->Type());
EXPECT_EQ(port->Network(), proxy->Network());
@@ -2124,7 +2126,7 @@
// In the case of shared socket, one port may be shared by local and stun.
// Test that candidates with different types will have different foundation.
TEST_F(PortTest, TestFoundation) {
- talk_base::scoped_ptr<TestPort> testport(
+ rtc::scoped_ptr<TestPort> testport(
CreateTestPort(kLocalAddr1, "name", "pass"));
testport->AddCandidateAddress(kLocalAddr1, kLocalAddr1,
LOCAL_PORT_TYPE,
@@ -2138,21 +2140,21 @@
// This test verifies the foundation of different types of ICE candidates.
TEST_F(PortTest, TestCandidateFoundation) {
- talk_base::scoped_ptr<talk_base::NATServer> nat_server(
+ rtc::scoped_ptr<rtc::NATServer> nat_server(
CreateNatServer(kNatAddr1, NAT_OPEN_CONE));
- talk_base::scoped_ptr<UDPPort> udpport1(CreateUdpPort(kLocalAddr1));
+ rtc::scoped_ptr<UDPPort> udpport1(CreateUdpPort(kLocalAddr1));
udpport1->PrepareAddress();
- talk_base::scoped_ptr<UDPPort> udpport2(CreateUdpPort(kLocalAddr1));
+ rtc::scoped_ptr<UDPPort> udpport2(CreateUdpPort(kLocalAddr1));
udpport2->PrepareAddress();
EXPECT_EQ(udpport1->Candidates()[0].foundation(),
udpport2->Candidates()[0].foundation());
- talk_base::scoped_ptr<TCPPort> tcpport1(CreateTcpPort(kLocalAddr1));
+ rtc::scoped_ptr<TCPPort> tcpport1(CreateTcpPort(kLocalAddr1));
tcpport1->PrepareAddress();
- talk_base::scoped_ptr<TCPPort> tcpport2(CreateTcpPort(kLocalAddr1));
+ rtc::scoped_ptr<TCPPort> tcpport2(CreateTcpPort(kLocalAddr1));
tcpport2->PrepareAddress();
EXPECT_EQ(tcpport1->Candidates()[0].foundation(),
tcpport2->Candidates()[0].foundation());
- talk_base::scoped_ptr<Port> stunport(
+ rtc::scoped_ptr<Port> stunport(
CreateStunPort(kLocalAddr1, nat_socket_factory1()));
stunport->PrepareAddress();
ASSERT_EQ_WAIT(1U, stunport->Candidates().size(), kTimeout);
@@ -2165,7 +2167,7 @@
EXPECT_NE(udpport2->Candidates()[0].foundation(),
stunport->Candidates()[0].foundation());
// Verify GTURN candidate foundation.
- talk_base::scoped_ptr<RelayPort> relayport(
+ rtc::scoped_ptr<RelayPort> relayport(
CreateGturnPort(kLocalAddr1));
relayport->AddServerAddress(
cricket::ProtocolAddress(kRelayUdpIntAddr, cricket::PROTO_UDP));
@@ -2176,7 +2178,7 @@
EXPECT_NE(udpport2->Candidates()[0].foundation(),
relayport->Candidates()[0].foundation());
// Verifying TURN candidate foundation.
- talk_base::scoped_ptr<Port> turnport1(CreateTurnPort(
+ rtc::scoped_ptr<Port> turnport1(CreateTurnPort(
kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP));
turnport1->PrepareAddress();
ASSERT_EQ_WAIT(1U, turnport1->Candidates().size(), kTimeout);
@@ -2186,7 +2188,7 @@
turnport1->Candidates()[0].foundation());
EXPECT_NE(stunport->Candidates()[0].foundation(),
turnport1->Candidates()[0].foundation());
- talk_base::scoped_ptr<Port> turnport2(CreateTurnPort(
+ rtc::scoped_ptr<Port> turnport2(CreateTurnPort(
kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP));
turnport2->PrepareAddress();
ASSERT_EQ_WAIT(1U, turnport2->Candidates().size(), kTimeout);
@@ -2197,8 +2199,8 @@
SocketAddress kTurnUdpIntAddr2("99.99.98.4", STUN_SERVER_PORT);
SocketAddress kTurnUdpExtAddr2("99.99.98.5", 0);
TestTurnServer turn_server2(
- talk_base::Thread::Current(), kTurnUdpIntAddr2, kTurnUdpExtAddr2);
- talk_base::scoped_ptr<Port> turnport3(CreateTurnPort(
+ rtc::Thread::Current(), kTurnUdpIntAddr2, kTurnUdpExtAddr2);
+ rtc::scoped_ptr<Port> turnport3(CreateTurnPort(
kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP,
kTurnUdpIntAddr2));
turnport3->PrepareAddress();
@@ -2210,16 +2212,16 @@
// This test verifies the related addresses of different types of
// ICE candiates.
TEST_F(PortTest, TestCandidateRelatedAddress) {
- talk_base::scoped_ptr<talk_base::NATServer> nat_server(
+ rtc::scoped_ptr<rtc::NATServer> nat_server(
CreateNatServer(kNatAddr1, NAT_OPEN_CONE));
- talk_base::scoped_ptr<UDPPort> udpport(CreateUdpPort(kLocalAddr1));
+ rtc::scoped_ptr<UDPPort> udpport(CreateUdpPort(kLocalAddr1));
udpport->PrepareAddress();
// For UDPPort, related address will be empty.
EXPECT_TRUE(udpport->Candidates()[0].related_address().IsNil());
// Testing related address for stun candidates.
// For stun candidate related address must be equal to the base
// socket address.
- talk_base::scoped_ptr<StunPort> stunport(
+ rtc::scoped_ptr<StunPort> stunport(
CreateStunPort(kLocalAddr1, nat_socket_factory1()));
stunport->PrepareAddress();
ASSERT_EQ_WAIT(1U, stunport->Candidates().size(), kTimeout);
@@ -2232,18 +2234,18 @@
// Verifying the related address for the GTURN candidates.
// NOTE: In case of GTURN related address will be equal to the mapped
// address, but address(mapped) will not be XOR.
- talk_base::scoped_ptr<RelayPort> relayport(
+ rtc::scoped_ptr<RelayPort> relayport(
CreateGturnPort(kLocalAddr1));
relayport->AddServerAddress(
cricket::ProtocolAddress(kRelayUdpIntAddr, cricket::PROTO_UDP));
relayport->PrepareAddress();
ASSERT_EQ_WAIT(1U, relayport->Candidates().size(), kTimeout);
// For Gturn related address is set to "0.0.0.0:0"
- EXPECT_EQ(talk_base::SocketAddress(),
+ EXPECT_EQ(rtc::SocketAddress(),
relayport->Candidates()[0].related_address());
// Verifying the related address for TURN candidate.
// For TURN related address must be equal to the mapped address.
- talk_base::scoped_ptr<Port> turnport(CreateTurnPort(
+ rtc::scoped_ptr<Port> turnport(CreateTurnPort(
kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP));
turnport->PrepareAddress();
ASSERT_EQ_WAIT(1U, turnport->Candidates().size(), kTimeout);
@@ -2264,10 +2266,10 @@
// Test the Connection priority is calculated correctly.
TEST_F(PortTest, TestConnectionPriority) {
- talk_base::scoped_ptr<TestPort> lport(
+ rtc::scoped_ptr<TestPort> lport(
CreateTestPort(kLocalAddr1, "lfrag", "lpass"));
lport->set_type_preference(cricket::ICE_TYPE_PREFERENCE_HOST);
- talk_base::scoped_ptr<TestPort> rport(
+ rtc::scoped_ptr<TestPort> rport(
CreateTestPort(kLocalAddr2, "rfrag", "rpass"));
rport->set_type_preference(cricket::ICE_TYPE_PREFERENCE_RELAY);
lport->set_component(123);
@@ -2326,7 +2328,7 @@
// Data should be unsendable until the connection is accepted.
char data[] = "abcd";
int data_size = ARRAY_SIZE(data);
- talk_base::PacketOptions options;
+ rtc::PacketOptions options;
EXPECT_EQ(SOCKET_ERROR, ch1.conn()->Send(data, data_size, options));
// Accept the connection to return the binding response, transition to
@@ -2403,7 +2405,7 @@
kLocalAddr1, "lfrag", "lpass", cricket::ICEPROTO_RFC5245,
cricket::ICEROLE_CONTROLLING, kTiebreaker1);
- talk_base::scoped_ptr<TestPort> ice_lite_port(CreateTestPort(
+ rtc::scoped_ptr<TestPort> ice_lite_port(CreateTestPort(
kLocalAddr2, "rfrag", "rpass", cricket::ICEPROTO_RFC5245,
cricket::ICEROLE_CONTROLLED, kTiebreaker2));
// Setup TestChannel. This behaves like FULL mode client.
@@ -2437,14 +2439,14 @@
// But we need a connection to send a response message.
ice_lite_port->CreateConnection(
ice_full_port->Candidates()[0], cricket::Port::ORIGIN_MESSAGE);
- talk_base::scoped_ptr<IceMessage> request(CopyStunMessage(msg));
+ rtc::scoped_ptr<IceMessage> request(CopyStunMessage(msg));
ice_lite_port->SendBindingResponse(
request.get(), ice_full_port->Candidates()[0].address());
// Feeding the respone message from litemode to the full mode connection.
ch1.conn()->OnReadPacket(ice_lite_port->last_stun_buf()->Data(),
ice_lite_port->last_stun_buf()->Length(),
- talk_base::PacketTime());
+ rtc::PacketTime());
// Verifying full mode connection becomes writable from the response.
EXPECT_EQ_WAIT(Connection::STATE_WRITABLE, ch1.conn()->write_state(),
kTimeout);
@@ -2482,7 +2484,7 @@
ConnectAndDisconnectChannels(&ch1, &ch2);
// After the connection is destroyed, the port should not be destroyed.
- talk_base::Thread::Current()->ProcessMessages(kTimeout);
+ rtc::Thread::Current()->ProcessMessages(kTimeout);
EXPECT_FALSE(destroyed());
}
diff --git a/p2p/base/portallocator.h b/p2p/base/portallocator.h
index ade9c7a..6bea077 100644
--- a/p2p/base/portallocator.h
+++ b/p2p/base/portallocator.h
@@ -31,9 +31,9 @@
#include <string>
#include <vector>
-#include "talk/base/helpers.h"
-#include "talk/base/proxyinfo.h"
-#include "talk/base/sigslot.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/proxyinfo.h"
+#include "webrtc/base/sigslot.h"
#include "talk/p2p/base/portinterface.h"
namespace cricket {
@@ -137,8 +137,8 @@
void set_flags(uint32 flags) { flags_ = flags; }
const std::string& user_agent() const { return agent_; }
- const talk_base::ProxyInfo& proxy() const { return proxy_; }
- void set_proxy(const std::string& agent, const talk_base::ProxyInfo& proxy) {
+ const rtc::ProxyInfo& proxy() const { return proxy_; }
+ void set_proxy(const std::string& agent, const rtc::ProxyInfo& proxy) {
agent_ = agent;
proxy_ = proxy;
}
@@ -178,7 +178,7 @@
uint32 flags_;
std::string agent_;
- talk_base::ProxyInfo proxy_;
+ rtc::ProxyInfo proxy_;
int min_port_;
int max_port_;
uint32 step_delay_;
diff --git a/p2p/base/portallocatorsessionproxy.cc b/p2p/base/portallocatorsessionproxy.cc
index d804bdc..f7e3668 100644
--- a/p2p/base/portallocatorsessionproxy.cc
+++ b/p2p/base/portallocatorsessionproxy.cc
@@ -27,7 +27,7 @@
#include "talk/p2p/base/portallocatorsessionproxy.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/thread.h"
#include "talk/p2p/base/portallocator.h"
#include "talk/p2p/base/portproxy.h"
@@ -38,11 +38,11 @@
MSG_SEND_ALLOCATED_PORTS,
};
-typedef talk_base::TypedMessageData<PortAllocatorSessionProxy*> ProxyObjData;
+typedef rtc::TypedMessageData<PortAllocatorSessionProxy*> ProxyObjData;
PortAllocatorSessionMuxer::PortAllocatorSessionMuxer(
PortAllocatorSession* session)
- : worker_thread_(talk_base::Thread::Current()),
+ : worker_thread_(rtc::Thread::Current()),
session_(session),
candidate_done_signal_received_(false) {
session_->SignalPortReady.connect(
@@ -114,7 +114,7 @@
}
}
-void PortAllocatorSessionMuxer::OnMessage(talk_base::Message *pmsg) {
+void PortAllocatorSessionMuxer::OnMessage(rtc::Message *pmsg) {
ProxyObjData* proxy = static_cast<ProxyObjData*>(pmsg->pdata);
switch (pmsg->message_id) {
case MSG_SEND_ALLOCATION_DONE:
diff --git a/p2p/base/portallocatorsessionproxy.h b/p2p/base/portallocatorsessionproxy.h
index 990ea8a..659c730 100644
--- a/p2p/base/portallocatorsessionproxy.h
+++ b/p2p/base/portallocatorsessionproxy.h
@@ -42,7 +42,7 @@
// deleted upon receiving SignalDestroyed signal. This class is used when
// PORTALLOCATOR_ENABLE_BUNDLE flag is set.
-class PortAllocatorSessionMuxer : public talk_base::MessageHandler,
+class PortAllocatorSessionMuxer : public rtc::MessageHandler,
public sigslot::has_slots<> {
public:
explicit PortAllocatorSessionMuxer(PortAllocatorSession* session);
@@ -59,16 +59,16 @@
sigslot::signal1<PortAllocatorSessionMuxer*> SignalDestroyed;
private:
- virtual void OnMessage(talk_base::Message *pmsg);
+ virtual void OnMessage(rtc::Message *pmsg);
void OnSessionProxyDestroyed(PortAllocatorSession* proxy);
void SendAllocationDone_w(PortAllocatorSessionProxy* proxy);
void SendAllocatedPorts_w(PortAllocatorSessionProxy* proxy);
// Port will be deleted when SignalDestroyed received, otherwise delete
// happens when PortAllocatorSession dtor is called.
- talk_base::Thread* worker_thread_;
+ rtc::Thread* worker_thread_;
std::vector<PortInterface*> ports_;
- talk_base::scoped_ptr<PortAllocatorSession> session_;
+ rtc::scoped_ptr<PortAllocatorSession> session_;
std::vector<PortAllocatorSessionProxy*> session_proxies_;
bool candidate_done_signal_received_;
};
diff --git a/p2p/base/portallocatorsessionproxy_unittest.cc b/p2p/base/portallocatorsessionproxy_unittest.cc
index 689fb96..95864d4 100644
--- a/p2p/base/portallocatorsessionproxy_unittest.cc
+++ b/p2p/base/portallocatorsessionproxy_unittest.cc
@@ -27,9 +27,9 @@
#include <vector>
-#include "talk/base/fakenetwork.h"
-#include "talk/base/gunit.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/fakenetwork.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/thread.h"
#include "talk/p2p/base/basicpacketsocketfactory.h"
#include "talk/p2p/base/portallocatorsessionproxy.h"
#include "talk/p2p/client/basicportallocator.h"
@@ -102,10 +102,10 @@
class PortAllocatorSessionProxyTest : public testing::Test {
public:
PortAllocatorSessionProxyTest()
- : socket_factory_(talk_base::Thread::Current()),
- allocator_(talk_base::Thread::Current(), NULL),
+ : socket_factory_(rtc::Thread::Current()),
+ allocator_(rtc::Thread::Current(), NULL),
session_(new cricket::FakePortAllocatorSession(
- talk_base::Thread::Current(), &socket_factory_,
+ rtc::Thread::Current(), &socket_factory_,
"test content", 1,
kIceUfrag0, kIcePwd0)),
session_muxer_(new PortAllocatorSessionMuxer(session_)) {
@@ -125,7 +125,7 @@
}
protected:
- talk_base::BasicPacketSocketFactory socket_factory_;
+ rtc::BasicPacketSocketFactory socket_factory_;
cricket::FakePortAllocator allocator_;
cricket::FakePortAllocatorSession* session_;
// Muxer object will be delete itself after all registered session proxies
diff --git a/p2p/base/portinterface.h b/p2p/base/portinterface.h
index 5ebf653..a36c2b1 100644
--- a/p2p/base/portinterface.h
+++ b/p2p/base/portinterface.h
@@ -30,10 +30,10 @@
#include <string>
-#include "talk/base/socketaddress.h"
+#include "webrtc/base/socketaddress.h"
#include "talk/p2p/base/transport.h"
-namespace talk_base {
+namespace rtc {
class Network;
struct PacketOptions;
}
@@ -58,7 +58,7 @@
virtual ~PortInterface() {}
virtual const std::string& Type() const = 0;
- virtual talk_base::Network* Network() const = 0;
+ virtual rtc::Network* Network() const = 0;
virtual void SetIceProtocolType(IceProtocolType protocol) = 0;
virtual IceProtocolType IceProtocol() const = 0;
@@ -81,7 +81,7 @@
// Returns the connection to the given address or NULL if none exists.
virtual Connection* GetConnection(
- const talk_base::SocketAddress& remote_addr) = 0;
+ const rtc::SocketAddress& remote_addr) = 0;
// Creates a new connection to the given address.
enum CandidateOrigin { ORIGIN_THIS_PORT, ORIGIN_OTHER_PORT, ORIGIN_MESSAGE };
@@ -89,8 +89,8 @@
const Candidate& remote_candidate, CandidateOrigin origin) = 0;
// Functions on the underlying socket(s).
- virtual int SetOption(talk_base::Socket::Option opt, int value) = 0;
- virtual int GetOption(talk_base::Socket::Option opt, int* value) = 0;
+ virtual int SetOption(rtc::Socket::Option opt, int value) = 0;
+ virtual int GetOption(rtc::Socket::Option opt, int* value) = 0;
virtual int GetError() = 0;
virtual const std::vector<Candidate>& Candidates() const = 0;
@@ -98,13 +98,13 @@
// Sends the given packet to the given address, provided that the address is
// that of a connection or an address that has sent to us already.
virtual int SendTo(const void* data, size_t size,
- const talk_base::SocketAddress& addr,
- const talk_base::PacketOptions& options, bool payload) = 0;
+ const rtc::SocketAddress& addr,
+ const rtc::PacketOptions& options, bool payload) = 0;
// Indicates that we received a successful STUN binding request from an
// address that doesn't correspond to any current connection. To turn this
// into a real connection, call CreateConnection.
- sigslot::signal6<PortInterface*, const talk_base::SocketAddress&,
+ sigslot::signal6<PortInterface*, const rtc::SocketAddress&,
ProtocolType, IceMessage*, const std::string&,
bool> SignalUnknownAddress;
@@ -112,9 +112,9 @@
// these methods should be called as a response to SignalUnknownAddress.
// NOTE: You MUST call CreateConnection BEFORE SendBindingResponse.
virtual void SendBindingResponse(StunMessage* request,
- const talk_base::SocketAddress& addr) = 0;
+ const rtc::SocketAddress& addr) = 0;
virtual void SendBindingErrorResponse(
- StunMessage* request, const talk_base::SocketAddress& addr,
+ StunMessage* request, const rtc::SocketAddress& addr,
int error_code, const std::string& reason) = 0;
// Signaled when this port decides to delete itself because it no longer has
@@ -130,7 +130,7 @@
// through this port.
virtual void EnablePortPackets() = 0;
sigslot::signal4<PortInterface*, const char*, size_t,
- const talk_base::SocketAddress&> SignalReadPacket;
+ const rtc::SocketAddress&> SignalReadPacket;
virtual std::string ToString() const = 0;
diff --git a/p2p/base/portproxy.cc b/p2p/base/portproxy.cc
index 43bb747..841cd85 100644
--- a/p2p/base/portproxy.cc
+++ b/p2p/base/portproxy.cc
@@ -42,7 +42,7 @@
return impl_->Type();
}
-talk_base::Network* PortProxy::Network() const {
+rtc::Network* PortProxy::Network() const {
ASSERT(impl_ != NULL);
return impl_->Network();
}
@@ -96,20 +96,20 @@
int PortProxy::SendTo(const void* data,
size_t size,
- const talk_base::SocketAddress& addr,
- const talk_base::PacketOptions& options,
+ const rtc::SocketAddress& addr,
+ const rtc::PacketOptions& options,
bool payload) {
ASSERT(impl_ != NULL);
return impl_->SendTo(data, size, addr, options, payload);
}
-int PortProxy::SetOption(talk_base::Socket::Option opt,
+int PortProxy::SetOption(rtc::Socket::Option opt,
int value) {
ASSERT(impl_ != NULL);
return impl_->SetOption(opt, value);
}
-int PortProxy::GetOption(talk_base::Socket::Option opt,
+int PortProxy::GetOption(rtc::Socket::Option opt,
int* value) {
ASSERT(impl_ != NULL);
return impl_->GetOption(opt, value);
@@ -126,19 +126,19 @@
}
void PortProxy::SendBindingResponse(
- StunMessage* request, const talk_base::SocketAddress& addr) {
+ StunMessage* request, const rtc::SocketAddress& addr) {
ASSERT(impl_ != NULL);
impl_->SendBindingResponse(request, addr);
}
Connection* PortProxy::GetConnection(
- const talk_base::SocketAddress& remote_addr) {
+ const rtc::SocketAddress& remote_addr) {
ASSERT(impl_ != NULL);
return impl_->GetConnection(remote_addr);
}
void PortProxy::SendBindingErrorResponse(
- StunMessage* request, const talk_base::SocketAddress& addr,
+ StunMessage* request, const rtc::SocketAddress& addr,
int error_code, const std::string& reason) {
ASSERT(impl_ != NULL);
impl_->SendBindingErrorResponse(request, addr, error_code, reason);
@@ -156,7 +156,7 @@
void PortProxy::OnUnknownAddress(
PortInterface *port,
- const talk_base::SocketAddress &addr,
+ const rtc::SocketAddress &addr,
ProtocolType proto,
IceMessage *stun_msg,
const std::string &remote_username,
diff --git a/p2p/base/portproxy.h b/p2p/base/portproxy.h
index d138dc3..da555cc 100644
--- a/p2p/base/portproxy.h
+++ b/p2p/base/portproxy.h
@@ -28,10 +28,10 @@
#ifndef TALK_P2P_BASE_PORTPROXY_H_
#define TALK_P2P_BASE_PORTPROXY_H_
-#include "talk/base/sigslot.h"
+#include "webrtc/base/sigslot.h"
#include "talk/p2p/base/portinterface.h"
-namespace talk_base {
+namespace rtc {
class Network;
}
@@ -46,7 +46,7 @@
void set_impl(PortInterface* port);
virtual const std::string& Type() const;
- virtual talk_base::Network* Network() const;
+ virtual rtc::Network* Network() const;
virtual void SetIceProtocolType(IceProtocolType protocol);
virtual IceProtocolType IceProtocol() const;
@@ -65,22 +65,22 @@
virtual Connection* CreateConnection(const Candidate& remote_candidate,
CandidateOrigin origin);
virtual Connection* GetConnection(
- const talk_base::SocketAddress& remote_addr);
+ const rtc::SocketAddress& remote_addr);
virtual int SendTo(const void* data, size_t size,
- const talk_base::SocketAddress& addr,
- const talk_base::PacketOptions& options,
+ const rtc::SocketAddress& addr,
+ const rtc::PacketOptions& options,
bool payload);
- virtual int SetOption(talk_base::Socket::Option opt, int value);
- virtual int GetOption(talk_base::Socket::Option opt, int* value);
+ virtual int SetOption(rtc::Socket::Option opt, int value);
+ virtual int GetOption(rtc::Socket::Option opt, int* value);
virtual int GetError();
virtual const std::vector<Candidate>& Candidates() const;
virtual void SendBindingResponse(StunMessage* request,
- const talk_base::SocketAddress& addr);
+ const rtc::SocketAddress& addr);
virtual void SendBindingErrorResponse(
- StunMessage* request, const talk_base::SocketAddress& addr,
+ StunMessage* request, const rtc::SocketAddress& addr,
int error_code, const std::string& reason);
virtual void EnablePortPackets();
@@ -88,7 +88,7 @@
private:
void OnUnknownAddress(PortInterface *port,
- const talk_base::SocketAddress &addr,
+ const rtc::SocketAddress &addr,
ProtocolType proto,
IceMessage *stun_msg,
const std::string &remote_username,
diff --git a/p2p/base/pseudotcp.cc b/p2p/base/pseudotcp.cc
index 3925637..9a944f0 100644
--- a/p2p/base/pseudotcp.cc
+++ b/p2p/base/pseudotcp.cc
@@ -32,15 +32,15 @@
#include <set>
-#include "talk/base/basictypes.h"
-#include "talk/base/bytebuffer.h"
-#include "talk/base/byteorder.h"
-#include "talk/base/common.h"
-#include "talk/base/logging.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/socket.h"
-#include "talk/base/stringutils.h"
-#include "talk/base/timeutils.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/bytebuffer.h"
+#include "webrtc/base/byteorder.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/socket.h"
+#include "webrtc/base/stringutils.h"
+#include "webrtc/base/timeutils.h"
// The following logging is for detailed (packet-level) analysis only.
#define _DBG_NONE 0
@@ -151,23 +151,23 @@
//////////////////////////////////////////////////////////////////////
inline void long_to_bytes(uint32 val, void* buf) {
- *static_cast<uint32*>(buf) = talk_base::HostToNetwork32(val);
+ *static_cast<uint32*>(buf) = rtc::HostToNetwork32(val);
}
inline void short_to_bytes(uint16 val, void* buf) {
- *static_cast<uint16*>(buf) = talk_base::HostToNetwork16(val);
+ *static_cast<uint16*>(buf) = rtc::HostToNetwork16(val);
}
inline uint32 bytes_to_long(const void* buf) {
- return talk_base::NetworkToHost32(*static_cast<const uint32*>(buf));
+ return rtc::NetworkToHost32(*static_cast<const uint32*>(buf));
}
inline uint16 bytes_to_short(const void* buf) {
- return talk_base::NetworkToHost16(*static_cast<const uint16*>(buf));
+ return rtc::NetworkToHost16(*static_cast<const uint16*>(buf));
}
uint32 bound(uint32 lower, uint32 middle, uint32 upper) {
- return talk_base::_min(talk_base::_max(lower, middle), upper);
+ return rtc::_min(rtc::_max(lower, middle), upper);
}
//////////////////////////////////////////////////////////////////////
@@ -199,7 +199,7 @@
char buffer[256];
size_t len = 0;
for (int i = 0; i < S_NUM_STATS; ++i) {
- len += talk_base::sprintfn(buffer, ARRAY_SIZE(buffer), "%s%s:%d",
+ len += rtc::sprintfn(buffer, ARRAY_SIZE(buffer), "%s%s:%d",
(i == 0) ? "" : ",", STAT_NAMES[i], g_stats[i]);
g_stats[i] = 0;
}
@@ -214,9 +214,9 @@
uint32 PseudoTcp::Now() {
#if 0 // Use this to synchronize timers with logging timestamps (easier debug)
- return talk_base::TimeSince(StartTime());
+ return rtc::TimeSince(StartTime());
#else
- return talk_base::Time();
+ return rtc::Time();
#endif
}
@@ -301,7 +301,7 @@
return;
// Check if it's time to retransmit a segment
- if (m_rto_base && (talk_base::TimeDiff(m_rto_base + m_rx_rto, now) <= 0)) {
+ if (m_rto_base && (rtc::TimeDiff(m_rto_base + m_rx_rto, now) <= 0)) {
if (m_slist.empty()) {
ASSERT(false);
} else {
@@ -320,21 +320,21 @@
}
uint32 nInFlight = m_snd_nxt - m_snd_una;
- m_ssthresh = talk_base::_max(nInFlight / 2, 2 * m_mss);
+ m_ssthresh = rtc::_max(nInFlight / 2, 2 * m_mss);
//LOG(LS_INFO) << "m_ssthresh: " << m_ssthresh << " nInFlight: " << nInFlight << " m_mss: " << m_mss;
m_cwnd = m_mss;
// Back off retransmit timer. Note: the limit is lower when connecting.
uint32 rto_limit = (m_state < TCP_ESTABLISHED) ? DEF_RTO : MAX_RTO;
- m_rx_rto = talk_base::_min(rto_limit, m_rx_rto * 2);
+ m_rx_rto = rtc::_min(rto_limit, m_rx_rto * 2);
m_rto_base = now;
}
}
// Check if it's time to probe closed windows
if ((m_snd_wnd == 0)
- && (talk_base::TimeDiff(m_lastsend + m_rx_rto, now) <= 0)) {
- if (talk_base::TimeDiff(now, m_lastrecv) >= 15000) {
+ && (rtc::TimeDiff(m_lastsend + m_rx_rto, now) <= 0)) {
+ if (rtc::TimeDiff(now, m_lastrecv) >= 15000) {
closedown(ECONNABORTED);
return;
}
@@ -344,11 +344,11 @@
m_lastsend = now;
// back off retransmit timer
- m_rx_rto = talk_base::_min(MAX_RTO, m_rx_rto * 2);
+ m_rx_rto = rtc::_min(MAX_RTO, m_rx_rto * 2);
}
// Check if it's time to send delayed acks
- if (m_t_ack && (talk_base::TimeDiff(m_t_ack + m_ack_delay, now) <= 0)) {
+ if (m_t_ack && (rtc::TimeDiff(m_t_ack + m_ack_delay, now) <= 0)) {
packet(m_snd_nxt, 0, 0, 0);
}
@@ -436,21 +436,21 @@
}
size_t read = 0;
- talk_base::StreamResult result = m_rbuf.Read(buffer, len, &read, NULL);
+ rtc::StreamResult result = m_rbuf.Read(buffer, len, &read, NULL);
// If there's no data in |m_rbuf|.
- if (result == talk_base::SR_BLOCK) {
+ if (result == rtc::SR_BLOCK) {
m_bReadEnable = true;
m_error = EWOULDBLOCK;
return SOCKET_ERROR;
}
- ASSERT(result == talk_base::SR_SUCCESS);
+ ASSERT(result == rtc::SR_SUCCESS);
size_t available_space = 0;
m_rbuf.GetWriteRemaining(&available_space);
if (uint32(available_space) - m_rcv_wnd >=
- talk_base::_min<uint32>(m_rbuf_len / 2, m_mss)) {
+ rtc::_min<uint32>(m_rbuf_len / 2, m_mss)) {
// TODO(jbeda): !?! Not sure about this was closed business
bool bWasClosed = (m_rcv_wnd == 0);
m_rcv_wnd = static_cast<uint32>(available_space);
@@ -528,7 +528,7 @@
uint32 now = Now();
- talk_base::scoped_ptr<uint8[]> buffer(new uint8[MAX_PACKET]);
+ rtc::scoped_ptr<uint8[]> buffer(new uint8[MAX_PACKET]);
long_to_bytes(m_conv, buffer.get());
long_to_bytes(seq, buffer.get() + 4);
long_to_bytes(m_rcv_nxt, buffer.get() + 8);
@@ -544,10 +544,10 @@
if (len) {
size_t bytes_read = 0;
- talk_base::StreamResult result = m_sbuf.ReadOffset(
+ rtc::StreamResult result = m_sbuf.ReadOffset(
buffer.get() + HEADER_SIZE, len, offset, &bytes_read);
- UNUSED(result);
- ASSERT(result == talk_base::SR_SUCCESS);
+ RTC_UNUSED(result);
+ ASSERT(result == rtc::SR_SUCCESS);
ASSERT(static_cast<uint32>(bytes_read) == len);
}
@@ -631,20 +631,20 @@
nTimeout = DEFAULT_TIMEOUT;
if (m_t_ack) {
- nTimeout = talk_base::_min<int32>(nTimeout,
- talk_base::TimeDiff(m_t_ack + m_ack_delay, now));
+ nTimeout = rtc::_min<int32>(nTimeout,
+ rtc::TimeDiff(m_t_ack + m_ack_delay, now));
}
if (m_rto_base) {
- nTimeout = talk_base::_min<int32>(nTimeout,
- talk_base::TimeDiff(m_rto_base + m_rx_rto, now));
+ nTimeout = rtc::_min<int32>(nTimeout,
+ rtc::TimeDiff(m_rto_base + m_rx_rto, now));
}
if (m_snd_wnd == 0) {
- nTimeout = talk_base::_min<int32>(nTimeout, talk_base::TimeDiff(m_lastsend + m_rx_rto, now));
+ nTimeout = rtc::_min<int32>(nTimeout, rtc::TimeDiff(m_lastsend + m_rx_rto, now));
}
#if PSEUDO_KEEPALIVE
if (m_state == TCP_ESTABLISHED) {
- nTimeout = talk_base::_min<int32>(nTimeout,
- talk_base::TimeDiff(m_lasttraffic + (m_bOutgoing ? IDLE_PING * 3/2 : IDLE_PING), now));
+ nTimeout = rtc::_min<int32>(nTimeout,
+ rtc::TimeDiff(m_lasttraffic + (m_bOutgoing ? IDLE_PING * 3/2 : IDLE_PING), now));
}
#endif // PSEUDO_KEEPALIVE
return true;
@@ -717,7 +717,7 @@
if ((seg.ack > m_snd_una) && (seg.ack <= m_snd_nxt)) {
// Calculate round-trip time
if (seg.tsecr) {
- int32 rtt = talk_base::TimeDiff(now, seg.tsecr);
+ int32 rtt = rtc::TimeDiff(now, seg.tsecr);
if (rtt >= 0) {
if (m_rx_srtt == 0) {
m_rx_srtt = rtt;
@@ -730,7 +730,7 @@
m_rx_srtt = (7 * m_rx_srtt + rtt) / 8;
}
m_rx_rto = bound(MIN_RTO, m_rx_srtt +
- talk_base::_max<uint32>(1, 4 * m_rx_rttvar), MAX_RTO);
+ rtc::_max<uint32>(1, 4 * m_rx_rttvar), MAX_RTO);
#if _DEBUGMSG >= _DBG_VERBOSE
LOG(LS_INFO) << "rtt: " << rtt
<< " srtt: " << m_rx_srtt
@@ -767,7 +767,7 @@
if (m_dup_acks >= 3) {
if (m_snd_una >= m_recover) { // NewReno
uint32 nInFlight = m_snd_nxt - m_snd_una;
- m_cwnd = talk_base::_min(m_ssthresh, nInFlight + m_mss); // (Fast Retransmit)
+ m_cwnd = rtc::_min(m_ssthresh, nInFlight + m_mss); // (Fast Retransmit)
#if _DEBUGMSG >= _DBG_NORMAL
LOG(LS_INFO) << "exit recovery";
#endif // _DEBUGMSG
@@ -780,7 +780,7 @@
closedown(ECONNABORTED);
return false;
}
- m_cwnd += m_mss - talk_base::_min(nAcked, m_cwnd);
+ m_cwnd += m_mss - rtc::_min(nAcked, m_cwnd);
}
} else {
m_dup_acks = 0;
@@ -788,7 +788,7 @@
if (m_cwnd < m_ssthresh) {
m_cwnd += m_mss;
} else {
- m_cwnd += talk_base::_max<uint32>(1, m_mss * m_mss / m_cwnd);
+ m_cwnd += rtc::_max<uint32>(1, m_mss * m_mss / m_cwnd);
}
}
} else if (seg.ack == m_snd_una) {
@@ -811,7 +811,7 @@
}
m_recover = m_snd_nxt;
uint32 nInFlight = m_snd_nxt - m_snd_una;
- m_ssthresh = talk_base::_max(nInFlight / 2, 2 * m_mss);
+ m_ssthresh = rtc::_max(nInFlight / 2, 2 * m_mss);
//LOG(LS_INFO) << "m_ssthresh: " << m_ssthresh << " nInFlight: " << nInFlight << " m_mss: " << m_mss;
m_cwnd = m_ssthresh + 3 * m_mss;
} else if (m_dup_acks > 3) {
@@ -908,10 +908,10 @@
} else {
uint32 nOffset = seg.seq - m_rcv_nxt;
- talk_base::StreamResult result = m_rbuf.WriteOffset(seg.data, seg.len,
+ rtc::StreamResult result = m_rbuf.WriteOffset(seg.data, seg.len,
nOffset, NULL);
- ASSERT(result == talk_base::SR_SUCCESS);
- UNUSED(result);
+ ASSERT(result == rtc::SR_SUCCESS);
+ RTC_UNUSED(result);
if (seg.seq == m_rcv_nxt) {
m_rbuf.ConsumeWriteBuffer(seg.len);
@@ -969,7 +969,7 @@
return false;
}
- uint32 nTransmit = talk_base::_min(seg->len, m_mss);
+ uint32 nTransmit = rtc::_min(seg->len, m_mss);
while (true) {
uint32 seq = seg->seq;
@@ -1035,13 +1035,13 @@
void PseudoTcp::attemptSend(SendFlags sflags) {
uint32 now = Now();
- if (talk_base::TimeDiff(now, m_lastsend) > static_cast<long>(m_rx_rto)) {
+ if (rtc::TimeDiff(now, m_lastsend) > static_cast<long>(m_rx_rto)) {
m_cwnd = m_mss;
}
#if _DEBUGMSG
bool bFirst = true;
- UNUSED(bFirst);
+ RTC_UNUSED(bFirst);
#endif // _DEBUGMSG
while (true) {
@@ -1049,14 +1049,14 @@
if ((m_dup_acks == 1) || (m_dup_acks == 2)) { // Limited Transmit
cwnd += m_dup_acks * m_mss;
}
- uint32 nWindow = talk_base::_min(m_snd_wnd, cwnd);
+ uint32 nWindow = rtc::_min(m_snd_wnd, cwnd);
uint32 nInFlight = m_snd_nxt - m_snd_una;
uint32 nUseable = (nInFlight < nWindow) ? (nWindow - nInFlight) : 0;
size_t snd_buffered = 0;
m_sbuf.GetBuffered(&snd_buffered);
uint32 nAvailable =
- talk_base::_min(static_cast<uint32>(snd_buffered) - nInFlight, m_mss);
+ rtc::_min(static_cast<uint32>(snd_buffered) - nInFlight, m_mss);
if (nAvailable > nUseable) {
if (nUseable * 4 < nWindow) {
@@ -1153,8 +1153,8 @@
LOG(LS_INFO) << "Adjusting mss to " << m_mss << " bytes";
#endif // _DEBUGMSG
// Enforce minimums on ssthresh and cwnd
- m_ssthresh = talk_base::_max(m_ssthresh, 2 * m_mss);
- m_cwnd = talk_base::_max(m_cwnd, m_mss);
+ m_ssthresh = rtc::_max(m_ssthresh, 2 * m_mss);
+ m_cwnd = rtc::_max(m_cwnd, m_mss);
}
bool
@@ -1171,7 +1171,7 @@
void
PseudoTcp::queueConnectMessage() {
- talk_base::ByteBuffer buf(talk_base::ByteBuffer::ORDER_NETWORK);
+ rtc::ByteBuffer buf(rtc::ByteBuffer::ORDER_NETWORK);
buf.WriteUInt8(CTL_CONNECT);
if (m_support_wnd_scale) {
@@ -1189,7 +1189,7 @@
// See http://www.freesoft.org/CIE/Course/Section4/8.htm for
// parsing the options list.
- talk_base::ByteBuffer buf(data, len);
+ rtc::ByteBuffer buf(data, len);
while (buf.Length()) {
uint8 kind = TCP_OPT_EOL;
buf.ReadUInt8(&kind);
@@ -1204,7 +1204,7 @@
// Length of this option.
ASSERT(len != 0);
- UNUSED(len);
+ RTC_UNUSED(len);
uint8 opt_len = 0;
buf.ReadUInt8(&opt_len);
@@ -1278,7 +1278,7 @@
// before connection is established or when peers are exchanging connect
// messages.
ASSERT(result);
- UNUSED(result);
+ RTC_UNUSED(result);
m_rbuf_len = new_size;
m_rwnd_scale = scale_factor;
m_ssthresh = new_size;
diff --git a/p2p/base/pseudotcp.h b/p2p/base/pseudotcp.h
index edd861b..46e9d3b 100644
--- a/p2p/base/pseudotcp.h
+++ b/p2p/base/pseudotcp.h
@@ -30,8 +30,8 @@
#include <list>
-#include "talk/base/basictypes.h"
-#include "talk/base/stream.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/stream.h"
namespace cricket {
@@ -219,13 +219,13 @@
RList m_rlist;
uint32 m_rbuf_len, m_rcv_nxt, m_rcv_wnd, m_lastrecv;
uint8 m_rwnd_scale; // Window scale factor.
- talk_base::FifoBuffer m_rbuf;
+ rtc::FifoBuffer m_rbuf;
// Outgoing data
SList m_slist;
uint32 m_sbuf_len, m_snd_nxt, m_snd_wnd, m_lastsend, m_snd_una;
uint8 m_swnd_scale; // Window scale factor.
- talk_base::FifoBuffer m_sbuf;
+ rtc::FifoBuffer m_sbuf;
// Maximum segment size, estimated protocol level, largest segment sent
uint32 m_mss, m_msslevel, m_largest, m_mtu_advise;
diff --git a/p2p/base/pseudotcp_unittest.cc b/p2p/base/pseudotcp_unittest.cc
index e18159e..8ca3ce1 100644
--- a/p2p/base/pseudotcp_unittest.cc
+++ b/p2p/base/pseudotcp_unittest.cc
@@ -27,12 +27,12 @@
#include <vector>
-#include "talk/base/gunit.h"
-#include "talk/base/helpers.h"
-#include "talk/base/messagehandler.h"
-#include "talk/base/stream.h"
-#include "talk/base/thread.h"
-#include "talk/base/timeutils.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/messagehandler.h"
+#include "webrtc/base/stream.h"
+#include "webrtc/base/thread.h"
+#include "webrtc/base/timeutils.h"
#include "talk/p2p/base/pseudotcp.h"
using cricket::PseudoTcp;
@@ -57,7 +57,7 @@
};
class PseudoTcpTestBase : public testing::Test,
- public talk_base::MessageHandler,
+ public rtc::MessageHandler,
public cricket::IPseudoTcpNotify {
public:
PseudoTcpTestBase()
@@ -70,11 +70,11 @@
delay_(0),
loss_(0) {
// Set use of the test RNG to get predictable loss patterns.
- talk_base::SetRandomTestMode(true);
+ rtc::SetRandomTestMode(true);
}
~PseudoTcpTestBase() {
// Put it back for the next test.
- talk_base::SetRandomTestMode(false);
+ rtc::SetRandomTestMode(false);
}
void SetLocalMtu(int mtu) {
local_.NotifyMTU(mtu);
@@ -157,16 +157,16 @@
const char* buffer, size_t len) {
// Randomly drop the desired percentage of packets.
// Also drop packets that are larger than the configured MTU.
- if (talk_base::CreateRandomId() % 100 < static_cast<uint32>(loss_)) {
+ if (rtc::CreateRandomId() % 100 < static_cast<uint32>(loss_)) {
LOG(LS_VERBOSE) << "Randomly dropping packet, size=" << len;
} else if (len > static_cast<size_t>(
- talk_base::_min(local_mtu_, remote_mtu_))) {
+ rtc::_min(local_mtu_, remote_mtu_))) {
LOG(LS_VERBOSE) << "Dropping packet that exceeds path MTU, size=" << len;
} else {
int id = (tcp == &local_) ? MSG_RPACKET : MSG_LPACKET;
std::string packet(buffer, len);
- talk_base::Thread::Current()->PostDelayed(delay_, this, id,
- talk_base::WrapMessageData(packet));
+ rtc::Thread::Current()->PostDelayed(delay_, this, id,
+ rtc::WrapMessageData(packet));
}
return WR_SUCCESS;
}
@@ -176,23 +176,23 @@
void UpdateClock(PseudoTcp* tcp, uint32 message) {
long interval = 0; // NOLINT
tcp->GetNextClock(PseudoTcp::Now(), interval);
- interval = talk_base::_max<int>(interval, 0L); // sometimes interval is < 0
- talk_base::Thread::Current()->Clear(this, message);
- talk_base::Thread::Current()->PostDelayed(interval, this, message);
+ interval = rtc::_max<int>(interval, 0L); // sometimes interval is < 0
+ rtc::Thread::Current()->Clear(this, message);
+ rtc::Thread::Current()->PostDelayed(interval, this, message);
}
- virtual void OnMessage(talk_base::Message* message) {
+ virtual void OnMessage(rtc::Message* message) {
switch (message->message_id) {
case MSG_LPACKET: {
const std::string& s(
- talk_base::UseMessageData<std::string>(message->pdata));
+ rtc::UseMessageData<std::string>(message->pdata));
local_.NotifyPacket(s.c_str(), s.size());
UpdateLocalClock();
break;
}
case MSG_RPACKET: {
const std::string& s(
- talk_base::UseMessageData<std::string>(message->pdata));
+ rtc::UseMessageData<std::string>(message->pdata));
remote_.NotifyPacket(s.c_str(), s.size());
UpdateRemoteClock();
break;
@@ -213,8 +213,8 @@
PseudoTcpForTest local_;
PseudoTcpForTest remote_;
- talk_base::MemoryStream send_stream_;
- talk_base::MemoryStream recv_stream_;
+ rtc::MemoryStream send_stream_;
+ rtc::MemoryStream recv_stream_;
bool have_connected_;
bool have_disconnected_;
int local_mtu_;
@@ -238,13 +238,13 @@
// Prepare the receive stream.
recv_stream_.ReserveSize(size);
// Connect and wait until connected.
- start = talk_base::Time();
+ start = rtc::Time();
EXPECT_EQ(0, Connect());
EXPECT_TRUE_WAIT(have_connected_, kConnectTimeoutMs);
// Sending will start from OnTcpWriteable and complete when all data has
// been received.
EXPECT_TRUE_WAIT(have_disconnected_, kTransferTimeoutMs);
- elapsed = talk_base::TimeSince(start);
+ elapsed = rtc::TimeSince(start);
recv_stream_.GetSize(&received);
// Ensure we closed down OK and we got the right data.
// TODO: Ensure the errors are cleared properly.
@@ -308,7 +308,7 @@
do {
send_stream_.GetPosition(&position);
if (send_stream_.Read(block, sizeof(block), &tosend, NULL) !=
- talk_base::SR_EOS) {
+ rtc::SR_EOS) {
sent = local_.Send(block, tosend);
UpdateLocalClock();
if (sent != -1) {
@@ -326,8 +326,8 @@
}
private:
- talk_base::MemoryStream send_stream_;
- talk_base::MemoryStream recv_stream_;
+ rtc::MemoryStream send_stream_;
+ rtc::MemoryStream recv_stream_;
};
@@ -357,13 +357,13 @@
// Prepare the receive stream.
recv_stream_.ReserveSize(size);
// Connect and wait until connected.
- start = talk_base::Time();
+ start = rtc::Time();
EXPECT_EQ(0, Connect());
EXPECT_TRUE_WAIT(have_connected_, kConnectTimeoutMs);
// Sending will start from OnTcpWriteable and stop when the required
// number of iterations have completed.
EXPECT_TRUE_WAIT(have_disconnected_, kTransferTimeoutMs);
- elapsed = talk_base::TimeSince(start);
+ elapsed = rtc::TimeSince(start);
LOG(LS_INFO) << "Performed " << iterations << " pings in "
<< elapsed << " ms";
}
@@ -428,7 +428,7 @@
send_stream_.GetPosition(&position);
tosend = bytes_per_send_ ? bytes_per_send_ : sizeof(block);
if (send_stream_.Read(block, tosend, &tosend, NULL) !=
- talk_base::SR_EOS) {
+ rtc::SR_EOS) {
sent = sender_->Send(block, tosend);
UpdateLocalClock();
if (sent != -1) {
@@ -474,7 +474,7 @@
EXPECT_EQ(0, Connect());
EXPECT_TRUE_WAIT(have_connected_, kConnectTimeoutMs);
- talk_base::Thread::Current()->Post(this, MSG_WRITE);
+ rtc::Thread::Current()->Post(this, MSG_WRITE);
EXPECT_TRUE_WAIT(have_disconnected_, kTransferTimeoutMs);
ASSERT_EQ(2u, send_position_.size());
@@ -492,7 +492,7 @@
EXPECT_EQ(2 * estimated_recv_window, recv_position_[1]);
}
- virtual void OnMessage(talk_base::Message* message) {
+ virtual void OnMessage(rtc::Message* message) {
int message_id = message->message_id;
PseudoTcpTestBase::OnMessage(message);
@@ -555,7 +555,7 @@
do {
send_stream_.GetPosition(&position);
if (send_stream_.Read(block, sizeof(block), &tosend, NULL) !=
- talk_base::SR_EOS) {
+ rtc::SR_EOS) {
sent = local_.Send(block, tosend);
UpdateLocalClock();
if (sent != -1) {
@@ -572,7 +572,7 @@
// At this point, we've filled up the available space in the send queue.
int message_queue_size =
- static_cast<int>(talk_base::Thread::Current()->size());
+ static_cast<int>(rtc::Thread::Current()->size());
// The message queue will always have at least 2 messages, an RCLOCK and
// an LCLOCK, since they are added back on the delay queue at the same time
// they are pulled off and therefore are never really removed.
@@ -580,7 +580,7 @@
// If there are non-clock messages remaining, attempt to continue sending
// after giving those messages time to process, which should free up the
// send buffer.
- talk_base::Thread::Current()->PostDelayed(10, this, MSG_WRITE);
+ rtc::Thread::Current()->PostDelayed(10, this, MSG_WRITE);
} else {
if (!remote_.isReceiveBufferFull()) {
LOG(LS_ERROR) << "This shouldn't happen - the send buffer is full, "
@@ -596,8 +596,8 @@
}
private:
- talk_base::MemoryStream send_stream_;
- talk_base::MemoryStream recv_stream_;
+ rtc::MemoryStream send_stream_;
+ rtc::MemoryStream recv_stream_;
std::vector<size_t> send_position_;
std::vector<size_t> recv_position_;
diff --git a/p2p/base/rawtransport.cc b/p2p/base/rawtransport.cc
index fe4f3a2..60f8879 100644
--- a/p2p/base/rawtransport.cc
+++ b/p2p/base/rawtransport.cc
@@ -28,7 +28,7 @@
#include <string>
#include <vector>
#include "talk/p2p/base/rawtransport.h"
-#include "talk/base/common.h"
+#include "webrtc/base/common.h"
#include "talk/p2p/base/constants.h"
#include "talk/p2p/base/parsing.h"
#include "talk/p2p/base/sessionmanager.h"
@@ -40,8 +40,8 @@
#if defined(FEATURE_ENABLE_PSTN)
namespace cricket {
-RawTransport::RawTransport(talk_base::Thread* signaling_thread,
- talk_base::Thread* worker_thread,
+RawTransport::RawTransport(rtc::Thread* signaling_thread,
+ rtc::Thread* worker_thread,
const std::string& content_name,
PortAllocator* allocator)
: Transport(signaling_thread, worker_thread,
@@ -67,7 +67,7 @@
if (type() != cand_elem->Attr(buzz::QN_NAME)) {
return BadParse("channel named does not exist", error);
}
- talk_base::SocketAddress addr;
+ rtc::SocketAddress addr;
if (!ParseRawAddress(cand_elem, &addr, error))
return false;
@@ -91,7 +91,7 @@
++cand) {
ASSERT(cand->component() == 1);
ASSERT(cand->protocol() == "udp");
- talk_base::SocketAddress addr = cand->address();
+ rtc::SocketAddress addr = cand->address();
buzz::XmlElement* elem = new buzz::XmlElement(QN_GINGLE_RAW_CHANNEL);
elem->SetAttr(buzz::QN_NAME, type());
@@ -103,7 +103,7 @@
}
bool RawTransport::ParseRawAddress(const buzz::XmlElement* elem,
- talk_base::SocketAddress* addr,
+ rtc::SocketAddress* addr,
ParseError* error) {
// Make sure the required attributes exist
if (!elem->HasAttr(QN_ADDRESS) ||
diff --git a/p2p/base/rawtransport.h b/p2p/base/rawtransport.h
index 6bb04fe..3a20ef5 100644
--- a/p2p/base/rawtransport.h
+++ b/p2p/base/rawtransport.h
@@ -39,8 +39,8 @@
// that it thinks will work.
class RawTransport : public Transport, public TransportParser {
public:
- RawTransport(talk_base::Thread* signaling_thread,
- talk_base::Thread* worker_thread,
+ RawTransport(rtc::Thread* signaling_thread,
+ rtc::Thread* worker_thread,
const std::string& content_name,
PortAllocator* allocator);
virtual ~RawTransport();
@@ -66,7 +66,7 @@
// given channel. This will return false and signal an error if the address
// or channel name is bad.
bool ParseRawAddress(const buzz::XmlElement* elem,
- talk_base::SocketAddress* addr,
+ rtc::SocketAddress* addr,
ParseError* error);
friend class RawTransportChannel; // For ParseAddress.
diff --git a/p2p/base/rawtransportchannel.cc b/p2p/base/rawtransportchannel.cc
index 37478ca..4df0692 100644
--- a/p2p/base/rawtransportchannel.cc
+++ b/p2p/base/rawtransportchannel.cc
@@ -29,7 +29,7 @@
#include <string>
#include <vector>
-#include "talk/base/common.h"
+#include "webrtc/base/common.h"
#include "talk/p2p/base/constants.h"
#include "talk/p2p/base/portallocator.h"
#include "talk/p2p/base/portinterface.h"
@@ -45,7 +45,7 @@
namespace {
-const uint32 MSG_DESTROY_UNUSED_PORTS = 1;
+const uint32 MSG_DESTROY_RTC_UNUSED_PORTS = 1;
} // namespace
@@ -54,7 +54,7 @@
RawTransportChannel::RawTransportChannel(const std::string& content_name,
int component,
RawTransport* transport,
- talk_base::Thread *worker_thread,
+ rtc::Thread *worker_thread,
PortAllocator *allocator)
: TransportChannelImpl(content_name, component),
raw_transport_(transport),
@@ -75,7 +75,7 @@
}
int RawTransportChannel::SendPacket(const char *data, size_t size,
- const talk_base::PacketOptions& options,
+ const rtc::PacketOptions& options,
int flags) {
if (port_ == NULL)
return -1;
@@ -86,7 +86,7 @@
return port_->SendTo(data, size, remote_address_, options, true);
}
-int RawTransportChannel::SetOption(talk_base::Socket::Option opt, int value) {
+int RawTransportChannel::SetOption(rtc::Socket::Option opt, int value) {
// TODO: allow these to be set before we have a port
if (port_ == NULL)
return -1;
@@ -130,7 +130,7 @@
stun_port_ = NULL;
relay_port_ = NULL;
port_ = NULL;
- remote_address_ = talk_base::SocketAddress();
+ remote_address_ = rtc::SocketAddress();
}
void RawTransportChannel::OnCandidate(const Candidate& candidate) {
@@ -144,7 +144,7 @@
}
void RawTransportChannel::OnRemoteAddress(
- const talk_base::SocketAddress& remote_address) {
+ const rtc::SocketAddress& remote_address) {
remote_address_ = remote_address;
set_readable(true);
@@ -225,7 +225,7 @@
// We don't need any ports other than the one we picked.
allocator_session_->StopGettingPorts();
worker_thread_->Post(
- this, MSG_DESTROY_UNUSED_PORTS, NULL);
+ this, MSG_DESTROY_RTC_UNUSED_PORTS, NULL);
// Send a message to the other client containing our address.
@@ -255,13 +255,13 @@
void RawTransportChannel::OnReadPacket(
PortInterface* port, const char* data, size_t size,
- const talk_base::SocketAddress& addr) {
+ const rtc::SocketAddress& addr) {
ASSERT(port_ == port);
- SignalReadPacket(this, data, size, talk_base::CreatePacketTime(0), 0);
+ SignalReadPacket(this, data, size, rtc::CreatePacketTime(0), 0);
}
-void RawTransportChannel::OnMessage(talk_base::Message* msg) {
- ASSERT(msg->message_id == MSG_DESTROY_UNUSED_PORTS);
+void RawTransportChannel::OnMessage(rtc::Message* msg) {
+ ASSERT(msg->message_id == MSG_DESTROY_RTC_UNUSED_PORTS);
ASSERT(port_ != NULL);
if (port_ != stun_port_) {
stun_port_->Destroy();
diff --git a/p2p/base/rawtransportchannel.h b/p2p/base/rawtransportchannel.h
index 52085c0..43c25e5 100644
--- a/p2p/base/rawtransportchannel.h
+++ b/p2p/base/rawtransportchannel.h
@@ -30,14 +30,14 @@
#include <string>
#include <vector>
-#include "talk/base/messagequeue.h"
+#include "webrtc/base/messagequeue.h"
#include "talk/p2p/base/transportchannelimpl.h"
#include "talk/p2p/base/rawtransport.h"
#include "talk/p2p/base/candidate.h"
#if defined(FEATURE_ENABLE_PSTN)
-namespace talk_base {
+namespace rtc {
class Thread;
}
@@ -54,19 +54,19 @@
// address of the other side. We pick a single address to send them based on
// a simple investigation of NAT type.
class RawTransportChannel : public TransportChannelImpl,
- public talk_base::MessageHandler {
+ public rtc::MessageHandler {
public:
RawTransportChannel(const std::string& content_name,
int component,
RawTransport* transport,
- talk_base::Thread *worker_thread,
+ rtc::Thread *worker_thread,
PortAllocator *allocator);
virtual ~RawTransportChannel();
// Implementation of normal channel packet sending.
virtual int SendPacket(const char *data, size_t len,
- const talk_base::PacketOptions& options, int flags);
- virtual int SetOption(talk_base::Socket::Option opt, int value);
+ const rtc::PacketOptions& options, int flags);
+ virtual int SetOption(rtc::Socket::Option opt, int value);
virtual int GetError();
// Implements TransportChannelImpl.
@@ -91,7 +91,7 @@
// have this since we now know where to send.
virtual void OnCandidate(const Candidate& candidate);
- void OnRemoteAddress(const talk_base::SocketAddress& remote_address);
+ void OnRemoteAddress(const rtc::SocketAddress& remote_address);
// Below ICE specific virtual methods not implemented.
virtual IceRole GetIceRole() const { return ICEROLE_UNKNOWN; }
@@ -114,11 +114,11 @@
virtual bool IsDtlsActive() const { return false; }
// Default implementation.
- virtual bool GetSslRole(talk_base::SSLRole* role) const {
+ virtual bool GetSslRole(rtc::SSLRole* role) const {
return false;
}
- virtual bool SetSslRole(talk_base::SSLRole role) {
+ virtual bool SetSslRole(rtc::SSLRole role) {
return false;
}
@@ -133,11 +133,11 @@
}
// Returns false because the channel is not DTLS.
- virtual bool GetLocalIdentity(talk_base::SSLIdentity** identity) const {
+ virtual bool GetLocalIdentity(rtc::SSLIdentity** identity) const {
return false;
}
- virtual bool GetRemoteCertificate(talk_base::SSLCertificate** cert) const {
+ virtual bool GetRemoteCertificate(rtc::SSLCertificate** cert) const {
return false;
}
@@ -152,7 +152,7 @@
return false;
}
- virtual bool SetLocalIdentity(talk_base::SSLIdentity* identity) {
+ virtual bool SetLocalIdentity(rtc::SSLIdentity* identity) {
return false;
}
@@ -166,14 +166,14 @@
private:
RawTransport* raw_transport_;
- talk_base::Thread *worker_thread_;
+ rtc::Thread *worker_thread_;
PortAllocator* allocator_;
PortAllocatorSession* allocator_session_;
StunPort* stun_port_;
RelayPort* relay_port_;
PortInterface* port_;
bool use_relay_;
- talk_base::SocketAddress remote_address_;
+ rtc::SocketAddress remote_address_;
// Called when the allocator creates another port.
void OnPortReady(PortAllocatorSession* session, PortInterface* port);
@@ -192,10 +192,10 @@
// Called when we receive a packet from the other client.
void OnReadPacket(PortInterface* port, const char* data, size_t size,
- const talk_base::SocketAddress& addr);
+ const rtc::SocketAddress& addr);
// Handles a message to destroy unused ports.
- virtual void OnMessage(talk_base::Message *msg);
+ virtual void OnMessage(rtc::Message *msg);
DISALLOW_EVIL_CONSTRUCTORS(RawTransportChannel);
};
diff --git a/p2p/base/relayport.cc b/p2p/base/relayport.cc
index 23571ea..78bf65a 100644
--- a/p2p/base/relayport.cc
+++ b/p2p/base/relayport.cc
@@ -25,9 +25,9 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/asyncpacketsocket.h"
-#include "talk/base/helpers.h"
-#include "talk/base/logging.h"
+#include "webrtc/base/asyncpacketsocket.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/logging.h"
#include "talk/p2p/base/relayport.h"
namespace cricket {
@@ -44,16 +44,16 @@
class RelayConnection : public sigslot::has_slots<> {
public:
RelayConnection(const ProtocolAddress* protocol_address,
- talk_base::AsyncPacketSocket* socket,
- talk_base::Thread* thread);
+ rtc::AsyncPacketSocket* socket,
+ rtc::Thread* thread);
~RelayConnection();
- talk_base::AsyncPacketSocket* socket() const { return socket_; }
+ rtc::AsyncPacketSocket* socket() const { return socket_; }
const ProtocolAddress* protocol_address() {
return protocol_address_;
}
- talk_base::SocketAddress GetAddress() const {
+ rtc::SocketAddress GetAddress() const {
return protocol_address_->address;
}
@@ -61,13 +61,13 @@
return protocol_address_->proto;
}
- int SetSocketOption(talk_base::Socket::Option opt, int value);
+ int SetSocketOption(rtc::Socket::Option opt, int value);
// Validates a response to a STUN allocate request.
bool CheckResponse(StunMessage* msg);
// Sends data to the relay server.
- int Send(const void* pv, size_t cb, const talk_base::PacketOptions& options);
+ int Send(const void* pv, size_t cb, const rtc::PacketOptions& options);
// Sends a STUN allocate request message to the relay server.
void SendAllocateRequest(RelayEntry* entry, int delay);
@@ -80,7 +80,7 @@
void OnSendPacket(const void* data, size_t size, StunRequest* req);
private:
- talk_base::AsyncPacketSocket* socket_;
+ rtc::AsyncPacketSocket* socket_;
const ProtocolAddress* protocol_address_;
StunRequestManager *request_manager_;
};
@@ -89,16 +89,16 @@
// available protocol. We aim to use each connection for only a
// specific destination address so that we can avoid wrapping every
// packet in a STUN send / data indication.
-class RelayEntry : public talk_base::MessageHandler,
+class RelayEntry : public rtc::MessageHandler,
public sigslot::has_slots<> {
public:
- RelayEntry(RelayPort* port, const talk_base::SocketAddress& ext_addr);
+ RelayEntry(RelayPort* port, const rtc::SocketAddress& ext_addr);
~RelayEntry();
RelayPort* port() { return port_; }
- const talk_base::SocketAddress& address() const { return ext_addr_; }
- void set_address(const talk_base::SocketAddress& addr) { ext_addr_ = addr; }
+ const rtc::SocketAddress& address() const { return ext_addr_; }
+ void set_address(const rtc::SocketAddress& addr) { ext_addr_ = addr; }
bool connected() const { return connected_; }
bool locked() const { return locked_; }
@@ -117,14 +117,14 @@
// Called when this entry becomes connected. The address given is the one
// exposed to the outside world on the relay server.
- void OnConnect(const talk_base::SocketAddress& mapped_addr,
+ void OnConnect(const rtc::SocketAddress& mapped_addr,
RelayConnection* socket);
// Sends a packet to the given destination address using the socket of this
// entry. This will wrap the packet in STUN if necessary.
int SendTo(const void* data, size_t size,
- const talk_base::SocketAddress& addr,
- const talk_base::PacketOptions& options);
+ const rtc::SocketAddress& addr,
+ const rtc::PacketOptions& options);
// Schedules a keep-alive allocate request.
void ScheduleKeepAlive();
@@ -132,41 +132,41 @@
void SetServerIndex(size_t sindex) { server_index_ = sindex; }
// Sets this option on the socket of each connection.
- int SetSocketOption(talk_base::Socket::Option opt, int value);
+ int SetSocketOption(rtc::Socket::Option opt, int value);
size_t ServerIndex() const { return server_index_; }
// Try a different server address
- void HandleConnectFailure(talk_base::AsyncPacketSocket* socket);
+ void HandleConnectFailure(rtc::AsyncPacketSocket* socket);
// Implementation of the MessageHandler Interface.
- virtual void OnMessage(talk_base::Message *pmsg);
+ virtual void OnMessage(rtc::Message *pmsg);
private:
RelayPort* port_;
- talk_base::SocketAddress ext_addr_;
+ rtc::SocketAddress ext_addr_;
size_t server_index_;
bool connected_;
bool locked_;
RelayConnection* current_connection_;
// Called when a TCP connection is established or fails
- void OnSocketConnect(talk_base::AsyncPacketSocket* socket);
- void OnSocketClose(talk_base::AsyncPacketSocket* socket, int error);
+ void OnSocketConnect(rtc::AsyncPacketSocket* socket);
+ void OnSocketClose(rtc::AsyncPacketSocket* socket, int error);
// Called when a packet is received on this socket.
void OnReadPacket(
- talk_base::AsyncPacketSocket* socket,
+ rtc::AsyncPacketSocket* socket,
const char* data, size_t size,
- const talk_base::SocketAddress& remote_addr,
- const talk_base::PacketTime& packet_time);
+ const rtc::SocketAddress& remote_addr,
+ const rtc::PacketTime& packet_time);
// Called when the socket is currently able to send.
- void OnReadyToSend(talk_base::AsyncPacketSocket* socket);
+ void OnReadyToSend(rtc::AsyncPacketSocket* socket);
// Sends the given data on the socket to the server with no wrapping. This
// returns the number of bytes written or -1 if an error occurred.
int SendPacket(const void* data, size_t size,
- const talk_base::PacketOptions& options);
+ const rtc::PacketOptions& options);
};
// Handles an allocate request for a particular RelayEntry.
@@ -190,8 +190,8 @@
};
RelayPort::RelayPort(
- talk_base::Thread* thread, talk_base::PacketSocketFactory* factory,
- talk_base::Network* network, const talk_base::IPAddress& ip,
+ rtc::Thread* thread, rtc::PacketSocketFactory* factory,
+ rtc::Network* network, const rtc::IPAddress& ip,
int min_port, int max_port, const std::string& username,
const std::string& password)
: Port(thread, RELAY_PORT_TYPE, factory, network, ip, min_port, max_port,
@@ -199,7 +199,7 @@
ready_(false),
error_(0) {
entries_.push_back(
- new RelayEntry(this, talk_base::SocketAddress()));
+ new RelayEntry(this, rtc::SocketAddress()));
// TODO: set local preference value for TCP based candidates.
}
@@ -213,8 +213,8 @@
// Since HTTP proxies usually only allow 443,
// let's up the priority on PROTO_SSLTCP
if (addr.proto == PROTO_SSLTCP &&
- (proxy().type == talk_base::PROXY_HTTPS ||
- proxy().type == talk_base::PROXY_UNKNOWN)) {
+ (proxy().type == rtc::PROXY_HTTPS ||
+ proxy().type == rtc::PROXY_UNKNOWN)) {
server_addr_.push_front(addr);
} else {
server_addr_.push_back(addr);
@@ -243,7 +243,7 @@
// In case of Gturn, related address is set to null socket address.
// This is due to as mapped address stun attribute is used for allocated
// address.
- AddAddress(iter->address, iter->address, talk_base::SocketAddress(),
+ AddAddress(iter->address, iter->address, rtc::SocketAddress(),
proto_name, RELAY_PORT_TYPE, ICE_TYPE_PREFERENCE_RELAY, false);
}
ready_ = true;
@@ -307,8 +307,8 @@
}
int RelayPort::SendTo(const void* data, size_t size,
- const talk_base::SocketAddress& addr,
- const talk_base::PacketOptions& options,
+ const rtc::SocketAddress& addr,
+ const rtc::PacketOptions& options,
bool payload) {
// Try to find an entry for this specific address. Note that the first entry
// created was not given an address initially, so it can be set to the first
@@ -361,7 +361,7 @@
return static_cast<int>(size);
}
-int RelayPort::SetOption(talk_base::Socket::Option opt, int value) {
+int RelayPort::SetOption(rtc::Socket::Option opt, int value) {
int result = 0;
for (size_t i = 0; i < entries_.size(); ++i) {
if (entries_[i]->SetSocketOption(opt, value) < 0) {
@@ -373,7 +373,7 @@
return result;
}
-int RelayPort::GetOption(talk_base::Socket::Option opt, int* value) {
+int RelayPort::GetOption(rtc::Socket::Option opt, int* value) {
std::vector<OptionValue>::iterator it;
for (it = options_.begin(); it < options_.end(); ++it) {
if (it->first == opt) {
@@ -390,9 +390,9 @@
void RelayPort::OnReadPacket(
const char* data, size_t size,
- const talk_base::SocketAddress& remote_addr,
+ const rtc::SocketAddress& remote_addr,
ProtocolType proto,
- const talk_base::PacketTime& packet_time) {
+ const rtc::PacketTime& packet_time) {
if (Connection* conn = GetConnection(remote_addr)) {
conn->OnReadPacket(data, size, packet_time);
} else {
@@ -401,8 +401,8 @@
}
RelayConnection::RelayConnection(const ProtocolAddress* protocol_address,
- talk_base::AsyncPacketSocket* socket,
- talk_base::Thread* thread)
+ rtc::AsyncPacketSocket* socket,
+ rtc::Thread* thread)
: socket_(socket),
protocol_address_(protocol_address) {
request_manager_ = new StunRequestManager(thread);
@@ -415,7 +415,7 @@
delete socket_;
}
-int RelayConnection::SetSocketOption(talk_base::Socket::Option opt,
+int RelayConnection::SetSocketOption(rtc::Socket::Option opt,
int value) {
if (socket_) {
return socket_->SetOption(opt, value);
@@ -430,7 +430,7 @@
void RelayConnection::OnSendPacket(const void* data, size_t size,
StunRequest* req) {
// TODO(mallinath) Find a way to get DSCP value from Port.
- talk_base::PacketOptions options; // Default dscp set to NO_CHANGE.
+ rtc::PacketOptions options; // Default dscp set to NO_CHANGE.
int sent = socket_->SendTo(data, size, GetAddress(), options);
if (sent <= 0) {
LOG(LS_VERBOSE) << "OnSendPacket: failed sending to " << GetAddress() <<
@@ -440,7 +440,7 @@
}
int RelayConnection::Send(const void* pv, size_t cb,
- const talk_base::PacketOptions& options) {
+ const rtc::PacketOptions& options) {
return socket_->SendTo(pv, cb, GetAddress(), options);
}
@@ -449,7 +449,7 @@
}
RelayEntry::RelayEntry(RelayPort* port,
- const talk_base::SocketAddress& ext_addr)
+ const rtc::SocketAddress& ext_addr)
: port_(port), ext_addr_(ext_addr),
server_index_(0), connected_(false), locked_(false),
current_connection_(NULL) {
@@ -483,18 +483,18 @@
LOG(LS_INFO) << "Connecting to relay via " << ProtoToString(ra->proto) <<
" @ " << ra->address.ToSensitiveString();
- talk_base::AsyncPacketSocket* socket = NULL;
+ rtc::AsyncPacketSocket* socket = NULL;
if (ra->proto == PROTO_UDP) {
// UDP sockets are simple.
socket = port_->socket_factory()->CreateUdpSocket(
- talk_base::SocketAddress(port_->ip(), 0),
+ rtc::SocketAddress(port_->ip(), 0),
port_->min_port(), port_->max_port());
} else if (ra->proto == PROTO_TCP || ra->proto == PROTO_SSLTCP) {
int opts = (ra->proto == PROTO_SSLTCP) ?
- talk_base::PacketSocketFactory::OPT_SSLTCP : 0;
+ rtc::PacketSocketFactory::OPT_SSLTCP : 0;
socket = port_->socket_factory()->CreateClientTcpSocket(
- talk_base::SocketAddress(port_->ip(), 0), ra->address,
+ rtc::SocketAddress(port_->ip(), 0), ra->address,
port_->proxy(), port_->user_agent(), opts);
} else {
LOG(LS_WARNING) << "Unknown protocol (" << ra->proto << ")";
@@ -543,7 +543,7 @@
return conn1->GetProtocol() <= conn2->GetProtocol() ? conn1 : conn2;
}
-void RelayEntry::OnConnect(const talk_base::SocketAddress& mapped_addr,
+void RelayEntry::OnConnect(const rtc::SocketAddress& mapped_addr,
RelayConnection* connection) {
// We are connected, notify our parent.
ProtocolType proto = PROTO_UDP;
@@ -556,8 +556,8 @@
}
int RelayEntry::SendTo(const void* data, size_t size,
- const talk_base::SocketAddress& addr,
- const talk_base::PacketOptions& options) {
+ const rtc::SocketAddress& addr,
+ const rtc::PacketOptions& options) {
// If this connection is locked to the address given, then we can send the
// packet with no wrapper.
if (locked_ && (ext_addr_ == addr))
@@ -606,7 +606,7 @@
// TODO: compute the HMAC.
- talk_base::ByteBuffer buf;
+ rtc::ByteBuffer buf;
request.Write(&buf);
return SendPacket(buf.Data(), buf.Length(), options);
@@ -618,7 +618,7 @@
}
}
-int RelayEntry::SetSocketOption(talk_base::Socket::Option opt, int value) {
+int RelayEntry::SetSocketOption(rtc::Socket::Option opt, int value) {
// Set the option on all available sockets.
int socket_error = 0;
if (current_connection_) {
@@ -628,7 +628,7 @@
}
void RelayEntry::HandleConnectFailure(
- talk_base::AsyncPacketSocket* socket) {
+ rtc::AsyncPacketSocket* socket) {
// Make sure it's the current connection that has failed, it might
// be an old socked that has not yet been disposed.
if (!socket ||
@@ -642,7 +642,7 @@
}
}
-void RelayEntry::OnMessage(talk_base::Message *pmsg) {
+void RelayEntry::OnMessage(rtc::Message *pmsg) {
ASSERT(pmsg->message_id == kMessageConnectTimeout);
if (current_connection_) {
const ProtocolAddress* ra = current_connection_->protocol_address();
@@ -663,7 +663,7 @@
}
}
-void RelayEntry::OnSocketConnect(talk_base::AsyncPacketSocket* socket) {
+void RelayEntry::OnSocketConnect(rtc::AsyncPacketSocket* socket) {
LOG(INFO) << "relay tcp connected to " <<
socket->GetRemoteAddress().ToSensitiveString();
if (current_connection_ != NULL) {
@@ -671,17 +671,17 @@
}
}
-void RelayEntry::OnSocketClose(talk_base::AsyncPacketSocket* socket,
+void RelayEntry::OnSocketClose(rtc::AsyncPacketSocket* socket,
int error) {
PLOG(LERROR, error) << "Relay connection failed: socket closed";
HandleConnectFailure(socket);
}
void RelayEntry::OnReadPacket(
- talk_base::AsyncPacketSocket* socket,
+ rtc::AsyncPacketSocket* socket,
const char* data, size_t size,
- const talk_base::SocketAddress& remote_addr,
- const talk_base::PacketTime& packet_time) {
+ const rtc::SocketAddress& remote_addr,
+ const rtc::PacketTime& packet_time) {
// ASSERT(remote_addr == port_->server_addr());
// TODO: are we worried about this?
@@ -702,7 +702,7 @@
return;
}
- talk_base::ByteBuffer buf(data, size);
+ rtc::ByteBuffer buf(data, size);
RelayMessage msg;
if (!msg.Read(&buf)) {
LOG(INFO) << "Incoming packet was not STUN";
@@ -738,7 +738,7 @@
return;
}
- talk_base::SocketAddress remote_addr2(addr_attr->ipaddr(), addr_attr->port());
+ rtc::SocketAddress remote_addr2(addr_attr->ipaddr(), addr_attr->port());
const StunByteStringAttribute* data_attr = msg.GetByteString(STUN_ATTR_DATA);
if (!data_attr) {
@@ -751,14 +751,14 @@
PROTO_UDP, packet_time);
}
-void RelayEntry::OnReadyToSend(talk_base::AsyncPacketSocket* socket) {
+void RelayEntry::OnReadyToSend(rtc::AsyncPacketSocket* socket) {
if (connected()) {
port_->OnReadyToSend();
}
}
int RelayEntry::SendPacket(const void* data, size_t size,
- const talk_base::PacketOptions& options) {
+ const rtc::PacketOptions& options) {
int sent = 0;
if (current_connection_) {
// We are connected, no need to send packets anywere else than to
@@ -773,7 +773,7 @@
: StunRequest(new RelayMessage()),
entry_(entry),
connection_(connection) {
- start_time_ = talk_base::Time();
+ start_time_ = rtc::Time();
}
void AllocateRequest::Prepare(StunMessage* request) {
@@ -788,7 +788,7 @@
}
int AllocateRequest::GetNextDelay() {
- int delay = 100 * talk_base::_max(1 << count_, 2);
+ int delay = 100 * rtc::_max(1 << count_, 2);
count_ += 1;
if (count_ == 5)
timeout_ = true;
@@ -803,7 +803,7 @@
} else if (addr_attr->family() != 1) {
LOG(INFO) << "Mapped address has bad family";
} else {
- talk_base::SocketAddress addr(addr_attr->ipaddr(), addr_attr->port());
+ rtc::SocketAddress addr(addr_attr->ipaddr(), addr_attr->port());
entry_->OnConnect(addr, connection_);
}
@@ -822,7 +822,7 @@
<< " reason='" << attr->reason() << "'";
}
- if (talk_base::TimeSince(start_time_) <= kRetryTimeout)
+ if (rtc::TimeSince(start_time_) <= kRetryTimeout)
entry_->ScheduleKeepAlive();
}
diff --git a/p2p/base/relayport.h b/p2p/base/relayport.h
index 140c80f..f22d045 100644
--- a/p2p/base/relayport.h
+++ b/p2p/base/relayport.h
@@ -49,12 +49,12 @@
// successful all other connection attemts are aborted.
class RelayPort : public Port {
public:
- typedef std::pair<talk_base::Socket::Option, int> OptionValue;
+ typedef std::pair<rtc::Socket::Option, int> OptionValue;
// RelayPort doesn't yet do anything fancy in the ctor.
static RelayPort* Create(
- talk_base::Thread* thread, talk_base::PacketSocketFactory* factory,
- talk_base::Network* network, const talk_base::IPAddress& ip,
+ rtc::Thread* thread, rtc::PacketSocketFactory* factory,
+ rtc::Network* network, const rtc::IPAddress& ip,
int min_port, int max_port, const std::string& username,
const std::string& password) {
return new RelayPort(thread, factory, network, ip, min_port, max_port,
@@ -71,8 +71,8 @@
virtual void PrepareAddress();
virtual Connection* CreateConnection(const Candidate& address,
CandidateOrigin origin);
- virtual int SetOption(talk_base::Socket::Option opt, int value);
- virtual int GetOption(talk_base::Socket::Option opt, int* value);
+ virtual int SetOption(rtc::Socket::Option opt, int value);
+ virtual int GetOption(rtc::Socket::Option opt, int* value);
virtual int GetError();
const ProtocolAddress * ServerAddress(size_t index) const;
@@ -83,8 +83,8 @@
sigslot::signal1<const ProtocolAddress*> SignalSoftTimeout;
protected:
- RelayPort(talk_base::Thread* thread, talk_base::PacketSocketFactory* factory,
- talk_base::Network*, const talk_base::IPAddress& ip,
+ RelayPort(rtc::Thread* thread, rtc::PacketSocketFactory* factory,
+ rtc::Network*, const rtc::IPAddress& ip,
int min_port, int max_port, const std::string& username,
const std::string& password);
bool Init();
@@ -92,15 +92,15 @@
void SetReady();
virtual int SendTo(const void* data, size_t size,
- const talk_base::SocketAddress& addr,
- const talk_base::PacketOptions& options,
+ const rtc::SocketAddress& addr,
+ const rtc::PacketOptions& options,
bool payload);
// Dispatches the given packet to the port or connection as appropriate.
void OnReadPacket(const char* data, size_t size,
- const talk_base::SocketAddress& remote_addr,
+ const rtc::SocketAddress& remote_addr,
ProtocolType proto,
- const talk_base::PacketTime& packet_time);
+ const rtc::PacketTime& packet_time);
private:
friend class RelayEntry;
diff --git a/p2p/base/relayport_unittest.cc b/p2p/base/relayport_unittest.cc
index 987fd1e..f7b7fa7 100644
--- a/p2p/base/relayport_unittest.cc
+++ b/p2p/base/relayport_unittest.cc
@@ -25,21 +25,21 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/logging.h"
-#include "talk/base/gunit.h"
-#include "talk/base/helpers.h"
-#include "talk/base/physicalsocketserver.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/socketadapters.h"
-#include "talk/base/socketaddress.h"
-#include "talk/base/ssladapter.h"
-#include "talk/base/thread.h"
-#include "talk/base/virtualsocketserver.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/physicalsocketserver.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/socketadapters.h"
+#include "webrtc/base/socketaddress.h"
+#include "webrtc/base/ssladapter.h"
+#include "webrtc/base/thread.h"
+#include "webrtc/base/virtualsocketserver.h"
#include "talk/p2p/base/basicpacketsocketfactory.h"
#include "talk/p2p/base/relayport.h"
#include "talk/p2p/base/relayserver.h"
-using talk_base::SocketAddress;
+using rtc::SocketAddress;
static const SocketAddress kLocalAddress = SocketAddress("192.168.1.2", 0);
static const SocketAddress kRelayUdpAddr = SocketAddress("99.99.99.1", 5000);
@@ -61,15 +61,15 @@
public sigslot::has_slots<> {
public:
RelayPortTest()
- : main_(talk_base::Thread::Current()),
- physical_socket_server_(new talk_base::PhysicalSocketServer),
- virtual_socket_server_(new talk_base::VirtualSocketServer(
+ : main_(rtc::Thread::Current()),
+ physical_socket_server_(new rtc::PhysicalSocketServer),
+ virtual_socket_server_(new rtc::VirtualSocketServer(
physical_socket_server_.get())),
ss_scope_(virtual_socket_server_.get()),
- network_("unittest", "unittest", talk_base::IPAddress(INADDR_ANY), 32),
- socket_factory_(talk_base::Thread::Current()),
- username_(talk_base::CreateRandomString(16)),
- password_(talk_base::CreateRandomString(16)),
+ network_("unittest", "unittest", rtc::IPAddress(INADDR_ANY), 32),
+ socket_factory_(rtc::Thread::Current()),
+ username_(rtc::CreateRandomString(16)),
+ password_(rtc::CreateRandomString(16)),
relay_port_(cricket::RelayPort::Create(main_, &socket_factory_,
&network_,
kLocalAddress.ipaddr(),
@@ -77,10 +77,10 @@
relay_server_(new cricket::RelayServer(main_)) {
}
- void OnReadPacket(talk_base::AsyncPacketSocket* socket,
+ void OnReadPacket(rtc::AsyncPacketSocket* socket,
const char* data, size_t size,
- const talk_base::SocketAddress& remote_addr,
- const talk_base::PacketTime& packet_time) {
+ const rtc::SocketAddress& remote_addr,
+ const rtc::PacketTime& packet_time) {
received_packet_count_[socket]++;
}
@@ -94,17 +94,17 @@
protected:
static void SetUpTestCase() {
- talk_base::InitializeSSL();
+ rtc::InitializeSSL();
}
static void TearDownTestCase() {
- talk_base::CleanupSSL();
+ rtc::CleanupSSL();
}
virtual void SetUp() {
// The relay server needs an external socket to work properly.
- talk_base::AsyncUDPSocket* ext_socket =
+ rtc::AsyncUDPSocket* ext_socket =
CreateAsyncUdpSocket(kRelayExtAddr);
relay_server_->AddExternalSocket(ext_socket);
@@ -126,9 +126,9 @@
// abort any other connection attempts.
void TestConnectUdp() {
// Add a UDP socket to the relay server.
- talk_base::AsyncUDPSocket* internal_udp_socket =
+ rtc::AsyncUDPSocket* internal_udp_socket =
CreateAsyncUdpSocket(kRelayUdpAddr);
- talk_base::AsyncSocket* server_socket = CreateServerSocket(kRelayTcpAddr);
+ rtc::AsyncSocket* server_socket = CreateServerSocket(kRelayTcpAddr);
relay_server_->AddInternalSocket(internal_udp_socket);
relay_server_->AddInternalServerSocket(server_socket, cricket::PROTO_TCP);
@@ -165,7 +165,7 @@
cricket::ProtocolAddress(kRelayUdpAddr, cricket::PROTO_UDP);
// Create a server socket for the RelayServer.
- talk_base::AsyncSocket* server_socket = CreateServerSocket(kRelayTcpAddr);
+ rtc::AsyncSocket* server_socket = CreateServerSocket(kRelayTcpAddr);
relay_server_->AddInternalServerSocket(server_socket, cricket::PROTO_TCP);
// Add server addresses to the relay port and let it start.
@@ -198,14 +198,14 @@
cricket::ProtocolAddress(kRelayTcpAddr, cricket::PROTO_TCP);
// Create a ssl server socket for the RelayServer.
- talk_base::AsyncSocket* ssl_server_socket =
+ rtc::AsyncSocket* ssl_server_socket =
CreateServerSocket(kRelaySslAddr);
relay_server_->AddInternalServerSocket(ssl_server_socket,
cricket::PROTO_SSLTCP);
// Create a tcp server socket that listens on the fake address so
// the relay port can attempt to connect to it.
- talk_base::scoped_ptr<talk_base::AsyncSocket> tcp_server_socket(
+ rtc::scoped_ptr<rtc::AsyncSocket> tcp_server_socket(
CreateServerSocket(kRelayTcpAddr));
// Add server addresses to the relay port and let it start.
@@ -229,18 +229,18 @@
}
private:
- talk_base::AsyncUDPSocket* CreateAsyncUdpSocket(const SocketAddress addr) {
- talk_base::AsyncSocket* socket =
+ rtc::AsyncUDPSocket* CreateAsyncUdpSocket(const SocketAddress addr) {
+ rtc::AsyncSocket* socket =
virtual_socket_server_->CreateAsyncSocket(SOCK_DGRAM);
- talk_base::AsyncUDPSocket* packet_socket =
- talk_base::AsyncUDPSocket::Create(socket, addr);
+ rtc::AsyncUDPSocket* packet_socket =
+ rtc::AsyncUDPSocket::Create(socket, addr);
EXPECT_TRUE(packet_socket != NULL);
packet_socket->SignalReadPacket.connect(this, &RelayPortTest::OnReadPacket);
return packet_socket;
}
- talk_base::AsyncSocket* CreateServerSocket(const SocketAddress addr) {
- talk_base::AsyncSocket* socket =
+ rtc::AsyncSocket* CreateServerSocket(const SocketAddress addr) {
+ rtc::AsyncSocket* socket =
virtual_socket_server_->CreateAsyncSocket(SOCK_STREAM);
EXPECT_GE(socket->Bind(addr), 0);
EXPECT_GE(socket->Listen(5), 0);
@@ -267,19 +267,19 @@
return false;
}
- typedef std::map<talk_base::AsyncPacketSocket*, int> PacketMap;
+ typedef std::map<rtc::AsyncPacketSocket*, int> PacketMap;
- talk_base::Thread* main_;
- talk_base::scoped_ptr<talk_base::PhysicalSocketServer>
+ rtc::Thread* main_;
+ rtc::scoped_ptr<rtc::PhysicalSocketServer>
physical_socket_server_;
- talk_base::scoped_ptr<talk_base::VirtualSocketServer> virtual_socket_server_;
- talk_base::SocketServerScope ss_scope_;
- talk_base::Network network_;
- talk_base::BasicPacketSocketFactory socket_factory_;
+ rtc::scoped_ptr<rtc::VirtualSocketServer> virtual_socket_server_;
+ rtc::SocketServerScope ss_scope_;
+ rtc::Network network_;
+ rtc::BasicPacketSocketFactory socket_factory_;
std::string username_;
std::string password_;
- talk_base::scoped_ptr<cricket::RelayPort> relay_port_;
- talk_base::scoped_ptr<cricket::RelayServer> relay_server_;
+ rtc::scoped_ptr<cricket::RelayPort> relay_port_;
+ rtc::scoped_ptr<cricket::RelayServer> relay_server_;
std::vector<cricket::ProtocolAddress> failed_connections_;
std::vector<cricket::ProtocolAddress> soft_timedout_connections_;
PacketMap received_packet_count_;
diff --git a/p2p/base/relayserver.cc b/p2p/base/relayserver.cc
index 3dd8506..b5d1ac6 100644
--- a/p2p/base/relayserver.cc
+++ b/p2p/base/relayserver.cc
@@ -33,10 +33,10 @@
#include <algorithm>
-#include "talk/base/asynctcpsocket.h"
-#include "talk/base/helpers.h"
-#include "talk/base/logging.h"
-#include "talk/base/socketadapters.h"
+#include "webrtc/base/asynctcpsocket.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/socketadapters.h"
namespace cricket {
@@ -47,9 +47,9 @@
const uint32 USERNAME_LENGTH = 16;
// Calls SendTo on the given socket and logs any bad results.
-void Send(talk_base::AsyncPacketSocket* socket, const char* bytes, size_t size,
- const talk_base::SocketAddress& addr) {
- talk_base::PacketOptions options;
+void Send(rtc::AsyncPacketSocket* socket, const char* bytes, size_t size,
+ const rtc::SocketAddress& addr) {
+ rtc::PacketOptions options;
int result = socket->SendTo(bytes, size, addr, options);
if (result < static_cast<int>(size)) {
LOG(LS_ERROR) << "SendTo wrote only " << result << " of " << size
@@ -61,16 +61,16 @@
// Sends the given STUN message on the given socket.
void SendStun(const StunMessage& msg,
- talk_base::AsyncPacketSocket* socket,
- const talk_base::SocketAddress& addr) {
- talk_base::ByteBuffer buf;
+ rtc::AsyncPacketSocket* socket,
+ const rtc::SocketAddress& addr) {
+ rtc::ByteBuffer buf;
msg.Write(&buf);
Send(socket, buf.Data(), buf.Length(), addr);
}
// Constructs a STUN error response and sends it on the given socket.
-void SendStunError(const StunMessage& msg, talk_base::AsyncPacketSocket* socket,
- const talk_base::SocketAddress& remote_addr, int error_code,
+void SendStunError(const StunMessage& msg, rtc::AsyncPacketSocket* socket,
+ const rtc::SocketAddress& remote_addr, int error_code,
const char* error_desc, const std::string& magic_cookie) {
RelayMessage err_msg;
err_msg.SetType(GetStunErrorResponseType(msg.type()));
@@ -95,7 +95,7 @@
SendStun(err_msg, socket, remote_addr);
}
-RelayServer::RelayServer(talk_base::Thread* thread)
+RelayServer::RelayServer(rtc::Thread* thread)
: thread_(thread), log_bindings_(true) {
}
@@ -110,20 +110,20 @@
for (size_t i = 0; i < removed_sockets_.size(); ++i)
delete removed_sockets_[i];
while (!server_sockets_.empty()) {
- talk_base::AsyncSocket* socket = server_sockets_.begin()->first;
+ rtc::AsyncSocket* socket = server_sockets_.begin()->first;
server_sockets_.erase(server_sockets_.begin()->first);
delete socket;
}
}
-void RelayServer::AddInternalSocket(talk_base::AsyncPacketSocket* socket) {
+void RelayServer::AddInternalSocket(rtc::AsyncPacketSocket* socket) {
ASSERT(internal_sockets_.end() ==
std::find(internal_sockets_.begin(), internal_sockets_.end(), socket));
internal_sockets_.push_back(socket);
socket->SignalReadPacket.connect(this, &RelayServer::OnInternalPacket);
}
-void RelayServer::RemoveInternalSocket(talk_base::AsyncPacketSocket* socket) {
+void RelayServer::RemoveInternalSocket(rtc::AsyncPacketSocket* socket) {
SocketList::iterator iter =
std::find(internal_sockets_.begin(), internal_sockets_.end(), socket);
ASSERT(iter != internal_sockets_.end());
@@ -132,14 +132,14 @@
socket->SignalReadPacket.disconnect(this);
}
-void RelayServer::AddExternalSocket(talk_base::AsyncPacketSocket* socket) {
+void RelayServer::AddExternalSocket(rtc::AsyncPacketSocket* socket) {
ASSERT(external_sockets_.end() ==
std::find(external_sockets_.begin(), external_sockets_.end(), socket));
external_sockets_.push_back(socket);
socket->SignalReadPacket.connect(this, &RelayServer::OnExternalPacket);
}
-void RelayServer::RemoveExternalSocket(talk_base::AsyncPacketSocket* socket) {
+void RelayServer::RemoveExternalSocket(rtc::AsyncPacketSocket* socket) {
SocketList::iterator iter =
std::find(external_sockets_.begin(), external_sockets_.end(), socket);
ASSERT(iter != external_sockets_.end());
@@ -148,7 +148,7 @@
socket->SignalReadPacket.disconnect(this);
}
-void RelayServer::AddInternalServerSocket(talk_base::AsyncSocket* socket,
+void RelayServer::AddInternalServerSocket(rtc::AsyncSocket* socket,
cricket::ProtocolType proto) {
ASSERT(server_sockets_.end() ==
server_sockets_.find(socket));
@@ -157,7 +157,7 @@
}
void RelayServer::RemoveInternalServerSocket(
- talk_base::AsyncSocket* socket) {
+ rtc::AsyncSocket* socket) {
ServerSocketMap::iterator iter = server_sockets_.find(socket);
ASSERT(iter != server_sockets_.end());
server_sockets_.erase(iter);
@@ -168,7 +168,7 @@
return static_cast<int>(connections_.size());
}
-talk_base::SocketAddressPair RelayServer::GetConnection(int connection) const {
+rtc::SocketAddressPair RelayServer::GetConnection(int connection) const {
int i = 0;
for (ConnectionMap::const_iterator it = connections_.begin();
it != connections_.end(); ++it) {
@@ -177,10 +177,10 @@
}
++i;
}
- return talk_base::SocketAddressPair();
+ return rtc::SocketAddressPair();
}
-bool RelayServer::HasConnection(const talk_base::SocketAddress& address) const {
+bool RelayServer::HasConnection(const rtc::SocketAddress& address) const {
for (ConnectionMap::const_iterator it = connections_.begin();
it != connections_.end(); ++it) {
if (it->second->addr_pair().destination() == address) {
@@ -190,18 +190,18 @@
return false;
}
-void RelayServer::OnReadEvent(talk_base::AsyncSocket* socket) {
+void RelayServer::OnReadEvent(rtc::AsyncSocket* socket) {
ASSERT(server_sockets_.find(socket) != server_sockets_.end());
AcceptConnection(socket);
}
void RelayServer::OnInternalPacket(
- talk_base::AsyncPacketSocket* socket, const char* bytes, size_t size,
- const talk_base::SocketAddress& remote_addr,
- const talk_base::PacketTime& packet_time) {
+ rtc::AsyncPacketSocket* socket, const char* bytes, size_t size,
+ const rtc::SocketAddress& remote_addr,
+ const rtc::PacketTime& packet_time) {
// Get the address of the connection we just received on.
- talk_base::SocketAddressPair ap(remote_addr, socket->GetLocalAddress());
+ rtc::SocketAddressPair ap(remote_addr, socket->GetLocalAddress());
ASSERT(!ap.destination().IsNil());
// If this did not come from an existing connection, it should be a STUN
@@ -241,12 +241,12 @@
}
void RelayServer::OnExternalPacket(
- talk_base::AsyncPacketSocket* socket, const char* bytes, size_t size,
- const talk_base::SocketAddress& remote_addr,
- const talk_base::PacketTime& packet_time) {
+ rtc::AsyncPacketSocket* socket, const char* bytes, size_t size,
+ const rtc::SocketAddress& remote_addr,
+ const rtc::PacketTime& packet_time) {
// Get the address of the connection we just received on.
- talk_base::SocketAddressPair ap(remote_addr, socket->GetLocalAddress());
+ rtc::SocketAddressPair ap(remote_addr, socket->GetLocalAddress());
ASSERT(!ap.destination().IsNil());
// If this connection already exists, then forward the traffic.
@@ -266,7 +266,7 @@
// The first packet should always be a STUN / TURN packet. If it isn't, then
// we should just ignore this packet.
RelayMessage msg;
- talk_base::ByteBuffer buf(bytes, size);
+ rtc::ByteBuffer buf(bytes, size);
if (!msg.Read(&buf)) {
LOG(LS_WARNING) << "Dropping packet: first packet not STUN";
return;
@@ -280,7 +280,7 @@
return;
}
- uint32 length = talk_base::_min(static_cast<uint32>(username_attr->length()),
+ uint32 length = rtc::_min(static_cast<uint32>(username_attr->length()),
USERNAME_LENGTH);
std::string username(username_attr->bytes(), length);
// TODO: Check the HMAC.
@@ -310,12 +310,12 @@
}
bool RelayServer::HandleStun(
- const char* bytes, size_t size, const talk_base::SocketAddress& remote_addr,
- talk_base::AsyncPacketSocket* socket, std::string* username,
+ const char* bytes, size_t size, const rtc::SocketAddress& remote_addr,
+ rtc::AsyncPacketSocket* socket, std::string* username,
StunMessage* msg) {
// Parse this into a stun message. Eat the message if this fails.
- talk_base::ByteBuffer buf(bytes, size);
+ rtc::ByteBuffer buf(bytes, size);
if (!msg->Read(&buf)) {
return false;
}
@@ -338,8 +338,8 @@
}
void RelayServer::HandleStunAllocate(
- const char* bytes, size_t size, const talk_base::SocketAddressPair& ap,
- talk_base::AsyncPacketSocket* socket) {
+ const char* bytes, size_t size, const rtc::SocketAddressPair& ap,
+ rtc::AsyncPacketSocket* socket) {
// Make sure this is a valid STUN request.
RelayMessage request;
@@ -376,7 +376,7 @@
const StunUInt32Attribute* lifetime_attr =
request.GetUInt32(STUN_ATTR_LIFETIME);
if (lifetime_attr)
- lifetime = talk_base::_min(lifetime, lifetime_attr->value() * 1000);
+ lifetime = rtc::_min(lifetime, lifetime_attr->value() * 1000);
binding = new RelayServerBinding(this, username, "0", lifetime);
binding->SignalTimeout.connect(this, &RelayServer::OnTimeout);
@@ -442,7 +442,7 @@
response.AddAttribute(magic_cookie_attr);
size_t index = rand() % external_sockets_.size();
- talk_base::SocketAddress ext_addr =
+ rtc::SocketAddress ext_addr =
external_sockets_[index]->GetLocalAddress();
StunAddressAttribute* addr_attr =
@@ -481,14 +481,14 @@
return;
}
- talk_base::SocketAddress ext_addr(addr_attr->ipaddr(), addr_attr->port());
+ rtc::SocketAddress ext_addr(addr_attr->ipaddr(), addr_attr->port());
RelayServerConnection* ext_conn =
int_conn->binding()->GetExternalConnection(ext_addr);
if (!ext_conn) {
// Create a new connection to establish the relationship with this binding.
ASSERT(external_sockets_.size() == 1);
- talk_base::AsyncPacketSocket* socket = external_sockets_[0];
- talk_base::SocketAddressPair ap(ext_addr, socket->GetLocalAddress());
+ rtc::AsyncPacketSocket* socket = external_sockets_[0];
+ rtc::SocketAddressPair ap(ext_addr, socket->GetLocalAddress());
ext_conn = new RelayServerConnection(int_conn->binding(), ap, socket);
ext_conn->binding()->AddExternalConnection(ext_conn);
AddConnection(ext_conn);
@@ -545,14 +545,14 @@
}
}
-void RelayServer::OnMessage(talk_base::Message *pmsg) {
+void RelayServer::OnMessage(rtc::Message *pmsg) {
#if ENABLE_DEBUG
static const uint32 kMessageAcceptConnection = 1;
ASSERT(pmsg->message_id == kMessageAcceptConnection);
#endif
- talk_base::MessageData* data = pmsg->pdata;
- talk_base::AsyncSocket* socket =
- static_cast <talk_base::TypedMessageData<talk_base::AsyncSocket*>*>
+ rtc::MessageData* data = pmsg->pdata;
+ rtc::AsyncSocket* socket =
+ static_cast <rtc::TypedMessageData<rtc::AsyncSocket*>*>
(data)->data();
AcceptConnection(socket);
delete data;
@@ -564,10 +564,10 @@
thread_->Dispose(binding);
}
-void RelayServer::AcceptConnection(talk_base::AsyncSocket* server_socket) {
+void RelayServer::AcceptConnection(rtc::AsyncSocket* server_socket) {
// Check if someone is trying to connect to us.
- talk_base::SocketAddress accept_addr;
- talk_base::AsyncSocket* accepted_socket =
+ rtc::SocketAddress accept_addr;
+ rtc::AsyncSocket* accepted_socket =
server_socket->Accept(&accept_addr);
if (accepted_socket != NULL) {
// We had someone trying to connect, now check which protocol to
@@ -575,10 +575,10 @@
ASSERT(server_sockets_[server_socket] == cricket::PROTO_TCP ||
server_sockets_[server_socket] == cricket::PROTO_SSLTCP);
if (server_sockets_[server_socket] == cricket::PROTO_SSLTCP) {
- accepted_socket = new talk_base::AsyncSSLServerSocket(accepted_socket);
+ accepted_socket = new rtc::AsyncSSLServerSocket(accepted_socket);
}
- talk_base::AsyncTCPSocket* tcp_socket =
- new talk_base::AsyncTCPSocket(accepted_socket, false);
+ rtc::AsyncTCPSocket* tcp_socket =
+ new rtc::AsyncTCPSocket(accepted_socket, false);
// Finally add the socket so it can start communicating with the client.
AddInternalSocket(tcp_socket);
@@ -586,8 +586,8 @@
}
RelayServerConnection::RelayServerConnection(
- RelayServerBinding* binding, const talk_base::SocketAddressPair& addrs,
- talk_base::AsyncPacketSocket* socket)
+ RelayServerBinding* binding, const rtc::SocketAddressPair& addrs,
+ rtc::AsyncPacketSocket* socket)
: binding_(binding), addr_pair_(addrs), socket_(socket), locked_(false) {
// The creation of a new connection constitutes a use of the binding.
binding_->NoteUsed();
@@ -606,7 +606,7 @@
}
void RelayServerConnection::Send(
- const char* data, size_t size, const talk_base::SocketAddress& from_addr) {
+ const char* data, size_t size, const rtc::SocketAddress& from_addr) {
// If the from address is known to the client, we don't need to send it.
if (locked() && (from_addr == default_dest_)) {
Send(data, size);
@@ -707,7 +707,7 @@
}
void RelayServerBinding::NoteUsed() {
- last_used_ = talk_base::Time();
+ last_used_ = rtc::Time();
}
bool RelayServerBinding::HasMagicCookie(const char* bytes, size_t size) const {
@@ -719,7 +719,7 @@
}
RelayServerConnection* RelayServerBinding::GetInternalConnection(
- const talk_base::SocketAddress& ext_addr) {
+ const rtc::SocketAddress& ext_addr) {
// Look for an internal connection that is locked to this address.
for (size_t i = 0; i < internal_connections_.size(); ++i) {
@@ -734,7 +734,7 @@
}
RelayServerConnection* RelayServerBinding::GetExternalConnection(
- const talk_base::SocketAddress& ext_addr) {
+ const rtc::SocketAddress& ext_addr) {
for (size_t i = 0; i < external_connections_.size(); ++i) {
if (ext_addr == external_connections_[i]->addr_pair().source())
return external_connections_[i];
@@ -742,13 +742,13 @@
return 0;
}
-void RelayServerBinding::OnMessage(talk_base::Message *pmsg) {
+void RelayServerBinding::OnMessage(rtc::Message *pmsg) {
if (pmsg->message_id == MSG_LIFETIME_TIMER) {
ASSERT(!pmsg->pdata);
// If the lifetime timeout has been exceeded, then send a signal.
// Otherwise, just keep waiting.
- if (talk_base::Time() >= last_used_ + lifetime_) {
+ if (rtc::Time() >= last_used_ + lifetime_) {
LOG(LS_INFO) << "Expiring binding " << username_;
SignalTimeout(this);
} else {
diff --git a/p2p/base/relayserver.h b/p2p/base/relayserver.h
index 922a256..5a5b5e2 100644
--- a/p2p/base/relayserver.h
+++ b/p2p/base/relayserver.h
@@ -32,10 +32,10 @@
#include <vector>
#include <map>
-#include "talk/base/asyncudpsocket.h"
-#include "talk/base/socketaddresspair.h"
-#include "talk/base/thread.h"
-#include "talk/base/timeutils.h"
+#include "webrtc/base/asyncudpsocket.h"
+#include "webrtc/base/socketaddresspair.h"
+#include "webrtc/base/thread.h"
+#include "webrtc/base/timeutils.h"
#include "talk/p2p/base/port.h"
#include "talk/p2p/base/stun.h"
@@ -46,14 +46,14 @@
// Relays traffic between connections to the server that are "bound" together.
// All connections created with the same username/password are bound together.
-class RelayServer : public talk_base::MessageHandler,
+class RelayServer : public rtc::MessageHandler,
public sigslot::has_slots<> {
public:
// Creates a server, which will use this thread to post messages to itself.
- explicit RelayServer(talk_base::Thread* thread);
+ explicit RelayServer(rtc::Thread* thread);
~RelayServer();
- talk_base::Thread* thread() { return thread_; }
+ rtc::Thread* thread() { return thread_; }
// Indicates whether we will print updates of the number of bindings.
bool log_bindings() const { return log_bindings_; }
@@ -61,38 +61,38 @@
// Updates the set of sockets that the server uses to talk to "internal"
// clients. These are clients that do the "port allocations".
- void AddInternalSocket(talk_base::AsyncPacketSocket* socket);
- void RemoveInternalSocket(talk_base::AsyncPacketSocket* socket);
+ void AddInternalSocket(rtc::AsyncPacketSocket* socket);
+ void RemoveInternalSocket(rtc::AsyncPacketSocket* socket);
// Updates the set of sockets that the server uses to talk to "external"
// clients. These are the clients that do not do allocations. They do not
// know that these addresses represent a relay server.
- void AddExternalSocket(talk_base::AsyncPacketSocket* socket);
- void RemoveExternalSocket(talk_base::AsyncPacketSocket* socket);
+ void AddExternalSocket(rtc::AsyncPacketSocket* socket);
+ void RemoveExternalSocket(rtc::AsyncPacketSocket* socket);
// Starts listening for connections on this sockets. When someone
// tries to connect, the connection will be accepted and a new
// internal socket will be added.
- void AddInternalServerSocket(talk_base::AsyncSocket* socket,
+ void AddInternalServerSocket(rtc::AsyncSocket* socket,
cricket::ProtocolType proto);
// Removes this server socket from the list.
- void RemoveInternalServerSocket(talk_base::AsyncSocket* socket);
+ void RemoveInternalServerSocket(rtc::AsyncSocket* socket);
// Methods for testing and debuging.
int GetConnectionCount() const;
- talk_base::SocketAddressPair GetConnection(int connection) const;
- bool HasConnection(const talk_base::SocketAddress& address) const;
+ rtc::SocketAddressPair GetConnection(int connection) const;
+ bool HasConnection(const rtc::SocketAddress& address) const;
private:
- typedef std::vector<talk_base::AsyncPacketSocket*> SocketList;
- typedef std::map<talk_base::AsyncSocket*,
+ typedef std::vector<rtc::AsyncPacketSocket*> SocketList;
+ typedef std::map<rtc::AsyncSocket*,
cricket::ProtocolType> ServerSocketMap;
typedef std::map<std::string, RelayServerBinding*> BindingMap;
- typedef std::map<talk_base::SocketAddressPair,
+ typedef std::map<rtc::SocketAddressPair,
RelayServerConnection*> ConnectionMap;
- talk_base::Thread* thread_;
+ rtc::Thread* thread_;
bool log_bindings_;
SocketList internal_sockets_;
SocketList external_sockets_;
@@ -102,25 +102,25 @@
ConnectionMap connections_;
// Called when a packet is received by the server on one of its sockets.
- void OnInternalPacket(talk_base::AsyncPacketSocket* socket,
+ void OnInternalPacket(rtc::AsyncPacketSocket* socket,
const char* bytes, size_t size,
- const talk_base::SocketAddress& remote_addr,
- const talk_base::PacketTime& packet_time);
- void OnExternalPacket(talk_base::AsyncPacketSocket* socket,
+ const rtc::SocketAddress& remote_addr,
+ const rtc::PacketTime& packet_time);
+ void OnExternalPacket(rtc::AsyncPacketSocket* socket,
const char* bytes, size_t size,
- const talk_base::SocketAddress& remote_addr,
- const talk_base::PacketTime& packet_time);
+ const rtc::SocketAddress& remote_addr,
+ const rtc::PacketTime& packet_time);
- void OnReadEvent(talk_base::AsyncSocket* socket);
+ void OnReadEvent(rtc::AsyncSocket* socket);
// Processes the relevant STUN request types from the client.
bool HandleStun(const char* bytes, size_t size,
- const talk_base::SocketAddress& remote_addr,
- talk_base::AsyncPacketSocket* socket,
+ const rtc::SocketAddress& remote_addr,
+ rtc::AsyncPacketSocket* socket,
std::string* username, StunMessage* msg);
void HandleStunAllocate(const char* bytes, size_t size,
- const talk_base::SocketAddressPair& ap,
- talk_base::AsyncPacketSocket* socket);
+ const rtc::SocketAddressPair& ap,
+ rtc::AsyncPacketSocket* socket);
void HandleStun(RelayServerConnection* int_conn, const char* bytes,
size_t size);
void HandleStunAllocate(RelayServerConnection* int_conn,
@@ -133,13 +133,13 @@
void RemoveBinding(RelayServerBinding* binding);
// Handle messages in our worker thread.
- void OnMessage(talk_base::Message *pmsg);
+ void OnMessage(rtc::Message *pmsg);
// Called when the timer for checking lifetime times out.
void OnTimeout(RelayServerBinding* binding);
// Accept connections on this server socket.
- void AcceptConnection(talk_base::AsyncSocket* server_socket);
+ void AcceptConnection(rtc::AsyncSocket* server_socket);
friend class RelayServerConnection;
friend class RelayServerBinding;
@@ -150,22 +150,22 @@
class RelayServerConnection {
public:
RelayServerConnection(RelayServerBinding* binding,
- const talk_base::SocketAddressPair& addrs,
- talk_base::AsyncPacketSocket* socket);
+ const rtc::SocketAddressPair& addrs,
+ rtc::AsyncPacketSocket* socket);
~RelayServerConnection();
RelayServerBinding* binding() { return binding_; }
- talk_base::AsyncPacketSocket* socket() { return socket_; }
+ rtc::AsyncPacketSocket* socket() { return socket_; }
// Returns a pair where the source is the remote address and the destination
// is the local address.
- const talk_base::SocketAddressPair& addr_pair() { return addr_pair_; }
+ const rtc::SocketAddressPair& addr_pair() { return addr_pair_; }
// Sends a packet to the connected client. If an address is provided, then
// we make sure the internal client receives it, wrapping if necessary.
void Send(const char* data, size_t size);
void Send(const char* data, size_t size,
- const talk_base::SocketAddress& ext_addr);
+ const rtc::SocketAddress& ext_addr);
// Sends a STUN message to the connected client with no wrapping.
void SendStun(const StunMessage& msg);
@@ -179,24 +179,24 @@
// Records the address that raw packets should be forwarded to (for internal
// packets only; for external, we already know where they go).
- const talk_base::SocketAddress& default_destination() const {
+ const rtc::SocketAddress& default_destination() const {
return default_dest_;
}
- void set_default_destination(const talk_base::SocketAddress& addr) {
+ void set_default_destination(const rtc::SocketAddress& addr) {
default_dest_ = addr;
}
private:
RelayServerBinding* binding_;
- talk_base::SocketAddressPair addr_pair_;
- talk_base::AsyncPacketSocket* socket_;
+ rtc::SocketAddressPair addr_pair_;
+ rtc::AsyncPacketSocket* socket_;
bool locked_;
- talk_base::SocketAddress default_dest_;
+ rtc::SocketAddress default_dest_;
};
// Records a set of internal and external connections that we relay between,
// or in other words, that are "bound" together.
-class RelayServerBinding : public talk_base::MessageHandler {
+class RelayServerBinding : public rtc::MessageHandler {
public:
RelayServerBinding(
RelayServer* server, const std::string& username,
@@ -225,12 +225,12 @@
// Determines the connection to use to send packets to or from the given
// external address.
RelayServerConnection* GetInternalConnection(
- const talk_base::SocketAddress& ext_addr);
+ const rtc::SocketAddress& ext_addr);
RelayServerConnection* GetExternalConnection(
- const talk_base::SocketAddress& ext_addr);
+ const rtc::SocketAddress& ext_addr);
// MessageHandler:
- void OnMessage(talk_base::Message *pmsg);
+ void OnMessage(rtc::Message *pmsg);
private:
RelayServer* server_;
diff --git a/p2p/base/relayserver_unittest.cc b/p2p/base/relayserver_unittest.cc
index 239f644..43d288d 100644
--- a/p2p/base/relayserver_unittest.cc
+++ b/p2p/base/relayserver_unittest.cc
@@ -27,17 +27,17 @@
#include <string>
-#include "talk/base/gunit.h"
-#include "talk/base/helpers.h"
-#include "talk/base/logging.h"
-#include "talk/base/physicalsocketserver.h"
-#include "talk/base/socketaddress.h"
-#include "talk/base/ssladapter.h"
-#include "talk/base/testclient.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/physicalsocketserver.h"
+#include "webrtc/base/socketaddress.h"
+#include "webrtc/base/ssladapter.h"
+#include "webrtc/base/testclient.h"
+#include "webrtc/base/thread.h"
#include "talk/p2p/base/relayserver.h"
-using talk_base::SocketAddress;
+using rtc::SocketAddress;
using namespace cricket;
static const uint32 LIFETIME = 4; // seconds
@@ -54,35 +54,35 @@
class RelayServerTest : public testing::Test {
public:
static void SetUpTestCase() {
- talk_base::InitializeSSL();
+ rtc::InitializeSSL();
}
static void TearDownTestCase() {
- talk_base::CleanupSSL();
+ rtc::CleanupSSL();
}
RelayServerTest()
- : main_(talk_base::Thread::Current()), ss_(main_->socketserver()),
- username_(talk_base::CreateRandomString(12)),
- password_(talk_base::CreateRandomString(12)) {
+ : main_(rtc::Thread::Current()), ss_(main_->socketserver()),
+ username_(rtc::CreateRandomString(12)),
+ password_(rtc::CreateRandomString(12)) {
}
protected:
virtual void SetUp() {
server_.reset(new RelayServer(main_));
server_->AddInternalSocket(
- talk_base::AsyncUDPSocket::Create(ss_, server_int_addr));
+ rtc::AsyncUDPSocket::Create(ss_, server_int_addr));
server_->AddExternalSocket(
- talk_base::AsyncUDPSocket::Create(ss_, server_ext_addr));
+ rtc::AsyncUDPSocket::Create(ss_, server_ext_addr));
- client1_.reset(new talk_base::TestClient(
- talk_base::AsyncUDPSocket::Create(ss_, client1_addr)));
- client2_.reset(new talk_base::TestClient(
- talk_base::AsyncUDPSocket::Create(ss_, client2_addr)));
+ client1_.reset(new rtc::TestClient(
+ rtc::AsyncUDPSocket::Create(ss_, client1_addr)));
+ client2_.reset(new rtc::TestClient(
+ rtc::AsyncUDPSocket::Create(ss_, client2_addr)));
}
void Allocate() {
- talk_base::scoped_ptr<StunMessage> req(
+ rtc::scoped_ptr<StunMessage> req(
CreateStunMessage(STUN_ALLOCATE_REQUEST));
AddUsernameAttr(req.get(), username_);
AddLifetimeAttr(req.get(), LIFETIME);
@@ -90,7 +90,7 @@
delete Receive1();
}
void Bind() {
- talk_base::scoped_ptr<StunMessage> req(
+ rtc::scoped_ptr<StunMessage> req(
CreateStunMessage(STUN_BINDING_REQUEST));
AddUsernameAttr(req.get(), username_);
Send2(req.get());
@@ -98,12 +98,12 @@
}
void Send1(const StunMessage* msg) {
- talk_base::ByteBuffer buf;
+ rtc::ByteBuffer buf;
msg->Write(&buf);
SendRaw1(buf.Data(), static_cast<int>(buf.Length()));
}
void Send2(const StunMessage* msg) {
- talk_base::ByteBuffer buf;
+ rtc::ByteBuffer buf;
msg->Write(&buf);
SendRaw2(buf.Data(), static_cast<int>(buf.Length()));
}
@@ -113,7 +113,7 @@
void SendRaw2(const char* data, int len) {
return Send(client2_.get(), data, len, server_ext_addr);
}
- void Send(talk_base::TestClient* client, const char* data,
+ void Send(rtc::TestClient* client, const char* data,
int len, const SocketAddress& addr) {
client->SendTo(data, len, addr);
}
@@ -130,20 +130,20 @@
std::string ReceiveRaw2() {
return ReceiveRaw(client2_.get());
}
- StunMessage* Receive(talk_base::TestClient* client) {
+ StunMessage* Receive(rtc::TestClient* client) {
StunMessage* msg = NULL;
- talk_base::TestClient::Packet* packet = client->NextPacket();
+ rtc::TestClient::Packet* packet = client->NextPacket();
if (packet) {
- talk_base::ByteBuffer buf(packet->buf, packet->size);
+ rtc::ByteBuffer buf(packet->buf, packet->size);
msg = new RelayMessage();
msg->Read(&buf);
delete packet;
}
return msg;
}
- std::string ReceiveRaw(talk_base::TestClient* client) {
+ std::string ReceiveRaw(rtc::TestClient* client) {
std::string raw;
- talk_base::TestClient::Packet* packet = client->NextPacket();
+ rtc::TestClient::Packet* packet = client->NextPacket();
if (packet) {
raw = std::string(packet->buf, packet->size);
delete packet;
@@ -155,7 +155,7 @@
StunMessage* msg = new RelayMessage();
msg->SetType(type);
msg->SetTransactionID(
- talk_base::CreateRandomString(kStunTransactionIdLength));
+ rtc::CreateRandomString(kStunTransactionIdLength));
return msg;
}
static void AddMagicCookieAttr(StunMessage* msg) {
@@ -184,18 +184,18 @@
msg->AddAttribute(attr);
}
- talk_base::Thread* main_;
- talk_base::SocketServer* ss_;
- talk_base::scoped_ptr<RelayServer> server_;
- talk_base::scoped_ptr<talk_base::TestClient> client1_;
- talk_base::scoped_ptr<talk_base::TestClient> client2_;
+ rtc::Thread* main_;
+ rtc::SocketServer* ss_;
+ rtc::scoped_ptr<RelayServer> server_;
+ rtc::scoped_ptr<rtc::TestClient> client1_;
+ rtc::scoped_ptr<rtc::TestClient> client2_;
std::string username_;
std::string password_;
};
// Send a complete nonsense message and verify that it is eaten.
TEST_F(RelayServerTest, TestBadRequest) {
- talk_base::scoped_ptr<StunMessage> res;
+ rtc::scoped_ptr<StunMessage> res;
SendRaw1(bad, static_cast<int>(strlen(bad)));
res.reset(Receive1());
@@ -205,7 +205,7 @@
// Send an allocate request without a username and verify it is rejected.
TEST_F(RelayServerTest, TestAllocateNoUsername) {
- talk_base::scoped_ptr<StunMessage> req(
+ rtc::scoped_ptr<StunMessage> req(
CreateStunMessage(STUN_ALLOCATE_REQUEST)), res;
Send1(req.get());
@@ -224,7 +224,7 @@
// Send a binding request and verify that it is rejected.
TEST_F(RelayServerTest, TestBindingRequest) {
- talk_base::scoped_ptr<StunMessage> req(
+ rtc::scoped_ptr<StunMessage> req(
CreateStunMessage(STUN_BINDING_REQUEST)), res;
AddUsernameAttr(req.get(), username_);
@@ -244,7 +244,7 @@
// Send an allocate request and verify that it is accepted.
TEST_F(RelayServerTest, TestAllocate) {
- talk_base::scoped_ptr<StunMessage> req(
+ rtc::scoped_ptr<StunMessage> req(
CreateStunMessage(STUN_ALLOCATE_REQUEST)), res;
AddUsernameAttr(req.get(), username_);
AddLifetimeAttr(req.get(), LIFETIME);
@@ -274,7 +274,7 @@
TEST_F(RelayServerTest, TestReallocate) {
Allocate();
- talk_base::scoped_ptr<StunMessage> req(
+ rtc::scoped_ptr<StunMessage> req(
CreateStunMessage(STUN_ALLOCATE_REQUEST)), res;
AddMagicCookieAttr(req.get());
AddUsernameAttr(req.get(), username_);
@@ -304,7 +304,7 @@
TEST_F(RelayServerTest, TestRemoteBind) {
Allocate();
- talk_base::scoped_ptr<StunMessage> req(
+ rtc::scoped_ptr<StunMessage> req(
CreateStunMessage(STUN_BINDING_REQUEST)), res;
AddUsernameAttr(req.get(), username_);
@@ -318,8 +318,8 @@
res->GetByteString(STUN_ATTR_DATA);
ASSERT_TRUE(recv_data != NULL);
- talk_base::ByteBuffer buf(recv_data->bytes(), recv_data->length());
- talk_base::scoped_ptr<StunMessage> res2(new StunMessage());
+ rtc::ByteBuffer buf(recv_data->bytes(), recv_data->length());
+ rtc::scoped_ptr<StunMessage> res2(new StunMessage());
EXPECT_TRUE(res2->Read(&buf));
EXPECT_EQ(STUN_BINDING_REQUEST, res2->type());
EXPECT_EQ(req->transaction_id(), res2->transaction_id());
@@ -350,7 +350,7 @@
Allocate();
Bind();
- talk_base::scoped_ptr<StunMessage> req(
+ rtc::scoped_ptr<StunMessage> req(
CreateStunMessage(STUN_SEND_REQUEST)), res;
AddMagicCookieAttr(req.get());
@@ -373,7 +373,7 @@
Allocate();
Bind();
- talk_base::scoped_ptr<StunMessage> req(
+ rtc::scoped_ptr<StunMessage> req(
CreateStunMessage(STUN_SEND_REQUEST)), res;
AddMagicCookieAttr(req.get());
AddUsernameAttr(req.get(), "foobarbizbaz");
@@ -398,7 +398,7 @@
Allocate();
Bind();
- talk_base::scoped_ptr<StunMessage> req(
+ rtc::scoped_ptr<StunMessage> req(
CreateStunMessage(STUN_SEND_REQUEST)), res;
AddMagicCookieAttr(req.get());
AddUsernameAttr(req.get(), username_);
@@ -422,7 +422,7 @@
Allocate();
Bind();
- talk_base::scoped_ptr<StunMessage> req(
+ rtc::scoped_ptr<StunMessage> req(
CreateStunMessage(STUN_SEND_REQUEST)), res;
AddMagicCookieAttr(req.get());
AddUsernameAttr(req.get(), username_);
@@ -447,7 +447,7 @@
Allocate();
Bind();
- talk_base::scoped_ptr<StunMessage> req(
+ rtc::scoped_ptr<StunMessage> req(
CreateStunMessage(STUN_BINDING_REQUEST)), res;
AddMagicCookieAttr(req.get());
AddUsernameAttr(req.get(), username_);
@@ -473,7 +473,7 @@
Bind();
for (int i = 0; i < 10; i++) {
- talk_base::scoped_ptr<StunMessage> req(
+ rtc::scoped_ptr<StunMessage> req(
CreateStunMessage(STUN_SEND_REQUEST)), res;
AddMagicCookieAttr(req.get());
AddUsernameAttr(req.get(), username_);
@@ -513,9 +513,9 @@
Bind();
// Wait twice the lifetime to make sure the server has expired the binding.
- talk_base::Thread::Current()->ProcessMessages((LIFETIME * 2) * 1000);
+ rtc::Thread::Current()->ProcessMessages((LIFETIME * 2) * 1000);
- talk_base::scoped_ptr<StunMessage> req(
+ rtc::scoped_ptr<StunMessage> req(
CreateStunMessage(STUN_SEND_REQUEST)), res;
AddMagicCookieAttr(req.get());
AddUsernameAttr(req.get(), username_);
diff --git a/p2p/base/session.cc b/p2p/base/session.cc
index 0eefe6c..6c98fe1 100644
--- a/p2p/base/session.cc
+++ b/p2p/base/session.cc
@@ -27,12 +27,12 @@
#include "talk/p2p/base/session.h"
-#include "talk/base/bind.h"
-#include "talk/base/common.h"
-#include "talk/base/logging.h"
-#include "talk/base/helpers.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/sslstreamadapter.h"
+#include "webrtc/base/bind.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/sslstreamadapter.h"
#include "talk/xmpp/constants.h"
#include "talk/xmpp/jid.h"
#include "talk/p2p/base/dtlstransport.h"
@@ -46,7 +46,7 @@
namespace cricket {
-using talk_base::Bind;
+using rtc::Bind;
bool BadMessage(const buzz::QName type,
const std::string& text,
@@ -69,13 +69,13 @@
}
TransportChannel* TransportProxy::GetChannel(int component) {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ ASSERT(rtc::Thread::Current() == worker_thread_);
return GetChannelProxy(component);
}
TransportChannel* TransportProxy::CreateChannel(
const std::string& name, int component) {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ ASSERT(rtc::Thread::Current() == worker_thread_);
ASSERT(GetChannel(component) == NULL);
ASSERT(!transport_->get()->HasChannel(component));
@@ -99,7 +99,7 @@
}
void TransportProxy::DestroyChannel(int component) {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ ASSERT(rtc::Thread::Current() == worker_thread_);
TransportChannel* channel = GetChannel(component);
if (channel) {
// If the state of TransportProxy is not NEGOTIATED
@@ -204,7 +204,7 @@
TransportChannelImpl* TransportProxy::GetOrCreateChannelProxyImpl_w(
int component) {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ ASSERT(rtc::Thread::Current() == worker_thread_);
TransportChannelImpl* impl = transport_->get()->GetChannel(component);
if (impl == NULL) {
impl = transport_->get()->CreateChannel(component);
@@ -220,7 +220,7 @@
void TransportProxy::SetupChannelProxy_w(
int component, TransportChannelProxy* transproxy) {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ ASSERT(rtc::Thread::Current() == worker_thread_);
TransportChannelImpl* impl = GetOrCreateChannelProxyImpl(component);
ASSERT(impl != NULL);
transproxy->SetImplementation(impl);
@@ -234,7 +234,7 @@
void TransportProxy::ReplaceChannelProxyImpl_w(TransportChannelProxy* proxy,
TransportChannelImpl* impl) {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ ASSERT(rtc::Thread::Current() == worker_thread_);
ASSERT(proxy != NULL);
proxy->SetImplementation(impl);
}
@@ -336,7 +336,7 @@
}
void TransportProxy::SetIdentity(
- talk_base::SSLIdentity* identity) {
+ rtc::SSLIdentity* identity) {
transport_->get()->SetIdentity(identity);
}
@@ -377,11 +377,11 @@
default:
break;
}
- return "STATE_" + talk_base::ToString(state);
+ return "STATE_" + rtc::ToString(state);
}
-BaseSession::BaseSession(talk_base::Thread* signaling_thread,
- talk_base::Thread* worker_thread,
+BaseSession::BaseSession(rtc::Thread* signaling_thread,
+ rtc::Thread* worker_thread,
PortAllocator* port_allocator,
const std::string& sid,
const std::string& content_type,
@@ -396,7 +396,7 @@
transport_type_(NS_GINGLE_P2P),
initiator_(initiator),
identity_(NULL),
- ice_tiebreaker_(talk_base::CreateRandomId64()),
+ ice_tiebreaker_(rtc::CreateRandomId64()),
role_switch_(false) {
ASSERT(signaling_thread->IsCurrent());
}
@@ -447,7 +447,7 @@
return initiator_ ? local_description_.get() : remote_description_.get();
}
-bool BaseSession::SetIdentity(talk_base::SSLIdentity* identity) {
+bool BaseSession::SetIdentity(rtc::SSLIdentity* identity) {
if (identity_)
return false;
identity_ = identity;
@@ -910,7 +910,7 @@
return true;
}
-void BaseSession::OnMessage(talk_base::Message *pmsg) {
+void BaseSession::OnMessage(rtc::Message *pmsg) {
switch (pmsg->message_id) {
case MSG_TIMEOUT:
// Session timeout has occured.
@@ -1562,7 +1562,7 @@
signaling_thread()->Post(this, MSG_ERROR);
}
-void Session::OnMessage(talk_base::Message* pmsg) {
+void Session::OnMessage(rtc::Message* pmsg) {
// preserve this because BaseSession::OnMessage may modify it
State orig_state = state();
@@ -1710,7 +1710,7 @@
bool Session::SendMessage(ActionType type, const XmlElements& action_elems,
const std::string& remote_name, SessionError* error) {
- talk_base::scoped_ptr<buzz::XmlElement> stanza(
+ rtc::scoped_ptr<buzz::XmlElement> stanza(
new buzz::XmlElement(buzz::QN_IQ));
SessionMessage msg(current_protocol_, type, id(), initiator_name());
@@ -1724,7 +1724,7 @@
template <typename Action>
bool Session::SendMessage(ActionType type, const Action& action,
SessionError* error) {
- talk_base::scoped_ptr<buzz::XmlElement> stanza(
+ rtc::scoped_ptr<buzz::XmlElement> stanza(
new buzz::XmlElement(buzz::QN_IQ));
if (!WriteActionMessage(type, action, stanza.get(), error))
return false;
@@ -1765,7 +1765,7 @@
}
void Session::SendAcknowledgementMessage(const buzz::XmlElement* stanza) {
- talk_base::scoped_ptr<buzz::XmlElement> ack(
+ rtc::scoped_ptr<buzz::XmlElement> ack(
new buzz::XmlElement(buzz::QN_IQ));
ack->SetAttr(buzz::QN_TO, remote_name());
ack->SetAttr(buzz::QN_ID, stanza->Attr(buzz::QN_ID));
diff --git a/p2p/base/session.h b/p2p/base/session.h
index 4f99f16..2c6c252 100644
--- a/p2p/base/session.h
+++ b/p2p/base/session.h
@@ -33,10 +33,10 @@
#include <string>
#include <vector>
-#include "talk/base/refcount.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/scoped_ref_ptr.h"
-#include "talk/base/socketaddress.h"
+#include "webrtc/base/refcount.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/scoped_ref_ptr.h"
+#include "webrtc/base/socketaddress.h"
#include "talk/p2p/base/parsing.h"
#include "talk/p2p/base/port.h"
#include "talk/p2p/base/sessionclient.h"
@@ -55,7 +55,7 @@
class TransportChannelProxy;
class TransportChannelImpl;
-typedef talk_base::RefCountedObject<talk_base::scoped_ptr<Transport> >
+typedef rtc::RefCountedObject<rtc::scoped_ptr<Transport> >
TransportWrapper;
// Used for errors that will send back a specific error message to the
@@ -91,7 +91,7 @@
public CandidateTranslator {
public:
TransportProxy(
- talk_base::Thread* worker_thread,
+ rtc::Thread* worker_thread,
const std::string& sid,
const std::string& content_name,
TransportWrapper* transport)
@@ -145,7 +145,7 @@
// Simple functions that thunk down to the same functions on Transport.
void SetIceRole(IceRole role);
- void SetIdentity(talk_base::SSLIdentity* identity);
+ void SetIdentity(rtc::SSLIdentity* identity);
bool SetLocalTransportDescription(const TransportDescription& description,
ContentAction action,
std::string* error_desc);
@@ -195,10 +195,10 @@
void ReplaceChannelProxyImpl_w(TransportChannelProxy* proxy,
TransportChannelImpl* impl);
- talk_base::Thread* const worker_thread_;
+ rtc::Thread* const worker_thread_;
const std::string sid_;
const std::string content_name_;
- talk_base::scoped_refptr<TransportWrapper> transport_;
+ rtc::scoped_refptr<TransportWrapper> transport_;
bool connecting_;
bool negotiated_;
ChannelMap channels_;
@@ -228,7 +228,7 @@
// packets are represented by TransportChannels. The application-level protocol
// is represented by SessionDecription objects.
class BaseSession : public sigslot::has_slots<>,
- public talk_base::MessageHandler {
+ public rtc::MessageHandler {
public:
enum {
MSG_TIMEOUT = 0,
@@ -267,8 +267,8 @@
// Convert State to a readable string.
static std::string StateToString(State state);
- BaseSession(talk_base::Thread* signaling_thread,
- talk_base::Thread* worker_thread,
+ BaseSession(rtc::Thread* signaling_thread,
+ rtc::Thread* worker_thread,
PortAllocator* port_allocator,
const std::string& sid,
const std::string& content_type,
@@ -276,8 +276,8 @@
virtual ~BaseSession();
// These are const to allow them to be called from const methods.
- talk_base::Thread* signaling_thread() const { return signaling_thread_; }
- talk_base::Thread* worker_thread() const { return worker_thread_; }
+ rtc::Thread* signaling_thread() const { return signaling_thread_; }
+ rtc::Thread* worker_thread() const { return worker_thread_; }
PortAllocator* port_allocator() const { return port_allocator_; }
// The ID of this session.
@@ -371,11 +371,11 @@
// This avoids exposing the internal structures used to track them.
virtual bool GetStats(SessionStats* stats);
- talk_base::SSLIdentity* identity() { return identity_; }
+ rtc::SSLIdentity* identity() { return identity_; }
protected:
// Specifies the identity to use in this session.
- bool SetIdentity(talk_base::SSLIdentity* identity);
+ bool SetIdentity(rtc::SSLIdentity* identity);
bool PushdownTransportDescription(ContentSource source,
ContentAction action,
@@ -464,7 +464,7 @@
virtual void OnRoleConflict();
// Handles messages posted to us.
- virtual void OnMessage(talk_base::Message *pmsg);
+ virtual void OnMessage(rtc::Message *pmsg);
protected:
State state_;
@@ -504,16 +504,16 @@
// Gets the ContentAction and ContentSource according to the session state.
bool GetContentAction(ContentAction* action, ContentSource* source);
- talk_base::Thread* const signaling_thread_;
- talk_base::Thread* const worker_thread_;
+ rtc::Thread* const signaling_thread_;
+ rtc::Thread* const worker_thread_;
PortAllocator* const port_allocator_;
const std::string sid_;
const std::string content_type_;
const std::string transport_type_;
bool initiator_;
- talk_base::SSLIdentity* identity_;
- talk_base::scoped_ptr<const SessionDescription> local_description_;
- talk_base::scoped_ptr<SessionDescription> remote_description_;
+ rtc::SSLIdentity* identity_;
+ rtc::scoped_ptr<const SessionDescription> local_description_;
+ rtc::scoped_ptr<SessionDescription> remote_description_;
uint64 ice_tiebreaker_;
// This flag will be set to true after the first role switch. This flag
// will enable us to stop any role switch during the call.
@@ -628,7 +628,7 @@
const std::string& type,
const std::string& text,
const buzz::XmlElement* extra_info);
- virtual void OnMessage(talk_base::Message *pmsg);
+ virtual void OnMessage(rtc::Message *pmsg);
// Send various kinds of session messages.
bool SendInitiateMessage(const SessionDescription* sdesc,
diff --git a/p2p/base/session_unittest.cc b/p2p/base/session_unittest.cc
index 1c08bf1..758c5e9 100644
--- a/p2p/base/session_unittest.cc
+++ b/p2p/base/session_unittest.cc
@@ -31,14 +31,14 @@
#include <deque>
#include <map>
-#include "talk/base/base64.h"
-#include "talk/base/common.h"
-#include "talk/base/gunit.h"
-#include "talk/base/helpers.h"
-#include "talk/base/logging.h"
-#include "talk/base/natserver.h"
-#include "talk/base/natsocketfactory.h"
-#include "talk/base/stringencode.h"
+#include "webrtc/base/base64.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/natserver.h"
+#include "webrtc/base/natsocketfactory.h"
+#include "webrtc/base/stringencode.h"
#include "talk/p2p/base/basicpacketsocketfactory.h"
#include "talk/p2p/base/constants.h"
#include "talk/p2p/base/parsing.h"
@@ -82,17 +82,17 @@
}
std::string GetPortString(int port_index) {
- return talk_base::ToString(GetPort(port_index));
+ return rtc::ToString(GetPort(port_index));
}
// Only works for port_index < 10, which is fine for our purposes.
std::string GetUsername(int port_index) {
- return "username" + std::string(8, talk_base::ToString(port_index)[0]);
+ return "username" + std::string(8, rtc::ToString(port_index)[0]);
}
// Only works for port_index < 10, which is fine for our purposes.
std::string GetPassword(int port_index) {
- return "password" + std::string(8, talk_base::ToString(port_index)[0]);
+ return "password" + std::string(8, rtc::ToString(port_index)[0]);
}
std::string IqAck(const std::string& id,
@@ -164,7 +164,7 @@
if (name == "rtcp" || name == "video_rtcp" || name == "chanb") {
char next_ch = username[username.size() - 1];
ASSERT(username.size() > 0);
- talk_base::Base64::GetNextBase64Char(next_ch, &next_ch);
+ rtc::Base64::GetNextBase64Char(next_ch, &next_ch);
username[username.size() - 1] = next_ch;
}
return "<candidate"
@@ -599,8 +599,8 @@
ports_(kNumPorts),
address_("127.0.0.1", 0),
network_("network", "unittest",
- talk_base::IPAddress(INADDR_LOOPBACK), 8),
- socket_factory_(talk_base::Thread::Current()),
+ rtc::IPAddress(INADDR_LOOPBACK), 8),
+ socket_factory_(rtc::Thread::Current()),
running_(false),
port_(28653) {
network_.AddIP(address_.ipaddr());
@@ -615,7 +615,7 @@
for (int i = 0; i < kNumPorts; i++) {
int index = port_offset_ + i;
ports_[i] = cricket::UDPPort::Create(
- talk_base::Thread::Current(), &socket_factory_,
+ rtc::Thread::Current(), &socket_factory_,
&network_, address_.ipaddr(), GetPort(index), GetPort(index),
GetUsername(index), GetPassword(index));
AddPort(ports_[i]);
@@ -651,9 +651,9 @@
private:
int port_offset_;
std::vector<cricket::Port*> ports_;
- talk_base::SocketAddress address_;
- talk_base::Network network_;
- talk_base::BasicPacketSocketFactory socket_factory_;
+ rtc::SocketAddress address_;
+ rtc::Network network_;
+ rtc::BasicPacketSocketFactory socket_factory_;
bool running_;
int port_;
};
@@ -801,7 +801,7 @@
}
void OnReadPacket(cricket::TransportChannel* p, const char* buf,
- size_t size, const talk_base::PacketTime& time, int flags) {
+ size_t size, const rtc::PacketTime& time, int flags) {
if (memcmp(buf, name.c_str(), name.size()) != 0)
return; // drop packet if packet doesn't belong to this channel. This
// can happen when transport channels are muxed together.
@@ -815,7 +815,7 @@
}
void Send(const char* data, size_t size) {
- talk_base::PacketOptions options;
+ rtc::PacketOptions options;
std::string data_with_id(name);
data_with_id += data;
int result = channel->SendPacket(data_with_id.c_str(), data_with_id.size(),
@@ -1108,15 +1108,15 @@
cricket::ContentAction last_content_action;
cricket::ContentSource last_content_source;
std::deque<buzz::XmlElement*> sent_stanzas;
- talk_base::scoped_ptr<buzz::XmlElement> last_expected_sent_stanza;
+ rtc::scoped_ptr<buzz::XmlElement> last_expected_sent_stanza;
cricket::SessionManager* session_manager;
TestSessionClient* client;
cricket::PortAllocator* port_allocator_;
cricket::Session* session;
cricket::BaseSession::State last_session_state;
- talk_base::scoped_ptr<ChannelHandler> chan_a;
- talk_base::scoped_ptr<ChannelHandler> chan_b;
+ rtc::scoped_ptr<ChannelHandler> chan_a;
+ rtc::scoped_ptr<ChannelHandler> chan_b;
bool blow_up_on_error;
int error_count;
};
@@ -1125,11 +1125,11 @@
protected:
virtual void SetUp() {
// Seed needed for each test to satisfy expectations.
- talk_base::SetRandomTestMode(true);
+ rtc::SetRandomTestMode(true);
}
virtual void TearDown() {
- talk_base::SetRandomTestMode(false);
+ rtc::SetRandomTestMode(false);
}
// Tests sending data between two clients, over two channels.
@@ -1185,17 +1185,17 @@
const std::string& transport_info_reply_b_xml,
const std::string& accept_xml,
bool bundle = false) {
- talk_base::scoped_ptr<cricket::PortAllocator> allocator(
+ rtc::scoped_ptr<cricket::PortAllocator> allocator(
new TestPortAllocator());
int next_message_id = 0;
- talk_base::scoped_ptr<TestClient> initiator(
+ rtc::scoped_ptr<TestClient> initiator(
new TestClient(allocator.get(), &next_message_id,
kInitiator, initiator_protocol,
content_type,
content_name_a, channel_name_a,
content_name_b, channel_name_b));
- talk_base::scoped_ptr<TestClient> responder(
+ rtc::scoped_ptr<TestClient> responder(
new TestClient(allocator.get(), &next_message_id,
kResponder, responder_protocol,
content_type,
@@ -1624,18 +1624,18 @@
protocol, content_name, content_type);
std::string responder_full = kResponder + "/full";
- talk_base::scoped_ptr<cricket::PortAllocator> allocator(
+ rtc::scoped_ptr<cricket::PortAllocator> allocator(
new TestPortAllocator());
int next_message_id = 0;
- talk_base::scoped_ptr<TestClient> initiator(
+ rtc::scoped_ptr<TestClient> initiator(
new TestClient(allocator.get(), &next_message_id,
kInitiator, protocol,
content_type,
content_name, channel_name_a,
content_name, channel_name_b));
- talk_base::scoped_ptr<TestClient> responder(
+ rtc::scoped_ptr<TestClient> responder(
new TestClient(allocator.get(), &next_message_id,
responder_full, protocol,
content_type,
@@ -1676,7 +1676,7 @@
// Send an unauthorized redirect to the initiator and expect it be ignored.
initiator->blow_up_on_error = false;
const buzz::XmlElement* initiate_stanza = initiator->stanza();
- talk_base::scoped_ptr<buzz::XmlElement> redirect_stanza(
+ rtc::scoped_ptr<buzz::XmlElement> redirect_stanza(
buzz::XmlElement::ForStr(
IqError("ER", kResponder, kInitiator,
RedirectXml(protocol, initiate_xml, "not@allowed.com"))));
@@ -1706,18 +1706,18 @@
protocol, content_name, content_type);
std::string responder_full = kResponder + "/full";
- talk_base::scoped_ptr<cricket::PortAllocator> allocator(
+ rtc::scoped_ptr<cricket::PortAllocator> allocator(
new TestPortAllocator());
int next_message_id = 0;
- talk_base::scoped_ptr<TestClient> initiator(
+ rtc::scoped_ptr<TestClient> initiator(
new TestClient(allocator.get(), &next_message_id,
kInitiator, protocol,
content_type,
content_name, channel_name_a,
content_name, channel_name_b));
- talk_base::scoped_ptr<TestClient> responder(
+ rtc::scoped_ptr<TestClient> responder(
new TestClient(allocator.get(), &next_message_id,
responder_full, protocol,
content_type,
@@ -1758,7 +1758,7 @@
// Send a redirect to the initiator and expect all of the message
// to be resent.
const buzz::XmlElement* initiate_stanza = initiator->stanza();
- talk_base::scoped_ptr<buzz::XmlElement> redirect_stanza(
+ rtc::scoped_ptr<buzz::XmlElement> redirect_stanza(
buzz::XmlElement::ForStr(
IqError("ER2", kResponder, kInitiator,
RedirectXml(protocol, initiate_xml, responder_full))));
@@ -1851,18 +1851,18 @@
std::string channel_name_b = "rtcp";
cricket::SignalingProtocol protocol = PROTOCOL_JINGLE;
- talk_base::scoped_ptr<cricket::PortAllocator> allocator(
+ rtc::scoped_ptr<cricket::PortAllocator> allocator(
new TestPortAllocator());
int next_message_id = 0;
- talk_base::scoped_ptr<TestClient> initiator(
+ rtc::scoped_ptr<TestClient> initiator(
new TestClient(allocator.get(), &next_message_id,
kInitiator, protocol,
content_type,
content_name, channel_name_a,
content_name, channel_name_b));
- talk_base::scoped_ptr<TestClient> responder(
+ rtc::scoped_ptr<TestClient> responder(
new TestClient(allocator.get(), &next_message_id,
kResponder, protocol,
content_type,
@@ -1988,18 +1988,18 @@
std::string content_name = "main";
std::string content_type = "http://oink.splat/session";
- talk_base::scoped_ptr<cricket::PortAllocator> allocator(
+ rtc::scoped_ptr<cricket::PortAllocator> allocator(
new TestPortAllocator());
int next_message_id = 0;
- talk_base::scoped_ptr<TestClient> initiator(
+ rtc::scoped_ptr<TestClient> initiator(
new TestClient(allocator.get(), &next_message_id,
kInitiator, protocol,
content_type,
content_name, "a",
content_name, "b"));
- talk_base::scoped_ptr<TestClient> responder(
+ rtc::scoped_ptr<TestClient> responder(
new TestClient(allocator.get(), &next_message_id,
kResponder, protocol,
content_type,
@@ -2042,11 +2042,11 @@
std::string content_name = "main";
std::string content_type = "http://oink.splat/session";
- talk_base::scoped_ptr<cricket::PortAllocator> allocator(
+ rtc::scoped_ptr<cricket::PortAllocator> allocator(
new TestPortAllocator());
int next_message_id = 0;
- talk_base::scoped_ptr<TestClient> initiator(
+ rtc::scoped_ptr<TestClient> initiator(
new TestClient(allocator.get(), &next_message_id,
kInitiator, protocol,
content_type,
@@ -2124,13 +2124,13 @@
}
void TestSendDescriptionInfo() {
- talk_base::scoped_ptr<cricket::PortAllocator> allocator(
+ rtc::scoped_ptr<cricket::PortAllocator> allocator(
new TestPortAllocator());
int next_message_id = 0;
std::string content_name = "content-name";
std::string content_type = "content-type";
- talk_base::scoped_ptr<TestClient> initiator(
+ rtc::scoped_ptr<TestClient> initiator(
new TestClient(allocator.get(), &next_message_id,
kInitiator, PROTOCOL_JINGLE,
content_type,
@@ -2178,13 +2178,13 @@
}
void TestCallerSignalNewDescription() {
- talk_base::scoped_ptr<cricket::PortAllocator> allocator(
+ rtc::scoped_ptr<cricket::PortAllocator> allocator(
new TestPortAllocator());
int next_message_id = 0;
std::string content_name = "content-name";
std::string content_type = "content-type";
- talk_base::scoped_ptr<TestClient> initiator(
+ rtc::scoped_ptr<TestClient> initiator(
new TestClient(allocator.get(), &next_message_id,
kInitiator, PROTOCOL_JINGLE,
content_type,
@@ -2218,13 +2218,13 @@
}
void TestCalleeSignalNewDescription() {
- talk_base::scoped_ptr<cricket::PortAllocator> allocator(
+ rtc::scoped_ptr<cricket::PortAllocator> allocator(
new TestPortAllocator());
int next_message_id = 0;
std::string content_name = "content-name";
std::string content_type = "content-type";
- talk_base::scoped_ptr<TestClient> initiator(
+ rtc::scoped_ptr<TestClient> initiator(
new TestClient(allocator.get(), &next_message_id,
kInitiator, PROTOCOL_JINGLE,
content_type,
@@ -2258,13 +2258,13 @@
}
void TestGetTransportStats() {
- talk_base::scoped_ptr<cricket::PortAllocator> allocator(
+ rtc::scoped_ptr<cricket::PortAllocator> allocator(
new TestPortAllocator());
int next_message_id = 0;
std::string content_name = "content-name";
std::string content_type = "content-type";
- talk_base::scoped_ptr<TestClient> initiator(
+ rtc::scoped_ptr<TestClient> initiator(
new TestClient(allocator.get(), &next_message_id,
kInitiator, PROTOCOL_JINGLE,
content_type,
diff --git a/p2p/base/sessiondescription.h b/p2p/base/sessiondescription.h
index d33b4c3..8d56a96 100644
--- a/p2p/base/sessiondescription.h
+++ b/p2p/base/sessiondescription.h
@@ -31,7 +31,7 @@
#include <string>
#include <vector>
-#include "talk/base/constructormagic.h"
+#include "webrtc/base/constructormagic.h"
#include "talk/p2p/base/transportinfo.h"
namespace cricket {
diff --git a/p2p/base/sessionmanager.cc b/p2p/base/sessionmanager.cc
index 15b7452..a8782c4 100644
--- a/p2p/base/sessionmanager.cc
+++ b/p2p/base/sessionmanager.cc
@@ -27,11 +27,11 @@
#include "talk/p2p/base/sessionmanager.h"
-#include "talk/base/common.h"
-#include "talk/base/helpers.h"
-#include "talk/base/logging.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/stringencode.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/stringencode.h"
#include "talk/p2p/base/constants.h"
#include "talk/p2p/base/session.h"
#include "talk/p2p/base/sessionmessages.h"
@@ -41,11 +41,11 @@
namespace cricket {
SessionManager::SessionManager(PortAllocator *allocator,
- talk_base::Thread *worker) {
+ rtc::Thread *worker) {
allocator_ = allocator;
- signaling_thread_ = talk_base::Thread::Current();
+ signaling_thread_ = rtc::Thread::Current();
if (worker == NULL) {
- worker_thread_ = talk_base::Thread::Current();
+ worker_thread_ = rtc::Thread::Current();
} else {
worker_thread_ = worker;
}
@@ -87,7 +87,7 @@
const std::string& local_name,
const std::string& content_type) {
std::string sid =
- id.empty() ? talk_base::ToString(talk_base::CreateRandomId64()) : id;
+ id.empty() ? rtc::ToString(rtc::CreateRandomId64()) : id;
return CreateSession(local_name, local_name, sid, content_type, false);
}
@@ -231,7 +231,7 @@
Session* session = FindSession(msg.sid, msg.to);
if (session) {
- talk_base::scoped_ptr<buzz::XmlElement> synthetic_error;
+ rtc::scoped_ptr<buzz::XmlElement> synthetic_error;
if (!error_stanza) {
// A failed send is semantically equivalent to an error response, so we
// can just turn the former into the latter.
@@ -250,7 +250,7 @@
const std::string& type,
const std::string& text,
const buzz::XmlElement* extra_info) {
- talk_base::scoped_ptr<buzz::XmlElement> msg(
+ rtc::scoped_ptr<buzz::XmlElement> msg(
CreateErrorMessage(stanza, name, type, text, extra_info));
SignalOutgoingMessage(this, msg.get());
}
diff --git a/p2p/base/sessionmanager.h b/p2p/base/sessionmanager.h
index d88e050..55cf78d 100644
--- a/p2p/base/sessionmanager.h
+++ b/p2p/base/sessionmanager.h
@@ -33,8 +33,8 @@
#include <utility>
#include <vector>
-#include "talk/base/sigslot.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/thread.h"
#include "talk/p2p/base/portallocator.h"
#include "talk/p2p/base/transportdescriptionfactory.h"
@@ -53,12 +53,12 @@
class SessionManager : public sigslot::has_slots<> {
public:
SessionManager(PortAllocator *allocator,
- talk_base::Thread *worker_thread = NULL);
+ rtc::Thread *worker_thread = NULL);
virtual ~SessionManager();
PortAllocator *port_allocator() const { return allocator_; }
- talk_base::Thread *worker_thread() const { return worker_thread_; }
- talk_base::Thread *signaling_thread() const { return signaling_thread_; }
+ rtc::Thread *worker_thread() const { return worker_thread_; }
+ rtc::Thread *signaling_thread() const { return signaling_thread_; }
int session_timeout() const { return timeout_; }
void set_session_timeout(int timeout) { timeout_ = timeout; }
@@ -72,7 +72,7 @@
void set_secure(SecurePolicy policy) {
transport_desc_factory_.set_secure(policy);
}
- void set_identity(talk_base::SSLIdentity* identity) {
+ void set_identity(rtc::SSLIdentity* identity) {
transport_desc_factory_.set_identity(identity);
}
const TransportDescriptionFactory* transport_desc_factory() const {
@@ -198,8 +198,8 @@
const buzz::XmlElement* extra_info);
PortAllocator *allocator_;
- talk_base::Thread *signaling_thread_;
- talk_base::Thread *worker_thread_;
+ rtc::Thread *signaling_thread_;
+ rtc::Thread *worker_thread_;
int timeout_;
TransportDescriptionFactory transport_desc_factory_;
SessionMap session_map_;
diff --git a/p2p/base/sessionmessages.cc b/p2p/base/sessionmessages.cc
index 7a03d76..a542dfd 100644
--- a/p2p/base/sessionmessages.cc
+++ b/p2p/base/sessionmessages.cc
@@ -30,9 +30,9 @@
#include <stdio.h>
#include <string>
-#include "talk/base/logging.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/stringutils.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/stringutils.h"
#include "talk/p2p/base/constants.h"
#include "talk/p2p/base/p2ptransport.h"
#include "talk/p2p/base/parsing.h"
@@ -491,7 +491,7 @@
return false;
for (size_t i = 0; i < candidates.size(); ++i) {
- talk_base::scoped_ptr<buzz::XmlElement> element;
+ rtc::scoped_ptr<buzz::XmlElement> element;
if (!trans_parser->WriteGingleCandidate(candidates[i], translator,
element.accept(), error)) {
return false;
@@ -627,7 +627,7 @@
// namespace and only parse the codecs relevant to that namespace.
// We use this to control which codecs get parsed: first audio,
// then video.
- talk_base::scoped_ptr<buzz::XmlElement> audio_elem(
+ rtc::scoped_ptr<buzz::XmlElement> audio_elem(
new buzz::XmlElement(QN_GINGLE_AUDIO_CONTENT));
CopyXmlChildren(content_elem, audio_elem.get());
if (!ParseContentInfo(PROTOCOL_GINGLE, CN_AUDIO, NS_JINGLE_RTP,
diff --git a/p2p/base/sessionmessages.h b/p2p/base/sessionmessages.h
index 5cd565c..d11c460 100644
--- a/p2p/base/sessionmessages.h
+++ b/p2p/base/sessionmessages.h
@@ -32,7 +32,7 @@
#include <vector>
#include <map>
-#include "talk/base/basictypes.h"
+#include "webrtc/base/basictypes.h"
#include "talk/p2p/base/constants.h"
#include "talk/p2p/base/parsing.h"
#include "talk/p2p/base/sessiondescription.h" // Needed to delete contents.
diff --git a/p2p/base/stun.cc b/p2p/base/stun.cc
index 6331ba9..be96b76 100644
--- a/p2p/base/stun.cc
+++ b/p2p/base/stun.cc
@@ -29,15 +29,15 @@
#include <string.h>
-#include "talk/base/byteorder.h"
-#include "talk/base/common.h"
-#include "talk/base/crc32.h"
-#include "talk/base/logging.h"
-#include "talk/base/messagedigest.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/stringencode.h"
+#include "webrtc/base/byteorder.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/crc32.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/messagedigest.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/stringencode.h"
-using talk_base::ByteBuffer;
+using rtc::ByteBuffer;
namespace cricket {
@@ -151,7 +151,7 @@
}
// Getting the message length from the STUN header.
- uint16 msg_length = talk_base::GetBE16(&data[2]);
+ uint16 msg_length = rtc::GetBE16(&data[2]);
if (size != (msg_length + kStunHeaderSize)) {
return false;
}
@@ -162,8 +162,8 @@
while (current_pos < size) {
uint16 attr_type, attr_length;
// Getting attribute type and length.
- attr_type = talk_base::GetBE16(&data[current_pos]);
- attr_length = talk_base::GetBE16(&data[current_pos + sizeof(attr_type)]);
+ attr_type = rtc::GetBE16(&data[current_pos]);
+ attr_length = rtc::GetBE16(&data[current_pos + sizeof(attr_type)]);
// If M-I, sanity check it, and break out.
if (attr_type == STUN_ATTR_MESSAGE_INTEGRITY) {
@@ -188,7 +188,7 @@
// Getting length of the message to calculate Message Integrity.
size_t mi_pos = current_pos;
- talk_base::scoped_ptr<char[]> temp_data(new char[current_pos]);
+ rtc::scoped_ptr<char[]> temp_data(new char[current_pos]);
memcpy(temp_data.get(), data, current_pos);
if (size > mi_pos + kStunAttributeHeaderSize + kStunMessageIntegritySize) {
// Stun message has other attributes after message integrity.
@@ -203,12 +203,12 @@
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// |0 0| STUN Message Type | Message Length |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- talk_base::SetBE16(temp_data.get() + 2,
+ rtc::SetBE16(temp_data.get() + 2,
static_cast<uint16>(new_adjusted_len));
}
char hmac[kStunMessageIntegritySize];
- size_t ret = talk_base::ComputeHmac(talk_base::DIGEST_SHA_1,
+ size_t ret = rtc::ComputeHmac(rtc::DIGEST_SHA_1,
password.c_str(), password.size(),
temp_data.get(), mi_pos,
hmac, sizeof(hmac));
@@ -236,14 +236,14 @@
VERIFY(AddAttribute(msg_integrity_attr));
// Calculate the HMAC for the message.
- talk_base::ByteBuffer buf;
+ rtc::ByteBuffer buf;
if (!Write(&buf))
return false;
int msg_len_for_hmac = static_cast<int>(
buf.Length() - kStunAttributeHeaderSize - msg_integrity_attr->length());
char hmac[kStunMessageIntegritySize];
- size_t ret = talk_base::ComputeHmac(talk_base::DIGEST_SHA_1,
+ size_t ret = rtc::ComputeHmac(rtc::DIGEST_SHA_1,
key, keylen,
buf.Data(), msg_len_for_hmac,
hmac, sizeof(hmac));
@@ -272,21 +272,21 @@
// Skip the rest if the magic cookie isn't present.
const char* magic_cookie =
data + kStunTransactionIdOffset - kStunMagicCookieLength;
- if (talk_base::GetBE32(magic_cookie) != kStunMagicCookie)
+ if (rtc::GetBE32(magic_cookie) != kStunMagicCookie)
return false;
// Check the fingerprint type and length.
const char* fingerprint_attr_data = data + size - fingerprint_attr_size;
- if (talk_base::GetBE16(fingerprint_attr_data) != STUN_ATTR_FINGERPRINT ||
- talk_base::GetBE16(fingerprint_attr_data + sizeof(uint16)) !=
+ if (rtc::GetBE16(fingerprint_attr_data) != STUN_ATTR_FINGERPRINT ||
+ rtc::GetBE16(fingerprint_attr_data + sizeof(uint16)) !=
StunUInt32Attribute::SIZE)
return false;
// Check the fingerprint value.
uint32 fingerprint =
- talk_base::GetBE32(fingerprint_attr_data + kStunAttributeHeaderSize);
+ rtc::GetBE32(fingerprint_attr_data + kStunAttributeHeaderSize);
return ((fingerprint ^ STUN_FINGERPRINT_XOR_VALUE) ==
- talk_base::ComputeCrc32(data, size - fingerprint_attr_size));
+ rtc::ComputeCrc32(data, size - fingerprint_attr_size));
}
bool StunMessage::AddFingerprint() {
@@ -297,13 +297,13 @@
VERIFY(AddAttribute(fingerprint_attr));
// Calculate the CRC-32 for the message and insert it.
- talk_base::ByteBuffer buf;
+ rtc::ByteBuffer buf;
if (!Write(&buf))
return false;
int msg_len_for_crc32 = static_cast<int>(
buf.Length() - kStunAttributeHeaderSize - fingerprint_attr->length());
- uint32 c = talk_base::ComputeCrc32(buf.Data(), msg_len_for_crc32);
+ uint32 c = rtc::ComputeCrc32(buf.Data(), msg_len_for_crc32);
// Insert the correct CRC-32, XORed with a constant, into the attribute.
fingerprint_attr->SetValue(c ^ STUN_FINGERPRINT_XOR_VALUE);
@@ -333,7 +333,7 @@
uint32 magic_cookie_int =
*reinterpret_cast<const uint32*>(magic_cookie.data());
- if (talk_base::NetworkToHost32(magic_cookie_int) != kStunMagicCookie) {
+ if (rtc::NetworkToHost32(magic_cookie_int) != kStunMagicCookie) {
// If magic cookie is invalid it means that the peer implements
// RFC3489 instead of RFC5389.
transaction_id.insert(0, magic_cookie);
@@ -433,14 +433,14 @@
: type_(type), length_(length) {
}
-void StunAttribute::ConsumePadding(talk_base::ByteBuffer* buf) const {
+void StunAttribute::ConsumePadding(rtc::ByteBuffer* buf) const {
int remainder = length_ % 4;
if (remainder > 0) {
buf->Consume(4 - remainder);
}
}
-void StunAttribute::WritePadding(talk_base::ByteBuffer* buf) const {
+void StunAttribute::WritePadding(rtc::ByteBuffer* buf) const {
int remainder = length_ % 4;
if (remainder > 0) {
char zeroes[4] = {0};
@@ -501,7 +501,7 @@
}
StunAddressAttribute::StunAddressAttribute(uint16 type,
- const talk_base::SocketAddress& addr)
+ const rtc::SocketAddress& addr)
: StunAttribute(type, 0) {
SetAddress(addr);
}
@@ -530,8 +530,8 @@
if (!buf->ReadBytes(reinterpret_cast<char*>(&v4addr), sizeof(v4addr))) {
return false;
}
- talk_base::IPAddress ipaddr(v4addr);
- SetAddress(talk_base::SocketAddress(ipaddr, port));
+ rtc::IPAddress ipaddr(v4addr);
+ SetAddress(rtc::SocketAddress(ipaddr, port));
} else if (stun_family == STUN_ADDRESS_IPV6) {
in6_addr v6addr;
if (length() != SIZE_IP6) {
@@ -540,8 +540,8 @@
if (!buf->ReadBytes(reinterpret_cast<char*>(&v6addr), sizeof(v6addr))) {
return false;
}
- talk_base::IPAddress ipaddr(v6addr);
- SetAddress(talk_base::SocketAddress(ipaddr, port));
+ rtc::IPAddress ipaddr(v6addr);
+ SetAddress(rtc::SocketAddress(ipaddr, port));
} else {
return false;
}
@@ -573,7 +573,7 @@
}
StunXorAddressAttribute::StunXorAddressAttribute(uint16 type,
- const talk_base::SocketAddress& addr)
+ const rtc::SocketAddress& addr)
: StunAddressAttribute(type, addr), owner_(NULL) {
}
@@ -582,15 +582,15 @@
StunMessage* owner)
: StunAddressAttribute(type, length), owner_(owner) {}
-talk_base::IPAddress StunXorAddressAttribute::GetXoredIP() const {
+rtc::IPAddress StunXorAddressAttribute::GetXoredIP() const {
if (owner_) {
- talk_base::IPAddress ip = ipaddr();
+ rtc::IPAddress ip = ipaddr();
switch (ip.family()) {
case AF_INET: {
in_addr v4addr = ip.ipv4_address();
v4addr.s_addr =
- (v4addr.s_addr ^ talk_base::HostToNetwork32(kStunMagicCookie));
- return talk_base::IPAddress(v4addr);
+ (v4addr.s_addr ^ rtc::HostToNetwork32(kStunMagicCookie));
+ return rtc::IPAddress(v4addr);
}
case AF_INET6: {
in6_addr v6addr = ip.ipv6_address();
@@ -603,11 +603,11 @@
// Transaction ID is in network byte order, but magic cookie
// is stored in host byte order.
ip_as_ints[0] =
- (ip_as_ints[0] ^ talk_base::HostToNetwork32(kStunMagicCookie));
+ (ip_as_ints[0] ^ rtc::HostToNetwork32(kStunMagicCookie));
ip_as_ints[1] = (ip_as_ints[1] ^ transactionid_as_ints[0]);
ip_as_ints[2] = (ip_as_ints[2] ^ transactionid_as_ints[1]);
ip_as_ints[3] = (ip_as_ints[3] ^ transactionid_as_ints[2]);
- return talk_base::IPAddress(v6addr);
+ return rtc::IPAddress(v6addr);
}
break;
}
@@ -615,15 +615,15 @@
}
// Invalid ip family or transaction ID, or missing owner.
// Return an AF_UNSPEC address.
- return talk_base::IPAddress();
+ return rtc::IPAddress();
}
bool StunXorAddressAttribute::Read(ByteBuffer* buf) {
if (!StunAddressAttribute::Read(buf))
return false;
uint16 xoredport = port() ^ (kStunMagicCookie >> 16);
- talk_base::IPAddress xored_ip = GetXoredIP();
- SetAddress(talk_base::SocketAddress(xored_ip, xoredport));
+ rtc::IPAddress xored_ip = GetXoredIP();
+ SetAddress(rtc::SocketAddress(xored_ip, xoredport));
return true;
}
@@ -633,7 +633,7 @@
LOG(LS_ERROR) << "Error writing xor-address attribute: unknown family.";
return false;
}
- talk_base::IPAddress xored_ip = GetXoredIP();
+ rtc::IPAddress xored_ip = GetXoredIP();
if (xored_ip.family() == AF_UNSPEC) {
return false;
}
@@ -916,9 +916,9 @@
input += ':';
input += password;
- char digest[talk_base::MessageDigest::kMaxSize];
- size_t size = talk_base::ComputeDigest(
- talk_base::DIGEST_MD5, input.c_str(), input.size(),
+ char digest[rtc::MessageDigest::kMaxSize];
+ size_t size = rtc::ComputeDigest(
+ rtc::DIGEST_MD5, input.c_str(), input.size(),
digest, sizeof(digest));
if (size == 0) {
return false;
diff --git a/p2p/base/stun.h b/p2p/base/stun.h
index 6416e51..b22b51e 100644
--- a/p2p/base/stun.h
+++ b/p2p/base/stun.h
@@ -34,9 +34,9 @@
#include <string>
#include <vector>
-#include "talk/base/basictypes.h"
-#include "talk/base/bytebuffer.h"
-#include "talk/base/socketaddress.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/bytebuffer.h"
+#include "webrtc/base/socketaddress.h"
namespace cricket {
@@ -195,11 +195,11 @@
// Parses the STUN packet in the given buffer and records it here. The
// return value indicates whether this was successful.
- bool Read(talk_base::ByteBuffer* buf);
+ bool Read(rtc::ByteBuffer* buf);
// Writes this object into a STUN packet. The return value indicates whether
// this was successful.
- bool Write(talk_base::ByteBuffer* buf) const;
+ bool Write(rtc::ByteBuffer* buf) const;
// Creates an empty message. Overridable by derived classes.
virtual StunMessage* CreateNew() const { return new StunMessage(); }
@@ -236,11 +236,11 @@
// Reads the body (not the type or length) for this type of attribute from
// the given buffer. Return value is true if successful.
- virtual bool Read(talk_base::ByteBuffer* buf) = 0;
+ virtual bool Read(rtc::ByteBuffer* buf) = 0;
// Writes the body (not the type or length) to the given buffer. Return
// value is true if successful.
- virtual bool Write(talk_base::ByteBuffer* buf) const = 0;
+ virtual bool Write(rtc::ByteBuffer* buf) const = 0;
// Creates an attribute object with the given type and smallest length.
static StunAttribute* Create(StunAttributeValueType value_type, uint16 type,
@@ -258,8 +258,8 @@
protected:
StunAttribute(uint16 type, uint16 length);
void SetLength(uint16 length) { length_ = length; }
- void WritePadding(talk_base::ByteBuffer* buf) const;
- void ConsumePadding(talk_base::ByteBuffer* buf) const;
+ void WritePadding(rtc::ByteBuffer* buf) const;
+ void ConsumePadding(rtc::ByteBuffer* buf) const;
private:
uint16 type_;
@@ -272,7 +272,7 @@
static const uint16 SIZE_UNDEF = 0;
static const uint16 SIZE_IP4 = 8;
static const uint16 SIZE_IP6 = 20;
- StunAddressAttribute(uint16 type, const talk_base::SocketAddress& addr);
+ StunAddressAttribute(uint16 type, const rtc::SocketAddress& addr);
StunAddressAttribute(uint16 type, uint16 length);
virtual StunAttributeValueType value_type() const {
@@ -289,22 +289,22 @@
return STUN_ADDRESS_UNDEF;
}
- const talk_base::SocketAddress& GetAddress() const { return address_; }
- const talk_base::IPAddress& ipaddr() const { return address_.ipaddr(); }
+ const rtc::SocketAddress& GetAddress() const { return address_; }
+ const rtc::IPAddress& ipaddr() const { return address_.ipaddr(); }
uint16 port() const { return address_.port(); }
- void SetAddress(const talk_base::SocketAddress& addr) {
+ void SetAddress(const rtc::SocketAddress& addr) {
address_ = addr;
EnsureAddressLength();
}
- void SetIP(const talk_base::IPAddress& ip) {
+ void SetIP(const rtc::IPAddress& ip) {
address_.SetIP(ip);
EnsureAddressLength();
}
void SetPort(uint16 port) { address_.SetPort(port); }
- virtual bool Read(talk_base::ByteBuffer* buf);
- virtual bool Write(talk_base::ByteBuffer* buf) const;
+ virtual bool Read(rtc::ByteBuffer* buf);
+ virtual bool Write(rtc::ByteBuffer* buf) const;
private:
void EnsureAddressLength() {
@@ -323,7 +323,7 @@
}
}
}
- talk_base::SocketAddress address_;
+ rtc::SocketAddress address_;
};
// Implements STUN attributes that record an Internet address. When encoded
@@ -331,7 +331,7 @@
// transaction ID of the message.
class StunXorAddressAttribute : public StunAddressAttribute {
public:
- StunXorAddressAttribute(uint16 type, const talk_base::SocketAddress& addr);
+ StunXorAddressAttribute(uint16 type, const rtc::SocketAddress& addr);
StunXorAddressAttribute(uint16 type, uint16 length,
StunMessage* owner);
@@ -341,11 +341,11 @@
virtual void SetOwner(StunMessage* owner) {
owner_ = owner;
}
- virtual bool Read(talk_base::ByteBuffer* buf);
- virtual bool Write(talk_base::ByteBuffer* buf) const;
+ virtual bool Read(rtc::ByteBuffer* buf);
+ virtual bool Write(rtc::ByteBuffer* buf) const;
private:
- talk_base::IPAddress GetXoredIP() const;
+ rtc::IPAddress GetXoredIP() const;
StunMessage* owner_;
};
@@ -366,8 +366,8 @@
bool GetBit(size_t index) const;
void SetBit(size_t index, bool value);
- virtual bool Read(talk_base::ByteBuffer* buf);
- virtual bool Write(talk_base::ByteBuffer* buf) const;
+ virtual bool Read(rtc::ByteBuffer* buf);
+ virtual bool Write(rtc::ByteBuffer* buf) const;
private:
uint32 bits_;
@@ -386,8 +386,8 @@
uint64 value() const { return bits_; }
void SetValue(uint64 bits) { bits_ = bits; }
- virtual bool Read(talk_base::ByteBuffer* buf);
- virtual bool Write(talk_base::ByteBuffer* buf) const;
+ virtual bool Read(rtc::ByteBuffer* buf);
+ virtual bool Write(rtc::ByteBuffer* buf) const;
private:
uint64 bits_;
@@ -415,8 +415,8 @@
uint8 GetByte(size_t index) const;
void SetByte(size_t index, uint8 value);
- virtual bool Read(talk_base::ByteBuffer* buf);
- virtual bool Write(talk_base::ByteBuffer* buf) const;
+ virtual bool Read(rtc::ByteBuffer* buf);
+ virtual bool Write(rtc::ByteBuffer* buf) const;
private:
void SetBytes(char* bytes, size_t length);
@@ -448,8 +448,8 @@
void SetNumber(uint8 number) { number_ = number; }
void SetReason(const std::string& reason);
- bool Read(talk_base::ByteBuffer* buf);
- bool Write(talk_base::ByteBuffer* buf) const;
+ bool Read(rtc::ByteBuffer* buf);
+ bool Write(rtc::ByteBuffer* buf) const;
private:
uint8 class_;
@@ -472,8 +472,8 @@
void SetType(int index, uint16 value);
void AddType(uint16 value);
- bool Read(talk_base::ByteBuffer* buf);
- bool Write(talk_base::ByteBuffer* buf) const;
+ bool Read(rtc::ByteBuffer* buf);
+ bool Write(rtc::ByteBuffer* buf) const;
private:
std::vector<uint16>* attr_types_;
diff --git a/p2p/base/stun_unittest.cc b/p2p/base/stun_unittest.cc
index 71d8750..05a0f6c 100644
--- a/p2p/base/stun_unittest.cc
+++ b/p2p/base/stun_unittest.cc
@@ -27,12 +27,12 @@
#include <string>
-#include "talk/base/bytebuffer.h"
-#include "talk/base/gunit.h"
-#include "talk/base/logging.h"
-#include "talk/base/messagedigest.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/socketaddress.h"
+#include "webrtc/base/bytebuffer.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/messagedigest.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/socketaddress.h"
#include "talk/p2p/base/stun.h"
namespace cricket {
@@ -56,7 +56,7 @@
void CheckStunAddressAttribute(const StunAddressAttribute* addr,
StunAddressFamily expected_family,
int expected_port,
- talk_base::IPAddress expected_address) {
+ rtc::IPAddress expected_address) {
ASSERT_EQ(expected_family, addr->family());
ASSERT_EQ(expected_port, addr->port());
@@ -78,7 +78,7 @@
const unsigned char* testcase,
size_t size) {
const char* input = reinterpret_cast<const char*>(testcase);
- talk_base::ByteBuffer buf(input, size);
+ rtc::ByteBuffer buf(input, size);
if (msg->Read(&buf)) {
// Returns the size the stun message should report itself as being
return (size - 20);
@@ -267,9 +267,9 @@
static const char kRfc5769SampleMsgServerSoftware[] = "test vector";
static const char kRfc5769SampleMsgUsername[] = "evtj:h6vY";
static const char kRfc5769SampleMsgPassword[] = "VOkJxbRl1RmTxUk/WvJxBt";
-static const talk_base::SocketAddress kRfc5769SampleMsgMappedAddress(
+static const rtc::SocketAddress kRfc5769SampleMsgMappedAddress(
"192.0.2.1", 32853);
-static const talk_base::SocketAddress kRfc5769SampleMsgIPv6MappedAddress(
+static const rtc::SocketAddress kRfc5769SampleMsgIPv6MappedAddress(
"2001:db8:1234:5678:11:2233:4455:6677", 32853);
static const unsigned char kRfc5769SampleMsgWithAuthTransactionId[] = {
@@ -533,7 +533,7 @@
CheckStunTransactionID(msg, kTestTransactionId1, kStunTransactionIdLength);
const StunAddressAttribute* addr = msg.GetAddress(STUN_ATTR_MAPPED_ADDRESS);
- talk_base::IPAddress test_address(kIPv4TestAddress1);
+ rtc::IPAddress test_address(kIPv4TestAddress1);
CheckStunAddressAttribute(addr, STUN_ADDRESS_IPV4,
kTestMessagePort4, test_address);
}
@@ -547,7 +547,7 @@
const StunAddressAttribute* addr =
msg.GetAddress(STUN_ATTR_XOR_MAPPED_ADDRESS);
- talk_base::IPAddress test_address(kIPv4TestAddress1);
+ rtc::IPAddress test_address(kIPv4TestAddress1);
CheckStunAddressAttribute(addr, STUN_ADDRESS_IPV4,
kTestMessagePort3, test_address);
}
@@ -558,7 +558,7 @@
CheckStunHeader(msg, STUN_BINDING_REQUEST, size);
CheckStunTransactionID(msg, kTestTransactionId1, kStunTransactionIdLength);
- talk_base::IPAddress test_address(kIPv6TestAddress1);
+ rtc::IPAddress test_address(kIPv6TestAddress1);
const StunAddressAttribute* addr = msg.GetAddress(STUN_ATTR_MAPPED_ADDRESS);
CheckStunAddressAttribute(addr, STUN_ADDRESS_IPV6,
@@ -571,7 +571,7 @@
CheckStunHeader(msg, STUN_BINDING_REQUEST, size);
CheckStunTransactionID(msg, kTestTransactionId1, kStunTransactionIdLength);
- talk_base::IPAddress test_address(kIPv6TestAddress1);
+ rtc::IPAddress test_address(kIPv6TestAddress1);
const StunAddressAttribute* addr = msg.GetAddress(STUN_ATTR_MAPPED_ADDRESS);
CheckStunAddressAttribute(addr, STUN_ADDRESS_IPV6,
@@ -582,7 +582,7 @@
StunMessage msg;
size_t size = ReadStunMessage(&msg, kStunMessageWithIPv6XorMappedAddress);
- talk_base::IPAddress test_address(kIPv6TestAddress1);
+ rtc::IPAddress test_address(kIPv6TestAddress1);
CheckStunHeader(msg, STUN_BINDING_RESPONSE, size);
CheckStunTransactionID(msg, kTestTransactionId2, kStunTransactionIdLength);
@@ -711,7 +711,7 @@
CheckStunTransactionID(msg, &rfc3489_packet[4], kStunTransactionIdLength + 4);
const StunAddressAttribute* addr = msg.GetAddress(STUN_ATTR_MAPPED_ADDRESS);
- talk_base::IPAddress test_address(kIPv4TestAddress1);
+ rtc::IPAddress test_address(kIPv4TestAddress1);
CheckStunAddressAttribute(addr, STUN_ADDRESS_IPV4,
kTestMessagePort4, test_address);
}
@@ -721,7 +721,7 @@
StunMessage msg2;
size_t size = ReadStunMessage(&msg, kStunMessageWithIPv6XorMappedAddress);
- talk_base::IPAddress test_address(kIPv6TestAddress1);
+ rtc::IPAddress test_address(kIPv6TestAddress1);
CheckStunHeader(msg, STUN_BINDING_RESPONSE, size);
CheckStunTransactionID(msg, kTestTransactionId2, kStunTransactionIdLength);
@@ -740,8 +740,8 @@
// The internal IP address shouldn't change.
ASSERT_EQ(addr2.ipaddr(), addr->ipaddr());
- talk_base::ByteBuffer correct_buf;
- talk_base::ByteBuffer wrong_buf;
+ rtc::ByteBuffer correct_buf;
+ rtc::ByteBuffer wrong_buf;
EXPECT_TRUE(addr->Write(&correct_buf));
EXPECT_TRUE(addr2.Write(&wrong_buf));
// But when written out, the buffers should look different.
@@ -768,7 +768,7 @@
StunMessage msg2;
size_t size = ReadStunMessage(&msg, kStunMessageWithIPv4XorMappedAddress);
- talk_base::IPAddress test_address(kIPv4TestAddress1);
+ rtc::IPAddress test_address(kIPv4TestAddress1);
CheckStunHeader(msg, STUN_BINDING_RESPONSE, size);
CheckStunTransactionID(msg, kTestTransactionId1, kStunTransactionIdLength);
@@ -787,8 +787,8 @@
// The internal IP address shouldn't change.
ASSERT_EQ(addr2.ipaddr(), addr->ipaddr());
- talk_base::ByteBuffer correct_buf;
- talk_base::ByteBuffer wrong_buf;
+ rtc::ByteBuffer correct_buf;
+ rtc::ByteBuffer wrong_buf;
EXPECT_TRUE(addr->Write(&correct_buf));
EXPECT_TRUE(addr2.Write(&wrong_buf));
// The same address data should be written.
@@ -807,11 +807,11 @@
}
TEST_F(StunTest, CreateIPv6AddressAttribute) {
- talk_base::IPAddress test_ip(kIPv6TestAddress2);
+ rtc::IPAddress test_ip(kIPv6TestAddress2);
StunAddressAttribute* addr =
StunAttribute::CreateAddress(STUN_ATTR_MAPPED_ADDRESS);
- talk_base::SocketAddress test_addr(test_ip, kTestMessagePort2);
+ rtc::SocketAddress test_addr(test_ip, kTestMessagePort2);
addr->SetAddress(test_addr);
CheckStunAddressAttribute(addr, STUN_ADDRESS_IPV6,
@@ -822,11 +822,11 @@
TEST_F(StunTest, CreateIPv4AddressAttribute) {
struct in_addr test_in_addr;
test_in_addr.s_addr = 0xBEB0B0BE;
- talk_base::IPAddress test_ip(test_in_addr);
+ rtc::IPAddress test_ip(test_in_addr);
StunAddressAttribute* addr =
StunAttribute::CreateAddress(STUN_ATTR_MAPPED_ADDRESS);
- talk_base::SocketAddress test_addr(test_ip, kTestMessagePort2);
+ rtc::SocketAddress test_addr(test_ip, kTestMessagePort2);
addr->SetAddress(test_addr);
CheckStunAddressAttribute(addr, STUN_ADDRESS_IPV4,
@@ -840,17 +840,17 @@
StunAttribute::CreateAddress(STUN_ATTR_DESTINATION_ADDRESS);
// Port first
addr->SetPort(kTestMessagePort1);
- addr->SetIP(talk_base::IPAddress(kIPv4TestAddress1));
+ addr->SetIP(rtc::IPAddress(kIPv4TestAddress1));
ASSERT_EQ(kTestMessagePort1, addr->port());
- ASSERT_EQ(talk_base::IPAddress(kIPv4TestAddress1), addr->ipaddr());
+ ASSERT_EQ(rtc::IPAddress(kIPv4TestAddress1), addr->ipaddr());
StunAddressAttribute* addr2 =
StunAttribute::CreateAddress(STUN_ATTR_DESTINATION_ADDRESS);
// IP first
- addr2->SetIP(talk_base::IPAddress(kIPv4TestAddress1));
+ addr2->SetIP(rtc::IPAddress(kIPv4TestAddress1));
addr2->SetPort(kTestMessagePort2);
ASSERT_EQ(kTestMessagePort2, addr2->port());
- ASSERT_EQ(talk_base::IPAddress(kIPv4TestAddress1), addr2->ipaddr());
+ ASSERT_EQ(rtc::IPAddress(kIPv4TestAddress1), addr2->ipaddr());
delete addr;
delete addr2;
@@ -860,7 +860,7 @@
StunMessage msg;
size_t size = sizeof(kStunMessageWithIPv6MappedAddress);
- talk_base::IPAddress test_ip(kIPv6TestAddress1);
+ rtc::IPAddress test_ip(kIPv6TestAddress1);
msg.SetType(STUN_BINDING_REQUEST);
msg.SetTransactionID(
@@ -870,13 +870,13 @@
StunAddressAttribute* addr =
StunAttribute::CreateAddress(STUN_ATTR_MAPPED_ADDRESS);
- talk_base::SocketAddress test_addr(test_ip, kTestMessagePort2);
+ rtc::SocketAddress test_addr(test_ip, kTestMessagePort2);
addr->SetAddress(test_addr);
EXPECT_TRUE(msg.AddAttribute(addr));
CheckStunHeader(msg, STUN_BINDING_REQUEST, (size - 20));
- talk_base::ByteBuffer out;
+ rtc::ByteBuffer out;
EXPECT_TRUE(msg.Write(&out));
ASSERT_EQ(out.Length(), sizeof(kStunMessageWithIPv6MappedAddress));
int len1 = static_cast<int>(out.Length());
@@ -889,7 +889,7 @@
StunMessage msg;
size_t size = sizeof(kStunMessageWithIPv4MappedAddress);
- talk_base::IPAddress test_ip(kIPv4TestAddress1);
+ rtc::IPAddress test_ip(kIPv4TestAddress1);
msg.SetType(STUN_BINDING_RESPONSE);
msg.SetTransactionID(
@@ -899,13 +899,13 @@
StunAddressAttribute* addr =
StunAttribute::CreateAddress(STUN_ATTR_MAPPED_ADDRESS);
- talk_base::SocketAddress test_addr(test_ip, kTestMessagePort4);
+ rtc::SocketAddress test_addr(test_ip, kTestMessagePort4);
addr->SetAddress(test_addr);
EXPECT_TRUE(msg.AddAttribute(addr));
CheckStunHeader(msg, STUN_BINDING_RESPONSE, (size - 20));
- talk_base::ByteBuffer out;
+ rtc::ByteBuffer out;
EXPECT_TRUE(msg.Write(&out));
ASSERT_EQ(out.Length(), sizeof(kStunMessageWithIPv4MappedAddress));
int len1 = static_cast<int>(out.Length());
@@ -918,7 +918,7 @@
StunMessage msg;
size_t size = sizeof(kStunMessageWithIPv6XorMappedAddress);
- talk_base::IPAddress test_ip(kIPv6TestAddress1);
+ rtc::IPAddress test_ip(kIPv6TestAddress1);
msg.SetType(STUN_BINDING_RESPONSE);
msg.SetTransactionID(
@@ -928,13 +928,13 @@
StunAddressAttribute* addr =
StunAttribute::CreateXorAddress(STUN_ATTR_XOR_MAPPED_ADDRESS);
- talk_base::SocketAddress test_addr(test_ip, kTestMessagePort1);
+ rtc::SocketAddress test_addr(test_ip, kTestMessagePort1);
addr->SetAddress(test_addr);
EXPECT_TRUE(msg.AddAttribute(addr));
CheckStunHeader(msg, STUN_BINDING_RESPONSE, (size - 20));
- talk_base::ByteBuffer out;
+ rtc::ByteBuffer out;
EXPECT_TRUE(msg.Write(&out));
ASSERT_EQ(out.Length(), sizeof(kStunMessageWithIPv6XorMappedAddress));
int len1 = static_cast<int>(out.Length());
@@ -948,7 +948,7 @@
StunMessage msg;
size_t size = sizeof(kStunMessageWithIPv4XorMappedAddress);
- talk_base::IPAddress test_ip(kIPv4TestAddress1);
+ rtc::IPAddress test_ip(kIPv4TestAddress1);
msg.SetType(STUN_BINDING_RESPONSE);
msg.SetTransactionID(
@@ -958,13 +958,13 @@
StunAddressAttribute* addr =
StunAttribute::CreateXorAddress(STUN_ATTR_XOR_MAPPED_ADDRESS);
- talk_base::SocketAddress test_addr(test_ip, kTestMessagePort3);
+ rtc::SocketAddress test_addr(test_ip, kTestMessagePort3);
addr->SetAddress(test_addr);
EXPECT_TRUE(msg.AddAttribute(addr));
CheckStunHeader(msg, STUN_BINDING_RESPONSE, (size - 20));
- talk_base::ByteBuffer out;
+ rtc::ByteBuffer out;
EXPECT_TRUE(msg.Write(&out));
ASSERT_EQ(out.Length(), sizeof(kStunMessageWithIPv4XorMappedAddress));
int len1 = static_cast<int>(out.Length());
@@ -1052,7 +1052,7 @@
EXPECT_TRUE(msg.AddAttribute(errorcode));
CheckStunHeader(msg, STUN_BINDING_ERROR_RESPONSE, (size - 20));
- talk_base::ByteBuffer out;
+ rtc::ByteBuffer out;
EXPECT_TRUE(msg.Write(&out));
ASSERT_EQ(size, out.Length());
// No padding.
@@ -1075,7 +1075,7 @@
EXPECT_TRUE(msg.AddAttribute(list));
CheckStunHeader(msg, STUN_BINDING_REQUEST, (size - 20));
- talk_base::ByteBuffer out;
+ rtc::ByteBuffer out;
EXPECT_TRUE(msg.Write(&out));
ASSERT_EQ(size, out.Length());
// Check everything up to the padding.
@@ -1087,7 +1087,7 @@
void CheckFailureToRead(const unsigned char* testcase, size_t length) {
StunMessage msg;
const char* input = reinterpret_cast<const char*>(testcase);
- talk_base::ByteBuffer buf(input, length);
+ rtc::ByteBuffer buf(input, length);
ASSERT_FALSE(msg.Read(&buf));
}
@@ -1179,7 +1179,7 @@
// the RFC5769 test messages used include attributes not found in basic STUN.
TEST_F(StunTest, AddMessageIntegrity) {
IceMessage msg;
- talk_base::ByteBuffer buf(
+ rtc::ByteBuffer buf(
reinterpret_cast<const char*>(kRfc5769SampleRequestWithoutMI),
sizeof(kRfc5769SampleRequestWithoutMI));
EXPECT_TRUE(msg.Read(&buf));
@@ -1190,14 +1190,14 @@
EXPECT_EQ(0, memcmp(
mi_attr->bytes(), kCalculatedHmac1, sizeof(kCalculatedHmac1)));
- talk_base::ByteBuffer buf1;
+ rtc::ByteBuffer buf1;
EXPECT_TRUE(msg.Write(&buf1));
EXPECT_TRUE(StunMessage::ValidateMessageIntegrity(
reinterpret_cast<const char*>(buf1.Data()), buf1.Length(),
kRfc5769SampleMsgPassword));
IceMessage msg2;
- talk_base::ByteBuffer buf2(
+ rtc::ByteBuffer buf2(
reinterpret_cast<const char*>(kRfc5769SampleResponseWithoutMI),
sizeof(kRfc5769SampleResponseWithoutMI));
EXPECT_TRUE(msg2.Read(&buf2));
@@ -1208,7 +1208,7 @@
EXPECT_EQ(
0, memcmp(mi_attr2->bytes(), kCalculatedHmac2, sizeof(kCalculatedHmac2)));
- talk_base::ByteBuffer buf3;
+ rtc::ByteBuffer buf3;
EXPECT_TRUE(msg2.Write(&buf3));
EXPECT_TRUE(StunMessage::ValidateMessageIntegrity(
reinterpret_cast<const char*>(buf3.Data()), buf3.Length(),
@@ -1254,13 +1254,13 @@
TEST_F(StunTest, AddFingerprint) {
IceMessage msg;
- talk_base::ByteBuffer buf(
+ rtc::ByteBuffer buf(
reinterpret_cast<const char*>(kRfc5769SampleRequestWithoutMI),
sizeof(kRfc5769SampleRequestWithoutMI));
EXPECT_TRUE(msg.Read(&buf));
EXPECT_TRUE(msg.AddFingerprint());
- talk_base::ByteBuffer buf1;
+ rtc::ByteBuffer buf1;
EXPECT_TRUE(msg.Write(&buf1));
EXPECT_TRUE(StunMessage::ValidateFingerprint(
reinterpret_cast<const char*>(buf1.Data()), buf1.Length()));
@@ -1303,7 +1303,7 @@
const char* input = reinterpret_cast<const char*>(kRelayMessage);
size_t size = sizeof(kRelayMessage);
- talk_base::ByteBuffer buf(input, size);
+ rtc::ByteBuffer buf(input, size);
EXPECT_TRUE(msg.Read(&buf));
EXPECT_EQ(STUN_BINDING_REQUEST, msg.type());
@@ -1315,7 +1315,7 @@
in_addr legacy_in_addr;
legacy_in_addr.s_addr = htonl(17U);
- talk_base::IPAddress legacy_ip(legacy_in_addr);
+ rtc::IPAddress legacy_ip(legacy_in_addr);
const StunAddressAttribute* addr = msg.GetAddress(STUN_ATTR_MAPPED_ADDRESS);
ASSERT_TRUE(addr != NULL);
@@ -1399,7 +1399,7 @@
bytes2->CopyBytes("abcdefg");
EXPECT_TRUE(msg2.AddAttribute(bytes2));
- talk_base::ByteBuffer out;
+ rtc::ByteBuffer out;
EXPECT_TRUE(msg.Write(&out));
EXPECT_EQ(size, out.Length());
size_t len1 = out.Length();
@@ -1407,7 +1407,7 @@
out.ReadString(&outstring, len1);
EXPECT_EQ(0, memcmp(outstring.c_str(), input, len1));
- talk_base::ByteBuffer out2;
+ rtc::ByteBuffer out2;
EXPECT_TRUE(msg2.Write(&out2));
EXPECT_EQ(size, out2.Length());
size_t len2 = out2.Length();
diff --git a/p2p/base/stunport.cc b/p2p/base/stunport.cc
index 6e18fc5..57c7850 100644
--- a/p2p/base/stunport.cc
+++ b/p2p/base/stunport.cc
@@ -27,10 +27,10 @@
#include "talk/p2p/base/stunport.h"
-#include "talk/base/common.h"
-#include "talk/base/logging.h"
-#include "talk/base/helpers.h"
-#include "talk/base/nethelpers.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/nethelpers.h"
#include "talk/p2p/base/common.h"
#include "talk/p2p/base/stun.h"
@@ -45,15 +45,15 @@
class StunBindingRequest : public StunRequest {
public:
StunBindingRequest(UDPPort* port, bool keep_alive,
- const talk_base::SocketAddress& addr)
+ const rtc::SocketAddress& addr)
: port_(port), keep_alive_(keep_alive), server_addr_(addr) {
- start_time_ = talk_base::Time();
+ start_time_ = rtc::Time();
}
virtual ~StunBindingRequest() {
}
- const talk_base::SocketAddress& server_addr() const { return server_addr_; }
+ const rtc::SocketAddress& server_addr() const { return server_addr_; }
virtual void Prepare(StunMessage* request) {
request->SetType(STUN_BINDING_REQUEST);
@@ -68,11 +68,11 @@
addr_attr->family() != STUN_ADDRESS_IPV6) {
LOG(LS_ERROR) << "Binding address has bad family";
} else {
- talk_base::SocketAddress addr(addr_attr->ipaddr(), addr_attr->port());
- port_->OnStunBindingRequestSucceeded(addr);
+ rtc::SocketAddress addr(addr_attr->ipaddr(), addr_attr->port());
+ port_->OnStunBindingRequestSucceeded(server_addr_, addr);
}
- // We will do a keep-alive regardless of whether this request suceeds.
+ // We will do a keep-alive regardless of whether this request succeeds.
// This should have almost no impact on network usage.
if (keep_alive_) {
port_->requests_.SendDelayed(
@@ -92,10 +92,10 @@
<< " reason='" << attr->reason() << "'";
}
- port_->OnStunBindingOrResolveRequestFailed();
+ port_->OnStunBindingOrResolveRequestFailed(server_addr_);
if (keep_alive_
- && (talk_base::TimeSince(start_time_) <= RETRY_TIMEOUT)) {
+ && (rtc::TimeSince(start_time_) <= RETRY_TIMEOUT)) {
port_->requests_.SendDelayed(
new StunBindingRequest(port_, true, server_addr_),
port_->stun_keepalive_delay());
@@ -107,10 +107,10 @@
<< port_->GetLocalAddress().ToSensitiveString()
<< " (" << port_->Network()->name() << ")";
- port_->OnStunBindingOrResolveRequestFailed();
+ port_->OnStunBindingOrResolveRequestFailed(server_addr_);
if (keep_alive_
- && (talk_base::TimeSince(start_time_) <= RETRY_TIMEOUT)) {
+ && (rtc::TimeSince(start_time_) <= RETRY_TIMEOUT)) {
port_->requests_.SendDelayed(
new StunBindingRequest(port_, true, server_addr_),
RETRY_DELAY);
@@ -120,36 +120,84 @@
private:
UDPPort* port_;
bool keep_alive_;
- talk_base::SocketAddress server_addr_;
+ const rtc::SocketAddress server_addr_;
uint32 start_time_;
};
-UDPPort::UDPPort(talk_base::Thread* thread,
- talk_base::PacketSocketFactory* factory,
- talk_base::Network* network,
- talk_base::AsyncPacketSocket* socket,
+UDPPort::AddressResolver::AddressResolver(
+ rtc::PacketSocketFactory* factory)
+ : socket_factory_(factory) {}
+
+UDPPort::AddressResolver::~AddressResolver() {
+ for (ResolverMap::iterator it = resolvers_.begin();
+ it != resolvers_.end(); ++it) {
+ it->second->Destroy(true);
+ }
+}
+
+void UDPPort::AddressResolver::Resolve(
+ const rtc::SocketAddress& address) {
+ if (resolvers_.find(address) != resolvers_.end())
+ return;
+
+ rtc::AsyncResolverInterface* resolver =
+ socket_factory_->CreateAsyncResolver();
+ resolvers_.insert(
+ std::pair<rtc::SocketAddress, rtc::AsyncResolverInterface*>(
+ address, resolver));
+
+ resolver->SignalDone.connect(this,
+ &UDPPort::AddressResolver::OnResolveResult);
+
+ resolver->Start(address);
+}
+
+bool UDPPort::AddressResolver::GetResolvedAddress(
+ const rtc::SocketAddress& input,
+ int family,
+ rtc::SocketAddress* output) const {
+ ResolverMap::const_iterator it = resolvers_.find(input);
+ if (it == resolvers_.end())
+ return false;
+
+ return it->second->GetResolvedAddress(family, output);
+}
+
+void UDPPort::AddressResolver::OnResolveResult(
+ rtc::AsyncResolverInterface* resolver) {
+ for (ResolverMap::iterator it = resolvers_.begin();
+ it != resolvers_.end(); ++it) {
+ if (it->second == resolver) {
+ SignalDone(it->first, resolver->GetError());
+ return;
+ }
+ }
+}
+
+UDPPort::UDPPort(rtc::Thread* thread,
+ rtc::PacketSocketFactory* factory,
+ rtc::Network* network,
+ rtc::AsyncPacketSocket* socket,
const std::string& username, const std::string& password)
: Port(thread, factory, network, socket->GetLocalAddress().ipaddr(),
username, password),
requests_(thread),
socket_(socket),
error_(0),
- resolver_(NULL),
ready_(false),
stun_keepalive_delay_(KEEPALIVE_DELAY) {
}
-UDPPort::UDPPort(talk_base::Thread* thread,
- talk_base::PacketSocketFactory* factory,
- talk_base::Network* network,
- const talk_base::IPAddress& ip, int min_port, int max_port,
+UDPPort::UDPPort(rtc::Thread* thread,
+ rtc::PacketSocketFactory* factory,
+ rtc::Network* network,
+ const rtc::IPAddress& ip, int min_port, int max_port,
const std::string& username, const std::string& password)
: Port(thread, LOCAL_PORT_TYPE, factory, network, ip, min_port, max_port,
username, password),
requests_(thread),
socket_(NULL),
error_(0),
- resolver_(NULL),
ready_(false),
stun_keepalive_delay_(KEEPALIVE_DELAY) {
}
@@ -158,7 +206,7 @@
if (!SharedSocket()) {
ASSERT(socket_ == NULL);
socket_ = socket_factory()->CreateUdpSocket(
- talk_base::SocketAddress(ip(), 0), min_port(), max_port());
+ rtc::SocketAddress(ip(), 0), min_port(), max_port());
if (!socket_) {
LOG_J(LS_WARNING, this) << "UDP socket creation failed";
return false;
@@ -172,16 +220,13 @@
}
UDPPort::~UDPPort() {
- if (resolver_) {
- resolver_->Destroy(true);
- }
if (!SharedSocket())
delete socket_;
}
void UDPPort::PrepareAddress() {
ASSERT(requests_.empty());
- if (socket_->GetState() == talk_base::AsyncPacketSocket::STATE_BOUND) {
+ if (socket_->GetState() == rtc::AsyncPacketSocket::STATE_BOUND) {
OnLocalAddressReady(socket_, socket_->GetLocalAddress());
}
}
@@ -189,11 +234,11 @@
void UDPPort::MaybePrepareStunCandidate() {
// Sending binding request to the STUN server if address is available to
// prepare STUN candidate.
- if (!server_addr_.IsNil()) {
- SendStunBindingRequest();
+ if (!server_addresses_.empty()) {
+ SendStunBindingRequests();
} else {
// Port is done allocating candidates.
- SetResult(true);
+ MaybeSetPortCompleteOrError();
}
}
@@ -217,8 +262,8 @@
}
int UDPPort::SendTo(const void* data, size_t size,
- const talk_base::SocketAddress& addr,
- const talk_base::PacketOptions& options,
+ const rtc::SocketAddress& addr,
+ const rtc::PacketOptions& options,
bool payload) {
int sent = socket_->SendTo(data, size, addr, options);
if (sent < 0) {
@@ -229,11 +274,11 @@
return sent;
}
-int UDPPort::SetOption(talk_base::Socket::Option opt, int value) {
+int UDPPort::SetOption(rtc::Socket::Option opt, int value) {
return socket_->SetOption(opt, value);
}
-int UDPPort::GetOption(talk_base::Socket::Option opt, int* value) {
+int UDPPort::GetOption(rtc::Socket::Option opt, int* value) {
return socket_->GetOption(opt, value);
}
@@ -241,25 +286,26 @@
return error_;
}
-void UDPPort::OnLocalAddressReady(talk_base::AsyncPacketSocket* socket,
- const talk_base::SocketAddress& address) {
- AddAddress(address, address, talk_base::SocketAddress(),
+void UDPPort::OnLocalAddressReady(rtc::AsyncPacketSocket* socket,
+ const rtc::SocketAddress& address) {
+ AddAddress(address, address, rtc::SocketAddress(),
UDP_PROTOCOL_NAME, LOCAL_PORT_TYPE,
ICE_TYPE_PREFERENCE_HOST, false);
MaybePrepareStunCandidate();
}
void UDPPort::OnReadPacket(
- talk_base::AsyncPacketSocket* socket, const char* data, size_t size,
- const talk_base::SocketAddress& remote_addr,
- const talk_base::PacketTime& packet_time) {
+ rtc::AsyncPacketSocket* socket, const char* data, size_t size,
+ const rtc::SocketAddress& remote_addr,
+ const rtc::PacketTime& packet_time) {
ASSERT(socket == socket_);
+ ASSERT(!remote_addr.IsUnresolved());
// Look for a response from the STUN server.
// Even if the response doesn't match one of our outstanding requests, we
// will eat it because it might be a response to a retransmitted packet, and
// we already cleared the request when we got the first response.
- if (!server_addr_.IsUnresolved() && remote_addr == server_addr_) {
+ if (server_addresses_.find(remote_addr) != server_addresses_.end()) {
requests_.CheckResponse(data, size);
return;
}
@@ -271,80 +317,118 @@
}
}
-void UDPPort::OnReadyToSend(talk_base::AsyncPacketSocket* socket) {
+void UDPPort::OnReadyToSend(rtc::AsyncPacketSocket* socket) {
Port::OnReadyToSend();
}
-void UDPPort::SendStunBindingRequest() {
+void UDPPort::SendStunBindingRequests() {
// We will keep pinging the stun server to make sure our NAT pin-hole stays
// open during the call.
- // TODO: Support multiple stun servers, or make ResolveStunAddress find a
- // server with the correct family, or something similar.
ASSERT(requests_.empty());
- if (server_addr_.IsUnresolved()) {
- ResolveStunAddress();
- } else if (socket_->GetState() == talk_base::AsyncPacketSocket::STATE_BOUND) {
+
+ for (ServerAddresses::const_iterator it = server_addresses_.begin();
+ it != server_addresses_.end(); ++it) {
+ SendStunBindingRequest(*it);
+ }
+}
+
+void UDPPort::ResolveStunAddress(const rtc::SocketAddress& stun_addr) {
+ if (!resolver_) {
+ resolver_.reset(new AddressResolver(socket_factory()));
+ resolver_->SignalDone.connect(this, &UDPPort::OnResolveResult);
+ }
+
+ resolver_->Resolve(stun_addr);
+}
+
+void UDPPort::OnResolveResult(const rtc::SocketAddress& input,
+ int error) {
+ ASSERT(resolver_.get() != NULL);
+
+ rtc::SocketAddress resolved;
+ if (error != 0 ||
+ !resolver_->GetResolvedAddress(input, ip().family(), &resolved)) {
+ LOG_J(LS_WARNING, this) << "StunPort: stun host lookup received error "
+ << error;
+ OnStunBindingOrResolveRequestFailed(input);
+ return;
+ }
+
+ server_addresses_.erase(input);
+
+ if (server_addresses_.find(resolved) == server_addresses_.end()) {
+ server_addresses_.insert(resolved);
+ SendStunBindingRequest(resolved);
+ }
+}
+
+void UDPPort::SendStunBindingRequest(
+ const rtc::SocketAddress& stun_addr) {
+ if (stun_addr.IsUnresolved()) {
+ ResolveStunAddress(stun_addr);
+
+ } else if (socket_->GetState() == rtc::AsyncPacketSocket::STATE_BOUND) {
// Check if |server_addr_| is compatible with the port's ip.
- if (IsCompatibleAddress(server_addr_)) {
- requests_.Send(new StunBindingRequest(this, true, server_addr_));
+ if (IsCompatibleAddress(stun_addr)) {
+ requests_.Send(new StunBindingRequest(this, true, stun_addr));
} else {
// Since we can't send stun messages to the server, we should mark this
// port ready.
- OnStunBindingOrResolveRequestFailed();
+ LOG(LS_WARNING) << "STUN server address is incompatible.";
+ OnStunBindingOrResolveRequestFailed(stun_addr);
}
}
}
-void UDPPort::ResolveStunAddress() {
- if (resolver_)
- return;
-
- resolver_ = socket_factory()->CreateAsyncResolver();
- resolver_->SignalDone.connect(this, &UDPPort::OnResolveResult);
- resolver_->Start(server_addr_);
-}
-
-void UDPPort::OnResolveResult(talk_base::AsyncResolverInterface* resolver) {
- ASSERT(resolver == resolver_);
- if (resolver_->GetError() != 0 ||
- !resolver_->GetResolvedAddress(ip().family(), &server_addr_)) {
- LOG_J(LS_WARNING, this) << "StunPort: stun host lookup received error "
- << resolver_->GetError();
- OnStunBindingOrResolveRequestFailed();
+void UDPPort::OnStunBindingRequestSucceeded(
+ const rtc::SocketAddress& stun_server_addr,
+ const rtc::SocketAddress& stun_reflected_addr) {
+ if (bind_request_succeeded_servers_.find(stun_server_addr) !=
+ bind_request_succeeded_servers_.end()) {
return;
}
+ bind_request_succeeded_servers_.insert(stun_server_addr);
- SendStunBindingRequest();
-}
-
-void UDPPort::OnStunBindingRequestSucceeded(
- const talk_base::SocketAddress& stun_addr) {
- if (ready_) // Discarding the binding response if port is already enabled.
- return;
-
- if (!SharedSocket() || stun_addr != socket_->GetLocalAddress()) {
- // If socket is shared and |stun_addr| is equal to local socket
+ if (!SharedSocket() || stun_reflected_addr != socket_->GetLocalAddress()) {
+ // If socket is shared and |stun_reflected_addr| is equal to local socket
// address then discarding the stun address.
// For STUN related address is local socket address.
- AddAddress(stun_addr, socket_->GetLocalAddress(),
+ AddAddress(stun_reflected_addr, socket_->GetLocalAddress(),
socket_->GetLocalAddress(), UDP_PROTOCOL_NAME,
STUN_PORT_TYPE, ICE_TYPE_PREFERENCE_SRFLX, false);
}
- SetResult(true);
+ MaybeSetPortCompleteOrError();
}
-void UDPPort::OnStunBindingOrResolveRequestFailed() {
- if (ready_) // Discarding failure response if port is already enabled.
+void UDPPort::OnStunBindingOrResolveRequestFailed(
+ const rtc::SocketAddress& stun_server_addr) {
+ if (bind_request_failed_servers_.find(stun_server_addr) !=
+ bind_request_failed_servers_.end()) {
+ return;
+ }
+ bind_request_failed_servers_.insert(stun_server_addr);
+ MaybeSetPortCompleteOrError();
+}
+
+void UDPPort::MaybeSetPortCompleteOrError() {
+ if (ready_)
return;
- // If socket is shared, we should process local udp candidate.
- SetResult(SharedSocket());
-}
+ // Do not set port ready if we are still waiting for bind responses.
+ const size_t servers_done_bind_request = bind_request_failed_servers_.size() +
+ bind_request_succeeded_servers_.size();
+ if (server_addresses_.size() != servers_done_bind_request) {
+ return;
+ }
-void UDPPort::SetResult(bool success) {
// Setting ready status.
ready_ = true;
- if (success) {
+
+ // The port is "completed" if there is no stun server provided, or the bind
+ // request succeeded for any stun server, or the socket is shared.
+ if (server_addresses_.empty() ||
+ bind_request_succeeded_servers_.size() > 0 ||
+ SharedSocket()) {
SignalPortComplete(this);
} else {
SignalPortError(this);
@@ -354,7 +438,7 @@
// TODO: merge this with SendTo above.
void UDPPort::OnSendPacket(const void* data, size_t size, StunRequest* req) {
StunBindingRequest* sreq = static_cast<StunBindingRequest*>(req);
- talk_base::PacketOptions options(DefaultDscpValue());
+ rtc::PacketOptions options(DefaultDscpValue());
if (socket_->SendTo(data, size, sreq->server_addr(), options) < 0)
PLOG(LERROR, socket_->GetError()) << "sendto";
}
diff --git a/p2p/base/stunport.h b/p2p/base/stunport.h
index c45d6af..d5457ba 100644
--- a/p2p/base/stunport.h
+++ b/p2p/base/stunport.h
@@ -30,12 +30,12 @@
#include <string>
-#include "talk/base/asyncpacketsocket.h"
+#include "webrtc/base/asyncpacketsocket.h"
#include "talk/p2p/base/port.h"
#include "talk/p2p/base/stunrequest.h"
// TODO(mallinath) - Rename stunport.cc|h to udpport.cc|h.
-namespace talk_base {
+namespace rtc {
class AsyncResolver;
class SignalThread;
}
@@ -45,10 +45,10 @@
// Communicates using the address on the outside of a NAT.
class UDPPort : public Port {
public:
- static UDPPort* Create(talk_base::Thread* thread,
- talk_base::PacketSocketFactory* factory,
- talk_base::Network* network,
- talk_base::AsyncPacketSocket* socket,
+ static UDPPort* Create(rtc::Thread* thread,
+ rtc::PacketSocketFactory* factory,
+ rtc::Network* network,
+ rtc::AsyncPacketSocket* socket,
const std::string& username,
const std::string& password) {
UDPPort* port = new UDPPort(thread, factory, network, socket,
@@ -60,10 +60,10 @@
return port;
}
- static UDPPort* Create(talk_base::Thread* thread,
- talk_base::PacketSocketFactory* factory,
- talk_base::Network* network,
- const talk_base::IPAddress& ip,
+ static UDPPort* Create(rtc::Thread* thread,
+ rtc::PacketSocketFactory* factory,
+ rtc::Network* network,
+ const rtc::IPAddress& ip,
int min_port, int max_port,
const std::string& username,
const std::string& password) {
@@ -78,27 +78,30 @@
}
virtual ~UDPPort();
- talk_base::SocketAddress GetLocalAddress() const {
+ rtc::SocketAddress GetLocalAddress() const {
return socket_->GetLocalAddress();
}
- const talk_base::SocketAddress& server_addr() const { return server_addr_; }
- void set_server_addr(const talk_base::SocketAddress& addr) {
- server_addr_ = addr;
+ const ServerAddresses server_addresses() const {
+ return server_addresses_;
+ }
+ void
+ set_server_addresses(const ServerAddresses& addresses) {
+ server_addresses_ = addresses;
}
virtual void PrepareAddress();
virtual Connection* CreateConnection(const Candidate& address,
CandidateOrigin origin);
- virtual int SetOption(talk_base::Socket::Option opt, int value);
- virtual int GetOption(talk_base::Socket::Option opt, int* value);
+ virtual int SetOption(rtc::Socket::Option opt, int value);
+ virtual int GetOption(rtc::Socket::Option opt, int* value);
virtual int GetError();
virtual bool HandleIncomingPacket(
- talk_base::AsyncPacketSocket* socket, const char* data, size_t size,
- const talk_base::SocketAddress& remote_addr,
- const talk_base::PacketTime& packet_time) {
+ rtc::AsyncPacketSocket* socket, const char* data, size_t size,
+ const rtc::SocketAddress& remote_addr,
+ const rtc::PacketTime& packet_time) {
// All packets given to UDP port will be consumed.
OnReadPacket(socket, data, size, remote_addr, packet_time);
return true;
@@ -112,57 +115,92 @@
}
protected:
- UDPPort(talk_base::Thread* thread, talk_base::PacketSocketFactory* factory,
- talk_base::Network* network, const talk_base::IPAddress& ip,
+ UDPPort(rtc::Thread* thread, rtc::PacketSocketFactory* factory,
+ rtc::Network* network, const rtc::IPAddress& ip,
int min_port, int max_port,
const std::string& username, const std::string& password);
- UDPPort(talk_base::Thread* thread, talk_base::PacketSocketFactory* factory,
- talk_base::Network* network, talk_base::AsyncPacketSocket* socket,
+ UDPPort(rtc::Thread* thread, rtc::PacketSocketFactory* factory,
+ rtc::Network* network, rtc::AsyncPacketSocket* socket,
const std::string& username, const std::string& password);
bool Init();
virtual int SendTo(const void* data, size_t size,
- const talk_base::SocketAddress& addr,
- const talk_base::PacketOptions& options,
+ const rtc::SocketAddress& addr,
+ const rtc::PacketOptions& options,
bool payload);
- void OnLocalAddressReady(talk_base::AsyncPacketSocket* socket,
- const talk_base::SocketAddress& address);
- void OnReadPacket(talk_base::AsyncPacketSocket* socket,
+ void OnLocalAddressReady(rtc::AsyncPacketSocket* socket,
+ const rtc::SocketAddress& address);
+ void OnReadPacket(rtc::AsyncPacketSocket* socket,
const char* data, size_t size,
- const talk_base::SocketAddress& remote_addr,
- const talk_base::PacketTime& packet_time);
+ const rtc::SocketAddress& remote_addr,
+ const rtc::PacketTime& packet_time);
- void OnReadyToSend(talk_base::AsyncPacketSocket* socket);
+ void OnReadyToSend(rtc::AsyncPacketSocket* socket);
// This method will send STUN binding request if STUN server address is set.
void MaybePrepareStunCandidate();
- void SendStunBindingRequest();
+ void SendStunBindingRequests();
private:
+ // A helper class which can be called repeatedly to resolve multiple
+ // addresses, as opposed to rtc::AsyncResolverInterface, which can only
+ // resolve one address per instance.
+ class AddressResolver : public sigslot::has_slots<> {
+ public:
+ explicit AddressResolver(rtc::PacketSocketFactory* factory);
+ ~AddressResolver();
+
+ void Resolve(const rtc::SocketAddress& address);
+ bool GetResolvedAddress(const rtc::SocketAddress& input,
+ int family,
+ rtc::SocketAddress* output) const;
+
+ // The signal is sent when resolving the specified address is finished. The
+ // first argument is the input address, the second argument is the error
+ // or 0 if it succeeded.
+ sigslot::signal2<const rtc::SocketAddress&, int> SignalDone;
+
+ private:
+ typedef std::map<rtc::SocketAddress,
+ rtc::AsyncResolverInterface*> ResolverMap;
+
+ void OnResolveResult(rtc::AsyncResolverInterface* resolver);
+
+ rtc::PacketSocketFactory* socket_factory_;
+ ResolverMap resolvers_;
+ };
+
// DNS resolution of the STUN server.
- void ResolveStunAddress();
- void OnResolveResult(talk_base::AsyncResolverInterface* resolver);
+ void ResolveStunAddress(const rtc::SocketAddress& stun_addr);
+ void OnResolveResult(const rtc::SocketAddress& input, int error);
+
+ void SendStunBindingRequest(const rtc::SocketAddress& stun_addr);
// Below methods handles binding request responses.
- void OnStunBindingRequestSucceeded(const talk_base::SocketAddress& stun_addr);
- void OnStunBindingOrResolveRequestFailed();
+ void OnStunBindingRequestSucceeded(
+ const rtc::SocketAddress& stun_server_addr,
+ const rtc::SocketAddress& stun_reflected_addr);
+ void OnStunBindingOrResolveRequestFailed(
+ const rtc::SocketAddress& stun_server_addr);
// Sends STUN requests to the server.
void OnSendPacket(const void* data, size_t size, StunRequest* req);
// TODO(mallinaht) - Move this up to cricket::Port when SignalAddressReady is
// changed to SignalPortReady.
- void SetResult(bool success);
+ void MaybeSetPortCompleteOrError();
- talk_base::SocketAddress server_addr_;
+ ServerAddresses server_addresses_;
+ ServerAddresses bind_request_succeeded_servers_;
+ ServerAddresses bind_request_failed_servers_;
StunRequestManager requests_;
- talk_base::AsyncPacketSocket* socket_;
+ rtc::AsyncPacketSocket* socket_;
int error_;
- talk_base::AsyncResolverInterface* resolver_;
+ rtc::scoped_ptr<AddressResolver> resolver_;
bool ready_;
int stun_keepalive_delay_;
@@ -171,17 +209,18 @@
class StunPort : public UDPPort {
public:
- static StunPort* Create(talk_base::Thread* thread,
- talk_base::PacketSocketFactory* factory,
- talk_base::Network* network,
- const talk_base::IPAddress& ip,
- int min_port, int max_port,
- const std::string& username,
- const std::string& password,
- const talk_base::SocketAddress& server_addr) {
+ static StunPort* Create(
+ rtc::Thread* thread,
+ rtc::PacketSocketFactory* factory,
+ rtc::Network* network,
+ const rtc::IPAddress& ip,
+ int min_port, int max_port,
+ const std::string& username,
+ const std::string& password,
+ const ServerAddresses& servers) {
StunPort* port = new StunPort(thread, factory, network,
ip, min_port, max_port,
- username, password, server_addr);
+ username, password, servers);
if (!port->Init()) {
delete port;
port = NULL;
@@ -192,20 +231,20 @@
virtual ~StunPort() {}
virtual void PrepareAddress() {
- SendStunBindingRequest();
+ SendStunBindingRequests();
}
protected:
- StunPort(talk_base::Thread* thread, talk_base::PacketSocketFactory* factory,
- talk_base::Network* network, const talk_base::IPAddress& ip,
+ StunPort(rtc::Thread* thread, rtc::PacketSocketFactory* factory,
+ rtc::Network* network, const rtc::IPAddress& ip,
int min_port, int max_port,
const std::string& username, const std::string& password,
- const talk_base::SocketAddress& server_address)
+ const ServerAddresses& servers)
: UDPPort(thread, factory, network, ip, min_port, max_port, username,
password) {
// UDPPort will set these to local udp, updating these to STUN.
set_type(STUN_PORT_TYPE);
- set_server_addr(server_address);
+ set_server_addresses(servers);
}
};
diff --git a/p2p/base/stunport_unittest.cc b/p2p/base/stunport_unittest.cc
index 5850027..8d2c7cf 100644
--- a/p2p/base/stunport_unittest.cc
+++ b/p2p/base/stunport_unittest.cc
@@ -25,20 +25,23 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/gunit.h"
-#include "talk/base/helpers.h"
-#include "talk/base/physicalsocketserver.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/socketaddress.h"
-#include "talk/base/virtualsocketserver.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/physicalsocketserver.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/socketaddress.h"
+#include "webrtc/base/ssladapter.h"
+#include "webrtc/base/virtualsocketserver.h"
#include "talk/p2p/base/basicpacketsocketfactory.h"
#include "talk/p2p/base/stunport.h"
#include "talk/p2p/base/teststunserver.h"
-using talk_base::SocketAddress;
+using cricket::ServerAddresses;
+using rtc::SocketAddress;
static const SocketAddress kLocalAddr("127.0.0.1", 0);
-static const SocketAddress kStunAddr("127.0.0.1", 5000);
+static const SocketAddress kStunAddr1("127.0.0.1", 5000);
+static const SocketAddress kStunAddr2("127.0.0.1", 4000);
static const SocketAddress kBadAddr("0.0.0.1", 5000);
static const SocketAddress kStunHostnameAddr("localhost", 5000);
static const SocketAddress kBadHostnameAddr("not-a-real-hostname", 5000);
@@ -53,13 +56,15 @@
public sigslot::has_slots<> {
public:
StunPortTest()
- : pss_(new talk_base::PhysicalSocketServer),
- ss_(new talk_base::VirtualSocketServer(pss_.get())),
+ : pss_(new rtc::PhysicalSocketServer),
+ ss_(new rtc::VirtualSocketServer(pss_.get())),
ss_scope_(ss_.get()),
- network_("unittest", "unittest", talk_base::IPAddress(INADDR_ANY), 32),
- socket_factory_(talk_base::Thread::Current()),
- stun_server_(new cricket::TestStunServer(
- talk_base::Thread::Current(), kStunAddr)),
+ network_("unittest", "unittest", rtc::IPAddress(INADDR_ANY), 32),
+ socket_factory_(rtc::Thread::Current()),
+ stun_server_1_(new cricket::TestStunServer(
+ rtc::Thread::Current(), kStunAddr1)),
+ stun_server_2_(new cricket::TestStunServer(
+ rtc::Thread::Current(), kStunAddr2)),
done_(false), error_(false), stun_keepalive_delay_(0) {
}
@@ -67,11 +72,17 @@
bool done() const { return done_; }
bool error() const { return error_; }
- void CreateStunPort(const talk_base::SocketAddress& server_addr) {
+ void CreateStunPort(const rtc::SocketAddress& server_addr) {
+ ServerAddresses stun_servers;
+ stun_servers.insert(server_addr);
+ CreateStunPort(stun_servers);
+ }
+
+ void CreateStunPort(const ServerAddresses& stun_servers) {
stun_port_.reset(cricket::StunPort::Create(
- talk_base::Thread::Current(), &socket_factory_, &network_,
- kLocalAddr.ipaddr(), 0, 0, talk_base::CreateRandomString(16),
- talk_base::CreateRandomString(22), server_addr));
+ rtc::Thread::Current(), &socket_factory_, &network_,
+ kLocalAddr.ipaddr(), 0, 0, rtc::CreateRandomString(16),
+ rtc::CreateRandomString(22), stun_servers));
stun_port_->set_stun_keepalive_delay(stun_keepalive_delay_);
stun_port_->SignalPortComplete.connect(this,
&StunPortTest::OnPortComplete);
@@ -79,17 +90,19 @@
&StunPortTest::OnPortError);
}
- void CreateSharedStunPort(const talk_base::SocketAddress& server_addr) {
+ void CreateSharedStunPort(const rtc::SocketAddress& server_addr) {
socket_.reset(socket_factory_.CreateUdpSocket(
- talk_base::SocketAddress(kLocalAddr.ipaddr(), 0), 0, 0));
+ rtc::SocketAddress(kLocalAddr.ipaddr(), 0), 0, 0));
ASSERT_TRUE(socket_ != NULL);
socket_->SignalReadPacket.connect(this, &StunPortTest::OnReadPacket);
stun_port_.reset(cricket::UDPPort::Create(
- talk_base::Thread::Current(), &socket_factory_,
+ rtc::Thread::Current(), &socket_factory_,
&network_, socket_.get(),
- talk_base::CreateRandomString(16), talk_base::CreateRandomString(22)));
+ rtc::CreateRandomString(16), rtc::CreateRandomString(22)));
ASSERT_TRUE(stun_port_ != NULL);
- stun_port_->set_server_addr(server_addr);
+ ServerAddresses stun_servers;
+ stun_servers.insert(server_addr);
+ stun_port_->set_server_addresses(stun_servers);
stun_port_->SignalPortComplete.connect(this,
&StunPortTest::OnPortComplete);
stun_port_->SignalPortError.connect(this,
@@ -100,26 +113,32 @@
stun_port_->PrepareAddress();
}
- void OnReadPacket(talk_base::AsyncPacketSocket* socket, const char* data,
- size_t size, const talk_base::SocketAddress& remote_addr,
- const talk_base::PacketTime& packet_time) {
+ void OnReadPacket(rtc::AsyncPacketSocket* socket, const char* data,
+ size_t size, const rtc::SocketAddress& remote_addr,
+ const rtc::PacketTime& packet_time) {
stun_port_->HandleIncomingPacket(
- socket, data, size, remote_addr, talk_base::PacketTime());
+ socket, data, size, remote_addr, rtc::PacketTime());
}
void SendData(const char* data, size_t len) {
stun_port_->HandleIncomingPacket(
- socket_.get(), data, len, talk_base::SocketAddress("22.22.22.22", 0),
- talk_base::PacketTime());
+ socket_.get(), data, len, rtc::SocketAddress("22.22.22.22", 0),
+ rtc::PacketTime());
}
protected:
static void SetUpTestCase() {
+ rtc::InitializeSSL();
// Ensure the RNG is inited.
- talk_base::InitRandom(NULL, 0);
+ rtc::InitRandom(NULL, 0);
+
+ }
+ static void TearDownTestCase() {
+ rtc::CleanupSSL();
}
void OnPortComplete(cricket::Port* port) {
+ ASSERT_FALSE(done_);
done_ = true;
error_ = false;
}
@@ -132,14 +151,15 @@
}
private:
- talk_base::scoped_ptr<talk_base::PhysicalSocketServer> pss_;
- talk_base::scoped_ptr<talk_base::VirtualSocketServer> ss_;
- talk_base::SocketServerScope ss_scope_;
- talk_base::Network network_;
- talk_base::BasicPacketSocketFactory socket_factory_;
- talk_base::scoped_ptr<cricket::UDPPort> stun_port_;
- talk_base::scoped_ptr<cricket::TestStunServer> stun_server_;
- talk_base::scoped_ptr<talk_base::AsyncPacketSocket> socket_;
+ rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_;
+ rtc::scoped_ptr<rtc::VirtualSocketServer> ss_;
+ rtc::SocketServerScope ss_scope_;
+ rtc::Network network_;
+ rtc::BasicPacketSocketFactory socket_factory_;
+ rtc::scoped_ptr<cricket::UDPPort> stun_port_;
+ rtc::scoped_ptr<cricket::TestStunServer> stun_server_1_;
+ rtc::scoped_ptr<cricket::TestStunServer> stun_server_2_;
+ rtc::scoped_ptr<rtc::AsyncPacketSocket> socket_;
bool done_;
bool error_;
int stun_keepalive_delay_;
@@ -147,14 +167,14 @@
// Test that we can create a STUN port
TEST_F(StunPortTest, TestBasic) {
- CreateStunPort(kStunAddr);
+ CreateStunPort(kStunAddr1);
EXPECT_EQ("stun", port()->Type());
EXPECT_EQ(0U, port()->Candidates().size());
}
// Test that we can get an address from a STUN server.
TEST_F(StunPortTest, TestPrepareAddress) {
- CreateStunPort(kStunAddr);
+ CreateStunPort(kStunAddr1);
PrepareAddress();
EXPECT_TRUE_WAIT(done(), kTimeoutMs);
ASSERT_EQ(1U, port()->Candidates().size());
@@ -203,13 +223,13 @@
EXPECT_TRUE(kLocalAddr.EqualIPs(port()->Candidates()[0].address()));
// Waiting for 1 seond, which will allow us to process
// response for keepalive binding request. 500 ms is the keepalive delay.
- talk_base::Thread::Current()->ProcessMessages(1000);
+ rtc::Thread::Current()->ProcessMessages(1000);
ASSERT_EQ(1U, port()->Candidates().size());
}
// Test that a local candidate can be generated using a shared socket.
TEST_F(StunPortTest, TestSharedSocketPrepareAddress) {
- CreateSharedStunPort(kStunAddr);
+ CreateSharedStunPort(kStunAddr1);
PrepareAddress();
EXPECT_TRUE_WAIT(done(), kTimeoutMs);
ASSERT_EQ(1U, port()->Candidates().size());
@@ -232,3 +252,28 @@
SendData(data.c_str(), data.length());
// No crash is success.
}
+
+// Test that candidates can be allocated for multiple STUN servers.
+TEST_F(StunPortTest, TestMultipleGoodStunServers) {
+ ServerAddresses stun_servers;
+ stun_servers.insert(kStunAddr1);
+ stun_servers.insert(kStunAddr2);
+ CreateStunPort(stun_servers);
+ EXPECT_EQ("stun", port()->Type());
+ PrepareAddress();
+ EXPECT_TRUE_WAIT(done(), kTimeoutMs);
+ EXPECT_EQ(2U, port()->Candidates().size());
+}
+
+// Test that candidates can be allocated for multiple STUN servers, one of which
+// is not reachable.
+TEST_F(StunPortTest, TestMultipleStunServersWithBadServer) {
+ ServerAddresses stun_servers;
+ stun_servers.insert(kStunAddr1);
+ stun_servers.insert(kBadAddr);
+ CreateStunPort(stun_servers);
+ EXPECT_EQ("stun", port()->Type());
+ PrepareAddress();
+ EXPECT_TRUE_WAIT(done(), kTimeoutMs);
+ EXPECT_EQ(1U, port()->Candidates().size());
+}
diff --git a/p2p/base/stunrequest.cc b/p2p/base/stunrequest.cc
index b3b1118..148718f 100644
--- a/p2p/base/stunrequest.cc
+++ b/p2p/base/stunrequest.cc
@@ -27,9 +27,9 @@
#include "talk/p2p/base/stunrequest.h"
-#include "talk/base/common.h"
-#include "talk/base/helpers.h"
-#include "talk/base/logging.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/logging.h"
namespace cricket {
@@ -39,7 +39,7 @@
const int DELAY_UNIT = 100; // 100 milliseconds
const int DELAY_MAX_FACTOR = 16;
-StunRequestManager::StunRequestManager(talk_base::Thread* thread)
+StunRequestManager::StunRequestManager(rtc::Thread* thread)
: thread_(thread) {
}
@@ -122,8 +122,8 @@
// Parse the STUN message and continue processing as usual.
- talk_base::ByteBuffer buf(data, size);
- talk_base::scoped_ptr<StunMessage> response(iter->second->msg_->CreateNew());
+ rtc::ByteBuffer buf(data, size);
+ rtc::scoped_ptr<StunMessage> response(iter->second->msg_->CreateNew());
if (!response->Read(&buf))
return false;
@@ -134,14 +134,14 @@
: count_(0), timeout_(false), manager_(0),
msg_(new StunMessage()), tstamp_(0) {
msg_->SetTransactionID(
- talk_base::CreateRandomString(kStunTransactionIdLength));
+ rtc::CreateRandomString(kStunTransactionIdLength));
}
StunRequest::StunRequest(StunMessage* request)
: count_(0), timeout_(false), manager_(0),
msg_(request), tstamp_(0) {
msg_->SetTransactionID(
- talk_base::CreateRandomString(kStunTransactionIdLength));
+ rtc::CreateRandomString(kStunTransactionIdLength));
}
StunRequest::~StunRequest() {
@@ -170,7 +170,7 @@
}
uint32 StunRequest::Elapsed() const {
- return talk_base::TimeSince(tstamp_);
+ return rtc::TimeSince(tstamp_);
}
@@ -179,7 +179,7 @@
manager_ = manager;
}
-void StunRequest::OnMessage(talk_base::Message* pmsg) {
+void StunRequest::OnMessage(rtc::Message* pmsg) {
ASSERT(manager_ != NULL);
ASSERT(pmsg->message_id == MSG_STUN_SEND);
@@ -189,9 +189,9 @@
return;
}
- tstamp_ = talk_base::Time();
+ tstamp_ = rtc::Time();
- talk_base::ByteBuffer buf;
+ rtc::ByteBuffer buf;
msg_->Write(&buf);
manager_->SignalSendPacket(buf.Data(), buf.Length(), this);
@@ -200,7 +200,7 @@
}
int StunRequest::GetNextDelay() {
- int delay = DELAY_UNIT * talk_base::_min(1 << count_, DELAY_MAX_FACTOR);
+ int delay = DELAY_UNIT * rtc::_min(1 << count_, DELAY_MAX_FACTOR);
count_ += 1;
if (count_ == MAX_SENDS)
timeout_ = true;
diff --git a/p2p/base/stunrequest.h b/p2p/base/stunrequest.h
index f2c85b3..8e6fbf2 100644
--- a/p2p/base/stunrequest.h
+++ b/p2p/base/stunrequest.h
@@ -28,8 +28,8 @@
#ifndef TALK_P2P_BASE_STUNREQUEST_H_
#define TALK_P2P_BASE_STUNREQUEST_H_
-#include "talk/base/sigslot.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/thread.h"
#include "talk/p2p/base/stun.h"
#include <map>
#include <string>
@@ -42,7 +42,7 @@
// response or determine that the request has timed out.
class StunRequestManager {
public:
- StunRequestManager(talk_base::Thread* thread);
+ StunRequestManager(rtc::Thread* thread);
~StunRequestManager();
// Starts sending the given request (perhaps after a delay).
@@ -69,7 +69,7 @@
private:
typedef std::map<std::string, StunRequest*> RequestMap;
- talk_base::Thread* thread_;
+ rtc::Thread* thread_;
RequestMap requests_;
friend class StunRequest;
@@ -77,7 +77,7 @@
// Represents an individual request to be sent. The STUN message can either be
// constructed beforehand or built on demand.
-class StunRequest : public talk_base::MessageHandler {
+class StunRequest : public rtc::MessageHandler {
public:
StunRequest();
StunRequest(StunMessage* request);
@@ -119,7 +119,7 @@
void set_manager(StunRequestManager* manager);
// Handles messages for sending and timeout.
- void OnMessage(talk_base::Message* pmsg);
+ void OnMessage(rtc::Message* pmsg);
StunRequestManager* manager_;
StunMessage* msg_;
diff --git a/p2p/base/stunrequest_unittest.cc b/p2p/base/stunrequest_unittest.cc
index 508660c..6d6ecad 100644
--- a/p2p/base/stunrequest_unittest.cc
+++ b/p2p/base/stunrequest_unittest.cc
@@ -25,11 +25,11 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/gunit.h"
-#include "talk/base/helpers.h"
-#include "talk/base/logging.h"
-#include "talk/base/ssladapter.h"
-#include "talk/base/timeutils.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/ssladapter.h"
+#include "webrtc/base/timeutils.h"
#include "talk/p2p/base/stunrequest.h"
using namespace cricket;
@@ -38,15 +38,15 @@
public sigslot::has_slots<> {
public:
static void SetUpTestCase() {
- talk_base::InitializeSSL();
+ rtc::InitializeSSL();
}
static void TearDownTestCase() {
- talk_base::CleanupSSL();
+ rtc::CleanupSSL();
}
StunRequestTest()
- : manager_(talk_base::Thread::Current()),
+ : manager_(rtc::Thread::Current()),
request_count_(0), response_(NULL),
success_(false), failure_(false), timeout_(false) {
manager_.SignalSendPacket.connect(this, &StunRequestTest::OnSendPacket);
@@ -171,13 +171,13 @@
TEST_F(StunRequestTest, TestBackoff) {
StunMessage* req = CreateStunMessage(STUN_BINDING_REQUEST, NULL);
- uint32 start = talk_base::Time();
+ uint32 start = rtc::Time();
manager_.Send(new StunRequestThunker(req, this));
StunMessage* res = CreateStunMessage(STUN_BINDING_RESPONSE, req);
for (int i = 0; i < 9; ++i) {
while (request_count_ == i)
- talk_base::Thread::Current()->ProcessMessages(1);
- int32 elapsed = talk_base::TimeSince(start);
+ rtc::Thread::Current()->ProcessMessages(1);
+ int32 elapsed = rtc::TimeSince(start);
LOG(LS_INFO) << "STUN request #" << (i + 1)
<< " sent at " << elapsed << " ms";
EXPECT_GE(TotalDelay(i + 1), elapsed);
@@ -197,7 +197,7 @@
StunMessage* res = CreateStunMessage(STUN_BINDING_RESPONSE, req);
manager_.Send(new StunRequestThunker(req, this));
- talk_base::Thread::Current()->ProcessMessages(10000); // > STUN timeout
+ rtc::Thread::Current()->ProcessMessages(10000); // > STUN timeout
EXPECT_FALSE(manager_.CheckResponse(res));
EXPECT_TRUE(response_ == NULL);
diff --git a/p2p/base/stunserver.cc b/p2p/base/stunserver.cc
index ee6c643..d9633f0 100644
--- a/p2p/base/stunserver.cc
+++ b/p2p/base/stunserver.cc
@@ -27,12 +27,12 @@
#include "talk/p2p/base/stunserver.h"
-#include "talk/base/bytebuffer.h"
-#include "talk/base/logging.h"
+#include "webrtc/base/bytebuffer.h"
+#include "webrtc/base/logging.h"
namespace cricket {
-StunServer::StunServer(talk_base::AsyncUDPSocket* socket) : socket_(socket) {
+StunServer::StunServer(rtc::AsyncUDPSocket* socket) : socket_(socket) {
socket_->SignalReadPacket.connect(this, &StunServer::OnPacket);
}
@@ -41,11 +41,11 @@
}
void StunServer::OnPacket(
- talk_base::AsyncPacketSocket* socket, const char* buf, size_t size,
- const talk_base::SocketAddress& remote_addr,
- const talk_base::PacketTime& packet_time) {
+ rtc::AsyncPacketSocket* socket, const char* buf, size_t size,
+ const rtc::SocketAddress& remote_addr,
+ const rtc::PacketTime& packet_time) {
// Parse the STUN message; eat any messages that fail to parse.
- talk_base::ByteBuffer bbuf(buf, size);
+ rtc::ByteBuffer bbuf(buf, size);
StunMessage msg;
if (!msg.Read(&bbuf)) {
return;
@@ -66,7 +66,7 @@
}
void StunServer::OnBindingRequest(
- StunMessage* msg, const talk_base::SocketAddress& remote_addr) {
+ StunMessage* msg, const rtc::SocketAddress& remote_addr) {
StunMessage response;
response.SetType(STUN_BINDING_RESPONSE);
response.SetTransactionID(msg->transaction_id());
@@ -85,7 +85,7 @@
}
void StunServer::SendErrorResponse(
- const StunMessage& msg, const talk_base::SocketAddress& addr,
+ const StunMessage& msg, const rtc::SocketAddress& addr,
int error_code, const char* error_desc) {
StunMessage err_msg;
err_msg.SetType(GetStunErrorResponseType(msg.type()));
@@ -100,10 +100,10 @@
}
void StunServer::SendResponse(
- const StunMessage& msg, const talk_base::SocketAddress& addr) {
- talk_base::ByteBuffer buf;
+ const StunMessage& msg, const rtc::SocketAddress& addr) {
+ rtc::ByteBuffer buf;
msg.Write(&buf);
- talk_base::PacketOptions options;
+ rtc::PacketOptions options;
if (socket_->SendTo(buf.Data(), buf.Length(), addr, options) < 0)
LOG_ERR(LS_ERROR) << "sendto";
}
diff --git a/p2p/base/stunserver.h b/p2p/base/stunserver.h
index c5d12e1..e5d72bc 100644
--- a/p2p/base/stunserver.h
+++ b/p2p/base/stunserver.h
@@ -28,8 +28,8 @@
#ifndef TALK_P2P_BASE_STUNSERVER_H_
#define TALK_P2P_BASE_STUNSERVER_H_
-#include "talk/base/asyncudpsocket.h"
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/asyncudpsocket.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/p2p/base/stun.h"
namespace cricket {
@@ -39,38 +39,38 @@
class StunServer : public sigslot::has_slots<> {
public:
// Creates a STUN server, which will listen on the given socket.
- explicit StunServer(talk_base::AsyncUDPSocket* socket);
+ explicit StunServer(rtc::AsyncUDPSocket* socket);
// Removes the STUN server from the socket and deletes the socket.
~StunServer();
protected:
// Slot for AsyncSocket.PacketRead:
void OnPacket(
- talk_base::AsyncPacketSocket* socket, const char* buf, size_t size,
- const talk_base::SocketAddress& remote_addr,
- const talk_base::PacketTime& packet_time);
+ rtc::AsyncPacketSocket* socket, const char* buf, size_t size,
+ const rtc::SocketAddress& remote_addr,
+ const rtc::PacketTime& packet_time);
// Handlers for the different types of STUN/TURN requests:
void OnBindingRequest(StunMessage* msg,
- const talk_base::SocketAddress& addr);
+ const rtc::SocketAddress& addr);
void OnAllocateRequest(StunMessage* msg,
- const talk_base::SocketAddress& addr);
+ const rtc::SocketAddress& addr);
void OnSharedSecretRequest(StunMessage* msg,
- const talk_base::SocketAddress& addr);
+ const rtc::SocketAddress& addr);
void OnSendRequest(StunMessage* msg,
- const talk_base::SocketAddress& addr);
+ const rtc::SocketAddress& addr);
// Sends an error response to the given message back to the user.
void SendErrorResponse(
- const StunMessage& msg, const talk_base::SocketAddress& addr,
+ const StunMessage& msg, const rtc::SocketAddress& addr,
int error_code, const char* error_desc);
// Sends the given message to the appropriate destination.
void SendResponse(const StunMessage& msg,
- const talk_base::SocketAddress& addr);
+ const rtc::SocketAddress& addr);
private:
- talk_base::scoped_ptr<talk_base::AsyncUDPSocket> socket_;
+ rtc::scoped_ptr<rtc::AsyncUDPSocket> socket_;
};
} // namespace cricket
diff --git a/p2p/base/stunserver_unittest.cc b/p2p/base/stunserver_unittest.cc
index a6f56a5..1c26e22 100644
--- a/p2p/base/stunserver_unittest.cc
+++ b/p2p/base/stunserver_unittest.cc
@@ -27,36 +27,36 @@
#include <string>
-#include "talk/base/gunit.h"
-#include "talk/base/logging.h"
-#include "talk/base/physicalsocketserver.h"
-#include "talk/base/virtualsocketserver.h"
-#include "talk/base/testclient.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/physicalsocketserver.h"
+#include "webrtc/base/virtualsocketserver.h"
+#include "webrtc/base/testclient.h"
+#include "webrtc/base/thread.h"
#include "talk/p2p/base/stunserver.h"
using namespace cricket;
-static const talk_base::SocketAddress server_addr("99.99.99.1", 3478);
-static const talk_base::SocketAddress client_addr("1.2.3.4", 1234);
+static const rtc::SocketAddress server_addr("99.99.99.1", 3478);
+static const rtc::SocketAddress client_addr("1.2.3.4", 1234);
class StunServerTest : public testing::Test {
public:
StunServerTest()
- : pss_(new talk_base::PhysicalSocketServer),
- ss_(new talk_base::VirtualSocketServer(pss_.get())),
+ : pss_(new rtc::PhysicalSocketServer),
+ ss_(new rtc::VirtualSocketServer(pss_.get())),
worker_(ss_.get()) {
}
virtual void SetUp() {
server_.reset(new StunServer(
- talk_base::AsyncUDPSocket::Create(ss_.get(), server_addr)));
- client_.reset(new talk_base::TestClient(
- talk_base::AsyncUDPSocket::Create(ss_.get(), client_addr)));
+ rtc::AsyncUDPSocket::Create(ss_.get(), server_addr)));
+ client_.reset(new rtc::TestClient(
+ rtc::AsyncUDPSocket::Create(ss_.get(), client_addr)));
worker_.Start();
}
void Send(const StunMessage& msg) {
- talk_base::ByteBuffer buf;
+ rtc::ByteBuffer buf;
msg.Write(&buf);
Send(buf.Data(), static_cast<int>(buf.Length()));
}
@@ -65,9 +65,9 @@
}
StunMessage* Receive() {
StunMessage* msg = NULL;
- talk_base::TestClient::Packet* packet = client_->NextPacket();
+ rtc::TestClient::Packet* packet = client_->NextPacket();
if (packet) {
- talk_base::ByteBuffer buf(packet->buf, packet->size);
+ rtc::ByteBuffer buf(packet->buf, packet->size);
msg = new StunMessage();
msg->Read(&buf);
delete packet;
@@ -75,11 +75,11 @@
return msg;
}
private:
- talk_base::scoped_ptr<talk_base::PhysicalSocketServer> pss_;
- talk_base::scoped_ptr<talk_base::VirtualSocketServer> ss_;
- talk_base::Thread worker_;
- talk_base::scoped_ptr<StunServer> server_;
- talk_base::scoped_ptr<talk_base::TestClient> client_;
+ rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_;
+ rtc::scoped_ptr<rtc::VirtualSocketServer> ss_;
+ rtc::Thread worker_;
+ rtc::scoped_ptr<StunServer> server_;
+ rtc::scoped_ptr<rtc::TestClient> client_;
};
// Disable for TSan v2, see
diff --git a/p2p/base/tcpport.cc b/p2p/base/tcpport.cc
index 069323a..f6d9ae6 100644
--- a/p2p/base/tcpport.cc
+++ b/p2p/base/tcpport.cc
@@ -27,15 +27,15 @@
#include "talk/p2p/base/tcpport.h"
-#include "talk/base/common.h"
-#include "talk/base/logging.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/logging.h"
#include "talk/p2p/base/common.h"
namespace cricket {
-TCPPort::TCPPort(talk_base::Thread* thread,
- talk_base::PacketSocketFactory* factory,
- talk_base::Network* network, const talk_base::IPAddress& ip,
+TCPPort::TCPPort(rtc::Thread* thread,
+ rtc::PacketSocketFactory* factory,
+ rtc::Network* network, const rtc::IPAddress& ip,
int min_port, int max_port, const std::string& username,
const std::string& password, bool allow_listen)
: Port(thread, LOCAL_PORT_TYPE, factory, network, ip, min_port, max_port,
@@ -53,7 +53,7 @@
// Treat failure to create or bind a TCP socket as fatal. This
// should never happen.
socket_ = socket_factory()->CreateServerTcpSocket(
- talk_base::SocketAddress(ip(), 0), min_port(), max_port(),
+ rtc::SocketAddress(ip(), 0), min_port(), max_port(),
false /* ssl */);
if (!socket_) {
LOG_J(LS_ERROR, this) << "TCP socket creation failed.";
@@ -100,7 +100,7 @@
}
TCPConnection* conn = NULL;
- if (talk_base::AsyncPacketSocket* socket =
+ if (rtc::AsyncPacketSocket* socket =
GetIncoming(address.address(), true)) {
socket->SignalReadPacket.disconnect(this);
conn = new TCPConnection(this, address, socket);
@@ -118,28 +118,28 @@
// failed, we still want ot add the socket address.
LOG(LS_VERBOSE) << "Preparing TCP address, current state: "
<< socket_->GetState();
- if (socket_->GetState() == talk_base::AsyncPacketSocket::STATE_BOUND ||
- socket_->GetState() == talk_base::AsyncPacketSocket::STATE_CLOSED)
+ if (socket_->GetState() == rtc::AsyncPacketSocket::STATE_BOUND ||
+ socket_->GetState() == rtc::AsyncPacketSocket::STATE_CLOSED)
AddAddress(socket_->GetLocalAddress(), socket_->GetLocalAddress(),
- talk_base::SocketAddress(),
+ rtc::SocketAddress(),
TCP_PROTOCOL_NAME, LOCAL_PORT_TYPE,
ICE_TYPE_PREFERENCE_HOST_TCP, true);
} else {
LOG_J(LS_INFO, this) << "Not listening due to firewall restrictions.";
// Note: We still add the address, since otherwise the remote side won't
// recognize our incoming TCP connections.
- AddAddress(talk_base::SocketAddress(ip(), 0),
- talk_base::SocketAddress(ip(), 0), talk_base::SocketAddress(),
+ AddAddress(rtc::SocketAddress(ip(), 0),
+ rtc::SocketAddress(ip(), 0), rtc::SocketAddress(),
TCP_PROTOCOL_NAME, LOCAL_PORT_TYPE, ICE_TYPE_PREFERENCE_HOST_TCP,
true);
}
}
int TCPPort::SendTo(const void* data, size_t size,
- const talk_base::SocketAddress& addr,
- const talk_base::PacketOptions& options,
+ const rtc::SocketAddress& addr,
+ const rtc::PacketOptions& options,
bool payload) {
- talk_base::AsyncPacketSocket * socket = NULL;
+ rtc::AsyncPacketSocket * socket = NULL;
if (TCPConnection * conn = static_cast<TCPConnection*>(GetConnection(addr))) {
socket = conn->socket();
} else {
@@ -160,7 +160,7 @@
return sent;
}
-int TCPPort::GetOption(talk_base::Socket::Option opt, int* value) {
+int TCPPort::GetOption(rtc::Socket::Option opt, int* value) {
if (socket_) {
return socket_->GetOption(opt, value);
} else {
@@ -168,7 +168,7 @@
}
}
-int TCPPort::SetOption(talk_base::Socket::Option opt, int value) {
+int TCPPort::SetOption(rtc::Socket::Option opt, int value) {
if (socket_) {
return socket_->SetOption(opt, value);
} else {
@@ -180,8 +180,8 @@
return error_;
}
-void TCPPort::OnNewConnection(talk_base::AsyncPacketSocket* socket,
- talk_base::AsyncPacketSocket* new_socket) {
+void TCPPort::OnNewConnection(rtc::AsyncPacketSocket* socket,
+ rtc::AsyncPacketSocket* new_socket) {
ASSERT(socket == socket_);
Incoming incoming;
@@ -195,9 +195,9 @@
incoming_.push_back(incoming);
}
-talk_base::AsyncPacketSocket* TCPPort::GetIncoming(
- const talk_base::SocketAddress& addr, bool remove) {
- talk_base::AsyncPacketSocket* socket = NULL;
+rtc::AsyncPacketSocket* TCPPort::GetIncoming(
+ const rtc::SocketAddress& addr, bool remove) {
+ rtc::AsyncPacketSocket* socket = NULL;
for (std::list<Incoming>::iterator it = incoming_.begin();
it != incoming_.end(); ++it) {
if (it->addr == addr) {
@@ -210,34 +210,34 @@
return socket;
}
-void TCPPort::OnReadPacket(talk_base::AsyncPacketSocket* socket,
+void TCPPort::OnReadPacket(rtc::AsyncPacketSocket* socket,
const char* data, size_t size,
- const talk_base::SocketAddress& remote_addr,
- const talk_base::PacketTime& packet_time) {
+ const rtc::SocketAddress& remote_addr,
+ const rtc::PacketTime& packet_time) {
Port::OnReadPacket(data, size, remote_addr, PROTO_TCP);
}
-void TCPPort::OnReadyToSend(talk_base::AsyncPacketSocket* socket) {
+void TCPPort::OnReadyToSend(rtc::AsyncPacketSocket* socket) {
Port::OnReadyToSend();
}
-void TCPPort::OnAddressReady(talk_base::AsyncPacketSocket* socket,
- const talk_base::SocketAddress& address) {
- AddAddress(address, address, talk_base::SocketAddress(), "tcp",
+void TCPPort::OnAddressReady(rtc::AsyncPacketSocket* socket,
+ const rtc::SocketAddress& address) {
+ AddAddress(address, address, rtc::SocketAddress(), "tcp",
LOCAL_PORT_TYPE, ICE_TYPE_PREFERENCE_HOST_TCP,
true);
}
TCPConnection::TCPConnection(TCPPort* port, const Candidate& candidate,
- talk_base::AsyncPacketSocket* socket)
+ rtc::AsyncPacketSocket* socket)
: Connection(port, 0, candidate), socket_(socket), error_(0) {
bool outgoing = (socket_ == NULL);
if (outgoing) {
// TODO: Handle failures here (unlikely since TCP).
int opts = (candidate.protocol() == SSLTCP_PROTOCOL_NAME) ?
- talk_base::PacketSocketFactory::OPT_SSLTCP : 0;
+ rtc::PacketSocketFactory::OPT_SSLTCP : 0;
socket_ = port->socket_factory()->CreateClientTcpSocket(
- talk_base::SocketAddress(port->ip(), 0),
+ rtc::SocketAddress(port->ip(), 0),
candidate.address(), port->proxy(), port->user_agent(), opts);
if (socket_) {
LOG_J(LS_VERBOSE, this) << "Connecting from "
@@ -267,7 +267,7 @@
}
int TCPConnection::Send(const void* data, size_t size,
- const talk_base::PacketOptions& options) {
+ const rtc::PacketOptions& options) {
if (!socket_) {
error_ = ENOTCONN;
return SOCKET_ERROR;
@@ -291,7 +291,7 @@
return error_;
}
-void TCPConnection::OnConnect(talk_base::AsyncPacketSocket* socket) {
+void TCPConnection::OnConnect(rtc::AsyncPacketSocket* socket) {
ASSERT(socket == socket_);
// Do not use this connection if the socket bound to a different address than
// the one we asked for. This is seen in Chrome, where TCP sockets cannot be
@@ -308,7 +308,7 @@
}
}
-void TCPConnection::OnClose(talk_base::AsyncPacketSocket* socket, int error) {
+void TCPConnection::OnClose(rtc::AsyncPacketSocket* socket, int error) {
ASSERT(socket == socket_);
LOG_J(LS_VERBOSE, this) << "Connection closed with error " << error;
set_connected(false);
@@ -316,14 +316,14 @@
}
void TCPConnection::OnReadPacket(
- talk_base::AsyncPacketSocket* socket, const char* data, size_t size,
- const talk_base::SocketAddress& remote_addr,
- const talk_base::PacketTime& packet_time) {
+ rtc::AsyncPacketSocket* socket, const char* data, size_t size,
+ const rtc::SocketAddress& remote_addr,
+ const rtc::PacketTime& packet_time) {
ASSERT(socket == socket_);
Connection::OnReadPacket(data, size, packet_time);
}
-void TCPConnection::OnReadyToSend(talk_base::AsyncPacketSocket* socket) {
+void TCPConnection::OnReadyToSend(rtc::AsyncPacketSocket* socket) {
ASSERT(socket == socket_);
Connection::OnReadyToSend();
}
diff --git a/p2p/base/tcpport.h b/p2p/base/tcpport.h
index c152ec0..8d1b963 100644
--- a/p2p/base/tcpport.h
+++ b/p2p/base/tcpport.h
@@ -30,7 +30,7 @@
#include <string>
#include <list>
-#include "talk/base/asyncpacketsocket.h"
+#include "webrtc/base/asyncpacketsocket.h"
#include "talk/p2p/base/port.h"
namespace cricket {
@@ -45,10 +45,10 @@
// call this TCPPort::OnReadPacket (3 arg) to dispatch to a connection.
class TCPPort : public Port {
public:
- static TCPPort* Create(talk_base::Thread* thread,
- talk_base::PacketSocketFactory* factory,
- talk_base::Network* network,
- const talk_base::IPAddress& ip,
+ static TCPPort* Create(rtc::Thread* thread,
+ rtc::PacketSocketFactory* factory,
+ rtc::Network* network,
+ const rtc::IPAddress& ip,
int min_port, int max_port,
const std::string& username,
const std::string& password,
@@ -69,51 +69,51 @@
virtual void PrepareAddress();
- virtual int GetOption(talk_base::Socket::Option opt, int* value);
- virtual int SetOption(talk_base::Socket::Option opt, int value);
+ virtual int GetOption(rtc::Socket::Option opt, int* value);
+ virtual int SetOption(rtc::Socket::Option opt, int value);
virtual int GetError();
protected:
- TCPPort(talk_base::Thread* thread, talk_base::PacketSocketFactory* factory,
- talk_base::Network* network, const talk_base::IPAddress& ip,
+ TCPPort(rtc::Thread* thread, rtc::PacketSocketFactory* factory,
+ rtc::Network* network, const rtc::IPAddress& ip,
int min_port, int max_port, const std::string& username,
const std::string& password, bool allow_listen);
bool Init();
// Handles sending using the local TCP socket.
virtual int SendTo(const void* data, size_t size,
- const talk_base::SocketAddress& addr,
- const talk_base::PacketOptions& options,
+ const rtc::SocketAddress& addr,
+ const rtc::PacketOptions& options,
bool payload);
// Accepts incoming TCP connection.
- void OnNewConnection(talk_base::AsyncPacketSocket* socket,
- talk_base::AsyncPacketSocket* new_socket);
+ void OnNewConnection(rtc::AsyncPacketSocket* socket,
+ rtc::AsyncPacketSocket* new_socket);
private:
struct Incoming {
- talk_base::SocketAddress addr;
- talk_base::AsyncPacketSocket* socket;
+ rtc::SocketAddress addr;
+ rtc::AsyncPacketSocket* socket;
};
- talk_base::AsyncPacketSocket* GetIncoming(
- const talk_base::SocketAddress& addr, bool remove = false);
+ rtc::AsyncPacketSocket* GetIncoming(
+ const rtc::SocketAddress& addr, bool remove = false);
// Receives packet signal from the local TCP Socket.
- void OnReadPacket(talk_base::AsyncPacketSocket* socket,
+ void OnReadPacket(rtc::AsyncPacketSocket* socket,
const char* data, size_t size,
- const talk_base::SocketAddress& remote_addr,
- const talk_base::PacketTime& packet_time);
+ const rtc::SocketAddress& remote_addr,
+ const rtc::PacketTime& packet_time);
- void OnReadyToSend(talk_base::AsyncPacketSocket* socket);
+ void OnReadyToSend(rtc::AsyncPacketSocket* socket);
- void OnAddressReady(talk_base::AsyncPacketSocket* socket,
- const talk_base::SocketAddress& address);
+ void OnAddressReady(rtc::AsyncPacketSocket* socket,
+ const rtc::SocketAddress& address);
// TODO: Is this still needed?
bool incoming_only_;
bool allow_listen_;
- talk_base::AsyncPacketSocket* socket_;
+ rtc::AsyncPacketSocket* socket_;
int error_;
std::list<Incoming> incoming_;
@@ -124,25 +124,25 @@
public:
// Connection is outgoing unless socket is specified
TCPConnection(TCPPort* port, const Candidate& candidate,
- talk_base::AsyncPacketSocket* socket = 0);
+ rtc::AsyncPacketSocket* socket = 0);
virtual ~TCPConnection();
virtual int Send(const void* data, size_t size,
- const talk_base::PacketOptions& options);
+ const rtc::PacketOptions& options);
virtual int GetError();
- talk_base::AsyncPacketSocket* socket() { return socket_; }
+ rtc::AsyncPacketSocket* socket() { return socket_; }
private:
- void OnConnect(talk_base::AsyncPacketSocket* socket);
- void OnClose(talk_base::AsyncPacketSocket* socket, int error);
- void OnReadPacket(talk_base::AsyncPacketSocket* socket,
+ void OnConnect(rtc::AsyncPacketSocket* socket);
+ void OnClose(rtc::AsyncPacketSocket* socket, int error);
+ void OnReadPacket(rtc::AsyncPacketSocket* socket,
const char* data, size_t size,
- const talk_base::SocketAddress& remote_addr,
- const talk_base::PacketTime& packet_time);
- void OnReadyToSend(talk_base::AsyncPacketSocket* socket);
+ const rtc::SocketAddress& remote_addr,
+ const rtc::PacketTime& packet_time);
+ void OnReadyToSend(rtc::AsyncPacketSocket* socket);
- talk_base::AsyncPacketSocket* socket_;
+ rtc::AsyncPacketSocket* socket_;
int error_;
friend class TCPPort;
diff --git a/p2p/base/testrelayserver.h b/p2p/base/testrelayserver.h
index 29e9fe4..c6fdf73 100644
--- a/p2p/base/testrelayserver.h
+++ b/p2p/base/testrelayserver.h
@@ -28,11 +28,11 @@
#ifndef TALK_P2P_BASE_TESTRELAYSERVER_H_
#define TALK_P2P_BASE_TESTRELAYSERVER_H_
-#include "talk/base/asynctcpsocket.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/socketadapters.h"
-#include "talk/base/sigslot.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/asynctcpsocket.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/socketadapters.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/thread.h"
#include "talk/p2p/base/relayserver.h"
namespace cricket {
@@ -40,17 +40,17 @@
// A test relay server. Useful for unit tests.
class TestRelayServer : public sigslot::has_slots<> {
public:
- TestRelayServer(talk_base::Thread* thread,
- const talk_base::SocketAddress& udp_int_addr,
- const talk_base::SocketAddress& udp_ext_addr,
- const talk_base::SocketAddress& tcp_int_addr,
- const talk_base::SocketAddress& tcp_ext_addr,
- const talk_base::SocketAddress& ssl_int_addr,
- const talk_base::SocketAddress& ssl_ext_addr)
+ TestRelayServer(rtc::Thread* thread,
+ const rtc::SocketAddress& udp_int_addr,
+ const rtc::SocketAddress& udp_ext_addr,
+ const rtc::SocketAddress& tcp_int_addr,
+ const rtc::SocketAddress& tcp_ext_addr,
+ const rtc::SocketAddress& ssl_int_addr,
+ const rtc::SocketAddress& ssl_ext_addr)
: server_(thread) {
- server_.AddInternalSocket(talk_base::AsyncUDPSocket::Create(
+ server_.AddInternalSocket(rtc::AsyncUDPSocket::Create(
thread->socketserver(), udp_int_addr));
- server_.AddExternalSocket(talk_base::AsyncUDPSocket::Create(
+ server_.AddExternalSocket(rtc::AsyncUDPSocket::Create(
thread->socketserver(), udp_ext_addr));
tcp_int_socket_.reset(CreateListenSocket(thread, tcp_int_addr));
@@ -61,33 +61,33 @@
int GetConnectionCount() const {
return server_.GetConnectionCount();
}
- talk_base::SocketAddressPair GetConnection(int connection) const {
+ rtc::SocketAddressPair GetConnection(int connection) const {
return server_.GetConnection(connection);
}
- bool HasConnection(const talk_base::SocketAddress& address) const {
+ bool HasConnection(const rtc::SocketAddress& address) const {
return server_.HasConnection(address);
}
private:
- talk_base::AsyncSocket* CreateListenSocket(talk_base::Thread* thread,
- const talk_base::SocketAddress& addr) {
- talk_base::AsyncSocket* socket =
+ rtc::AsyncSocket* CreateListenSocket(rtc::Thread* thread,
+ const rtc::SocketAddress& addr) {
+ rtc::AsyncSocket* socket =
thread->socketserver()->CreateAsyncSocket(addr.family(), SOCK_STREAM);
socket->Bind(addr);
socket->Listen(5);
socket->SignalReadEvent.connect(this, &TestRelayServer::OnAccept);
return socket;
}
- void OnAccept(talk_base::AsyncSocket* socket) {
+ void OnAccept(rtc::AsyncSocket* socket) {
bool external = (socket == tcp_ext_socket_.get() ||
socket == ssl_ext_socket_.get());
bool ssl = (socket == ssl_int_socket_.get() ||
socket == ssl_ext_socket_.get());
- talk_base::AsyncSocket* raw_socket = socket->Accept(NULL);
+ rtc::AsyncSocket* raw_socket = socket->Accept(NULL);
if (raw_socket) {
- talk_base::AsyncTCPSocket* packet_socket = new talk_base::AsyncTCPSocket(
+ rtc::AsyncTCPSocket* packet_socket = new rtc::AsyncTCPSocket(
(!ssl) ? raw_socket :
- new talk_base::AsyncSSLServerSocket(raw_socket), false);
+ new rtc::AsyncSSLServerSocket(raw_socket), false);
if (!external) {
packet_socket->SignalClose.connect(this,
&TestRelayServer::OnInternalClose);
@@ -99,18 +99,18 @@
}
}
}
- void OnInternalClose(talk_base::AsyncPacketSocket* socket, int error) {
+ void OnInternalClose(rtc::AsyncPacketSocket* socket, int error) {
server_.RemoveInternalSocket(socket);
}
- void OnExternalClose(talk_base::AsyncPacketSocket* socket, int error) {
+ void OnExternalClose(rtc::AsyncPacketSocket* socket, int error) {
server_.RemoveExternalSocket(socket);
}
private:
cricket::RelayServer server_;
- talk_base::scoped_ptr<talk_base::AsyncSocket> tcp_int_socket_;
- talk_base::scoped_ptr<talk_base::AsyncSocket> tcp_ext_socket_;
- talk_base::scoped_ptr<talk_base::AsyncSocket> ssl_int_socket_;
- talk_base::scoped_ptr<talk_base::AsyncSocket> ssl_ext_socket_;
+ rtc::scoped_ptr<rtc::AsyncSocket> tcp_int_socket_;
+ rtc::scoped_ptr<rtc::AsyncSocket> tcp_ext_socket_;
+ rtc::scoped_ptr<rtc::AsyncSocket> ssl_int_socket_;
+ rtc::scoped_ptr<rtc::AsyncSocket> ssl_ext_socket_;
};
} // namespace cricket
diff --git a/p2p/base/teststunserver.h b/p2p/base/teststunserver.h
index 67bac21..131ce69 100644
--- a/p2p/base/teststunserver.h
+++ b/p2p/base/teststunserver.h
@@ -28,8 +28,8 @@
#ifndef TALK_P2P_BASE_TESTSTUNSERVER_H_
#define TALK_P2P_BASE_TESTSTUNSERVER_H_
-#include "talk/base/socketaddress.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/socketaddress.h"
+#include "webrtc/base/thread.h"
#include "talk/p2p/base/stunserver.h"
namespace cricket {
@@ -37,16 +37,16 @@
// A test STUN server. Useful for unit tests.
class TestStunServer {
public:
- TestStunServer(talk_base::Thread* thread,
- const talk_base::SocketAddress& addr)
+ TestStunServer(rtc::Thread* thread,
+ const rtc::SocketAddress& addr)
: socket_(thread->socketserver()->CreateAsyncSocket(addr.family(),
SOCK_DGRAM)),
- udp_socket_(talk_base::AsyncUDPSocket::Create(socket_, addr)),
+ udp_socket_(rtc::AsyncUDPSocket::Create(socket_, addr)),
server_(udp_socket_) {
}
private:
- talk_base::AsyncSocket* socket_;
- talk_base::AsyncUDPSocket* udp_socket_;
+ rtc::AsyncSocket* socket_;
+ rtc::AsyncUDPSocket* udp_socket_;
cricket::StunServer server_;
};
diff --git a/p2p/base/testturnserver.h b/p2p/base/testturnserver.h
index 7a3c83f..3b7f765 100644
--- a/p2p/base/testturnserver.h
+++ b/p2p/base/testturnserver.h
@@ -30,8 +30,8 @@
#include <string>
-#include "talk/base/asyncudpsocket.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/asyncudpsocket.h"
+#include "webrtc/base/thread.h"
#include "talk/p2p/base/basicpacketsocketfactory.h"
#include "talk/p2p/base/stun.h"
#include "talk/p2p/base/turnserver.h"
@@ -43,12 +43,12 @@
class TestTurnServer : public TurnAuthInterface {
public:
- TestTurnServer(talk_base::Thread* thread,
- const talk_base::SocketAddress& udp_int_addr,
- const talk_base::SocketAddress& udp_ext_addr)
+ TestTurnServer(rtc::Thread* thread,
+ const rtc::SocketAddress& udp_int_addr,
+ const rtc::SocketAddress& udp_ext_addr)
: server_(thread) {
AddInternalSocket(udp_int_addr, cricket::PROTO_UDP);
- server_.SetExternalSocketFactory(new talk_base::BasicPacketSocketFactory(),
+ server_.SetExternalSocketFactory(new rtc::BasicPacketSocketFactory(),
udp_ext_addr);
server_.set_realm(kTestRealm);
server_.set_software(kTestSoftware);
@@ -61,16 +61,16 @@
TurnServer* server() { return &server_; }
- void AddInternalSocket(const talk_base::SocketAddress& int_addr,
+ void AddInternalSocket(const rtc::SocketAddress& int_addr,
ProtocolType proto) {
- talk_base::Thread* thread = talk_base::Thread::Current();
+ rtc::Thread* thread = rtc::Thread::Current();
if (proto == cricket::PROTO_UDP) {
- server_.AddInternalSocket(talk_base::AsyncUDPSocket::Create(
+ server_.AddInternalSocket(rtc::AsyncUDPSocket::Create(
thread->socketserver(), int_addr), proto);
} else if (proto == cricket::PROTO_TCP) {
// For TCP we need to create a server socket which can listen for incoming
// new connections.
- talk_base::AsyncSocket* socket =
+ rtc::AsyncSocket* socket =
thread->socketserver()->CreateAsyncSocket(SOCK_STREAM);
socket->Bind(int_addr);
socket->Listen(5);
diff --git a/p2p/base/transport.cc b/p2p/base/transport.cc
index 2996487..825142a 100644
--- a/p2p/base/transport.cc
+++ b/p2p/base/transport.cc
@@ -27,9 +27,9 @@
#include "talk/p2p/base/transport.h"
-#include "talk/base/bind.h"
-#include "talk/base/common.h"
-#include "talk/base/logging.h"
+#include "webrtc/base/bind.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/logging.h"
#include "talk/p2p/base/candidate.h"
#include "talk/p2p/base/constants.h"
#include "talk/p2p/base/sessionmanager.h"
@@ -40,7 +40,7 @@
namespace cricket {
-using talk_base::Bind;
+using rtc::Bind;
enum {
MSG_ONSIGNALINGREADY = 1,
@@ -57,7 +57,7 @@
MSG_FAILED,
};
-struct ChannelParams : public talk_base::MessageData {
+struct ChannelParams : public rtc::MessageData {
ChannelParams() : channel(NULL), candidate(NULL) {}
explicit ChannelParams(int component)
: component(component), channel(NULL), candidate(NULL) {}
@@ -135,8 +135,8 @@
new_desc.ice_ufrag, new_desc.ice_pwd);
}
-Transport::Transport(talk_base::Thread* signaling_thread,
- talk_base::Thread* worker_thread,
+Transport::Transport(rtc::Thread* signaling_thread,
+ rtc::Thread* worker_thread,
const std::string& content_name,
const std::string& type,
PortAllocator* allocator)
@@ -165,25 +165,25 @@
worker_thread_->Invoke<void>(Bind(&Transport::SetIceRole_w, this, role));
}
-void Transport::SetIdentity(talk_base::SSLIdentity* identity) {
+void Transport::SetIdentity(rtc::SSLIdentity* identity) {
worker_thread_->Invoke<void>(Bind(&Transport::SetIdentity_w, this, identity));
}
-bool Transport::GetIdentity(talk_base::SSLIdentity** identity) {
+bool Transport::GetIdentity(rtc::SSLIdentity** identity) {
// The identity is set on the worker thread, so for safety it must also be
// acquired on the worker thread.
return worker_thread_->Invoke<bool>(
Bind(&Transport::GetIdentity_w, this, identity));
}
-bool Transport::GetRemoteCertificate(talk_base::SSLCertificate** cert) {
+bool Transport::GetRemoteCertificate(rtc::SSLCertificate** cert) {
// Channels can be deleted on the worker thread, so for safety the remote
// certificate is acquired on the worker thread.
return worker_thread_->Invoke<bool>(
Bind(&Transport::GetRemoteCertificate_w, this, cert));
}
-bool Transport::GetRemoteCertificate_w(talk_base::SSLCertificate** cert) {
+bool Transport::GetRemoteCertificate_w(rtc::SSLCertificate** cert) {
ASSERT(worker_thread()->IsCurrent());
if (channels_.empty())
return false;
@@ -218,7 +218,7 @@
TransportChannelImpl* Transport::CreateChannel_w(int component) {
ASSERT(worker_thread()->IsCurrent());
TransportChannelImpl *impl;
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
// Create the entry if it does not exist.
bool impl_exists = false;
@@ -276,13 +276,13 @@
}
TransportChannelImpl* Transport::GetChannel(int component) {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
ChannelMap::iterator iter = channels_.find(component);
return (iter != channels_.end()) ? iter->second.get() : NULL;
}
bool Transport::HasChannels() {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
return !channels_.empty();
}
@@ -296,7 +296,7 @@
TransportChannelImpl* impl = NULL;
{
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
ChannelMap::iterator iter = channels_.find(component);
if (iter == channels_.end())
return;
@@ -343,8 +343,8 @@
LOG(LS_INFO) << "Transport::ConnectChannels_w: No local description has "
<< "been set. Will generate one.";
TransportDescription desc(NS_GINGLE_P2P, std::vector<std::string>(),
- talk_base::CreateRandomString(ICE_UFRAG_LENGTH),
- talk_base::CreateRandomString(ICE_PWD_LENGTH),
+ rtc::CreateRandomString(ICE_UFRAG_LENGTH),
+ rtc::CreateRandomString(ICE_PWD_LENGTH),
ICEMODE_FULL, CONNECTIONROLE_NONE, NULL,
Candidates());
SetLocalTransportDescription_w(desc, CA_OFFER, NULL);
@@ -374,7 +374,7 @@
ASSERT(worker_thread()->IsCurrent());
std::vector<TransportChannelImpl*> impls;
{
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
for (ChannelMap::iterator iter = channels_.begin();
iter != channels_.end();
++iter) {
@@ -402,7 +402,7 @@
connect_requested_ = false;
// Clear out the old messages, they aren't relevant
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
ready_candidates_.clear();
// Reset all of the channels
@@ -421,7 +421,7 @@
void Transport::CallChannels_w(TransportChannelFunc func) {
ASSERT(worker_thread()->IsCurrent());
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
for (ChannelMap::iterator iter = channels_.begin();
iter != channels_.end();
++iter) {
@@ -483,7 +483,7 @@
return true;
}
-bool Transport::GetSslRole(talk_base::SSLRole* ssl_role) const {
+bool Transport::GetSslRole(rtc::SSLRole* ssl_role) const {
return worker_thread_->Invoke<bool>(Bind(
&Transport::GetSslRole_w, this, ssl_role));
}
@@ -552,7 +552,7 @@
TransportState Transport::GetTransportState_s(bool read) {
ASSERT(signaling_thread()->IsCurrent());
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
bool any = false;
bool all = !channels_.empty();
for (ChannelMap::iterator iter = channels_.begin();
@@ -583,7 +583,7 @@
LOG(LS_INFO) << "Transport: " << content_name_ << ", allocating candidates";
// Resetting ICE state for the channel.
{
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
ChannelMap::iterator iter = channels_.find(component);
if (iter != channels_.end())
iter->second.set_candidates_allocated(false);
@@ -594,7 +594,7 @@
void Transport::OnChannelCandidateReady(TransportChannelImpl* channel,
const Candidate& candidate) {
ASSERT(worker_thread()->IsCurrent());
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
ready_candidates_.push_back(candidate);
// We hold any messages until the client lets us connect.
@@ -610,7 +610,7 @@
std::vector<Candidate> candidates;
{
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
candidates.swap(ready_candidates_);
}
@@ -638,7 +638,7 @@
void Transport::OnChannelCandidatesAllocationDone(
TransportChannelImpl* channel) {
ASSERT(worker_thread()->IsCurrent());
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
ChannelMap::iterator iter = channels_.find(channel->component());
ASSERT(iter != channels_.end());
LOG(LS_INFO) << "Transport: " << content_name_ << ", component "
@@ -713,7 +713,7 @@
}
void Transport::SetIceRole_w(IceRole role) {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
ice_role_ = role;
for (ChannelMap::iterator iter = channels_.begin();
iter != channels_.end(); ++iter) {
@@ -722,7 +722,7 @@
}
void Transport::SetRemoteIceMode_w(IceMode mode) {
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
remote_ice_mode_ = mode;
// Shouldn't channels be created after this method executed?
for (ChannelMap::iterator iter = channels_.begin();
@@ -736,7 +736,7 @@
ContentAction action,
std::string* error_desc) {
bool ret = true;
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
if (!VerifyIceParams(desc)) {
return BadTransportDescription("Invalid ice-ufrag or ice-pwd length",
@@ -773,7 +773,7 @@
ContentAction action,
std::string* error_desc) {
bool ret = true;
- talk_base::CritScope cs(&crit_);
+ rtc::CritScope cs(&crit_);
if (!VerifyIceParams(desc)) {
return BadTransportDescription("Invalid ice-ufrag or ice-pwd length",
@@ -891,7 +891,7 @@
return true;
}
-void Transport::OnMessage(talk_base::Message* msg) {
+void Transport::OnMessage(rtc::Message* msg) {
switch (msg->message_id) {
case MSG_ONSIGNALINGREADY:
CallChannels_w(&TransportChannelImpl::OnSignalingReady);
@@ -944,7 +944,7 @@
bool TransportParser::ParseAddress(const buzz::XmlElement* elem,
const buzz::QName& address_name,
const buzz::QName& port_name,
- talk_base::SocketAddress* address,
+ rtc::SocketAddress* address,
ParseError* error) {
if (!elem->HasAttr(address_name))
return BadParse("address does not have " + address_name.LocalPart(), error);
diff --git a/p2p/base/transport.h b/p2p/base/transport.h
index 5a4b75f..0ce12e7 100644
--- a/p2p/base/transport.h
+++ b/p2p/base/transport.h
@@ -49,16 +49,16 @@
#include <string>
#include <map>
#include <vector>
-#include "talk/base/criticalsection.h"
-#include "talk/base/messagequeue.h"
-#include "talk/base/sigslot.h"
-#include "talk/base/sslstreamadapter.h"
+#include "webrtc/base/criticalsection.h"
+#include "webrtc/base/messagequeue.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/sslstreamadapter.h"
#include "talk/p2p/base/candidate.h"
#include "talk/p2p/base/constants.h"
#include "talk/p2p/base/sessiondescription.h"
#include "talk/p2p/base/transportinfo.h"
-namespace talk_base {
+namespace rtc {
class Thread;
}
@@ -123,7 +123,7 @@
bool ParseAddress(const buzz::XmlElement* elem,
const buzz::QName& address_name,
const buzz::QName& port_name,
- talk_base::SocketAddress* address,
+ rtc::SocketAddress* address,
ParseError* error);
virtual ~TransportParser() {}
@@ -194,20 +194,20 @@
const std::string& new_ufrag,
const std::string& new_pwd);
-class Transport : public talk_base::MessageHandler,
+class Transport : public rtc::MessageHandler,
public sigslot::has_slots<> {
public:
- Transport(talk_base::Thread* signaling_thread,
- talk_base::Thread* worker_thread,
+ Transport(rtc::Thread* signaling_thread,
+ rtc::Thread* worker_thread,
const std::string& content_name,
const std::string& type,
PortAllocator* allocator);
virtual ~Transport();
// Returns the signaling thread. The app talks to Transport on this thread.
- talk_base::Thread* signaling_thread() { return signaling_thread_; }
+ rtc::Thread* signaling_thread() { return signaling_thread_; }
// Returns the worker thread. The actual networking is done on this thread.
- talk_base::Thread* worker_thread() { return worker_thread_; }
+ rtc::Thread* worker_thread() { return worker_thread_; }
// Returns the content_name of this transport.
const std::string& content_name() const { return content_name_; }
@@ -254,13 +254,13 @@
uint64 IceTiebreaker() { return tiebreaker_; }
// Must be called before applying local session description.
- void SetIdentity(talk_base::SSLIdentity* identity);
+ void SetIdentity(rtc::SSLIdentity* identity);
// Get a copy of the local identity provided by SetIdentity.
- bool GetIdentity(talk_base::SSLIdentity** identity);
+ bool GetIdentity(rtc::SSLIdentity** identity);
// Get a copy of the remote certificate in use by the specified channel.
- bool GetRemoteCertificate(talk_base::SSLCertificate** cert);
+ bool GetRemoteCertificate(rtc::SSLCertificate** cert);
TransportProtocol protocol() const { return protocol_; }
@@ -341,7 +341,7 @@
// Forwards the signal from TransportChannel to BaseSession.
sigslot::signal0<> SignalRoleConflict;
- virtual bool GetSslRole(talk_base::SSLRole* ssl_role) const;
+ virtual bool GetSslRole(rtc::SSLRole* ssl_role) const;
protected:
// These are called by Create/DestroyChannel above in order to create or
@@ -364,9 +364,9 @@
return remote_description_.get();
}
- virtual void SetIdentity_w(talk_base::SSLIdentity* identity) {}
+ virtual void SetIdentity_w(rtc::SSLIdentity* identity) {}
- virtual bool GetIdentity_w(talk_base::SSLIdentity** identity) {
+ virtual bool GetIdentity_w(rtc::SSLIdentity** identity) {
return false;
}
@@ -395,7 +395,7 @@
virtual bool ApplyNegotiatedTransportDescription_w(
TransportChannelImpl* channel, std::string* error_desc);
- virtual bool GetSslRole_w(talk_base::SSLRole* ssl_role) const {
+ virtual bool GetSslRole_w(rtc::SSLRole* ssl_role) const {
return false;
}
@@ -452,7 +452,7 @@
void OnChannelConnectionRemoved(TransportChannelImpl* channel);
// Dispatches messages to the appropriate handler (below).
- void OnMessage(talk_base::Message* msg);
+ void OnMessage(rtc::Message* msg);
// These are versions of the above methods that are called only on a
// particular thread (s = signaling, w = worker). The above methods post or
@@ -489,13 +489,13 @@
ContentAction action,
std::string* error_desc);
bool GetStats_w(TransportStats* infos);
- bool GetRemoteCertificate_w(talk_base::SSLCertificate** cert);
+ bool GetRemoteCertificate_w(rtc::SSLCertificate** cert);
// Sends SignalCompleted if we are now in that state.
void MaybeCompleted_w();
- talk_base::Thread* signaling_thread_;
- talk_base::Thread* worker_thread_;
+ rtc::Thread* signaling_thread_;
+ rtc::Thread* worker_thread_;
std::string content_name_;
std::string type_;
PortAllocator* allocator_;
@@ -508,15 +508,15 @@
uint64 tiebreaker_;
TransportProtocol protocol_;
IceMode remote_ice_mode_;
- talk_base::scoped_ptr<TransportDescription> local_description_;
- talk_base::scoped_ptr<TransportDescription> remote_description_;
+ rtc::scoped_ptr<TransportDescription> local_description_;
+ rtc::scoped_ptr<TransportDescription> remote_description_;
ChannelMap channels_;
// Buffers the ready_candidates so that SignalCanidatesReady can
// provide them in multiples.
std::vector<Candidate> ready_candidates_;
// Protects changes to channels and messages
- talk_base::CriticalSection crit_;
+ rtc::CriticalSection crit_;
DISALLOW_EVIL_CONSTRUCTORS(Transport);
};
diff --git a/p2p/base/transport_unittest.cc b/p2p/base/transport_unittest.cc
index a83d256..f605bbc 100644
--- a/p2p/base/transport_unittest.cc
+++ b/p2p/base/transport_unittest.cc
@@ -25,9 +25,9 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/fakesslidentity.h"
-#include "talk/base/gunit.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/fakesslidentity.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/thread.h"
#include "talk/p2p/base/constants.h"
#include "talk/p2p/base/fakesession.h"
#include "talk/p2p/base/parsing.h"
@@ -47,7 +47,7 @@
using cricket::TransportDescription;
using cricket::WriteError;
using cricket::ParseError;
-using talk_base::SocketAddress;
+using rtc::SocketAddress;
static const char kIceUfrag1[] = "TESTICEUFRAG0001";
static const char kIcePwd1[] = "TESTICEPWD00000000000001";
@@ -59,7 +59,7 @@
public sigslot::has_slots<> {
public:
TransportTest()
- : thread_(talk_base::Thread::Current()),
+ : thread_(rtc::Thread::Current()),
transport_(new FakeTransport(
thread_, thread_, "test content name", NULL)),
channel_(NULL),
@@ -97,8 +97,8 @@
failed_ = true;
}
- talk_base::Thread* thread_;
- talk_base::scoped_ptr<FakeTransport> transport_;
+ rtc::Thread* thread_;
+ rtc::scoped_ptr<FakeTransport> transport_;
FakeTransportChannel* channel_;
bool connecting_signalled_;
bool completed_;
@@ -365,20 +365,20 @@
TEST_F(TransportTest, TestP2PTransportWriteAndParseCandidate) {
Candidate test_candidate(
"", 1, "udp",
- talk_base::SocketAddress("2001:db8:fefe::1", 9999),
+ rtc::SocketAddress("2001:db8:fefe::1", 9999),
738197504, "abcdef", "ghijkl", "foo", "testnet", 50, "");
Candidate test_candidate2(
"", 2, "tcp",
- talk_base::SocketAddress("192.168.7.1", 9999),
+ rtc::SocketAddress("192.168.7.1", 9999),
1107296256, "mnopqr", "stuvwx", "bar", "testnet2", 100, "");
- talk_base::SocketAddress host_address("www.google.com", 24601);
- host_address.SetResolvedIP(talk_base::IPAddress(0x0A000001));
+ rtc::SocketAddress host_address("www.google.com", 24601);
+ host_address.SetResolvedIP(rtc::IPAddress(0x0A000001));
Candidate test_candidate3(
"", 3, "spdy", host_address, 1476395008, "yzabcd",
"efghij", "baz", "testnet3", 150, "");
WriteError write_error;
ParseError parse_error;
- talk_base::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<buzz::XmlElement> elem;
cricket::Candidate parsed_candidate;
cricket::P2PTransportParser parser;
diff --git a/p2p/base/transportchannel.h b/p2p/base/transportchannel.h
index c548c1c..b804320 100644
--- a/p2p/base/transportchannel.h
+++ b/p2p/base/transportchannel.h
@@ -31,13 +31,13 @@
#include <string>
#include <vector>
-#include "talk/base/asyncpacketsocket.h"
-#include "talk/base/basictypes.h"
-#include "talk/base/dscp.h"
-#include "talk/base/sigslot.h"
-#include "talk/base/socket.h"
-#include "talk/base/sslidentity.h"
-#include "talk/base/sslstreamadapter.h"
+#include "webrtc/base/asyncpacketsocket.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/dscp.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/socket.h"
+#include "webrtc/base/sslidentity.h"
+#include "webrtc/base/sslstreamadapter.h"
#include "talk/p2p/base/candidate.h"
#include "talk/p2p/base/transport.h"
#include "talk/p2p/base/transportdescription.h"
@@ -83,12 +83,12 @@
// Attempts to send the given packet. The return value is < 0 on failure.
// TODO: Remove the default argument once channel code is updated.
virtual int SendPacket(const char* data, size_t len,
- const talk_base::PacketOptions& options,
+ const rtc::PacketOptions& options,
int flags = 0) = 0;
// Sets a socket option on this channel. Note that not all options are
// supported by all transport types.
- virtual int SetOption(talk_base::Socket::Option opt, int value) = 0;
+ virtual int SetOption(rtc::Socket::Option opt, int value) = 0;
// Returns the most recent error that occurred on this channel.
virtual int GetError() = 0;
@@ -100,7 +100,7 @@
virtual bool IsDtlsActive() const = 0;
// Default implementation.
- virtual bool GetSslRole(talk_base::SSLRole* role) const = 0;
+ virtual bool GetSslRole(rtc::SSLRole* role) const = 0;
// Sets up the ciphers to use for DTLS-SRTP.
virtual bool SetSrtpCiphers(const std::vector<std::string>& ciphers) = 0;
@@ -109,10 +109,10 @@
virtual bool GetSrtpCipher(std::string* cipher) = 0;
// Gets a copy of the local SSL identity, owned by the caller.
- virtual bool GetLocalIdentity(talk_base::SSLIdentity** identity) const = 0;
+ virtual bool GetLocalIdentity(rtc::SSLIdentity** identity) const = 0;
// Gets a copy of the remote side's SSL certificate, owned by the caller.
- virtual bool GetRemoteCertificate(talk_base::SSLCertificate** cert) const = 0;
+ virtual bool GetRemoteCertificate(rtc::SSLCertificate** cert) const = 0;
// Allows key material to be extracted for external encryption.
virtual bool ExportKeyingMaterial(const std::string& label,
@@ -124,7 +124,7 @@
// Signalled each time a packet is received on this channel.
sigslot::signal5<TransportChannel*, const char*,
- size_t, const talk_base::PacketTime&, int> SignalReadPacket;
+ size_t, const rtc::PacketTime&, int> SignalReadPacket;
// This signal occurs when there is a change in the way that packets are
// being routed, i.e. to a different remote location. The candidate
diff --git a/p2p/base/transportchannelimpl.h b/p2p/base/transportchannelimpl.h
index 25c3121..fde980b 100644
--- a/p2p/base/transportchannelimpl.h
+++ b/p2p/base/transportchannelimpl.h
@@ -99,14 +99,14 @@
// retains ownership and must delete it after this TransportChannelImpl is
// destroyed.
// TODO(bemasc): Fix the ownership semantics of this method.
- virtual bool SetLocalIdentity(talk_base::SSLIdentity* identity) = 0;
+ virtual bool SetLocalIdentity(rtc::SSLIdentity* identity) = 0;
// Set DTLS Remote fingerprint. Must be after local identity set.
virtual bool SetRemoteFingerprint(const std::string& digest_alg,
const uint8* digest,
size_t digest_len) = 0;
- virtual bool SetSslRole(talk_base::SSLRole role) = 0;
+ virtual bool SetSslRole(rtc::SSLRole role) = 0;
// TransportChannel is forwarding this signal from PortAllocatorSession.
sigslot::signal1<TransportChannelImpl*> SignalCandidatesAllocationDone;
diff --git a/p2p/base/transportchannelproxy.cc b/p2p/base/transportchannelproxy.cc
index fdcc509..28d7ff4 100644
--- a/p2p/base/transportchannelproxy.cc
+++ b/p2p/base/transportchannelproxy.cc
@@ -26,9 +26,9 @@
*/
#include "talk/p2p/base/transportchannelproxy.h"
-#include "talk/base/common.h"
-#include "talk/base/logging.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/thread.h"
#include "talk/p2p/base/transport.h"
#include "talk/p2p/base/transportchannelimpl.h"
@@ -44,7 +44,7 @@
: TransportChannel(content_name, component),
name_(name),
impl_(NULL) {
- worker_thread_ = talk_base::Thread::Current();
+ worker_thread_ = rtc::Thread::Current();
}
TransportChannelProxy::~TransportChannelProxy() {
@@ -55,7 +55,7 @@
}
void TransportChannelProxy::SetImplementation(TransportChannelImpl* impl) {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ ASSERT(rtc::Thread::Current() == worker_thread_);
if (impl == impl_) {
// Ignore if the |impl| has already been set.
@@ -101,9 +101,9 @@
}
int TransportChannelProxy::SendPacket(const char* data, size_t len,
- const talk_base::PacketOptions& options,
+ const rtc::PacketOptions& options,
int flags) {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ ASSERT(rtc::Thread::Current() == worker_thread_);
// Fail if we don't have an impl yet.
if (!impl_) {
return -1;
@@ -111,8 +111,8 @@
return impl_->SendPacket(data, len, options, flags);
}
-int TransportChannelProxy::SetOption(talk_base::Socket::Option opt, int value) {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+int TransportChannelProxy::SetOption(rtc::Socket::Option opt, int value) {
+ ASSERT(rtc::Thread::Current() == worker_thread_);
if (!impl_) {
pending_options_.push_back(OptionPair(opt, value));
return 0;
@@ -121,7 +121,7 @@
}
int TransportChannelProxy::GetError() {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ ASSERT(rtc::Thread::Current() == worker_thread_);
if (!impl_) {
return 0;
}
@@ -129,7 +129,7 @@
}
bool TransportChannelProxy::GetStats(ConnectionInfos* infos) {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ ASSERT(rtc::Thread::Current() == worker_thread_);
if (!impl_) {
return false;
}
@@ -137,23 +137,23 @@
}
bool TransportChannelProxy::IsDtlsActive() const {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ ASSERT(rtc::Thread::Current() == worker_thread_);
if (!impl_) {
return false;
}
return impl_->IsDtlsActive();
}
-bool TransportChannelProxy::GetSslRole(talk_base::SSLRole* role) const {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+bool TransportChannelProxy::GetSslRole(rtc::SSLRole* role) const {
+ ASSERT(rtc::Thread::Current() == worker_thread_);
if (!impl_) {
return false;
}
return impl_->GetSslRole(role);
}
-bool TransportChannelProxy::SetSslRole(talk_base::SSLRole role) {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+bool TransportChannelProxy::SetSslRole(rtc::SSLRole role) {
+ ASSERT(rtc::Thread::Current() == worker_thread_);
if (!impl_) {
return false;
}
@@ -162,7 +162,7 @@
bool TransportChannelProxy::SetSrtpCiphers(const std::vector<std::string>&
ciphers) {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ ASSERT(rtc::Thread::Current() == worker_thread_);
pending_srtp_ciphers_ = ciphers; // Cache so we can send later, but always
// set so it stays consistent.
if (impl_) {
@@ -172,7 +172,7 @@
}
bool TransportChannelProxy::GetSrtpCipher(std::string* cipher) {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ ASSERT(rtc::Thread::Current() == worker_thread_);
if (!impl_) {
return false;
}
@@ -180,8 +180,8 @@
}
bool TransportChannelProxy::GetLocalIdentity(
- talk_base::SSLIdentity** identity) const {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ rtc::SSLIdentity** identity) const {
+ ASSERT(rtc::Thread::Current() == worker_thread_);
if (!impl_) {
return false;
}
@@ -189,8 +189,8 @@
}
bool TransportChannelProxy::GetRemoteCertificate(
- talk_base::SSLCertificate** cert) const {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ rtc::SSLCertificate** cert) const {
+ ASSERT(rtc::Thread::Current() == worker_thread_);
if (!impl_) {
return false;
}
@@ -203,7 +203,7 @@
bool use_context,
uint8* result,
size_t result_len) {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ ASSERT(rtc::Thread::Current() == worker_thread_);
if (!impl_) {
return false;
}
@@ -212,7 +212,7 @@
}
IceRole TransportChannelProxy::GetIceRole() const {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ ASSERT(rtc::Thread::Current() == worker_thread_);
if (!impl_) {
return ICEROLE_UNKNOWN;
}
@@ -220,14 +220,14 @@
}
void TransportChannelProxy::OnReadableState(TransportChannel* channel) {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ ASSERT(rtc::Thread::Current() == worker_thread_);
ASSERT(channel == impl_);
set_readable(impl_->readable());
// Note: SignalReadableState fired by set_readable.
}
void TransportChannelProxy::OnWritableState(TransportChannel* channel) {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ ASSERT(rtc::Thread::Current() == worker_thread_);
ASSERT(channel == impl_);
set_writable(impl_->writable());
// Note: SignalWritableState fired by set_readable.
@@ -235,27 +235,27 @@
void TransportChannelProxy::OnReadPacket(
TransportChannel* channel, const char* data, size_t size,
- const talk_base::PacketTime& packet_time, int flags) {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ const rtc::PacketTime& packet_time, int flags) {
+ ASSERT(rtc::Thread::Current() == worker_thread_);
ASSERT(channel == impl_);
SignalReadPacket(this, data, size, packet_time, flags);
}
void TransportChannelProxy::OnReadyToSend(TransportChannel* channel) {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ ASSERT(rtc::Thread::Current() == worker_thread_);
ASSERT(channel == impl_);
SignalReadyToSend(this);
}
void TransportChannelProxy::OnRouteChange(TransportChannel* channel,
const Candidate& candidate) {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ ASSERT(rtc::Thread::Current() == worker_thread_);
ASSERT(channel == impl_);
SignalRouteChange(this, candidate);
}
-void TransportChannelProxy::OnMessage(talk_base::Message* msg) {
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+void TransportChannelProxy::OnMessage(rtc::Message* msg) {
+ ASSERT(rtc::Thread::Current() == worker_thread_);
if (msg->message_id == MSG_UPDATESTATE) {
// If impl_ is already readable or writable, push up those signals.
set_readable(impl_ ? impl_->readable() : false);
diff --git a/p2p/base/transportchannelproxy.h b/p2p/base/transportchannelproxy.h
index cb38c7b..2a1d21a 100644
--- a/p2p/base/transportchannelproxy.h
+++ b/p2p/base/transportchannelproxy.h
@@ -32,10 +32,10 @@
#include <utility>
#include <vector>
-#include "talk/base/messagehandler.h"
+#include "webrtc/base/messagehandler.h"
#include "talk/p2p/base/transportchannel.h"
-namespace talk_base {
+namespace rtc {
class Thread;
}
@@ -48,7 +48,7 @@
// network negotiation is complete. Hence, we create a proxy up front, and
// when negotiation completes, connect the proxy to the implementaiton.
class TransportChannelProxy : public TransportChannel,
- public talk_base::MessageHandler {
+ public rtc::MessageHandler {
public:
TransportChannelProxy(const std::string& content_name,
const std::string& name,
@@ -64,19 +64,19 @@
// Implementation of the TransportChannel interface. These simply forward to
// the implementation.
virtual int SendPacket(const char* data, size_t len,
- const talk_base::PacketOptions& options,
+ const rtc::PacketOptions& options,
int flags);
- virtual int SetOption(talk_base::Socket::Option opt, int value);
+ virtual int SetOption(rtc::Socket::Option opt, int value);
virtual int GetError();
virtual IceRole GetIceRole() const;
virtual bool GetStats(ConnectionInfos* infos);
virtual bool IsDtlsActive() const;
- virtual bool GetSslRole(talk_base::SSLRole* role) const;
- virtual bool SetSslRole(talk_base::SSLRole role);
+ virtual bool GetSslRole(rtc::SSLRole* role) const;
+ virtual bool SetSslRole(rtc::SSLRole role);
virtual bool SetSrtpCiphers(const std::vector<std::string>& ciphers);
virtual bool GetSrtpCipher(std::string* cipher);
- virtual bool GetLocalIdentity(talk_base::SSLIdentity** identity) const;
- virtual bool GetRemoteCertificate(talk_base::SSLCertificate** cert) const;
+ virtual bool GetLocalIdentity(rtc::SSLIdentity** identity) const;
+ virtual bool GetRemoteCertificate(rtc::SSLCertificate** cert) const;
virtual bool ExportKeyingMaterial(const std::string& label,
const uint8* context,
size_t context_len,
@@ -90,16 +90,16 @@
void OnReadableState(TransportChannel* channel);
void OnWritableState(TransportChannel* channel);
void OnReadPacket(TransportChannel* channel, const char* data, size_t size,
- const talk_base::PacketTime& packet_time, int flags);
+ const rtc::PacketTime& packet_time, int flags);
void OnReadyToSend(TransportChannel* channel);
void OnRouteChange(TransportChannel* channel, const Candidate& candidate);
- void OnMessage(talk_base::Message* message);
+ void OnMessage(rtc::Message* message);
- typedef std::pair<talk_base::Socket::Option, int> OptionPair;
+ typedef std::pair<rtc::Socket::Option, int> OptionPair;
typedef std::vector<OptionPair> OptionList;
std::string name_;
- talk_base::Thread* worker_thread_;
+ rtc::Thread* worker_thread_;
TransportChannelImpl* impl_;
OptionList pending_options_;
std::vector<std::string> pending_srtp_ciphers_;
diff --git a/p2p/base/transportdescription.h b/p2p/base/transportdescription.h
index a8233a6..5891ca6 100644
--- a/p2p/base/transportdescription.h
+++ b/p2p/base/transportdescription.h
@@ -32,8 +32,8 @@
#include <string>
#include <vector>
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/sslfingerprint.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/sslfingerprint.h"
#include "talk/p2p/base/candidate.h"
#include "talk/p2p/base/constants.h"
@@ -109,7 +109,7 @@
const std::string& ice_pwd,
IceMode ice_mode,
ConnectionRole role,
- const talk_base::SSLFingerprint* identity_fingerprint,
+ const rtc::SSLFingerprint* identity_fingerprint,
const Candidates& candidates)
: transport_type(transport_type),
transport_options(transport_options),
@@ -164,12 +164,12 @@
}
bool secure() const { return identity_fingerprint != NULL; }
- static talk_base::SSLFingerprint* CopyFingerprint(
- const talk_base::SSLFingerprint* from) {
+ static rtc::SSLFingerprint* CopyFingerprint(
+ const rtc::SSLFingerprint* from) {
if (!from)
return NULL;
- return new talk_base::SSLFingerprint(*from);
+ return new rtc::SSLFingerprint(*from);
}
std::string transport_type; // xmlns of <transport>
@@ -179,7 +179,7 @@
IceMode ice_mode;
ConnectionRole connection_role;
- talk_base::scoped_ptr<talk_base::SSLFingerprint> identity_fingerprint;
+ rtc::scoped_ptr<rtc::SSLFingerprint> identity_fingerprint;
Candidates candidates;
};
diff --git a/p2p/base/transportdescriptionfactory.cc b/p2p/base/transportdescriptionfactory.cc
index c8fb0b3..0d6308e 100644
--- a/p2p/base/transportdescriptionfactory.cc
+++ b/p2p/base/transportdescriptionfactory.cc
@@ -27,11 +27,11 @@
#include "talk/p2p/base/transportdescriptionfactory.h"
-#include "talk/base/helpers.h"
-#include "talk/base/logging.h"
-#include "talk/base/messagedigest.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/sslfingerprint.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/messagedigest.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/sslfingerprint.h"
#include "talk/p2p/base/transportdescription.h"
namespace cricket {
@@ -47,7 +47,7 @@
TransportDescription* TransportDescriptionFactory::CreateOffer(
const TransportOptions& options,
const TransportDescription* current_description) const {
- talk_base::scoped_ptr<TransportDescription> desc(new TransportDescription());
+ rtc::scoped_ptr<TransportDescription> desc(new TransportDescription());
// Set the transport type depending on the selected protocol.
if (protocol_ == ICEPROTO_RFC5245) {
@@ -61,8 +61,8 @@
// Generate the ICE credentials if we don't already have them.
if (!current_description || options.ice_restart) {
- desc->ice_ufrag = talk_base::CreateRandomString(ICE_UFRAG_LENGTH);
- desc->ice_pwd = talk_base::CreateRandomString(ICE_PWD_LENGTH);
+ desc->ice_ufrag = rtc::CreateRandomString(ICE_UFRAG_LENGTH);
+ desc->ice_pwd = rtc::CreateRandomString(ICE_PWD_LENGTH);
} else {
desc->ice_ufrag = current_description->ice_ufrag;
desc->ice_pwd = current_description->ice_pwd;
@@ -86,7 +86,7 @@
const TransportDescription* current_description) const {
// A NULL offer is treated as a GICE transport description.
// TODO(juberti): Figure out why we get NULL offers, and fix this upstream.
- talk_base::scoped_ptr<TransportDescription> desc(new TransportDescription());
+ rtc::scoped_ptr<TransportDescription> desc(new TransportDescription());
// Figure out which ICE variant to negotiate; prefer RFC 5245 ICE, but fall
// back to G-ICE if needed. Note that we never create a hybrid answer, since
@@ -114,8 +114,8 @@
// Generate the ICE credentials if we don't already have them or ice is
// being restarted.
if (!current_description || options.ice_restart) {
- desc->ice_ufrag = talk_base::CreateRandomString(ICE_UFRAG_LENGTH);
- desc->ice_pwd = talk_base::CreateRandomString(ICE_PWD_LENGTH);
+ desc->ice_ufrag = rtc::CreateRandomString(ICE_UFRAG_LENGTH);
+ desc->ice_pwd = rtc::CreateRandomString(ICE_PWD_LENGTH);
} else {
desc->ice_ufrag = current_description->ice_ufrag;
desc->ice_pwd = current_description->ice_pwd;
@@ -161,7 +161,7 @@
}
desc->identity_fingerprint.reset(
- talk_base::SSLFingerprint::Create(digest_alg, identity_));
+ rtc::SSLFingerprint::Create(digest_alg, identity_));
if (!desc->identity_fingerprint.get()) {
LOG(LS_ERROR) << "Failed to create identity fingerprint, alg="
<< digest_alg;
diff --git a/p2p/base/transportdescriptionfactory.h b/p2p/base/transportdescriptionfactory.h
index 53dd238..84f25ac 100644
--- a/p2p/base/transportdescriptionfactory.h
+++ b/p2p/base/transportdescriptionfactory.h
@@ -30,7 +30,7 @@
#include "talk/p2p/base/transportdescription.h"
-namespace talk_base {
+namespace rtc {
class SSLIdentity;
}
@@ -51,14 +51,14 @@
TransportDescriptionFactory();
SecurePolicy secure() const { return secure_; }
// The identity to use when setting up DTLS.
- talk_base::SSLIdentity* identity() const { return identity_; }
+ rtc::SSLIdentity* identity() const { return identity_; }
// Specifies the transport protocol to be use.
void set_protocol(TransportProtocol protocol) { protocol_ = protocol; }
// Specifies the transport security policy to use.
void set_secure(SecurePolicy s) { secure_ = s; }
// Specifies the identity to use (only used when secure is not SEC_DISABLED).
- void set_identity(talk_base::SSLIdentity* identity) { identity_ = identity; }
+ void set_identity(rtc::SSLIdentity* identity) { identity_ = identity; }
// Creates a transport description suitable for use in an offer.
TransportDescription* CreateOffer(const TransportOptions& options,
@@ -75,7 +75,7 @@
TransportProtocol protocol_;
SecurePolicy secure_;
- talk_base::SSLIdentity* identity_;
+ rtc::SSLIdentity* identity_;
};
} // namespace cricket
diff --git a/p2p/base/transportdescriptionfactory_unittest.cc b/p2p/base/transportdescriptionfactory_unittest.cc
index 8d9a73f..ade331d 100644
--- a/p2p/base/transportdescriptionfactory_unittest.cc
+++ b/p2p/base/transportdescriptionfactory_unittest.cc
@@ -28,13 +28,13 @@
#include <string>
#include <vector>
-#include "talk/base/fakesslidentity.h"
-#include "talk/base/gunit.h"
+#include "webrtc/base/fakesslidentity.h"
+#include "webrtc/base/gunit.h"
#include "talk/p2p/base/constants.h"
#include "talk/p2p/base/transportdescription.h"
#include "talk/p2p/base/transportdescriptionfactory.h"
-using talk_base::scoped_ptr;
+using rtc::scoped_ptr;
using cricket::TransportDescriptionFactory;
using cricket::TransportDescription;
using cricket::TransportOptions;
@@ -42,8 +42,8 @@
class TransportDescriptionFactoryTest : public testing::Test {
public:
TransportDescriptionFactoryTest()
- : id1_(new talk_base::FakeSSLIdentity("User1")),
- id2_(new talk_base::FakeSSLIdentity("User2")) {
+ : id1_(new rtc::FakeSSLIdentity("User1")),
+ id2_(new rtc::FakeSSLIdentity("User2")) {
}
void CheckDesc(const TransportDescription* desc, const std::string& type,
const std::string& opt, const std::string& ice_ufrag,
@@ -86,22 +86,22 @@
cricket::TransportOptions options;
// The initial offer / answer exchange.
- talk_base::scoped_ptr<TransportDescription> offer(f1_.CreateOffer(
+ rtc::scoped_ptr<TransportDescription> offer(f1_.CreateOffer(
options, NULL));
- talk_base::scoped_ptr<TransportDescription> answer(
+ rtc::scoped_ptr<TransportDescription> answer(
f2_.CreateAnswer(offer.get(),
options, NULL));
// Create an updated offer where we restart ice.
options.ice_restart = true;
- talk_base::scoped_ptr<TransportDescription> restart_offer(f1_.CreateOffer(
+ rtc::scoped_ptr<TransportDescription> restart_offer(f1_.CreateOffer(
options, offer.get()));
VerifyUfragAndPasswordChanged(dtls, offer.get(), restart_offer.get());
// Create a new answer. The transport ufrag and password is changed since
// |options.ice_restart == true|
- talk_base::scoped_ptr<TransportDescription> restart_answer(
+ rtc::scoped_ptr<TransportDescription> restart_answer(
f2_.CreateAnswer(restart_offer.get(), options, answer.get()));
ASSERT_TRUE(restart_answer.get() != NULL);
@@ -129,8 +129,8 @@
protected:
TransportDescriptionFactory f1_;
TransportDescriptionFactory f2_;
- scoped_ptr<talk_base::SSLIdentity> id1_;
- scoped_ptr<talk_base::SSLIdentity> id2_;
+ scoped_ptr<rtc::SSLIdentity> id1_;
+ scoped_ptr<rtc::SSLIdentity> id2_;
};
// Test that in the default case, we generate the expected G-ICE offer.
diff --git a/p2p/base/transportinfo.h b/p2p/base/transportinfo.h
index ad8b6a2..aab022c 100644
--- a/p2p/base/transportinfo.h
+++ b/p2p/base/transportinfo.h
@@ -31,7 +31,7 @@
#include <string>
#include <vector>
-#include "talk/base/helpers.h"
+#include "webrtc/base/helpers.h"
#include "talk/p2p/base/candidate.h"
#include "talk/p2p/base/constants.h"
#include "talk/p2p/base/transportdescription.h"
diff --git a/p2p/base/turnport.cc b/p2p/base/turnport.cc
index 195e970..7255a2b 100644
--- a/p2p/base/turnport.cc
+++ b/p2p/base/turnport.cc
@@ -29,13 +29,13 @@
#include <functional>
-#include "talk/base/asyncpacketsocket.h"
-#include "talk/base/byteorder.h"
-#include "talk/base/common.h"
-#include "talk/base/logging.h"
-#include "talk/base/nethelpers.h"
-#include "talk/base/socketaddress.h"
-#include "talk/base/stringencode.h"
+#include "webrtc/base/asyncpacketsocket.h"
+#include "webrtc/base/byteorder.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/nethelpers.h"
+#include "webrtc/base/socketaddress.h"
+#include "webrtc/base/stringencode.h"
#include "talk/p2p/base/common.h"
#include "talk/p2p/base/stun.h"
@@ -99,7 +99,7 @@
public sigslot::has_slots<> {
public:
TurnCreatePermissionRequest(TurnPort* port, TurnEntry* entry,
- const talk_base::SocketAddress& ext_addr);
+ const rtc::SocketAddress& ext_addr);
virtual void Prepare(StunMessage* request);
virtual void OnResponse(StunMessage* response);
virtual void OnErrorResponse(StunMessage* response);
@@ -110,14 +110,14 @@
TurnPort* port_;
TurnEntry* entry_;
- talk_base::SocketAddress ext_addr_;
+ rtc::SocketAddress ext_addr_;
};
class TurnChannelBindRequest : public StunRequest,
public sigslot::has_slots<> {
public:
TurnChannelBindRequest(TurnPort* port, TurnEntry* entry, int channel_id,
- const talk_base::SocketAddress& ext_addr);
+ const rtc::SocketAddress& ext_addr);
virtual void Prepare(StunMessage* request);
virtual void OnResponse(StunMessage* response);
virtual void OnErrorResponse(StunMessage* response);
@@ -129,7 +129,7 @@
TurnPort* port_;
TurnEntry* entry_;
int channel_id_;
- talk_base::SocketAddress ext_addr_;
+ rtc::SocketAddress ext_addr_;
};
// Manages a "connection" to a remote destination. We will attempt to bring up
@@ -138,12 +138,12 @@
public:
enum BindState { STATE_UNBOUND, STATE_BINDING, STATE_BOUND };
TurnEntry(TurnPort* port, int channel_id,
- const talk_base::SocketAddress& ext_addr);
+ const rtc::SocketAddress& ext_addr);
TurnPort* port() { return port_; }
int channel_id() const { return channel_id_; }
- const talk_base::SocketAddress& address() const { return ext_addr_; }
+ const rtc::SocketAddress& address() const { return ext_addr_; }
BindState state() const { return state_; }
// Helper methods to send permission and channel bind requests.
@@ -152,7 +152,7 @@
// Sends a packet to the given destination address.
// This will wrap the packet in STUN if necessary.
int Send(const void* data, size_t size, bool payload,
- const talk_base::PacketOptions& options);
+ const rtc::PacketOptions& options);
void OnCreatePermissionSuccess();
void OnCreatePermissionError(StunMessage* response, int code);
@@ -164,18 +164,19 @@
private:
TurnPort* port_;
int channel_id_;
- talk_base::SocketAddress ext_addr_;
+ rtc::SocketAddress ext_addr_;
BindState state_;
};
-TurnPort::TurnPort(talk_base::Thread* thread,
- talk_base::PacketSocketFactory* factory,
- talk_base::Network* network,
- talk_base::AsyncPacketSocket* socket,
+TurnPort::TurnPort(rtc::Thread* thread,
+ rtc::PacketSocketFactory* factory,
+ rtc::Network* network,
+ rtc::AsyncPacketSocket* socket,
const std::string& username,
const std::string& password,
const ProtocolAddress& server_address,
- const RelayCredentials& credentials)
+ const RelayCredentials& credentials,
+ int server_priority)
: Port(thread, factory, network, socket->GetLocalAddress().ipaddr(),
username, password),
server_address_(server_address),
@@ -185,19 +186,21 @@
error_(0),
request_manager_(thread),
next_channel_number_(TURN_CHANNEL_NUMBER_START),
- connected_(false) {
+ connected_(false),
+ server_priority_(server_priority) {
request_manager_.SignalSendPacket.connect(this, &TurnPort::OnSendStunPacket);
}
-TurnPort::TurnPort(talk_base::Thread* thread,
- talk_base::PacketSocketFactory* factory,
- talk_base::Network* network,
- const talk_base::IPAddress& ip,
+TurnPort::TurnPort(rtc::Thread* thread,
+ rtc::PacketSocketFactory* factory,
+ rtc::Network* network,
+ const rtc::IPAddress& ip,
int min_port, int max_port,
const std::string& username,
const std::string& password,
const ProtocolAddress& server_address,
- const RelayCredentials& credentials)
+ const RelayCredentials& credentials,
+ int server_priority)
: Port(thread, RELAY_PORT_TYPE, factory, network, ip, min_port, max_port,
username, password),
server_address_(server_address),
@@ -207,7 +210,8 @@
error_(0),
request_manager_(thread),
next_channel_number_(TURN_CHANNEL_NUMBER_START),
- connected_(false) {
+ connected_(false),
+ server_priority_(server_priority) {
request_manager_.SignalSendPacket.connect(this, &TurnPort::OnSendStunPacket);
}
@@ -252,43 +256,9 @@
LOG_J(LS_INFO, this) << "Trying to connect to TURN server via "
<< ProtoToString(server_address_.proto) << " @ "
<< server_address_.address.ToSensitiveString();
- if (server_address_.proto == PROTO_UDP && !SharedSocket()) {
- socket_ = socket_factory()->CreateUdpSocket(
- talk_base::SocketAddress(ip(), 0), min_port(), max_port());
- } else if (server_address_.proto == PROTO_TCP) {
- ASSERT(!SharedSocket());
- int opts = talk_base::PacketSocketFactory::OPT_STUN;
- // If secure bit is enabled in server address, use TLS over TCP.
- if (server_address_.secure) {
- opts |= talk_base::PacketSocketFactory::OPT_TLS;
- }
- socket_ = socket_factory()->CreateClientTcpSocket(
- talk_base::SocketAddress(ip(), 0), server_address_.address,
- proxy(), user_agent(), opts);
- }
-
- if (!socket_) {
+ if (!CreateTurnClientSocket()) {
OnAllocateError();
- return;
- }
-
- // Apply options if any.
- for (SocketOptionsMap::iterator iter = socket_options_.begin();
- iter != socket_options_.end(); ++iter) {
- socket_->SetOption(iter->first, iter->second);
- }
-
- if (!SharedSocket()) {
- // If socket is shared, AllocationSequence will receive the packet.
- socket_->SignalReadPacket.connect(this, &TurnPort::OnReadPacket);
- }
-
- socket_->SignalReadyToSend.connect(this, &TurnPort::OnReadyToSend);
-
- if (server_address_.proto == PROTO_TCP) {
- socket_->SignalConnect.connect(this, &TurnPort::OnSocketConnect);
- socket_->SignalClose.connect(this, &TurnPort::OnSocketClose);
- } else {
+ } else if (server_address_.proto == PROTO_UDP) {
// If its UDP, send AllocateRequest now.
// For TCP and TLS AllcateRequest will be sent by OnSocketConnect.
SendRequest(new TurnAllocateRequest(this), 0);
@@ -296,7 +266,48 @@
}
}
-void TurnPort::OnSocketConnect(talk_base::AsyncPacketSocket* socket) {
+bool TurnPort::CreateTurnClientSocket() {
+ if (server_address_.proto == PROTO_UDP && !SharedSocket()) {
+ socket_ = socket_factory()->CreateUdpSocket(
+ rtc::SocketAddress(ip(), 0), min_port(), max_port());
+ } else if (server_address_.proto == PROTO_TCP) {
+ ASSERT(!SharedSocket());
+ int opts = rtc::PacketSocketFactory::OPT_STUN;
+ // If secure bit is enabled in server address, use TLS over TCP.
+ if (server_address_.secure) {
+ opts |= rtc::PacketSocketFactory::OPT_TLS;
+ }
+ socket_ = socket_factory()->CreateClientTcpSocket(
+ rtc::SocketAddress(ip(), 0), server_address_.address,
+ proxy(), user_agent(), opts);
+ }
+
+ if (!socket_) {
+ error_ = SOCKET_ERROR;
+ return false;
+ }
+
+ // Apply options if any.
+ for (SocketOptionsMap::iterator iter = socket_options_.begin();
+ iter != socket_options_.end(); ++iter) {
+ socket_->SetOption(iter->first, iter->second);
+ }
+
+ if (!SharedSocket()) {
+ // If socket is shared, AllocationSequence will receive the packet.
+ socket_->SignalReadPacket.connect(this, &TurnPort::OnReadPacket);
+ }
+
+ socket_->SignalReadyToSend.connect(this, &TurnPort::OnReadyToSend);
+
+ if (server_address_.proto == PROTO_TCP) {
+ socket_->SignalConnect.connect(this, &TurnPort::OnSocketConnect);
+ socket_->SignalClose.connect(this, &TurnPort::OnSocketClose);
+ }
+ return true;
+}
+
+void TurnPort::OnSocketConnect(rtc::AsyncPacketSocket* socket) {
ASSERT(server_address_.proto == PROTO_TCP);
// Do not use this port if the socket bound to a different address than
// the one we asked for. This is seen in Chrome, where TCP sockets cannot be
@@ -309,12 +320,16 @@
return;
}
+ if (server_address_.address.IsUnresolved()) {
+ server_address_.address = socket_->GetRemoteAddress();
+ }
+
LOG(LS_INFO) << "TurnPort connected to " << socket->GetRemoteAddress()
<< " using tcp.";
SendRequest(new TurnAllocateRequest(this), 0);
}
-void TurnPort::OnSocketClose(talk_base::AsyncPacketSocket* socket, int error) {
+void TurnPort::OnSocketClose(rtc::AsyncPacketSocket* socket, int error) {
LOG_J(LS_WARNING, this) << "Connection with server failed, error=" << error;
if (!connected_) {
OnAllocateError();
@@ -349,7 +364,7 @@
return NULL;
}
-int TurnPort::SetOption(talk_base::Socket::Option opt, int value) {
+int TurnPort::SetOption(rtc::Socket::Option opt, int value) {
if (!socket_) {
// If socket is not created yet, these options will be applied during socket
// creation.
@@ -359,7 +374,7 @@
return socket_->SetOption(opt, value);
}
-int TurnPort::GetOption(talk_base::Socket::Option opt, int* value) {
+int TurnPort::GetOption(rtc::Socket::Option opt, int* value) {
if (!socket_) {
SocketOptionsMap::const_iterator it = socket_options_.find(opt);
if (it == socket_options_.end()) {
@@ -377,8 +392,8 @@
}
int TurnPort::SendTo(const void* data, size_t size,
- const talk_base::SocketAddress& addr,
- const talk_base::PacketOptions& options,
+ const rtc::SocketAddress& addr,
+ const rtc::PacketOptions& options,
bool payload) {
// Try to find an entry for this specific address; we should have one.
TurnEntry* entry = FindEntry(addr);
@@ -404,9 +419,9 @@
}
void TurnPort::OnReadPacket(
- talk_base::AsyncPacketSocket* socket, const char* data, size_t size,
- const talk_base::SocketAddress& remote_addr,
- const talk_base::PacketTime& packet_time) {
+ rtc::AsyncPacketSocket* socket, const char* data, size_t size,
+ const rtc::SocketAddress& remote_addr,
+ const rtc::PacketTime& packet_time) {
ASSERT(socket == socket_);
ASSERT(remote_addr == server_address_.address);
@@ -419,7 +434,7 @@
// Check the message type, to see if is a Channel Data message.
// The message will either be channel data, a TURN data indication, or
// a response to a previous request.
- uint16 msg_type = talk_base::GetBE16(data);
+ uint16 msg_type = rtc::GetBE16(data);
if (IsTurnChannelData(msg_type)) {
HandleChannelData(msg_type, data, size, packet_time);
} else if (msg_type == TURN_DATA_INDICATION) {
@@ -437,13 +452,13 @@
}
}
-void TurnPort::OnReadyToSend(talk_base::AsyncPacketSocket* socket) {
+void TurnPort::OnReadyToSend(rtc::AsyncPacketSocket* socket) {
if (connected_) {
Port::OnReadyToSend();
}
}
-void TurnPort::ResolveTurnAddress(const talk_base::SocketAddress& address) {
+void TurnPort::ResolveTurnAddress(const rtc::SocketAddress& address) {
if (resolver_)
return;
@@ -452,15 +467,27 @@
resolver_->Start(address);
}
-void TurnPort::OnResolveResult(talk_base::AsyncResolverInterface* resolver) {
+void TurnPort::OnResolveResult(rtc::AsyncResolverInterface* resolver) {
ASSERT(resolver == resolver_);
+ // If DNS resolve is failed when trying to connect to the server using TCP,
+ // one of the reason could be due to DNS queries blocked by firewall.
+ // In such cases we will try to connect to the server with hostname, assuming
+ // socket layer will resolve the hostname through a HTTP proxy (if any).
+ if (resolver_->GetError() != 0 && server_address_.proto == PROTO_TCP) {
+ if (!CreateTurnClientSocket()) {
+ OnAllocateError();
+ }
+ return;
+ }
+
// Copy the original server address in |resolved_address|. For TLS based
// sockets we need hostname along with resolved address.
- talk_base::SocketAddress resolved_address = server_address_.address;
+ rtc::SocketAddress resolved_address = server_address_.address;
if (resolver_->GetError() != 0 ||
!resolver_->GetResolvedAddress(ip().family(), &resolved_address)) {
LOG_J(LS_WARNING, this) << "TURN host lookup received error "
<< resolver_->GetError();
+ error_ = resolver_->GetError();
OnAllocateError();
return;
}
@@ -474,14 +501,14 @@
void TurnPort::OnSendStunPacket(const void* data, size_t size,
StunRequest* request) {
- talk_base::PacketOptions options(DefaultDscpValue());
+ rtc::PacketOptions options(DefaultDscpValue());
if (Send(data, size, options) < 0) {
LOG_J(LS_ERROR, this) << "Failed to send TURN message, err="
<< socket_->GetError();
}
}
-void TurnPort::OnStunAddress(const talk_base::SocketAddress& address) {
+void TurnPort::OnStunAddress(const rtc::SocketAddress& address) {
// STUN Port will discover STUN candidate, as it's supplied with first TURN
// server address.
// Why not using this address? - P2PTransportChannel will start creating
@@ -491,8 +518,8 @@
// handle to UDPPort to pass back the address.
}
-void TurnPort::OnAllocateSuccess(const talk_base::SocketAddress& address,
- const talk_base::SocketAddress& stun_address) {
+void TurnPort::OnAllocateSuccess(const rtc::SocketAddress& address,
+ const rtc::SocketAddress& stun_address) {
connected_ = true;
// For relayed candidate, Base is the candidate itself.
AddAddress(address, // Candidate address.
@@ -501,6 +528,7 @@
UDP_PROTOCOL_NAME,
RELAY_PORT_TYPE,
GetRelayPreference(server_address_.proto, server_address_.secure),
+ server_priority_,
true);
}
@@ -511,7 +539,7 @@
thread()->Post(this, MSG_ERROR);
}
-void TurnPort::OnMessage(talk_base::Message* message) {
+void TurnPort::OnMessage(rtc::Message* message) {
if (message->message_id == MSG_ERROR) {
SignalPortError(this);
return;
@@ -525,9 +553,9 @@
}
void TurnPort::HandleDataIndication(const char* data, size_t size,
- const talk_base::PacketTime& packet_time) {
+ const rtc::PacketTime& packet_time) {
// Read in the message, and process according to RFC5766, Section 10.4.
- talk_base::ByteBuffer buf(data, size);
+ rtc::ByteBuffer buf(data, size);
TurnMessage msg;
if (!msg.Read(&buf)) {
LOG_J(LS_WARNING, this) << "Received invalid TURN data indication";
@@ -552,7 +580,7 @@
}
// Verify that the data came from somewhere we think we have a permission for.
- talk_base::SocketAddress ext_addr(addr_attr->GetAddress());
+ rtc::SocketAddress ext_addr(addr_attr->GetAddress());
if (!HasPermission(ext_addr.ipaddr())) {
LOG_J(LS_WARNING, this) << "Received TURN data indication with invalid "
<< "peer address, addr="
@@ -566,7 +594,7 @@
void TurnPort::HandleChannelData(int channel_id, const char* data,
size_t size,
- const talk_base::PacketTime& packet_time) {
+ const rtc::PacketTime& packet_time) {
// Read the message, and process according to RFC5766, Section 11.6.
// 0 1 2 3
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
@@ -582,7 +610,7 @@
// +-------------------------------+
// Extract header fields from the message.
- uint16 len = talk_base::GetBE16(data + 2);
+ uint16 len = rtc::GetBE16(data + 2);
if (len > size - TURN_CHANNEL_HEADER_SIZE) {
LOG_J(LS_WARNING, this) << "Received TURN channel data message with "
<< "incorrect length, len=" << len;
@@ -602,8 +630,8 @@
}
void TurnPort::DispatchPacket(const char* data, size_t size,
- const talk_base::SocketAddress& remote_addr,
- ProtocolType proto, const talk_base::PacketTime& packet_time) {
+ const rtc::SocketAddress& remote_addr,
+ ProtocolType proto, const rtc::PacketTime& packet_time) {
if (Connection* conn = GetConnection(remote_addr)) {
conn->OnReadPacket(data, size, packet_time);
} else {
@@ -640,7 +668,7 @@
}
int TurnPort::Send(const void* data, size_t len,
- const talk_base::PacketOptions& options) {
+ const rtc::PacketOptions& options) {
return socket_->SendTo(data, len, server_address_.address, options);
}
@@ -673,18 +701,18 @@
return true;
}
-static bool MatchesIP(TurnEntry* e, talk_base::IPAddress ipaddr) {
+static bool MatchesIP(TurnEntry* e, rtc::IPAddress ipaddr) {
return e->address().ipaddr() == ipaddr;
}
-bool TurnPort::HasPermission(const talk_base::IPAddress& ipaddr) const {
+bool TurnPort::HasPermission(const rtc::IPAddress& ipaddr) const {
return (std::find_if(entries_.begin(), entries_.end(),
std::bind2nd(std::ptr_fun(MatchesIP), ipaddr)) != entries_.end());
}
-static bool MatchesAddress(TurnEntry* e, talk_base::SocketAddress addr) {
+static bool MatchesAddress(TurnEntry* e, rtc::SocketAddress addr) {
return e->address() == addr;
}
-TurnEntry* TurnPort::FindEntry(const talk_base::SocketAddress& addr) const {
+TurnEntry* TurnPort::FindEntry(const rtc::SocketAddress& addr) const {
EntryList::const_iterator it = std::find_if(entries_.begin(), entries_.end(),
std::bind2nd(std::ptr_fun(MatchesAddress), addr));
return (it != entries_.end()) ? *it : NULL;
@@ -699,14 +727,14 @@
return (it != entries_.end()) ? *it : NULL;
}
-TurnEntry* TurnPort::CreateEntry(const talk_base::SocketAddress& addr) {
+TurnEntry* TurnPort::CreateEntry(const rtc::SocketAddress& addr) {
ASSERT(FindEntry(addr) == NULL);
TurnEntry* entry = new TurnEntry(this, next_channel_number_++, addr);
entries_.push_back(entry);
return entry;
}
-void TurnPort::DestroyEntry(const talk_base::SocketAddress& addr) {
+void TurnPort::DestroyEntry(const rtc::SocketAddress& addr) {
TurnEntry* entry = FindEntry(addr);
ASSERT(entry != NULL);
entry->SignalDestroyed(entry);
@@ -865,7 +893,7 @@
TurnCreatePermissionRequest::TurnCreatePermissionRequest(
TurnPort* port, TurnEntry* entry,
- const talk_base::SocketAddress& ext_addr)
+ const rtc::SocketAddress& ext_addr)
: StunRequest(new TurnMessage()),
port_(port),
entry_(entry),
@@ -906,7 +934,7 @@
TurnChannelBindRequest::TurnChannelBindRequest(
TurnPort* port, TurnEntry* entry,
- int channel_id, const talk_base::SocketAddress& ext_addr)
+ int channel_id, const rtc::SocketAddress& ext_addr)
: StunRequest(new TurnMessage()),
port_(port),
entry_(entry),
@@ -954,7 +982,7 @@
}
TurnEntry::TurnEntry(TurnPort* port, int channel_id,
- const talk_base::SocketAddress& ext_addr)
+ const rtc::SocketAddress& ext_addr)
: port_(port),
channel_id_(channel_id),
ext_addr_(ext_addr),
@@ -974,14 +1002,14 @@
}
int TurnEntry::Send(const void* data, size_t size, bool payload,
- const talk_base::PacketOptions& options) {
- talk_base::ByteBuffer buf;
+ const rtc::PacketOptions& options) {
+ rtc::ByteBuffer buf;
if (state_ != STATE_BOUND) {
// If we haven't bound the channel yet, we have to use a Send Indication.
TurnMessage msg;
msg.SetType(TURN_SEND_INDICATION);
msg.SetTransactionID(
- talk_base::CreateRandomString(kStunTransactionIdLength));
+ rtc::CreateRandomString(kStunTransactionIdLength));
VERIFY(msg.AddAttribute(new StunXorAddressAttribute(
STUN_ATTR_XOR_PEER_ADDRESS, ext_addr_)));
VERIFY(msg.AddAttribute(new StunByteStringAttribute(
diff --git a/p2p/base/turnport.h b/p2p/base/turnport.h
index 2f5e8c4..d58e75d 100644
--- a/p2p/base/turnport.h
+++ b/p2p/base/turnport.h
@@ -32,11 +32,11 @@
#include <string>
#include <list>
-#include "talk/base/asyncpacketsocket.h"
+#include "webrtc/base/asyncpacketsocket.h"
#include "talk/p2p/base/port.h"
#include "talk/p2p/client/basicportallocator.h"
-namespace talk_base {
+namespace rtc {
class AsyncResolver;
class SignalThread;
}
@@ -49,29 +49,33 @@
class TurnPort : public Port {
public:
- static TurnPort* Create(talk_base::Thread* thread,
- talk_base::PacketSocketFactory* factory,
- talk_base::Network* network,
- talk_base::AsyncPacketSocket* socket,
+ static TurnPort* Create(rtc::Thread* thread,
+ rtc::PacketSocketFactory* factory,
+ rtc::Network* network,
+ rtc::AsyncPacketSocket* socket,
const std::string& username, // ice username.
const std::string& password, // ice password.
const ProtocolAddress& server_address,
- const RelayCredentials& credentials) {
+ const RelayCredentials& credentials,
+ int server_priority) {
return new TurnPort(thread, factory, network, socket,
- username, password, server_address, credentials);
+ username, password, server_address,
+ credentials, server_priority);
}
- static TurnPort* Create(talk_base::Thread* thread,
- talk_base::PacketSocketFactory* factory,
- talk_base::Network* network,
- const talk_base::IPAddress& ip,
+ static TurnPort* Create(rtc::Thread* thread,
+ rtc::PacketSocketFactory* factory,
+ rtc::Network* network,
+ const rtc::IPAddress& ip,
int min_port, int max_port,
const std::string& username, // ice username.
const std::string& password, // ice password.
const ProtocolAddress& server_address,
- const RelayCredentials& credentials) {
+ const RelayCredentials& credentials,
+ int server_priority) {
return new TurnPort(thread, factory, network, ip, min_port, max_port,
- username, password, server_address, credentials);
+ username, password, server_address, credentials,
+ server_priority);
}
virtual ~TurnPort();
@@ -85,72 +89,78 @@
virtual Connection* CreateConnection(
const Candidate& c, PortInterface::CandidateOrigin origin);
virtual int SendTo(const void* data, size_t size,
- const talk_base::SocketAddress& addr,
- const talk_base::PacketOptions& options,
+ const rtc::SocketAddress& addr,
+ const rtc::PacketOptions& options,
bool payload);
- virtual int SetOption(talk_base::Socket::Option opt, int value);
- virtual int GetOption(talk_base::Socket::Option opt, int* value);
+ virtual int SetOption(rtc::Socket::Option opt, int value);
+ virtual int GetOption(rtc::Socket::Option opt, int* value);
virtual int GetError();
virtual bool HandleIncomingPacket(
- talk_base::AsyncPacketSocket* socket, const char* data, size_t size,
- const talk_base::SocketAddress& remote_addr,
- const talk_base::PacketTime& packet_time) {
+ rtc::AsyncPacketSocket* socket, const char* data, size_t size,
+ const rtc::SocketAddress& remote_addr,
+ const rtc::PacketTime& packet_time) {
OnReadPacket(socket, data, size, remote_addr, packet_time);
return true;
}
- virtual void OnReadPacket(talk_base::AsyncPacketSocket* socket,
+ virtual void OnReadPacket(rtc::AsyncPacketSocket* socket,
const char* data, size_t size,
- const talk_base::SocketAddress& remote_addr,
- const talk_base::PacketTime& packet_time);
+ const rtc::SocketAddress& remote_addr,
+ const rtc::PacketTime& packet_time);
- virtual void OnReadyToSend(talk_base::AsyncPacketSocket* socket);
+ virtual void OnReadyToSend(rtc::AsyncPacketSocket* socket);
- void OnSocketConnect(talk_base::AsyncPacketSocket* socket);
- void OnSocketClose(talk_base::AsyncPacketSocket* socket, int error);
+ void OnSocketConnect(rtc::AsyncPacketSocket* socket);
+ void OnSocketClose(rtc::AsyncPacketSocket* socket, int error);
const std::string& hash() const { return hash_; }
const std::string& nonce() const { return nonce_; }
+ int error() const { return error_; }
+
// Signal with resolved server address.
// Parameters are port, server address and resolved server address.
// This signal will be sent only if server address is resolved successfully.
sigslot::signal3<TurnPort*,
- const talk_base::SocketAddress&,
- const talk_base::SocketAddress&> SignalResolvedServerAddress;
+ const rtc::SocketAddress&,
+ const rtc::SocketAddress&> SignalResolvedServerAddress;
// This signal is only for testing purpose.
- sigslot::signal3<TurnPort*, const talk_base::SocketAddress&, int>
+ sigslot::signal3<TurnPort*, const rtc::SocketAddress&, int>
SignalCreatePermissionResult;
protected:
- TurnPort(talk_base::Thread* thread,
- talk_base::PacketSocketFactory* factory,
- talk_base::Network* network,
- talk_base::AsyncPacketSocket* socket,
+ TurnPort(rtc::Thread* thread,
+ rtc::PacketSocketFactory* factory,
+ rtc::Network* network,
+ rtc::AsyncPacketSocket* socket,
const std::string& username,
const std::string& password,
const ProtocolAddress& server_address,
- const RelayCredentials& credentials);
+ const RelayCredentials& credentials,
+ int server_priority);
- TurnPort(talk_base::Thread* thread,
- talk_base::PacketSocketFactory* factory,
- talk_base::Network* network,
- const talk_base::IPAddress& ip,
+ TurnPort(rtc::Thread* thread,
+ rtc::PacketSocketFactory* factory,
+ rtc::Network* network,
+ const rtc::IPAddress& ip,
int min_port, int max_port,
const std::string& username,
const std::string& password,
const ProtocolAddress& server_address,
- const RelayCredentials& credentials);
+ const RelayCredentials& credentials,
+ int server_priority);
private:
enum { MSG_ERROR = MSG_FIRST_AVAILABLE };
typedef std::list<TurnEntry*> EntryList;
- typedef std::map<talk_base::Socket::Option, int> SocketOptionsMap;
+ typedef std::map<rtc::Socket::Option, int> SocketOptionsMap;
- virtual void OnMessage(talk_base::Message* pmsg);
+ virtual void OnMessage(rtc::Message* pmsg);
+
+ bool CreateTurnClientSocket();
void set_nonce(const std::string& nonce) { nonce_ = nonce; }
void set_realm(const std::string& realm) {
@@ -160,47 +170,47 @@
}
}
- void ResolveTurnAddress(const talk_base::SocketAddress& address);
- void OnResolveResult(talk_base::AsyncResolverInterface* resolver);
+ void ResolveTurnAddress(const rtc::SocketAddress& address);
+ void OnResolveResult(rtc::AsyncResolverInterface* resolver);
void AddRequestAuthInfo(StunMessage* msg);
void OnSendStunPacket(const void* data, size_t size, StunRequest* request);
// Stun address from allocate success response.
// Currently used only for testing.
- void OnStunAddress(const talk_base::SocketAddress& address);
- void OnAllocateSuccess(const talk_base::SocketAddress& address,
- const talk_base::SocketAddress& stun_address);
+ void OnStunAddress(const rtc::SocketAddress& address);
+ void OnAllocateSuccess(const rtc::SocketAddress& address,
+ const rtc::SocketAddress& stun_address);
void OnAllocateError();
void OnAllocateRequestTimeout();
void HandleDataIndication(const char* data, size_t size,
- const talk_base::PacketTime& packet_time);
+ const rtc::PacketTime& packet_time);
void HandleChannelData(int channel_id, const char* data, size_t size,
- const talk_base::PacketTime& packet_time);
+ const rtc::PacketTime& packet_time);
void DispatchPacket(const char* data, size_t size,
- const talk_base::SocketAddress& remote_addr,
- ProtocolType proto, const talk_base::PacketTime& packet_time);
+ const rtc::SocketAddress& remote_addr,
+ ProtocolType proto, const rtc::PacketTime& packet_time);
bool ScheduleRefresh(int lifetime);
void SendRequest(StunRequest* request, int delay);
int Send(const void* data, size_t size,
- const talk_base::PacketOptions& options);
+ const rtc::PacketOptions& options);
void UpdateHash();
bool UpdateNonce(StunMessage* response);
- bool HasPermission(const talk_base::IPAddress& ipaddr) const;
- TurnEntry* FindEntry(const talk_base::SocketAddress& address) const;
+ bool HasPermission(const rtc::IPAddress& ipaddr) const;
+ TurnEntry* FindEntry(const rtc::SocketAddress& address) const;
TurnEntry* FindEntry(int channel_id) const;
- TurnEntry* CreateEntry(const talk_base::SocketAddress& address);
- void DestroyEntry(const talk_base::SocketAddress& address);
+ TurnEntry* CreateEntry(const rtc::SocketAddress& address);
+ void DestroyEntry(const rtc::SocketAddress& address);
void OnConnectionDestroyed(Connection* conn);
ProtocolAddress server_address_;
RelayCredentials credentials_;
- talk_base::AsyncPacketSocket* socket_;
+ rtc::AsyncPacketSocket* socket_;
SocketOptionsMap socket_options_;
- talk_base::AsyncResolverInterface* resolver_;
+ rtc::AsyncResolverInterface* resolver_;
int error_;
StunRequestManager request_manager_;
@@ -212,6 +222,9 @@
EntryList entries_;
bool connected_;
+ // By default the value will be set to 0. This value will be used in
+ // calculating the candidate priority.
+ int server_priority_;
friend class TurnEntry;
friend class TurnAllocateRequest;
diff --git a/p2p/base/turnport_unittest.cc b/p2p/base/turnport_unittest.cc
index 12a19aa..99bd598 100644
--- a/p2p/base/turnport_unittest.cc
+++ b/p2p/base/turnport_unittest.cc
@@ -28,18 +28,19 @@
#include <dirent.h>
#endif
-#include "talk/base/asynctcpsocket.h"
-#include "talk/base/buffer.h"
-#include "talk/base/dscp.h"
-#include "talk/base/firewallsocketserver.h"
-#include "talk/base/logging.h"
-#include "talk/base/gunit.h"
-#include "talk/base/helpers.h"
-#include "talk/base/physicalsocketserver.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/socketaddress.h"
-#include "talk/base/thread.h"
-#include "talk/base/virtualsocketserver.h"
+#include "webrtc/base/asynctcpsocket.h"
+#include "webrtc/base/buffer.h"
+#include "webrtc/base/dscp.h"
+#include "webrtc/base/firewallsocketserver.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/physicalsocketserver.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/socketaddress.h"
+#include "webrtc/base/ssladapter.h"
+#include "webrtc/base/thread.h"
+#include "webrtc/base/virtualsocketserver.h"
#include "talk/p2p/base/basicpacketsocketfactory.h"
#include "talk/p2p/base/constants.h"
#include "talk/p2p/base/tcpport.h"
@@ -47,7 +48,7 @@
#include "talk/p2p/base/turnport.h"
#include "talk/p2p/base/udpport.h"
-using talk_base::SocketAddress;
+using rtc::SocketAddress;
using cricket::Connection;
using cricket::Port;
using cricket::PortInterface;
@@ -102,15 +103,15 @@
class TurnPortTest : public testing::Test,
public sigslot::has_slots<>,
- public talk_base::MessageHandler {
+ public rtc::MessageHandler {
public:
TurnPortTest()
- : main_(talk_base::Thread::Current()),
- pss_(new talk_base::PhysicalSocketServer),
- ss_(new talk_base::VirtualSocketServer(pss_.get())),
+ : main_(rtc::Thread::Current()),
+ pss_(new rtc::PhysicalSocketServer),
+ ss_(new rtc::VirtualSocketServer(pss_.get())),
ss_scope_(ss_.get()),
- network_("unittest", "unittest", talk_base::IPAddress(INADDR_ANY), 32),
- socket_factory_(talk_base::Thread::Current()),
+ network_("unittest", "unittest", rtc::IPAddress(INADDR_ANY), 32),
+ socket_factory_(rtc::Thread::Current()),
turn_server_(main_, kTurnUdpIntAddr, kTurnUdpExtAddr),
turn_ready_(false),
turn_error_(false),
@@ -118,10 +119,18 @@
turn_create_permission_success_(false),
udp_ready_(false),
test_finish_(false) {
- network_.AddIP(talk_base::IPAddress(INADDR_ANY));
+ network_.AddIP(rtc::IPAddress(INADDR_ANY));
}
- virtual void OnMessage(talk_base::Message* msg) {
+ static void SetUpTestCase() {
+ rtc::InitializeSSL();
+ }
+
+ static void TearDownTestCase() {
+ rtc::CleanupSSL();
+ }
+
+ virtual void OnMessage(rtc::Message* msg) {
ASSERT(msg->message_id == MSG_TESTFINISH);
if (msg->message_id == MSG_TESTFINISH)
test_finish_ = true;
@@ -147,25 +156,25 @@
}
}
void OnTurnReadPacket(Connection* conn, const char* data, size_t size,
- const talk_base::PacketTime& packet_time) {
- turn_packets_.push_back(talk_base::Buffer(data, size));
+ const rtc::PacketTime& packet_time) {
+ turn_packets_.push_back(rtc::Buffer(data, size));
}
void OnUdpPortComplete(Port* port) {
udp_ready_ = true;
}
void OnUdpReadPacket(Connection* conn, const char* data, size_t size,
- const talk_base::PacketTime& packet_time) {
- udp_packets_.push_back(talk_base::Buffer(data, size));
+ const rtc::PacketTime& packet_time) {
+ udp_packets_.push_back(rtc::Buffer(data, size));
}
- void OnSocketReadPacket(talk_base::AsyncPacketSocket* socket,
+ void OnSocketReadPacket(rtc::AsyncPacketSocket* socket,
const char* data, size_t size,
- const talk_base::SocketAddress& remote_addr,
- const talk_base::PacketTime& packet_time) {
+ const rtc::SocketAddress& remote_addr,
+ const rtc::PacketTime& packet_time) {
turn_port_->HandleIncomingPacket(socket, data, size, remote_addr,
packet_time);
}
- talk_base::AsyncSocket* CreateServerSocket(const SocketAddress addr) {
- talk_base::AsyncSocket* socket = ss_->CreateAsyncSocket(SOCK_STREAM);
+ rtc::AsyncSocket* CreateServerSocket(const SocketAddress addr) {
+ rtc::AsyncSocket* socket = ss_->CreateAsyncSocket(SOCK_STREAM);
EXPECT_GE(socket->Bind(addr), 0);
EXPECT_GE(socket->Listen(5), 0);
return socket;
@@ -176,7 +185,7 @@
const cricket::ProtocolAddress& server_address) {
CreateTurnPort(kLocalAddr1, username, password, server_address);
}
- void CreateTurnPort(const talk_base::SocketAddress& local_address,
+ void CreateTurnPort(const rtc::SocketAddress& local_address,
const std::string& username,
const std::string& password,
const cricket::ProtocolAddress& server_address) {
@@ -184,7 +193,7 @@
turn_port_.reset(TurnPort::Create(main_, &socket_factory_, &network_,
local_address.ipaddr(), 0, 0,
kIceUfrag1, kIcePwd1,
- server_address, credentials));
+ server_address, credentials, 0));
// Set ICE protocol type to ICEPROTO_RFC5245, as port by default will be
// in Hybrid mode. Protocol type is necessary to send correct type STUN ping
// messages.
@@ -200,14 +209,14 @@
ASSERT(server_address.proto == cricket::PROTO_UDP);
socket_.reset(socket_factory_.CreateUdpSocket(
- talk_base::SocketAddress(kLocalAddr1.ipaddr(), 0), 0, 0));
+ rtc::SocketAddress(kLocalAddr1.ipaddr(), 0), 0, 0));
ASSERT_TRUE(socket_ != NULL);
socket_->SignalReadPacket.connect(this, &TurnPortTest::OnSocketReadPacket);
cricket::RelayCredentials credentials(username, password);
turn_port_.reset(cricket::TurnPort::Create(
main_, &socket_factory_, &network_, socket_.get(),
- kIceUfrag1, kIcePwd1, server_address, credentials));
+ kIceUfrag1, kIcePwd1, server_address, credentials, 0));
// Set ICE protocol type to ICEPROTO_RFC5245, as port by default will be
// in Hybrid mode. Protocol type is necessary to send correct type STUN ping
// messages.
@@ -301,9 +310,9 @@
// Send some data.
size_t num_packets = 256;
for (size_t i = 0; i < num_packets; ++i) {
- char buf[256];
+ unsigned char buf[256] = { 0 };
for (size_t j = 0; j < i + 1; ++j) {
- buf[j] = 0xFF - j;
+ buf[j] = 0xFF - static_cast<unsigned char>(j);
}
conn1->Send(buf, i + 1, options);
conn2->Send(buf, i + 1, options);
@@ -321,31 +330,31 @@
}
protected:
- talk_base::Thread* main_;
- talk_base::scoped_ptr<talk_base::PhysicalSocketServer> pss_;
- talk_base::scoped_ptr<talk_base::VirtualSocketServer> ss_;
- talk_base::SocketServerScope ss_scope_;
- talk_base::Network network_;
- talk_base::BasicPacketSocketFactory socket_factory_;
- talk_base::scoped_ptr<talk_base::AsyncPacketSocket> socket_;
+ rtc::Thread* main_;
+ rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_;
+ rtc::scoped_ptr<rtc::VirtualSocketServer> ss_;
+ rtc::SocketServerScope ss_scope_;
+ rtc::Network network_;
+ rtc::BasicPacketSocketFactory socket_factory_;
+ rtc::scoped_ptr<rtc::AsyncPacketSocket> socket_;
cricket::TestTurnServer turn_server_;
- talk_base::scoped_ptr<TurnPort> turn_port_;
- talk_base::scoped_ptr<UDPPort> udp_port_;
+ rtc::scoped_ptr<TurnPort> turn_port_;
+ rtc::scoped_ptr<UDPPort> udp_port_;
bool turn_ready_;
bool turn_error_;
bool turn_unknown_address_;
bool turn_create_permission_success_;
bool udp_ready_;
bool test_finish_;
- std::vector<talk_base::Buffer> turn_packets_;
- std::vector<talk_base::Buffer> udp_packets_;
- talk_base::PacketOptions options;
+ std::vector<rtc::Buffer> turn_packets_;
+ std::vector<rtc::Buffer> udp_packets_;
+ rtc::PacketOptions options;
};
// Do a normal TURN allocation.
TEST_F(TurnPortTest, TestTurnAllocate) {
CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr);
- EXPECT_EQ(0, turn_port_->SetOption(talk_base::Socket::OPT_SNDBUF, 10*1024));
+ EXPECT_EQ(0, turn_port_->SetOption(rtc::Socket::OPT_SNDBUF, 10*1024));
turn_port_->PrepareAddress();
EXPECT_TRUE_WAIT(turn_ready_, kTimeout);
ASSERT_EQ(1U, turn_port_->Candidates().size());
@@ -354,10 +363,11 @@
EXPECT_NE(0, turn_port_->Candidates()[0].address().port());
}
+// Testing a normal UDP allocation using TCP connection.
TEST_F(TurnPortTest, TestTurnTcpAllocate) {
turn_server_.AddInternalSocket(kTurnTcpIntAddr, cricket::PROTO_TCP);
CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTcpProtoAddr);
- EXPECT_EQ(0, turn_port_->SetOption(talk_base::Socket::OPT_SNDBUF, 10*1024));
+ EXPECT_EQ(0, turn_port_->SetOption(rtc::Socket::OPT_SNDBUF, 10*1024));
turn_port_->PrepareAddress();
EXPECT_TRUE_WAIT(turn_ready_, kTimeout);
ASSERT_EQ(1U, turn_port_->Candidates().size());
@@ -366,6 +376,33 @@
EXPECT_NE(0, turn_port_->Candidates()[0].address().port());
}
+// Testing turn port will attempt to create TCP socket on address resolution
+// failure.
+TEST_F(TurnPortTest, TestTurnTcpOnAddressResolveFailure) {
+ turn_server_.AddInternalSocket(kTurnTcpIntAddr, cricket::PROTO_TCP);
+ CreateTurnPort(kTurnUsername, kTurnPassword, cricket::ProtocolAddress(
+ rtc::SocketAddress("www.webrtc-blah-blah.com", 3478),
+ cricket::PROTO_TCP));
+ turn_port_->PrepareAddress();
+ EXPECT_TRUE_WAIT(turn_error_, kTimeout);
+ // As VSS doesn't provide a DNS resolution, name resolve will fail. TurnPort
+ // will proceed in creating a TCP socket which will fail as there is no
+ // server on the above domain and error will be set to SOCKET_ERROR.
+ EXPECT_EQ(SOCKET_ERROR, turn_port_->error());
+}
+
+// In case of UDP on address resolve failure, TurnPort will not create socket
+// and return allocate failure.
+TEST_F(TurnPortTest, TestTurnUdpOnAdressResolveFailure) {
+ CreateTurnPort(kTurnUsername, kTurnPassword, cricket::ProtocolAddress(
+ rtc::SocketAddress("www.webrtc-blah-blah.com", 3478),
+ cricket::PROTO_UDP));
+ turn_port_->PrepareAddress();
+ EXPECT_TRUE_WAIT(turn_error_, kTimeout);
+ // Error from turn port will not be socket error.
+ EXPECT_NE(SOCKET_ERROR, turn_port_->error());
+}
+
// Try to do a TURN allocation with an invalid password.
TEST_F(TurnPortTest, TestTurnAllocateBadPassword) {
CreateTurnPort(kTurnUsername, "bad", kTurnUdpProtoAddr);
@@ -466,13 +503,13 @@
int last_fd_count = GetFDCount();
// Need to supply unresolved address to kick off resolver.
CreateTurnPort(kLocalIPv6Addr, kTurnUsername, kTurnPassword,
- cricket::ProtocolAddress(talk_base::SocketAddress(
+ cricket::ProtocolAddress(rtc::SocketAddress(
"stun.l.google.com", 3478), cricket::PROTO_UDP));
turn_port_->PrepareAddress();
ASSERT_TRUE_WAIT(turn_error_, kTimeout);
EXPECT_TRUE(turn_port_->Candidates().empty());
turn_port_.reset();
- talk_base::Thread::Current()->Post(this, MSG_TESTFINISH);
+ rtc::Thread::Current()->Post(this, MSG_TESTFINISH);
// Waiting for above message to be processed.
ASSERT_TRUE_WAIT(test_finish_, kTimeout);
EXPECT_EQ(last_fd_count, GetFDCount());
diff --git a/p2p/base/turnserver.cc b/p2p/base/turnserver.cc
index 4d7f39e..a6cafe0 100644
--- a/p2p/base/turnserver.cc
+++ b/p2p/base/turnserver.cc
@@ -27,13 +27,13 @@
#include "talk/p2p/base/turnserver.h"
-#include "talk/base/bytebuffer.h"
-#include "talk/base/helpers.h"
-#include "talk/base/logging.h"
-#include "talk/base/messagedigest.h"
-#include "talk/base/socketadapters.h"
-#include "talk/base/stringencode.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/bytebuffer.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/messagedigest.h"
+#include "webrtc/base/socketadapters.h"
+#include "webrtc/base/stringencode.h"
+#include "webrtc/base/thread.h"
#include "talk/p2p/base/asyncstuntcpsocket.h"
#include "talk/p2p/base/common.h"
#include "talk/p2p/base/packetsocketfactory.h"
@@ -72,12 +72,12 @@
// handles TURN messages (via HandleTurnMessage) and channel data messages
// (via HandleChannelData) for this allocation when received by the server.
// The object self-deletes and informs the server if its lifetime timer expires.
-class TurnServer::Allocation : public talk_base::MessageHandler,
+class TurnServer::Allocation : public rtc::MessageHandler,
public sigslot::has_slots<> {
public:
Allocation(TurnServer* server_,
- talk_base::Thread* thread, const Connection& conn,
- talk_base::AsyncPacketSocket* server_socket,
+ rtc::Thread* thread, const Connection& conn,
+ rtc::AsyncPacketSocket* server_socket,
const std::string& key);
virtual ~Allocation();
@@ -105,33 +105,33 @@
void HandleCreatePermissionRequest(const TurnMessage* msg);
void HandleChannelBindRequest(const TurnMessage* msg);
- void OnExternalPacket(talk_base::AsyncPacketSocket* socket,
+ void OnExternalPacket(rtc::AsyncPacketSocket* socket,
const char* data, size_t size,
- const talk_base::SocketAddress& addr,
- const talk_base::PacketTime& packet_time);
+ const rtc::SocketAddress& addr,
+ const rtc::PacketTime& packet_time);
static int ComputeLifetime(const TurnMessage* msg);
- bool HasPermission(const talk_base::IPAddress& addr);
- void AddPermission(const talk_base::IPAddress& addr);
- Permission* FindPermission(const talk_base::IPAddress& addr) const;
+ bool HasPermission(const rtc::IPAddress& addr);
+ void AddPermission(const rtc::IPAddress& addr);
+ Permission* FindPermission(const rtc::IPAddress& addr) const;
Channel* FindChannel(int channel_id) const;
- Channel* FindChannel(const talk_base::SocketAddress& addr) const;
+ Channel* FindChannel(const rtc::SocketAddress& addr) const;
void SendResponse(TurnMessage* msg);
void SendBadRequestResponse(const TurnMessage* req);
void SendErrorResponse(const TurnMessage* req, int code,
const std::string& reason);
void SendExternal(const void* data, size_t size,
- const talk_base::SocketAddress& peer);
+ const rtc::SocketAddress& peer);
void OnPermissionDestroyed(Permission* perm);
void OnChannelDestroyed(Channel* channel);
- virtual void OnMessage(talk_base::Message* msg);
+ virtual void OnMessage(rtc::Message* msg);
TurnServer* server_;
- talk_base::Thread* thread_;
+ rtc::Thread* thread_;
Connection conn_;
- talk_base::scoped_ptr<talk_base::AsyncPacketSocket> external_socket_;
+ rtc::scoped_ptr<rtc::AsyncPacketSocket> external_socket_;
std::string key_;
std::string transaction_id_;
std::string username_;
@@ -143,44 +143,44 @@
// Encapsulates a TURN permission.
// The object is created when a create permission request is received by an
// allocation, and self-deletes when its lifetime timer expires.
-class TurnServer::Permission : public talk_base::MessageHandler {
+class TurnServer::Permission : public rtc::MessageHandler {
public:
- Permission(talk_base::Thread* thread, const talk_base::IPAddress& peer);
+ Permission(rtc::Thread* thread, const rtc::IPAddress& peer);
~Permission();
- const talk_base::IPAddress& peer() const { return peer_; }
+ const rtc::IPAddress& peer() const { return peer_; }
void Refresh();
sigslot::signal1<Permission*> SignalDestroyed;
private:
- virtual void OnMessage(talk_base::Message* msg);
+ virtual void OnMessage(rtc::Message* msg);
- talk_base::Thread* thread_;
- talk_base::IPAddress peer_;
+ rtc::Thread* thread_;
+ rtc::IPAddress peer_;
};
// Encapsulates a TURN channel binding.
// The object is created when a channel bind request is received by an
// allocation, and self-deletes when its lifetime timer expires.
-class TurnServer::Channel : public talk_base::MessageHandler {
+class TurnServer::Channel : public rtc::MessageHandler {
public:
- Channel(talk_base::Thread* thread, int id,
- const talk_base::SocketAddress& peer);
+ Channel(rtc::Thread* thread, int id,
+ const rtc::SocketAddress& peer);
~Channel();
int id() const { return id_; }
- const talk_base::SocketAddress& peer() const { return peer_; }
+ const rtc::SocketAddress& peer() const { return peer_; }
void Refresh();
sigslot::signal1<Channel*> SignalDestroyed;
private:
- virtual void OnMessage(talk_base::Message* msg);
+ virtual void OnMessage(rtc::Message* msg);
- talk_base::Thread* thread_;
+ rtc::Thread* thread_;
int id_;
- talk_base::SocketAddress peer_;
+ rtc::SocketAddress peer_;
};
static bool InitResponse(const StunMessage* req, StunMessage* resp) {
@@ -204,9 +204,9 @@
return true;
}
-TurnServer::TurnServer(talk_base::Thread* thread)
+TurnServer::TurnServer(rtc::Thread* thread)
: thread_(thread),
- nonce_key_(talk_base::CreateRandomString(kNonceKeySize)),
+ nonce_key_(rtc::CreateRandomString(kNonceKeySize)),
auth_hook_(NULL),
enable_otu_nonce_(false) {
}
@@ -219,25 +219,25 @@
for (InternalSocketMap::iterator it = server_sockets_.begin();
it != server_sockets_.end(); ++it) {
- talk_base::AsyncPacketSocket* socket = it->first;
+ rtc::AsyncPacketSocket* socket = it->first;
delete socket;
}
for (ServerSocketMap::iterator it = server_listen_sockets_.begin();
it != server_listen_sockets_.end(); ++it) {
- talk_base::AsyncSocket* socket = it->first;
+ rtc::AsyncSocket* socket = it->first;
delete socket;
}
}
-void TurnServer::AddInternalSocket(talk_base::AsyncPacketSocket* socket,
+void TurnServer::AddInternalSocket(rtc::AsyncPacketSocket* socket,
ProtocolType proto) {
ASSERT(server_sockets_.end() == server_sockets_.find(socket));
server_sockets_[socket] = proto;
socket->SignalReadPacket.connect(this, &TurnServer::OnInternalPacket);
}
-void TurnServer::AddInternalServerSocket(talk_base::AsyncSocket* socket,
+void TurnServer::AddInternalServerSocket(rtc::AsyncSocket* socket,
ProtocolType proto) {
ASSERT(server_listen_sockets_.end() ==
server_listen_sockets_.find(socket));
@@ -246,21 +246,21 @@
}
void TurnServer::SetExternalSocketFactory(
- talk_base::PacketSocketFactory* factory,
- const talk_base::SocketAddress& external_addr) {
+ rtc::PacketSocketFactory* factory,
+ const rtc::SocketAddress& external_addr) {
external_socket_factory_.reset(factory);
external_addr_ = external_addr;
}
-void TurnServer::OnNewInternalConnection(talk_base::AsyncSocket* socket) {
+void TurnServer::OnNewInternalConnection(rtc::AsyncSocket* socket) {
ASSERT(server_listen_sockets_.find(socket) != server_listen_sockets_.end());
AcceptConnection(socket);
}
-void TurnServer::AcceptConnection(talk_base::AsyncSocket* server_socket) {
+void TurnServer::AcceptConnection(rtc::AsyncSocket* server_socket) {
// Check if someone is trying to connect to us.
- talk_base::SocketAddress accept_addr;
- talk_base::AsyncSocket* accepted_socket = server_socket->Accept(&accept_addr);
+ rtc::SocketAddress accept_addr;
+ rtc::AsyncSocket* accepted_socket = server_socket->Accept(&accept_addr);
if (accepted_socket != NULL) {
ProtocolType proto = server_listen_sockets_[server_socket];
cricket::AsyncStunTCPSocket* tcp_socket =
@@ -272,15 +272,15 @@
}
}
-void TurnServer::OnInternalSocketClose(talk_base::AsyncPacketSocket* socket,
+void TurnServer::OnInternalSocketClose(rtc::AsyncPacketSocket* socket,
int err) {
DestroyInternalSocket(socket);
}
-void TurnServer::OnInternalPacket(talk_base::AsyncPacketSocket* socket,
+void TurnServer::OnInternalPacket(rtc::AsyncPacketSocket* socket,
const char* data, size_t size,
- const talk_base::SocketAddress& addr,
- const talk_base::PacketTime& packet_time) {
+ const rtc::SocketAddress& addr,
+ const rtc::PacketTime& packet_time) {
// Fail if the packet is too small to even contain a channel header.
if (size < TURN_CHANNEL_HEADER_SIZE) {
return;
@@ -288,7 +288,7 @@
InternalSocketMap::iterator iter = server_sockets_.find(socket);
ASSERT(iter != server_sockets_.end());
Connection conn(addr, iter->second, socket);
- uint16 msg_type = talk_base::GetBE16(data);
+ uint16 msg_type = rtc::GetBE16(data);
if (!IsTurnChannelData(msg_type)) {
// This is a STUN message.
HandleStunMessage(&conn, data, size);
@@ -304,7 +304,7 @@
void TurnServer::HandleStunMessage(Connection* conn, const char* data,
size_t size) {
TurnMessage msg;
- talk_base::ByteBuffer buf(data, size);
+ rtc::ByteBuffer buf(data, size);
if (!msg.Read(&buf) || (buf.Length() > 0)) {
LOG(LS_WARNING) << "Received invalid STUN message";
return;
@@ -474,10 +474,10 @@
std::string TurnServer::GenerateNonce() const {
// Generate a nonce of the form hex(now + HMAC-MD5(nonce_key_, now))
- uint32 now = talk_base::Time();
+ uint32 now = rtc::Time();
std::string input(reinterpret_cast<const char*>(&now), sizeof(now));
- std::string nonce = talk_base::hex_encode(input.c_str(), input.size());
- nonce += talk_base::ComputeHmac(talk_base::DIGEST_MD5, nonce_key_, input);
+ std::string nonce = rtc::hex_encode(input.c_str(), input.size());
+ nonce += rtc::ComputeHmac(rtc::DIGEST_MD5, nonce_key_, input);
ASSERT(nonce.size() == kNonceSize);
return nonce;
}
@@ -491,20 +491,20 @@
// Decode the timestamp.
uint32 then;
char* p = reinterpret_cast<char*>(&then);
- size_t len = talk_base::hex_decode(p, sizeof(then),
+ size_t len = rtc::hex_decode(p, sizeof(then),
nonce.substr(0, sizeof(then) * 2));
if (len != sizeof(then)) {
return false;
}
// Verify the HMAC.
- if (nonce.substr(sizeof(then) * 2) != talk_base::ComputeHmac(
- talk_base::DIGEST_MD5, nonce_key_, std::string(p, sizeof(then)))) {
+ if (nonce.substr(sizeof(then) * 2) != rtc::ComputeHmac(
+ rtc::DIGEST_MD5, nonce_key_, std::string(p, sizeof(then)))) {
return false;
}
// Validate the timestamp.
- return talk_base::TimeSince(then) < kNonceTimeout;
+ return rtc::TimeSince(then) < kNonceTimeout;
}
TurnServer::Allocation* TurnServer::FindAllocation(Connection* conn) {
@@ -515,7 +515,7 @@
TurnServer::Allocation* TurnServer::CreateAllocation(Connection* conn,
int proto,
const std::string& key) {
- talk_base::AsyncPacketSocket* external_socket = (external_socket_factory_) ?
+ rtc::AsyncPacketSocket* external_socket = (external_socket_factory_) ?
external_socket_factory_->CreateUdpSocket(external_addr_, 0, 0) : NULL;
if (!external_socket) {
return NULL;
@@ -552,7 +552,7 @@
}
void TurnServer::SendStun(Connection* conn, StunMessage* msg) {
- talk_base::ByteBuffer buf;
+ rtc::ByteBuffer buf;
// Add a SOFTWARE attribute if one is set.
if (!software_.empty()) {
VERIFY(msg->AddAttribute(
@@ -563,14 +563,14 @@
}
void TurnServer::Send(Connection* conn,
- const talk_base::ByteBuffer& buf) {
- talk_base::PacketOptions options;
+ const rtc::ByteBuffer& buf) {
+ rtc::PacketOptions options;
conn->socket()->SendTo(buf.Data(), buf.Length(), conn->src(), options);
}
void TurnServer::OnAllocationDestroyed(Allocation* allocation) {
// Removing the internal socket if the connection is not udp.
- talk_base::AsyncPacketSocket* socket = allocation->conn()->socket();
+ rtc::AsyncPacketSocket* socket = allocation->conn()->socket();
InternalSocketMap::iterator iter = server_sockets_.find(socket);
ASSERT(iter != server_sockets_.end());
// Skip if the socket serving this allocation is UDP, as this will be shared
@@ -584,18 +584,18 @@
allocations_.erase(it);
}
-void TurnServer::DestroyInternalSocket(talk_base::AsyncPacketSocket* socket) {
+void TurnServer::DestroyInternalSocket(rtc::AsyncPacketSocket* socket) {
InternalSocketMap::iterator iter = server_sockets_.find(socket);
if (iter != server_sockets_.end()) {
- talk_base::AsyncPacketSocket* socket = iter->first;
+ rtc::AsyncPacketSocket* socket = iter->first;
delete socket;
server_sockets_.erase(iter);
}
}
-TurnServer::Connection::Connection(const talk_base::SocketAddress& src,
+TurnServer::Connection::Connection(const rtc::SocketAddress& src,
ProtocolType proto,
- talk_base::AsyncPacketSocket* socket)
+ rtc::AsyncPacketSocket* socket)
: src_(src),
dst_(socket->GetRemoteAddress()),
proto_(proto),
@@ -620,9 +620,9 @@
}
TurnServer::Allocation::Allocation(TurnServer* server,
- talk_base::Thread* thread,
+ rtc::Thread* thread,
const Connection& conn,
- talk_base::AsyncPacketSocket* socket,
+ rtc::AsyncPacketSocket* socket,
const std::string& key)
: server_(server),
thread_(thread),
@@ -823,7 +823,7 @@
void TurnServer::Allocation::HandleChannelData(const char* data, size_t size) {
// Extract the channel number from the data.
- uint16 channel_id = talk_base::GetBE16(data);
+ uint16 channel_id = rtc::GetBE16(data);
Channel* channel = FindChannel(channel_id);
if (channel) {
// Send the data to the peer address.
@@ -836,15 +836,15 @@
}
void TurnServer::Allocation::OnExternalPacket(
- talk_base::AsyncPacketSocket* socket,
+ rtc::AsyncPacketSocket* socket,
const char* data, size_t size,
- const talk_base::SocketAddress& addr,
- const talk_base::PacketTime& packet_time) {
+ const rtc::SocketAddress& addr,
+ const rtc::PacketTime& packet_time) {
ASSERT(external_socket_.get() == socket);
Channel* channel = FindChannel(addr);
if (channel) {
// There is a channel bound to this address. Send as a channel message.
- talk_base::ByteBuffer buf;
+ rtc::ByteBuffer buf;
buf.WriteUInt16(channel->id());
buf.WriteUInt16(static_cast<uint16>(size));
buf.WriteBytes(data, size);
@@ -854,7 +854,7 @@
TurnMessage msg;
msg.SetType(TURN_DATA_INDICATION);
msg.SetTransactionID(
- talk_base::CreateRandomString(kStunTransactionIdLength));
+ rtc::CreateRandomString(kStunTransactionIdLength));
VERIFY(msg.AddAttribute(new StunXorAddressAttribute(
STUN_ATTR_XOR_PEER_ADDRESS, addr)));
VERIFY(msg.AddAttribute(new StunByteStringAttribute(
@@ -876,11 +876,11 @@
return lifetime;
}
-bool TurnServer::Allocation::HasPermission(const talk_base::IPAddress& addr) {
+bool TurnServer::Allocation::HasPermission(const rtc::IPAddress& addr) {
return (FindPermission(addr) != NULL);
}
-void TurnServer::Allocation::AddPermission(const talk_base::IPAddress& addr) {
+void TurnServer::Allocation::AddPermission(const rtc::IPAddress& addr) {
Permission* perm = FindPermission(addr);
if (!perm) {
perm = new Permission(thread_, addr);
@@ -893,7 +893,7 @@
}
TurnServer::Permission* TurnServer::Allocation::FindPermission(
- const talk_base::IPAddress& addr) const {
+ const rtc::IPAddress& addr) const {
for (PermissionList::const_iterator it = perms_.begin();
it != perms_.end(); ++it) {
if ((*it)->peer() == addr)
@@ -912,7 +912,7 @@
}
TurnServer::Channel* TurnServer::Allocation::FindChannel(
- const talk_base::SocketAddress& addr) const {
+ const rtc::SocketAddress& addr) const {
for (ChannelList::const_iterator it = channels_.begin();
it != channels_.end(); ++it) {
if ((*it)->peer() == addr)
@@ -937,12 +937,12 @@
}
void TurnServer::Allocation::SendExternal(const void* data, size_t size,
- const talk_base::SocketAddress& peer) {
- talk_base::PacketOptions options;
+ const rtc::SocketAddress& peer) {
+ rtc::PacketOptions options;
external_socket_->SendTo(data, size, peer, options);
}
-void TurnServer::Allocation::OnMessage(talk_base::Message* msg) {
+void TurnServer::Allocation::OnMessage(rtc::Message* msg) {
ASSERT(msg->message_id == MSG_TIMEOUT);
SignalDestroyed(this);
delete this;
@@ -961,8 +961,8 @@
channels_.erase(it);
}
-TurnServer::Permission::Permission(talk_base::Thread* thread,
- const talk_base::IPAddress& peer)
+TurnServer::Permission::Permission(rtc::Thread* thread,
+ const rtc::IPAddress& peer)
: thread_(thread), peer_(peer) {
Refresh();
}
@@ -976,14 +976,14 @@
thread_->PostDelayed(kPermissionTimeout, this, MSG_TIMEOUT);
}
-void TurnServer::Permission::OnMessage(talk_base::Message* msg) {
+void TurnServer::Permission::OnMessage(rtc::Message* msg) {
ASSERT(msg->message_id == MSG_TIMEOUT);
SignalDestroyed(this);
delete this;
}
-TurnServer::Channel::Channel(talk_base::Thread* thread, int id,
- const talk_base::SocketAddress& peer)
+TurnServer::Channel::Channel(rtc::Thread* thread, int id,
+ const rtc::SocketAddress& peer)
: thread_(thread), id_(id), peer_(peer) {
Refresh();
}
@@ -997,7 +997,7 @@
thread_->PostDelayed(kChannelTimeout, this, MSG_TIMEOUT);
}
-void TurnServer::Channel::OnMessage(talk_base::Message* msg) {
+void TurnServer::Channel::OnMessage(rtc::Message* msg) {
ASSERT(msg->message_id == MSG_TIMEOUT);
SignalDestroyed(this);
delete this;
diff --git a/p2p/base/turnserver.h b/p2p/base/turnserver.h
index 2c33cdb..faf41fe 100644
--- a/p2p/base/turnserver.h
+++ b/p2p/base/turnserver.h
@@ -33,13 +33,13 @@
#include <set>
#include <string>
-#include "talk/base/asyncpacketsocket.h"
-#include "talk/base/messagequeue.h"
-#include "talk/base/sigslot.h"
-#include "talk/base/socketaddress.h"
+#include "webrtc/base/asyncpacketsocket.h"
+#include "webrtc/base/messagequeue.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/socketaddress.h"
#include "talk/p2p/base/portinterface.h"
-namespace talk_base {
+namespace rtc {
class ByteBuffer;
class PacketSocketFactory;
class Thread;
@@ -69,7 +69,7 @@
// Not yet wired up: TCP support.
class TurnServer : public sigslot::has_slots<> {
public:
- explicit TurnServer(talk_base::Thread* thread);
+ explicit TurnServer(rtc::Thread* thread);
~TurnServer();
// Gets/sets the realm value to use for the server.
@@ -86,51 +86,51 @@
void set_enable_otu_nonce(bool enable) { enable_otu_nonce_ = enable; }
// Starts listening for packets from internal clients.
- void AddInternalSocket(talk_base::AsyncPacketSocket* socket,
+ void AddInternalSocket(rtc::AsyncPacketSocket* socket,
ProtocolType proto);
// Starts listening for the connections on this socket. When someone tries
// to connect, the connection will be accepted and a new internal socket
// will be added.
- void AddInternalServerSocket(talk_base::AsyncSocket* socket,
+ void AddInternalServerSocket(rtc::AsyncSocket* socket,
ProtocolType proto);
// Specifies the factory to use for creating external sockets.
- void SetExternalSocketFactory(talk_base::PacketSocketFactory* factory,
- const talk_base::SocketAddress& address);
+ void SetExternalSocketFactory(rtc::PacketSocketFactory* factory,
+ const rtc::SocketAddress& address);
private:
// Encapsulates the client's connection to the server.
class Connection {
public:
Connection() : proto_(PROTO_UDP), socket_(NULL) {}
- Connection(const talk_base::SocketAddress& src,
+ Connection(const rtc::SocketAddress& src,
ProtocolType proto,
- talk_base::AsyncPacketSocket* socket);
- const talk_base::SocketAddress& src() const { return src_; }
- talk_base::AsyncPacketSocket* socket() { return socket_; }
+ rtc::AsyncPacketSocket* socket);
+ const rtc::SocketAddress& src() const { return src_; }
+ rtc::AsyncPacketSocket* socket() { return socket_; }
bool operator==(const Connection& t) const;
bool operator<(const Connection& t) const;
std::string ToString() const;
private:
- talk_base::SocketAddress src_;
- talk_base::SocketAddress dst_;
+ rtc::SocketAddress src_;
+ rtc::SocketAddress dst_;
cricket::ProtocolType proto_;
- talk_base::AsyncPacketSocket* socket_;
+ rtc::AsyncPacketSocket* socket_;
};
class Allocation;
class Permission;
class Channel;
typedef std::map<Connection, Allocation*> AllocationMap;
- void OnInternalPacket(talk_base::AsyncPacketSocket* socket, const char* data,
- size_t size, const talk_base::SocketAddress& address,
- const talk_base::PacketTime& packet_time);
+ void OnInternalPacket(rtc::AsyncPacketSocket* socket, const char* data,
+ size_t size, const rtc::SocketAddress& address,
+ const rtc::PacketTime& packet_time);
- void OnNewInternalConnection(talk_base::AsyncSocket* socket);
+ void OnNewInternalConnection(rtc::AsyncSocket* socket);
// Accept connections on this server socket.
- void AcceptConnection(talk_base::AsyncSocket* server_socket);
- void OnInternalSocketClose(talk_base::AsyncPacketSocket* socket, int err);
+ void AcceptConnection(rtc::AsyncSocket* server_socket);
+ void OnInternalSocketClose(rtc::AsyncPacketSocket* socket, int err);
void HandleStunMessage(Connection* conn, const char* data, size_t size);
void HandleBindingRequest(Connection* conn, const StunMessage* msg);
@@ -156,17 +156,17 @@
int code,
const std::string& reason);
void SendStun(Connection* conn, StunMessage* msg);
- void Send(Connection* conn, const talk_base::ByteBuffer& buf);
+ void Send(Connection* conn, const rtc::ByteBuffer& buf);
void OnAllocationDestroyed(Allocation* allocation);
- void DestroyInternalSocket(talk_base::AsyncPacketSocket* socket);
+ void DestroyInternalSocket(rtc::AsyncPacketSocket* socket);
- typedef std::map<talk_base::AsyncPacketSocket*,
+ typedef std::map<rtc::AsyncPacketSocket*,
ProtocolType> InternalSocketMap;
- typedef std::map<talk_base::AsyncSocket*,
+ typedef std::map<rtc::AsyncSocket*,
ProtocolType> ServerSocketMap;
- talk_base::Thread* thread_;
+ rtc::Thread* thread_;
std::string nonce_key_;
std::string realm_;
std::string software_;
@@ -176,9 +176,9 @@
bool enable_otu_nonce_;
InternalSocketMap server_sockets_;
ServerSocketMap server_listen_sockets_;
- talk_base::scoped_ptr<talk_base::PacketSocketFactory>
+ rtc::scoped_ptr<rtc::PacketSocketFactory>
external_socket_factory_;
- talk_base::SocketAddress external_addr_;
+ rtc::SocketAddress external_addr_;
AllocationMap allocations_;
};
diff --git a/p2p/client/autoportallocator.h b/p2p/client/autoportallocator.h
index 4ec324b..c6271d0 100644
--- a/p2p/client/autoportallocator.h
+++ b/p2p/client/autoportallocator.h
@@ -31,7 +31,7 @@
#include <string>
#include <vector>
-#include "talk/base/sigslot.h"
+#include "webrtc/base/sigslot.h"
#include "talk/p2p/client/httpportallocator.h"
#include "talk/xmpp/jingleinfotask.h"
#include "talk/xmpp/xmppclient.h"
@@ -40,7 +40,7 @@
// It enables the client to traverse Proxy and NAT.
class AutoPortAllocator : public cricket::HttpPortAllocator {
public:
- AutoPortAllocator(talk_base::NetworkManager* network_manager,
+ AutoPortAllocator(rtc::NetworkManager* network_manager,
const std::string& user_agent)
: cricket::HttpPortAllocator(network_manager, user_agent) {
}
@@ -59,7 +59,7 @@
void OnJingleInfo(
const std::string& token,
const std::vector<std::string>& relay_hosts,
- const std::vector<talk_base::SocketAddress>& stun_hosts) {
+ const std::vector<rtc::SocketAddress>& stun_hosts) {
SetRelayToken(token);
SetStunHosts(stun_hosts);
SetRelayHosts(relay_hosts);
diff --git a/p2p/client/basicportallocator.cc b/p2p/client/basicportallocator.cc
index 696588a..0a3fab1 100644
--- a/p2p/client/basicportallocator.cc
+++ b/p2p/client/basicportallocator.cc
@@ -30,9 +30,9 @@
#include <string>
#include <vector>
-#include "talk/base/common.h"
-#include "talk/base/helpers.h"
-#include "talk/base/logging.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/logging.h"
#include "talk/p2p/base/basicpacketsocketfactory.h"
#include "talk/p2p/base/common.h"
#include "talk/p2p/base/port.h"
@@ -42,8 +42,8 @@
#include "talk/p2p/base/turnport.h"
#include "talk/p2p/base/udpport.h"
-using talk_base::CreateRandomId;
-using talk_base::CreateRandomString;
+using rtc::CreateRandomId;
+using rtc::CreateRandomString;
namespace {
@@ -82,7 +82,7 @@
// Performs the allocation of ports, in a sequenced (timed) manner, for a given
// network and IP address.
-class AllocationSequence : public talk_base::MessageHandler,
+class AllocationSequence : public rtc::MessageHandler,
public sigslot::has_slots<> {
public:
enum State {
@@ -95,7 +95,7 @@
};
AllocationSequence(BasicPortAllocatorSession* session,
- talk_base::Network* network,
+ rtc::Network* network,
PortConfiguration* config,
uint32 flags);
~AllocationSequence();
@@ -106,7 +106,7 @@
// Disables the phases for a new sequence that this one already covers for an
// equivalent network setup.
- void DisableEquivalentPhases(talk_base::Network* network,
+ void DisableEquivalentPhases(rtc::Network* network,
PortConfiguration* config, uint32* flags);
// Starts and stops the sequence. When started, it will continue allocating
@@ -115,7 +115,7 @@
void Stop();
// MessageHandler
- void OnMessage(talk_base::Message* msg);
+ void OnMessage(rtc::Message* msg);
void EnableProtocol(ProtocolType proto);
bool ProtocolEnabled(ProtocolType proto) const;
@@ -141,35 +141,35 @@
void CreateGturnPort(const RelayServerConfig& config);
void CreateTurnPort(const RelayServerConfig& config);
- void OnReadPacket(talk_base::AsyncPacketSocket* socket,
+ void OnReadPacket(rtc::AsyncPacketSocket* socket,
const char* data, size_t size,
- const talk_base::SocketAddress& remote_addr,
- const talk_base::PacketTime& packet_time);
+ const rtc::SocketAddress& remote_addr,
+ const rtc::PacketTime& packet_time);
void OnPortDestroyed(PortInterface* port);
void OnResolvedTurnServerAddress(
- TurnPort* port, const talk_base::SocketAddress& server_address,
- const talk_base::SocketAddress& resolved_server_address);
+ TurnPort* port, const rtc::SocketAddress& server_address,
+ const rtc::SocketAddress& resolved_server_address);
BasicPortAllocatorSession* session_;
- talk_base::Network* network_;
- talk_base::IPAddress ip_;
+ rtc::Network* network_;
+ rtc::IPAddress ip_;
PortConfiguration* config_;
State state_;
uint32 flags_;
ProtocolList protocols_;
- talk_base::scoped_ptr<talk_base::AsyncPacketSocket> udp_socket_;
+ rtc::scoped_ptr<rtc::AsyncPacketSocket> udp_socket_;
// There will be only one udp port per AllocationSequence.
UDPPort* udp_port_;
// Keeping a map for turn ports keyed with server addresses.
- std::map<talk_base::SocketAddress, Port*> turn_ports_;
+ std::map<rtc::SocketAddress, Port*> turn_ports_;
int phase_;
};
// BasicPortAllocator
BasicPortAllocator::BasicPortAllocator(
- talk_base::NetworkManager* network_manager,
- talk_base::PacketSocketFactory* socket_factory)
+ rtc::NetworkManager* network_manager,
+ rtc::PacketSocketFactory* socket_factory)
: network_manager_(network_manager),
socket_factory_(socket_factory) {
ASSERT(socket_factory_ != NULL);
@@ -177,32 +177,32 @@
}
BasicPortAllocator::BasicPortAllocator(
- talk_base::NetworkManager* network_manager)
+ rtc::NetworkManager* network_manager)
: network_manager_(network_manager),
socket_factory_(NULL) {
Construct();
}
BasicPortAllocator::BasicPortAllocator(
- talk_base::NetworkManager* network_manager,
- talk_base::PacketSocketFactory* socket_factory,
- const talk_base::SocketAddress& stun_address)
+ rtc::NetworkManager* network_manager,
+ rtc::PacketSocketFactory* socket_factory,
+ const ServerAddresses& stun_servers)
: network_manager_(network_manager),
socket_factory_(socket_factory),
- stun_address_(stun_address) {
+ stun_servers_(stun_servers) {
ASSERT(socket_factory_ != NULL);
Construct();
}
BasicPortAllocator::BasicPortAllocator(
- talk_base::NetworkManager* network_manager,
- const talk_base::SocketAddress& stun_address,
- const talk_base::SocketAddress& relay_address_udp,
- const talk_base::SocketAddress& relay_address_tcp,
- const talk_base::SocketAddress& relay_address_ssl)
+ rtc::NetworkManager* network_manager,
+ const ServerAddresses& stun_servers,
+ const rtc::SocketAddress& relay_address_udp,
+ const rtc::SocketAddress& relay_address_tcp,
+ const rtc::SocketAddress& relay_address_ssl)
: network_manager_(network_manager),
socket_factory_(NULL),
- stun_address_(stun_address) {
+ stun_servers_(stun_servers) {
RelayServerConfig config(RELAY_GTURN);
if (!relay_address_udp.IsNil())
@@ -275,10 +275,10 @@
}
void BasicPortAllocatorSession::StartGettingPorts() {
- network_thread_ = talk_base::Thread::Current();
+ network_thread_ = rtc::Thread::Current();
if (!socket_factory_) {
owned_socket_factory_.reset(
- new talk_base::BasicPacketSocketFactory(network_thread_));
+ new rtc::BasicPacketSocketFactory(network_thread_));
socket_factory_ = owned_socket_factory_.get();
}
@@ -290,7 +290,7 @@
}
void BasicPortAllocatorSession::StopGettingPorts() {
- ASSERT(talk_base::Thread::Current() == network_thread_);
+ ASSERT(rtc::Thread::Current() == network_thread_);
running_ = false;
network_thread_->Clear(this, MSG_ALLOCATE);
for (uint32 i = 0; i < sequences_.size(); ++i)
@@ -298,33 +298,33 @@
network_thread_->Post(this, MSG_CONFIG_STOP);
}
-void BasicPortAllocatorSession::OnMessage(talk_base::Message *message) {
+void BasicPortAllocatorSession::OnMessage(rtc::Message *message) {
switch (message->message_id) {
case MSG_CONFIG_START:
- ASSERT(talk_base::Thread::Current() == network_thread_);
+ ASSERT(rtc::Thread::Current() == network_thread_);
GetPortConfigurations();
break;
case MSG_CONFIG_READY:
- ASSERT(talk_base::Thread::Current() == network_thread_);
+ ASSERT(rtc::Thread::Current() == network_thread_);
OnConfigReady(static_cast<PortConfiguration*>(message->pdata));
break;
case MSG_ALLOCATE:
- ASSERT(talk_base::Thread::Current() == network_thread_);
+ ASSERT(rtc::Thread::Current() == network_thread_);
OnAllocate();
break;
case MSG_SHAKE:
- ASSERT(talk_base::Thread::Current() == network_thread_);
+ ASSERT(rtc::Thread::Current() == network_thread_);
OnShake();
break;
case MSG_SEQUENCEOBJECTS_CREATED:
- ASSERT(talk_base::Thread::Current() == network_thread_);
+ ASSERT(rtc::Thread::Current() == network_thread_);
OnAllocationSequenceObjectsCreated();
break;
case MSG_CONFIG_STOP:
- ASSERT(talk_base::Thread::Current() == network_thread_);
+ ASSERT(rtc::Thread::Current() == network_thread_);
OnConfigStop();
break;
default:
@@ -333,7 +333,7 @@
}
void BasicPortAllocatorSession::GetPortConfigurations() {
- PortConfiguration* config = new PortConfiguration(allocator_->stun_address(),
+ PortConfiguration* config = new PortConfiguration(allocator_->stun_servers(),
username(),
password());
@@ -356,7 +356,7 @@
}
void BasicPortAllocatorSession::OnConfigStop() {
- ASSERT(talk_base::Thread::Current() == network_thread_);
+ ASSERT(rtc::Thread::Current() == network_thread_);
// If any of the allocated ports have not completed the candidates allocation,
// mark those as error. Since session doesn't need any new candidates
@@ -387,7 +387,7 @@
}
void BasicPortAllocatorSession::AllocatePorts() {
- ASSERT(talk_base::Thread::Current() == network_thread_);
+ ASSERT(rtc::Thread::Current() == network_thread_);
network_thread_->Post(this, MSG_ALLOCATE);
}
@@ -402,7 +402,7 @@
// create a new sequence to create the appropriate ports.
void BasicPortAllocatorSession::DoAllocate() {
bool done_signal_needed = false;
- std::vector<talk_base::Network*> networks;
+ std::vector<rtc::Network*> networks;
allocator_->network_manager()->GetNetworks(&networks);
if (networks.empty()) {
LOG(LS_WARNING) << "Machine has no networks; no ports will be allocated";
@@ -422,7 +422,7 @@
}
// Disables phases that are not specified in this config.
- if (!config || config->stun_address.IsNil()) {
+ if (!config || config->StunServers().empty()) {
// No STUN ports specified in this config.
sequence_flags |= PORTALLOCATOR_DISABLE_STUN;
}
@@ -472,7 +472,7 @@
}
void BasicPortAllocatorSession::DisableEquivalentPhases(
- talk_base::Network* network, PortConfiguration* config, uint32* flags) {
+ rtc::Network* network, PortConfiguration* config, uint32* flags) {
for (uint32 i = 0; i < sequences_.size() &&
(*flags & DISABLE_ALL_PHASES) != DISABLE_ALL_PHASES; ++i) {
sequences_[i]->DisableEquivalentPhases(network, config, flags);
@@ -489,7 +489,7 @@
port->set_content_name(content_name());
port->set_component(component_);
port->set_generation(generation());
- if (allocator_->proxy().type != talk_base::PROXY_NONE)
+ if (allocator_->proxy().type != rtc::PROXY_NONE)
port->set_proxy(allocator_->user_agent(), allocator_->proxy());
port->set_send_retransmit_count_attribute((allocator_->flags() &
PORTALLOCATOR_ENABLE_STUN_RETRANSMIT_ATTRIBUTE) != 0);
@@ -519,7 +519,7 @@
void BasicPortAllocatorSession::OnCandidateReady(
Port* port, const Candidate& c) {
- ASSERT(talk_base::Thread::Current() == network_thread_);
+ ASSERT(rtc::Thread::Current() == network_thread_);
PortData* data = FindPort(port);
ASSERT(data != NULL);
// Discarding any candidate signal if port allocation status is
@@ -549,7 +549,7 @@
}
void BasicPortAllocatorSession::OnPortComplete(Port* port) {
- ASSERT(talk_base::Thread::Current() == network_thread_);
+ ASSERT(rtc::Thread::Current() == network_thread_);
PortData* data = FindPort(port);
ASSERT(data != NULL);
@@ -564,7 +564,7 @@
}
void BasicPortAllocatorSession::OnPortError(Port* port) {
- ASSERT(talk_base::Thread::Current() == network_thread_);
+ ASSERT(rtc::Thread::Current() == network_thread_);
PortData* data = FindPort(port);
ASSERT(data != NULL);
// We might have already given up on this port and stopped it.
@@ -636,7 +636,7 @@
void BasicPortAllocatorSession::OnPortDestroyed(
PortInterface* port) {
- ASSERT(talk_base::Thread::Current() == network_thread_);
+ ASSERT(rtc::Thread::Current() == network_thread_);
for (std::vector<PortData>::iterator iter = ports_.begin();
iter != ports_.end(); ++iter) {
if (port == iter->port()) {
@@ -693,7 +693,7 @@
// AllocationSequence
AllocationSequence::AllocationSequence(BasicPortAllocatorSession* session,
- talk_base::Network* network,
+ rtc::Network* network,
PortConfiguration* config,
uint32 flags)
: session_(session),
@@ -718,7 +718,7 @@
if (IsFlagSet(PORTALLOCATOR_ENABLE_SHARED_SOCKET)) {
udp_socket_.reset(session_->socket_factory()->CreateUdpSocket(
- talk_base::SocketAddress(ip_, 0), session_->allocator()->min_port(),
+ rtc::SocketAddress(ip_, 0), session_->allocator()->min_port(),
session_->allocator()->max_port()));
if (udp_socket_) {
udp_socket_->SignalReadPacket.connect(
@@ -739,7 +739,7 @@
session_->network_thread()->Clear(this);
}
-void AllocationSequence::DisableEquivalentPhases(talk_base::Network* network,
+void AllocationSequence::DisableEquivalentPhases(rtc::Network* network,
PortConfiguration* config, uint32* flags) {
if (!((network == network_) && (ip_ == network->ip()))) {
// Different network setup; nothing is equivalent.
@@ -753,8 +753,8 @@
*flags |= PORTALLOCATOR_DISABLE_TCP;
if (config_ && config) {
- if (config_->stun_address == config->stun_address) {
- // Already got this STUN server covered.
+ if (config_->StunServers() == config->StunServers()) {
+ // Already got this STUN servers covered.
*flags |= PORTALLOCATOR_DISABLE_STUN;
}
if (!config_->relays.empty()) {
@@ -781,8 +781,8 @@
}
}
-void AllocationSequence::OnMessage(talk_base::Message* msg) {
- ASSERT(talk_base::Thread::Current() == session_->network_thread());
+void AllocationSequence::OnMessage(rtc::Message* msg) {
+ ASSERT(rtc::Thread::Current() == session_->network_thread());
ASSERT(msg->message_id == MSG_ALLOCATION_PHASE);
const char* const PHASE_NAMES[kNumPhases] = {
@@ -878,15 +878,15 @@
// If STUN is not disabled, setting stun server address to port.
if (!IsFlagSet(PORTALLOCATOR_DISABLE_STUN)) {
- // If config has stun_address, use it to get server reflexive candidate
+ // If config has stun_servers, use it to get server reflexive candidate
// otherwise use first TURN server which supports UDP.
- if (config_ && !config_->stun_address.IsNil()) {
+ if (config_ && !config_->StunServers().empty()) {
LOG(LS_INFO) << "AllocationSequence: UDPPort will be handling the "
<< "STUN candidate generation.";
- port->set_server_addr(config_->stun_address);
+ port->set_server_addresses(config_->StunServers());
} else if (config_ &&
config_->SupportsProtocol(RELAY_TURN, PROTO_UDP)) {
- port->set_server_addr(config_->GetFirstRelayServerAddress(
+ port->set_server_addresses(config_->GetRelayServerAddresses(
RELAY_TURN, PROTO_UDP));
LOG(LS_INFO) << "AllocationSequence: TURN Server address will be "
<< " used for generating STUN candidate.";
@@ -931,8 +931,8 @@
// If BasicPortAllocatorSession::OnAllocate left STUN ports enabled then we
// ought to have an address for them here.
- ASSERT(config_ && !config_->stun_address.IsNil());
- if (!(config_ && !config_->stun_address.IsNil())) {
+ ASSERT(config_ && !config_->StunServers().empty());
+ if (!(config_ && !config_->StunServers().empty())) {
LOG(LS_WARNING)
<< "AllocationSequence: No STUN server configured, skipping.";
return;
@@ -944,7 +944,7 @@
session_->allocator()->min_port(),
session_->allocator()->max_port(),
session_->username(), session_->password(),
- config_->stun_address);
+ config_->StunServers());
if (port) {
session_->AddAllocatedPort(port, this, true);
// Since StunPort is not created using shared socket, |port| will not be
@@ -1026,7 +1026,7 @@
session_->socket_factory(),
network_, udp_socket_.get(),
session_->username(), session_->password(),
- *relay_port, config.credentials);
+ *relay_port, config.credentials, config.priority);
// If we are using shared socket for TURN and udp ports, we need to
// find a way to demux the packets to the correct port when received.
// Mapping against server_address is one way of doing this. When packet
@@ -1051,7 +1051,7 @@
session_->allocator()->max_port(),
session_->username(),
session_->password(),
- *relay_port, config.credentials);
+ *relay_port, config.credentials, config.priority);
}
ASSERT(port != NULL);
session_->AddAllocatedPort(port, this, true);
@@ -1059,15 +1059,15 @@
}
void AllocationSequence::OnReadPacket(
- talk_base::AsyncPacketSocket* socket, const char* data, size_t size,
- const talk_base::SocketAddress& remote_addr,
- const talk_base::PacketTime& packet_time) {
+ rtc::AsyncPacketSocket* socket, const char* data, size_t size,
+ const rtc::SocketAddress& remote_addr,
+ const rtc::PacketTime& packet_time) {
ASSERT(socket == udp_socket_.get());
// If the packet is received from one of the TURN server in the config, then
// pass down the packet to that port, otherwise it will be handed down to
// the local udp port.
Port* port = NULL;
- std::map<talk_base::SocketAddress, Port*>::iterator iter =
+ std::map<rtc::SocketAddress, Port*>::iterator iter =
turn_ports_.find(remote_addr);
if (iter != turn_ports_.end()) {
port = iter->second;
@@ -1084,7 +1084,7 @@
if (udp_port_ == port) {
udp_port_ = NULL;
} else {
- std::map<talk_base::SocketAddress, Port*>::iterator iter;
+ std::map<rtc::SocketAddress, Port*>::iterator iter;
for (iter = turn_ports_.begin(); iter != turn_ports_.end(); ++iter) {
if (iter->second == port) {
turn_ports_.erase(iter);
@@ -1095,9 +1095,9 @@
}
void AllocationSequence::OnResolvedTurnServerAddress(
- TurnPort* port, const talk_base::SocketAddress& server_address,
- const talk_base::SocketAddress& resolved_server_address) {
- std::map<talk_base::SocketAddress, Port*>::iterator iter;
+ TurnPort* port, const rtc::SocketAddress& server_address,
+ const rtc::SocketAddress& resolved_server_address) {
+ std::map<rtc::SocketAddress, Port*>::iterator iter;
iter = turn_ports_.find(server_address);
if (iter == turn_ports_.end()) {
LOG(LS_INFO) << "TurnPort entry is not found in the map.";
@@ -1112,12 +1112,30 @@
// PortConfiguration
PortConfiguration::PortConfiguration(
- const talk_base::SocketAddress& stun_address,
+ const rtc::SocketAddress& stun_address,
const std::string& username,
const std::string& password)
- : stun_address(stun_address),
+ : stun_address(stun_address), username(username), password(password) {
+ if (!stun_address.IsNil())
+ stun_servers.insert(stun_address);
+}
+
+PortConfiguration::PortConfiguration(const ServerAddresses& stun_servers,
+ const std::string& username,
+ const std::string& password)
+ : stun_servers(stun_servers),
username(username),
password(password) {
+ if (!stun_servers.empty())
+ stun_address = *(stun_servers.begin());
+}
+
+ServerAddresses PortConfiguration::StunServers() {
+ if (!stun_address.IsNil() &&
+ stun_servers.find(stun_address) == stun_servers.end()) {
+ stun_servers.insert(stun_address);
+ }
+ return stun_servers;
}
void PortConfiguration::AddRelay(const RelayServerConfig& config) {
@@ -1146,14 +1164,15 @@
return false;
}
-talk_base::SocketAddress PortConfiguration::GetFirstRelayServerAddress(
+ServerAddresses PortConfiguration::GetRelayServerAddresses(
RelayType turn_type, ProtocolType type) const {
+ ServerAddresses servers;
for (size_t i = 0; i < relays.size(); ++i) {
if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) {
- return relays[i].ports.front().address;
+ servers.insert(relays[i].ports.front().address);
}
}
- return talk_base::SocketAddress();
+ return servers;
}
} // namespace cricket
diff --git a/p2p/client/basicportallocator.h b/p2p/client/basicportallocator.h
index 8a60c42..ca1deab 100644
--- a/p2p/client/basicportallocator.h
+++ b/p2p/client/basicportallocator.h
@@ -31,10 +31,10 @@
#include <string>
#include <vector>
-#include "talk/base/messagequeue.h"
-#include "talk/base/network.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/messagequeue.h"
+#include "webrtc/base/network.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/thread.h"
#include "talk/p2p/base/port.h"
#include "talk/p2p/base/portallocator.h"
@@ -54,36 +54,37 @@
typedef std::vector<ProtocolAddress> PortList;
struct RelayServerConfig {
- RelayServerConfig(RelayType type) : type(type) {}
+ RelayServerConfig(RelayType type) : type(type), priority(0) {}
RelayType type;
PortList ports;
RelayCredentials credentials;
+ int priority;
};
class BasicPortAllocator : public PortAllocator {
public:
- BasicPortAllocator(talk_base::NetworkManager* network_manager,
- talk_base::PacketSocketFactory* socket_factory);
- explicit BasicPortAllocator(talk_base::NetworkManager* network_manager);
- BasicPortAllocator(talk_base::NetworkManager* network_manager,
- talk_base::PacketSocketFactory* socket_factory,
- const talk_base::SocketAddress& stun_server);
- BasicPortAllocator(talk_base::NetworkManager* network_manager,
- const talk_base::SocketAddress& stun_server,
- const talk_base::SocketAddress& relay_server_udp,
- const talk_base::SocketAddress& relay_server_tcp,
- const talk_base::SocketAddress& relay_server_ssl);
+ BasicPortAllocator(rtc::NetworkManager* network_manager,
+ rtc::PacketSocketFactory* socket_factory);
+ explicit BasicPortAllocator(rtc::NetworkManager* network_manager);
+ BasicPortAllocator(rtc::NetworkManager* network_manager,
+ rtc::PacketSocketFactory* socket_factory,
+ const ServerAddresses& stun_servers);
+ BasicPortAllocator(rtc::NetworkManager* network_manager,
+ const ServerAddresses& stun_servers,
+ const rtc::SocketAddress& relay_server_udp,
+ const rtc::SocketAddress& relay_server_tcp,
+ const rtc::SocketAddress& relay_server_ssl);
virtual ~BasicPortAllocator();
- talk_base::NetworkManager* network_manager() { return network_manager_; }
+ rtc::NetworkManager* network_manager() { return network_manager_; }
// If socket_factory() is set to NULL each PortAllocatorSession
// creates its own socket factory.
- talk_base::PacketSocketFactory* socket_factory() { return socket_factory_; }
+ rtc::PacketSocketFactory* socket_factory() { return socket_factory_; }
- const talk_base::SocketAddress& stun_address() const {
- return stun_address_;
+ const ServerAddresses& stun_servers() const {
+ return stun_servers_;
}
const std::vector<RelayServerConfig>& relays() const {
@@ -102,9 +103,9 @@
private:
void Construct();
- talk_base::NetworkManager* network_manager_;
- talk_base::PacketSocketFactory* socket_factory_;
- const talk_base::SocketAddress stun_address_;
+ rtc::NetworkManager* network_manager_;
+ rtc::PacketSocketFactory* socket_factory_;
+ const ServerAddresses stun_servers_;
std::vector<RelayServerConfig> relays_;
bool allow_tcp_listen_;
};
@@ -113,7 +114,7 @@
class AllocationSequence;
class BasicPortAllocatorSession : public PortAllocatorSession,
- public talk_base::MessageHandler {
+ public rtc::MessageHandler {
public:
BasicPortAllocatorSession(BasicPortAllocator* allocator,
const std::string& content_name,
@@ -123,8 +124,8 @@
~BasicPortAllocatorSession();
virtual BasicPortAllocator* allocator() { return allocator_; }
- talk_base::Thread* network_thread() { return network_thread_; }
- talk_base::PacketSocketFactory* socket_factory() { return socket_factory_; }
+ rtc::Thread* network_thread() { return network_thread_; }
+ rtc::PacketSocketFactory* socket_factory() { return socket_factory_; }
virtual void StartGettingPorts();
virtual void StopGettingPorts();
@@ -139,7 +140,7 @@
virtual void ConfigReady(PortConfiguration* config);
// MessageHandler. Can be overriden if message IDs do not conflict.
- virtual void OnMessage(talk_base::Message *message);
+ virtual void OnMessage(rtc::Message *message);
private:
class PortData {
@@ -186,7 +187,7 @@
void DoAllocate();
void OnNetworksChanged();
void OnAllocationSequenceObjectsCreated();
- void DisableEquivalentPhases(talk_base::Network* network,
+ void DisableEquivalentPhases(rtc::Network* network,
PortConfiguration* config, uint32* flags);
void AddAllocatedPort(Port* port, AllocationSequence* seq,
bool prepare_address);
@@ -201,9 +202,9 @@
PortData* FindPort(Port* port);
BasicPortAllocator* allocator_;
- talk_base::Thread* network_thread_;
- talk_base::scoped_ptr<talk_base::PacketSocketFactory> owned_socket_factory_;
- talk_base::PacketSocketFactory* socket_factory_;
+ rtc::Thread* network_thread_;
+ rtc::scoped_ptr<rtc::PacketSocketFactory> owned_socket_factory_;
+ rtc::PacketSocketFactory* socket_factory_;
bool allocation_started_;
bool network_manager_started_;
bool running_; // set when StartGetAllPorts is called
@@ -216,18 +217,28 @@
};
// Records configuration information useful in creating ports.
-struct PortConfiguration : public talk_base::MessageData {
- talk_base::SocketAddress stun_address;
+struct PortConfiguration : public rtc::MessageData {
+ // TODO(jiayl): remove |stun_address| when Chrome is updated.
+ rtc::SocketAddress stun_address;
+ ServerAddresses stun_servers;
std::string username;
std::string password;
typedef std::vector<RelayServerConfig> RelayList;
RelayList relays;
- PortConfiguration(const talk_base::SocketAddress& stun_address,
+ // TODO(jiayl): remove this ctor when Chrome is updated.
+ PortConfiguration(const rtc::SocketAddress& stun_address,
const std::string& username,
const std::string& password);
+ PortConfiguration(const ServerAddresses& stun_servers,
+ const std::string& username,
+ const std::string& password);
+
+ // TODO(jiayl): remove when |stun_address| is removed.
+ ServerAddresses StunServers();
+
// Adds another relay server, with the given ports and modifier, to the list.
void AddRelay(const RelayServerConfig& config);
@@ -235,9 +246,9 @@
bool SupportsProtocol(const RelayServerConfig& relay,
ProtocolType type) const;
bool SupportsProtocol(RelayType turn_type, ProtocolType type) const;
- // Helper method returns the first server address for the matching
- // RelayType and Protocol type.
- talk_base::SocketAddress GetFirstRelayServerAddress(
+ // Helper method returns the server addresses for the matching RelayType and
+ // Protocol type.
+ ServerAddresses GetRelayServerAddresses(
RelayType turn_type, ProtocolType type) const;
};
diff --git a/p2p/client/connectivitychecker.cc b/p2p/client/connectivitychecker.cc
index 1b59943..dd8673a 100644
--- a/p2p/client/connectivitychecker.cc
+++ b/p2p/client/connectivitychecker.cc
@@ -5,14 +5,14 @@
#include "talk/p2p/client/connectivitychecker.h"
-#include "talk/base/asynchttprequest.h"
-#include "talk/base/autodetectproxy.h"
-#include "talk/base/helpers.h"
-#include "talk/base/httpcommon.h"
-#include "talk/base/httpcommon-inl.h"
-#include "talk/base/logging.h"
-#include "talk/base/proxydetect.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/asynchttprequest.h"
+#include "webrtc/base/autodetectproxy.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/httpcommon.h"
+#include "webrtc/base/httpcommon-inl.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/proxydetect.h"
+#include "webrtc/base/thread.h"
#include "talk/p2p/base/candidate.h"
#include "talk/p2p/base/constants.h"
#include "talk/p2p/base/common.h"
@@ -37,7 +37,7 @@
class TestHttpPortAllocator : public HttpPortAllocator {
public:
- TestHttpPortAllocator(talk_base::NetworkManager* network_manager,
+ TestHttpPortAllocator(rtc::NetworkManager* network_manager,
const std::string& user_agent,
const std::string& relay_token) :
HttpPortAllocator(network_manager, user_agent) {
@@ -61,9 +61,9 @@
}
void TestHttpPortAllocatorSession::OnRequestDone(
- talk_base::SignalThread* data) {
- talk_base::AsyncHttpRequest* request =
- static_cast<talk_base::AsyncHttpRequest*>(data);
+ rtc::SignalThread* data) {
+ rtc::AsyncHttpRequest* request =
+ static_cast<rtc::AsyncHttpRequest*>(data);
// Tell the checker that the request is complete.
SignalRequestDone(request);
@@ -73,7 +73,7 @@
}
ConnectivityChecker::ConnectivityChecker(
- talk_base::Thread* worker,
+ rtc::Thread* worker,
const std::string& jid,
const std::string& session_id,
const std::string& user_agent,
@@ -115,13 +115,13 @@
}
void ConnectivityChecker::Start() {
- main_ = talk_base::Thread::Current();
+ main_ = rtc::Thread::Current();
worker_->Post(this, MSG_START);
started_ = true;
}
void ConnectivityChecker::CleanUp() {
- ASSERT(worker_ == talk_base::Thread::Current());
+ ASSERT(worker_ == rtc::Thread::Current());
if (proxy_detect_) {
proxy_detect_->Release();
proxy_detect_ = NULL;
@@ -137,14 +137,14 @@
ports_.clear();
}
-bool ConnectivityChecker::AddNic(const talk_base::IPAddress& ip,
- const talk_base::SocketAddress& proxy_addr) {
+bool ConnectivityChecker::AddNic(const rtc::IPAddress& ip,
+ const rtc::SocketAddress& proxy_addr) {
NicMap::iterator i = nics_.find(NicId(ip, proxy_addr));
if (i != nics_.end()) {
// Already have it.
return false;
}
- uint32 now = talk_base::Time();
+ uint32 now = rtc::Time();
NicInfo info;
info.ip = ip;
info.proxy_info = GetProxyInfo();
@@ -153,13 +153,13 @@
return true;
}
-void ConnectivityChecker::SetProxyInfo(const talk_base::ProxyInfo& proxy_info) {
+void ConnectivityChecker::SetProxyInfo(const rtc::ProxyInfo& proxy_info) {
port_allocator_->set_proxy(user_agent_, proxy_info);
AllocatePorts();
}
-talk_base::ProxyInfo ConnectivityChecker::GetProxyInfo() const {
- talk_base::ProxyInfo proxy_info;
+rtc::ProxyInfo ConnectivityChecker::GetProxyInfo() const {
+ rtc::ProxyInfo proxy_info;
if (proxy_detect_) {
proxy_info = proxy_detect_->proxy();
}
@@ -172,10 +172,10 @@
network_manager_->StartUpdating();
}
-void ConnectivityChecker::OnMessage(talk_base::Message *msg) {
+void ConnectivityChecker::OnMessage(rtc::Message *msg) {
switch (msg->message_id) {
case MSG_START:
- ASSERT(worker_ == talk_base::Thread::Current());
+ ASSERT(worker_ == rtc::Thread::Current());
worker_->PostDelayed(timeout_ms_, this, MSG_TIMEOUT);
CheckNetworks();
break;
@@ -188,7 +188,7 @@
main_->Post(this, MSG_SIGNAL_RESULTS);
break;
case MSG_SIGNAL_RESULTS:
- ASSERT(main_ == talk_base::Thread::Current());
+ ASSERT(main_ == rtc::Thread::Current());
SignalCheckDone(this);
break;
default:
@@ -196,32 +196,32 @@
}
}
-void ConnectivityChecker::OnProxyDetect(talk_base::SignalThread* thread) {
- ASSERT(worker_ == talk_base::Thread::Current());
- if (proxy_detect_->proxy().type != talk_base::PROXY_NONE) {
+void ConnectivityChecker::OnProxyDetect(rtc::SignalThread* thread) {
+ ASSERT(worker_ == rtc::Thread::Current());
+ if (proxy_detect_->proxy().type != rtc::PROXY_NONE) {
SetProxyInfo(proxy_detect_->proxy());
}
}
-void ConnectivityChecker::OnRequestDone(talk_base::AsyncHttpRequest* request) {
- ASSERT(worker_ == talk_base::Thread::Current());
+void ConnectivityChecker::OnRequestDone(rtc::AsyncHttpRequest* request) {
+ ASSERT(worker_ == rtc::Thread::Current());
// Since we don't know what nic were actually used for the http request,
// for now, just use the first one.
- std::vector<talk_base::Network*> networks;
+ std::vector<rtc::Network*> networks;
network_manager_->GetNetworks(&networks);
if (networks.empty()) {
LOG(LS_ERROR) << "No networks while registering http start.";
return;
}
- talk_base::ProxyInfo proxy_info = request->proxy();
+ rtc::ProxyInfo proxy_info = request->proxy();
NicMap::iterator i = nics_.find(NicId(networks[0]->ip(), proxy_info.address));
if (i != nics_.end()) {
int port = request->port();
- uint32 now = talk_base::Time();
+ uint32 now = rtc::Time();
NicInfo* nic_info = &i->second;
- if (port == talk_base::HTTP_DEFAULT_PORT) {
+ if (port == rtc::HTTP_DEFAULT_PORT) {
nic_info->http.rtt = now - nic_info->http.start_time_ms;
- } else if (port == talk_base::HTTP_SECURE_PORT) {
+ } else if (port == rtc::HTTP_SECURE_PORT) {
nic_info->https.rtt = now - nic_info->https.start_time_ms;
} else {
LOG(LS_ERROR) << "Got response with unknown port: " << port;
@@ -233,8 +233,8 @@
void ConnectivityChecker::OnConfigReady(
const std::string& username, const std::string& password,
- const PortConfiguration* config, const talk_base::ProxyInfo& proxy_info) {
- ASSERT(worker_ == talk_base::Thread::Current());
+ const PortConfiguration* config, const rtc::ProxyInfo& proxy_info) {
+ ASSERT(worker_ == rtc::Thread::Current());
// Since we send requests on both HTTP and HTTPS we will get two
// configs per nic. Results from the second will overwrite the
@@ -244,10 +244,10 @@
}
void ConnectivityChecker::OnRelayPortComplete(Port* port) {
- ASSERT(worker_ == talk_base::Thread::Current());
+ ASSERT(worker_ == rtc::Thread::Current());
RelayPort* relay_port = reinterpret_cast<RelayPort*>(port);
const ProtocolAddress* address = relay_port->ServerAddress(0);
- talk_base::IPAddress ip = port->Network()->ip();
+ rtc::IPAddress ip = port->Network()->ip();
NicMap::iterator i = nics_.find(NicId(ip, port->proxy().address));
if (i != nics_.end()) {
// We have it already, add the new information.
@@ -269,7 +269,7 @@
}
if (connect_info) {
connect_info->rtt =
- talk_base::TimeSince(connect_info->start_time_ms);
+ rtc::TimeSince(connect_info->start_time_ms);
}
}
} else {
@@ -278,17 +278,19 @@
}
void ConnectivityChecker::OnStunPortComplete(Port* port) {
- ASSERT(worker_ == talk_base::Thread::Current());
+ ASSERT(worker_ == rtc::Thread::Current());
const std::vector<Candidate> candidates = port->Candidates();
Candidate c = candidates[0];
- talk_base::IPAddress ip = port->Network()->ip();
+ rtc::IPAddress ip = port->Network()->ip();
NicMap::iterator i = nics_.find(NicId(ip, port->proxy().address));
if (i != nics_.end()) {
// We have it already, add the new information.
- uint32 now = talk_base::Time();
+ uint32 now = rtc::Time();
NicInfo* nic_info = &i->second;
nic_info->external_address = c.address();
- nic_info->stun_server_address = static_cast<StunPort*>(port)->server_addr();
+
+ nic_info->stun_server_addresses =
+ static_cast<StunPort*>(port)->server_addresses();
nic_info->stun.rtt = now - nic_info->stun.start_time_ms;
} else {
LOG(LS_ERROR) << "Got stun address for non-existing nic";
@@ -296,25 +298,27 @@
}
void ConnectivityChecker::OnStunPortError(Port* port) {
- ASSERT(worker_ == talk_base::Thread::Current());
+ ASSERT(worker_ == rtc::Thread::Current());
LOG(LS_ERROR) << "Stun address error.";
- talk_base::IPAddress ip = port->Network()->ip();
+ rtc::IPAddress ip = port->Network()->ip();
NicMap::iterator i = nics_.find(NicId(ip, port->proxy().address));
if (i != nics_.end()) {
// We have it already, add the new information.
NicInfo* nic_info = &i->second;
- nic_info->stun_server_address = static_cast<StunPort*>(port)->server_addr();
+
+ nic_info->stun_server_addresses =
+ static_cast<StunPort*>(port)->server_addresses();
}
}
void ConnectivityChecker::OnRelayPortError(Port* port) {
- ASSERT(worker_ == talk_base::Thread::Current());
+ ASSERT(worker_ == rtc::Thread::Current());
LOG(LS_ERROR) << "Relay address error.";
}
void ConnectivityChecker::OnNetworksChanged() {
- ASSERT(worker_ == talk_base::Thread::Current());
- std::vector<talk_base::Network*> networks;
+ ASSERT(worker_ == rtc::Thread::Current());
+ std::vector<rtc::Network*> networks;
network_manager_->GetNetworks(&networks);
if (networks.empty()) {
LOG(LS_ERROR) << "Machine has no networks; nothing to do";
@@ -324,7 +328,7 @@
}
HttpPortAllocator* ConnectivityChecker::CreatePortAllocator(
- talk_base::NetworkManager* network_manager,
+ rtc::NetworkManager* network_manager,
const std::string& user_agent,
const std::string& relay_token) {
return new TestHttpPortAllocator(network_manager, user_agent, relay_token);
@@ -332,15 +336,15 @@
StunPort* ConnectivityChecker::CreateStunPort(
const std::string& username, const std::string& password,
- const PortConfiguration* config, talk_base::Network* network) {
+ const PortConfiguration* config, rtc::Network* network) {
return StunPort::Create(worker_, socket_factory_.get(),
network, network->ip(), 0, 0,
- username, password, config->stun_address);
+ username, password, config->stun_servers);
}
RelayPort* ConnectivityChecker::CreateRelayPort(
const std::string& username, const std::string& password,
- const PortConfiguration* config, talk_base::Network* network) {
+ const PortConfiguration* config, rtc::Network* network) {
return RelayPort::Create(worker_, socket_factory_.get(),
network, network->ip(),
port_allocator_->min_port(),
@@ -350,9 +354,9 @@
void ConnectivityChecker::CreateRelayPorts(
const std::string& username, const std::string& password,
- const PortConfiguration* config, const talk_base::ProxyInfo& proxy_info) {
+ const PortConfiguration* config, const rtc::ProxyInfo& proxy_info) {
PortConfiguration::RelayList::const_iterator relay;
- std::vector<talk_base::Network*> networks;
+ std::vector<rtc::Network*> networks;
network_manager_->GetNetworks(&networks);
if (networks.empty()) {
LOG(LS_ERROR) << "Machine has no networks; no relay ports created.";
@@ -367,7 +371,7 @@
// TODO: Now setting the same start time for all protocols.
// This might affect accuracy, but since we are mainly looking for
// connect failures or number that stick out, this is good enough.
- uint32 now = talk_base::Time();
+ uint32 now = rtc::Time();
NicInfo* nic_info = &iter->second;
nic_info->udp.start_time_ms = now;
nic_info->tcp.start_time_ms = now;
@@ -405,16 +409,18 @@
}
void ConnectivityChecker::AllocatePorts() {
- const std::string username = talk_base::CreateRandomString(ICE_UFRAG_LENGTH);
- const std::string password = talk_base::CreateRandomString(ICE_PWD_LENGTH);
- PortConfiguration config(stun_address_, username, password);
- std::vector<talk_base::Network*> networks;
+ const std::string username = rtc::CreateRandomString(ICE_UFRAG_LENGTH);
+ const std::string password = rtc::CreateRandomString(ICE_PWD_LENGTH);
+ ServerAddresses stun_servers;
+ stun_servers.insert(stun_address_);
+ PortConfiguration config(stun_servers, username, password);
+ std::vector<rtc::Network*> networks;
network_manager_->GetNetworks(&networks);
if (networks.empty()) {
LOG(LS_ERROR) << "Machine has no networks; no ports will be allocated";
return;
}
- talk_base::ProxyInfo proxy_info = GetProxyInfo();
+ rtc::ProxyInfo proxy_info = GetProxyInfo();
bool allocate_relay_ports = false;
for (uint32 i = 0; i < networks.size(); ++i) {
if (AddNic(networks[i]->ip(), proxy_info.address)) {
@@ -447,9 +453,9 @@
void ConnectivityChecker::InitiateProxyDetection() {
// Only start if we haven't been started before.
if (!proxy_detect_) {
- proxy_detect_ = new talk_base::AutoDetectProxy(user_agent_);
- talk_base::Url<char> host_url("/", "relay.google.com",
- talk_base::HTTP_DEFAULT_PORT);
+ proxy_detect_ = new rtc::AutoDetectProxy(user_agent_);
+ rtc::Url<char> host_url("/", "relay.google.com",
+ rtc::HTTP_DEFAULT_PORT);
host_url.set_secure(true);
proxy_detect_->set_server_url(host_url.url());
proxy_detect_->SignalWorkDone.connect(
@@ -465,8 +471,8 @@
port_allocator_->CreateSessionInternal(
"connectivity checker test content",
ICE_CANDIDATE_COMPONENT_RTP,
- talk_base::CreateRandomString(ICE_UFRAG_LENGTH),
- talk_base::CreateRandomString(ICE_PWD_LENGTH)));
+ rtc::CreateRandomString(ICE_UFRAG_LENGTH),
+ rtc::CreateRandomString(ICE_PWD_LENGTH)));
allocator_session->set_proxy(port_allocator_->proxy());
allocator_session->SignalConfigReady.connect(
this, &ConnectivityChecker::OnConfigReady);
@@ -474,12 +480,12 @@
this, &ConnectivityChecker::OnRequestDone);
// Try both http and https.
- RegisterHttpStart(talk_base::HTTP_SECURE_PORT);
+ RegisterHttpStart(rtc::HTTP_SECURE_PORT);
allocator_session->SendSessionRequest("relay.l.google.com",
- talk_base::HTTP_SECURE_PORT);
- RegisterHttpStart(talk_base::HTTP_DEFAULT_PORT);
+ rtc::HTTP_SECURE_PORT);
+ RegisterHttpStart(rtc::HTTP_DEFAULT_PORT);
allocator_session->SendSessionRequest("relay.l.google.com",
- talk_base::HTTP_DEFAULT_PORT);
+ rtc::HTTP_DEFAULT_PORT);
sessions_.push_back(allocator_session);
}
@@ -487,20 +493,20 @@
void ConnectivityChecker::RegisterHttpStart(int port) {
// Since we don't know what nic were actually used for the http request,
// for now, just use the first one.
- std::vector<talk_base::Network*> networks;
+ std::vector<rtc::Network*> networks;
network_manager_->GetNetworks(&networks);
if (networks.empty()) {
LOG(LS_ERROR) << "No networks while registering http start.";
return;
}
- talk_base::ProxyInfo proxy_info = GetProxyInfo();
+ rtc::ProxyInfo proxy_info = GetProxyInfo();
NicMap::iterator i = nics_.find(NicId(networks[0]->ip(), proxy_info.address));
if (i != nics_.end()) {
- uint32 now = talk_base::Time();
+ uint32 now = rtc::Time();
NicInfo* nic_info = &i->second;
- if (port == talk_base::HTTP_DEFAULT_PORT) {
+ if (port == rtc::HTTP_DEFAULT_PORT) {
nic_info->http.start_time_ms = now;
- } else if (port == talk_base::HTTP_SECURE_PORT) {
+ } else if (port == rtc::HTTP_SECURE_PORT) {
nic_info->https.start_time_ms = now;
} else {
LOG(LS_ERROR) << "Registering start time for unknown port: " << port;
@@ -510,4 +516,4 @@
}
}
-} // namespace talk_base
+} // namespace rtc
diff --git a/p2p/client/connectivitychecker.h b/p2p/client/connectivitychecker.h
index 95b736d..b4423c4 100644
--- a/p2p/client/connectivitychecker.h
+++ b/p2p/client/connectivitychecker.h
@@ -7,17 +7,17 @@
#include <map>
#include <string>
-#include "talk/base/network.h"
-#include "talk/base/basictypes.h"
-#include "talk/base/messagehandler.h"
-#include "talk/base/proxyinfo.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/sigslot.h"
-#include "talk/base/socketaddress.h"
+#include "webrtc/base/network.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/messagehandler.h"
+#include "webrtc/base/proxyinfo.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/socketaddress.h"
#include "talk/p2p/base/basicpacketsocketfactory.h"
#include "talk/p2p/client/httpportallocator.h"
-namespace talk_base {
+namespace rtc {
class AsyncHttpRequest;
class AutoDetectProxy;
class BasicPacketSocketFactory;
@@ -60,13 +60,13 @@
// Identifier for a network interface and proxy address pair.
struct NicId {
- NicId(const talk_base::IPAddress& ip,
- const talk_base::SocketAddress& proxy_address)
+ NicId(const rtc::IPAddress& ip,
+ const rtc::SocketAddress& proxy_address)
: ip(ip),
proxy_address(proxy_address) {
}
- talk_base::IPAddress ip;
- talk_base::SocketAddress proxy_address;
+ rtc::IPAddress ip;
+ rtc::SocketAddress proxy_address;
};
// Comparator implementation identifying unique network interface and
@@ -93,11 +93,11 @@
// Contains information of a network interface and proxy address pair.
struct NicInfo {
NicInfo() {}
- talk_base::IPAddress ip;
- talk_base::ProxyInfo proxy_info;
- talk_base::SocketAddress external_address;
- talk_base::SocketAddress stun_server_address;
- talk_base::SocketAddress media_server_address;
+ rtc::IPAddress ip;
+ rtc::ProxyInfo proxy_info;
+ rtc::SocketAddress external_address;
+ ServerAddresses stun_server_addresses;
+ rtc::SocketAddress media_server_address;
ConnectInfo stun;
ConnectInfo http;
ConnectInfo https;
@@ -119,7 +119,7 @@
int component,
const std::string& ice_ufrag,
const std::string& ice_pwd,
- const std::vector<talk_base::SocketAddress>& stun_hosts,
+ const std::vector<rtc::SocketAddress>& stun_hosts,
const std::vector<std::string>& relay_hosts,
const std::string& relay_token,
const std::string& user_agent)
@@ -127,30 +127,30 @@
allocator, content_name, component, ice_ufrag, ice_pwd, stun_hosts,
relay_hosts, relay_token, user_agent) {
}
- void set_proxy(const talk_base::ProxyInfo& proxy) {
+ void set_proxy(const rtc::ProxyInfo& proxy) {
proxy_ = proxy;
}
void ConfigReady(PortConfiguration* config);
- void OnRequestDone(talk_base::SignalThread* data);
+ void OnRequestDone(rtc::SignalThread* data);
sigslot::signal4<const std::string&, const std::string&,
const PortConfiguration*,
- const talk_base::ProxyInfo&> SignalConfigReady;
- sigslot::signal1<talk_base::AsyncHttpRequest*> SignalRequestDone;
+ const rtc::ProxyInfo&> SignalConfigReady;
+ sigslot::signal1<rtc::AsyncHttpRequest*> SignalRequestDone;
private:
- talk_base::ProxyInfo proxy_;
+ rtc::ProxyInfo proxy_;
};
// Runs a request/response check on all network interface and proxy
// address combinations. The check is considered done either when all
// checks has been successful or when the check times out.
class ConnectivityChecker
- : public talk_base::MessageHandler, public sigslot::has_slots<> {
+ : public rtc::MessageHandler, public sigslot::has_slots<> {
public:
- ConnectivityChecker(talk_base::Thread* worker,
+ ConnectivityChecker(rtc::Thread* worker,
const std::string& jid,
const std::string& session_id,
const std::string& user_agent,
@@ -163,7 +163,7 @@
virtual void Start();
// MessageHandler implementation.
- virtual void OnMessage(talk_base::Message *msg);
+ virtual void OnMessage(rtc::Message *msg);
// Instruct checker to stop and wait until that's done.
// Virtual for gMock.
@@ -179,7 +179,7 @@
timeout_ms_ = timeout;
}
- void set_stun_address(const talk_base::SocketAddress& stun_address) {
+ void set_stun_address(const rtc::SocketAddress& stun_address) {
stun_address_ = stun_address;
}
@@ -200,72 +200,72 @@
protected:
// Can be overridden for test.
- virtual talk_base::NetworkManager* CreateNetworkManager() {
- return new talk_base::BasicNetworkManager();
+ virtual rtc::NetworkManager* CreateNetworkManager() {
+ return new rtc::BasicNetworkManager();
}
- virtual talk_base::BasicPacketSocketFactory* CreateSocketFactory(
- talk_base::Thread* thread) {
- return new talk_base::BasicPacketSocketFactory(thread);
+ virtual rtc::BasicPacketSocketFactory* CreateSocketFactory(
+ rtc::Thread* thread) {
+ return new rtc::BasicPacketSocketFactory(thread);
}
virtual HttpPortAllocator* CreatePortAllocator(
- talk_base::NetworkManager* network_manager,
+ rtc::NetworkManager* network_manager,
const std::string& user_agent,
const std::string& relay_token);
virtual StunPort* CreateStunPort(
const std::string& username, const std::string& password,
- const PortConfiguration* config, talk_base::Network* network);
+ const PortConfiguration* config, rtc::Network* network);
virtual RelayPort* CreateRelayPort(
const std::string& username, const std::string& password,
- const PortConfiguration* config, talk_base::Network* network);
+ const PortConfiguration* config, rtc::Network* network);
virtual void InitiateProxyDetection();
- virtual void SetProxyInfo(const talk_base::ProxyInfo& info);
- virtual talk_base::ProxyInfo GetProxyInfo() const;
+ virtual void SetProxyInfo(const rtc::ProxyInfo& info);
+ virtual rtc::ProxyInfo GetProxyInfo() const;
- talk_base::Thread* worker() {
+ rtc::Thread* worker() {
return worker_;
}
private:
- bool AddNic(const talk_base::IPAddress& ip,
- const talk_base::SocketAddress& proxy_address);
+ bool AddNic(const rtc::IPAddress& ip,
+ const rtc::SocketAddress& proxy_address);
void AllocatePorts();
void AllocateRelayPorts();
void CheckNetworks();
void CreateRelayPorts(
const std::string& username, const std::string& password,
- const PortConfiguration* config, const talk_base::ProxyInfo& proxy_info);
+ const PortConfiguration* config, const rtc::ProxyInfo& proxy_info);
// Must be called by the worker thread.
void CleanUp();
- void OnRequestDone(talk_base::AsyncHttpRequest* request);
+ void OnRequestDone(rtc::AsyncHttpRequest* request);
void OnRelayPortComplete(Port* port);
void OnStunPortComplete(Port* port);
void OnRelayPortError(Port* port);
void OnStunPortError(Port* port);
void OnNetworksChanged();
- void OnProxyDetect(talk_base::SignalThread* thread);
+ void OnProxyDetect(rtc::SignalThread* thread);
void OnConfigReady(
const std::string& username, const std::string& password,
- const PortConfiguration* config, const talk_base::ProxyInfo& proxy);
+ const PortConfiguration* config, const rtc::ProxyInfo& proxy);
void OnConfigWithProxyReady(const PortConfiguration*);
void RegisterHttpStart(int port);
- talk_base::Thread* worker_;
+ rtc::Thread* worker_;
std::string jid_;
std::string session_id_;
std::string user_agent_;
std::string relay_token_;
std::string connection_;
- talk_base::AutoDetectProxy* proxy_detect_;
- talk_base::scoped_ptr<talk_base::NetworkManager> network_manager_;
- talk_base::scoped_ptr<talk_base::BasicPacketSocketFactory> socket_factory_;
- talk_base::scoped_ptr<HttpPortAllocator> port_allocator_;
+ rtc::AutoDetectProxy* proxy_detect_;
+ rtc::scoped_ptr<rtc::NetworkManager> network_manager_;
+ rtc::scoped_ptr<rtc::BasicPacketSocketFactory> socket_factory_;
+ rtc::scoped_ptr<HttpPortAllocator> port_allocator_;
NicMap nics_;
std::vector<Port*> ports_;
std::vector<PortAllocatorSession*> sessions_;
uint32 timeout_ms_;
- talk_base::SocketAddress stun_address_;
- talk_base::Thread* main_;
+ rtc::SocketAddress stun_address_;
+ rtc::Thread* main_;
bool started_;
};
diff --git a/p2p/client/connectivitychecker_unittest.cc b/p2p/client/connectivitychecker_unittest.cc
index c62120b..d1a6525 100644
--- a/p2p/client/connectivitychecker_unittest.cc
+++ b/p2p/client/connectivitychecker_unittest.cc
@@ -3,11 +3,11 @@
#include <string>
-#include "talk/base/asynchttprequest.h"
-#include "talk/base/gunit.h"
-#include "talk/base/fakenetwork.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/socketaddress.h"
+#include "webrtc/base/asynchttprequest.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/fakenetwork.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/socketaddress.h"
#include "talk/p2p/base/basicpacketsocketfactory.h"
#include "talk/p2p/base/relayport.h"
#include "talk/p2p/base/stunport.h"
@@ -16,13 +16,13 @@
namespace cricket {
-static const talk_base::SocketAddress kClientAddr1("11.11.11.11", 0);
-static const talk_base::SocketAddress kClientAddr2("22.22.22.22", 0);
-static const talk_base::SocketAddress kExternalAddr("33.33.33.33", 3333);
-static const talk_base::SocketAddress kStunAddr("44.44.44.44", 4444);
-static const talk_base::SocketAddress kRelayAddr("55.55.55.55", 5555);
-static const talk_base::SocketAddress kProxyAddr("66.66.66.66", 6666);
-static const talk_base::ProxyType kProxyType = talk_base::PROXY_HTTPS;
+static const rtc::SocketAddress kClientAddr1("11.11.11.11", 0);
+static const rtc::SocketAddress kClientAddr2("22.22.22.22", 0);
+static const rtc::SocketAddress kExternalAddr("33.33.33.33", 3333);
+static const rtc::SocketAddress kStunAddr("44.44.44.44", 4444);
+static const rtc::SocketAddress kRelayAddr("55.55.55.55", 5555);
+static const rtc::SocketAddress kProxyAddr("66.66.66.66", 6666);
+static const rtc::ProxyType kProxyType = rtc::PROXY_HTTPS;
static const char kRelayHost[] = "relay.google.com";
static const char kRelayToken[] =
"CAESFwoOb2phQGdvb2dsZS5jb20Q043h47MmGhBTB1rbfIXkhuarDCZe+xF6";
@@ -42,9 +42,9 @@
// Fake implementation to mock away real network usage.
class FakeRelayPort : public RelayPort {
public:
- FakeRelayPort(talk_base::Thread* thread,
- talk_base::PacketSocketFactory* factory,
- talk_base::Network* network, const talk_base::IPAddress& ip,
+ FakeRelayPort(rtc::Thread* thread,
+ rtc::PacketSocketFactory* factory,
+ rtc::Network* network, const rtc::IPAddress& ip,
int min_port, int max_port,
const std::string& username, const std::string& password)
: RelayPort(thread, factory, network, ip, min_port, max_port,
@@ -60,20 +60,20 @@
// Fake implementation to mock away real network usage.
class FakeStunPort : public StunPort {
public:
- FakeStunPort(talk_base::Thread* thread,
- talk_base::PacketSocketFactory* factory,
- talk_base::Network* network,
- const talk_base::IPAddress& ip,
+ FakeStunPort(rtc::Thread* thread,
+ rtc::PacketSocketFactory* factory,
+ rtc::Network* network,
+ const rtc::IPAddress& ip,
int min_port, int max_port,
const std::string& username, const std::string& password,
- const talk_base::SocketAddress& server_addr)
+ const ServerAddresses& server_addr)
: StunPort(thread, factory, network, ip, min_port, max_port,
username, password, server_addr) {
}
// Just set external address and signal that we are done.
virtual void PrepareAddress() {
- AddAddress(kExternalAddr, kExternalAddr, talk_base::SocketAddress(), "udp",
+ AddAddress(kExternalAddr, kExternalAddr, rtc::SocketAddress(), "udp",
STUN_PORT_TYPE, ICE_TYPE_PREFERENCE_SRFLX, true);
SignalPortComplete(this);
}
@@ -88,7 +88,7 @@
const std::string& content_name,
int component,
const std::string& ice_ufrag, const std::string& ice_pwd,
- const std::vector<talk_base::SocketAddress>& stun_hosts,
+ const std::vector<rtc::SocketAddress>& stun_hosts,
const std::vector<std::string>& relay_hosts,
const std::string& relay_token,
const std::string& agent)
@@ -108,16 +108,16 @@
// Pass results to the real implementation.
void FakeReceiveSessionResponse(const std::string& host, int port) {
- talk_base::AsyncHttpRequest* response = CreateAsyncHttpResponse(port);
+ rtc::AsyncHttpRequest* response = CreateAsyncHttpResponse(port);
TestHttpPortAllocatorSession::OnRequestDone(response);
response->Destroy(true);
}
private:
// Helper method for creating a response to a relay session request.
- talk_base::AsyncHttpRequest* CreateAsyncHttpResponse(int port) {
- talk_base::AsyncHttpRequest* request =
- new talk_base::AsyncHttpRequest(kBrowserAgent);
+ rtc::AsyncHttpRequest* CreateAsyncHttpResponse(int port) {
+ rtc::AsyncHttpRequest* request =
+ new rtc::AsyncHttpRequest(kBrowserAgent);
std::stringstream ss;
ss << "username=" << kUserName << std::endl
<< "password=" << kPassword << std::endl
@@ -127,10 +127,10 @@
<< "relay.tcp_port=" << kRelayTcpPort << std::endl
<< "relay.ssltcp_port=" << kRelaySsltcpPort << std::endl;
request->response().document.reset(
- new talk_base::MemoryStream(ss.str().c_str()));
+ new rtc::MemoryStream(ss.str().c_str()));
request->response().set_success();
request->set_port(port);
- request->set_secure(port == talk_base::HTTP_SECURE_PORT);
+ request->set_secure(port == rtc::HTTP_SECURE_PORT);
return request;
}
};
@@ -138,7 +138,7 @@
// Fake implementation for creating fake http sessions.
class FakeHttpPortAllocator : public HttpPortAllocator {
public:
- FakeHttpPortAllocator(talk_base::NetworkManager* network_manager,
+ FakeHttpPortAllocator(rtc::NetworkManager* network_manager,
const std::string& user_agent)
: HttpPortAllocator(network_manager, user_agent) {
}
@@ -146,7 +146,7 @@
virtual PortAllocatorSession* CreateSessionInternal(
const std::string& content_name, int component,
const std::string& ice_ufrag, const std::string& ice_pwd) {
- std::vector<talk_base::SocketAddress> stun_hosts;
+ std::vector<rtc::SocketAddress> stun_hosts;
stun_hosts.push_back(kStunAddr);
std::vector<std::string> relay_hosts;
relay_hosts.push_back(kRelayHost);
@@ -164,7 +164,7 @@
class ConnectivityCheckerForTest : public ConnectivityChecker {
public:
- ConnectivityCheckerForTest(talk_base::Thread* worker,
+ ConnectivityCheckerForTest(rtc::Thread* worker,
const std::string& jid,
const std::string& session_id,
const std::string& user_agent,
@@ -179,7 +179,7 @@
proxy_initiated_(false) {
}
- talk_base::FakeNetworkManager* network_manager() const {
+ rtc::FakeNetworkManager* network_manager() const {
return network_manager_;
}
@@ -189,19 +189,19 @@
protected:
// Overridden methods for faking a real network.
- virtual talk_base::NetworkManager* CreateNetworkManager() {
- network_manager_ = new talk_base::FakeNetworkManager();
+ virtual rtc::NetworkManager* CreateNetworkManager() {
+ network_manager_ = new rtc::FakeNetworkManager();
return network_manager_;
}
- virtual talk_base::BasicPacketSocketFactory* CreateSocketFactory(
- talk_base::Thread* thread) {
+ virtual rtc::BasicPacketSocketFactory* CreateSocketFactory(
+ rtc::Thread* thread) {
// Create socket factory, for simplicity, let it run on the current thread.
socket_factory_ =
- new talk_base::BasicPacketSocketFactory(talk_base::Thread::Current());
+ new rtc::BasicPacketSocketFactory(rtc::Thread::Current());
return socket_factory_;
}
virtual HttpPortAllocator* CreatePortAllocator(
- talk_base::NetworkManager* network_manager,
+ rtc::NetworkManager* network_manager,
const std::string& user_agent,
const std::string& relay_token) {
fake_port_allocator_ =
@@ -210,16 +210,16 @@
}
virtual StunPort* CreateStunPort(
const std::string& username, const std::string& password,
- const PortConfiguration* config, talk_base::Network* network) {
+ const PortConfiguration* config, rtc::Network* network) {
return new FakeStunPort(worker(), socket_factory_,
network, network->ip(),
kMinPort, kMaxPort,
username, password,
- config->stun_address);
+ config->stun_servers);
}
virtual RelayPort* CreateRelayPort(
const std::string& username, const std::string& password,
- const PortConfiguration* config, talk_base::Network* network) {
+ const PortConfiguration* config, rtc::Network* network) {
return new FakeRelayPort(worker(), socket_factory_,
network, network->ip(),
kMinPort, kMaxPort,
@@ -234,27 +234,28 @@
}
}
- virtual talk_base::ProxyInfo GetProxyInfo() const {
+ virtual rtc::ProxyInfo GetProxyInfo() const {
return proxy_info_;
}
private:
- talk_base::BasicPacketSocketFactory* socket_factory_;
+ rtc::BasicPacketSocketFactory* socket_factory_;
FakeHttpPortAllocator* fake_port_allocator_;
- talk_base::FakeNetworkManager* network_manager_;
- talk_base::ProxyInfo proxy_info_;
+ rtc::FakeNetworkManager* network_manager_;
+ rtc::ProxyInfo proxy_info_;
bool proxy_initiated_;
};
class ConnectivityCheckerTest : public testing::Test {
protected:
void VerifyNic(const NicInfo& info,
- const talk_base::SocketAddress& local_address) {
+ const rtc::SocketAddress& local_address) {
// Verify that the external address has been set.
EXPECT_EQ(kExternalAddr, info.external_address);
// Verify that the stun server address has been set.
- EXPECT_EQ(kStunAddr, info.stun_server_address);
+ EXPECT_EQ(1U, info.stun_server_addresses.size());
+ EXPECT_EQ(kStunAddr, *(info.stun_server_addresses.begin()));
// Verify that the media server address has been set. Don't care
// about port since it is different for different protocols.
@@ -282,7 +283,7 @@
// combinations of ip/proxy are created and that all protocols are
// tested on each combination.
TEST_F(ConnectivityCheckerTest, TestStart) {
- ConnectivityCheckerForTest connectivity_checker(talk_base::Thread::Current(),
+ ConnectivityCheckerForTest connectivity_checker(rtc::Thread::Current(),
kJid,
kSessionId,
kBrowserAgent,
@@ -294,7 +295,7 @@
connectivity_checker.network_manager()->AddInterface(kClientAddr2);
connectivity_checker.Start();
- talk_base::Thread::Current()->ProcessMessages(1000);
+ rtc::Thread::Current()->ProcessMessages(1000);
NicMap nics = connectivity_checker.GetResults();
@@ -303,7 +304,7 @@
EXPECT_EQ(4U, nics.size());
// First verify interfaces without proxy.
- talk_base::SocketAddress nilAddress;
+ rtc::SocketAddress nilAddress;
// First lookup the address of the first nic combined with no proxy.
NicMap::iterator i = nics.find(NicId(kClientAddr1.ipaddr(), nilAddress));
@@ -332,7 +333,7 @@
// Tests that nothing bad happens if thera are no network interfaces
// available to check.
TEST_F(ConnectivityCheckerTest, TestStartNoNetwork) {
- ConnectivityCheckerForTest connectivity_checker(talk_base::Thread::Current(),
+ ConnectivityCheckerForTest connectivity_checker(rtc::Thread::Current(),
kJid,
kSessionId,
kBrowserAgent,
@@ -340,7 +341,7 @@
kConnection);
connectivity_checker.Initialize();
connectivity_checker.Start();
- talk_base::Thread::Current()->ProcessMessages(1000);
+ rtc::Thread::Current()->ProcessMessages(1000);
NicMap nics = connectivity_checker.GetResults();
diff --git a/p2p/client/fakeportallocator.h b/p2p/client/fakeportallocator.h
index 5375e50..d54f644 100644
--- a/p2p/client/fakeportallocator.h
+++ b/p2p/client/fakeportallocator.h
@@ -6,12 +6,12 @@
#define TALK_P2P_CLIENT_FAKEPORTALLOCATOR_H_
#include <string>
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/p2p/base/basicpacketsocketfactory.h"
#include "talk/p2p/base/portallocator.h"
#include "talk/p2p/base/udpport.h"
-namespace talk_base {
+namespace rtc {
class SocketFactory;
class Thread;
}
@@ -20,8 +20,8 @@
class FakePortAllocatorSession : public PortAllocatorSession {
public:
- FakePortAllocatorSession(talk_base::Thread* worker_thread,
- talk_base::PacketSocketFactory* factory,
+ FakePortAllocatorSession(rtc::Thread* worker_thread,
+ rtc::PacketSocketFactory* factory,
const std::string& content_name,
int component,
const std::string& ice_ufrag,
@@ -31,10 +31,10 @@
worker_thread_(worker_thread),
factory_(factory),
network_("network", "unittest",
- talk_base::IPAddress(INADDR_LOOPBACK), 8),
+ rtc::IPAddress(INADDR_LOOPBACK), 8),
port_(), running_(false),
port_config_count_(0) {
- network_.AddIP(talk_base::IPAddress(INADDR_LOOPBACK));
+ network_.AddIP(rtc::IPAddress(INADDR_LOOPBACK));
}
virtual void StartGettingPorts() {
@@ -67,21 +67,21 @@
}
private:
- talk_base::Thread* worker_thread_;
- talk_base::PacketSocketFactory* factory_;
- talk_base::Network network_;
- talk_base::scoped_ptr<cricket::Port> port_;
+ rtc::Thread* worker_thread_;
+ rtc::PacketSocketFactory* factory_;
+ rtc::Network network_;
+ rtc::scoped_ptr<cricket::Port> port_;
bool running_;
int port_config_count_;
};
class FakePortAllocator : public cricket::PortAllocator {
public:
- FakePortAllocator(talk_base::Thread* worker_thread,
- talk_base::PacketSocketFactory* factory)
+ FakePortAllocator(rtc::Thread* worker_thread,
+ rtc::PacketSocketFactory* factory)
: worker_thread_(worker_thread), factory_(factory) {
if (factory_ == NULL) {
- owned_factory_.reset(new talk_base::BasicPacketSocketFactory(
+ owned_factory_.reset(new rtc::BasicPacketSocketFactory(
worker_thread_));
factory_ = owned_factory_.get();
}
@@ -97,9 +97,9 @@
}
private:
- talk_base::Thread* worker_thread_;
- talk_base::PacketSocketFactory* factory_;
- talk_base::scoped_ptr<talk_base::BasicPacketSocketFactory> owned_factory_;
+ rtc::Thread* worker_thread_;
+ rtc::PacketSocketFactory* factory_;
+ rtc::scoped_ptr<rtc::BasicPacketSocketFactory> owned_factory_;
};
} // namespace cricket
diff --git a/p2p/client/httpportallocator.cc b/p2p/client/httpportallocator.cc
index b881d43..31c9b51 100644
--- a/p2p/client/httpportallocator.cc
+++ b/p2p/client/httpportallocator.cc
@@ -30,14 +30,14 @@
#include <algorithm>
#include <map>
-#include "talk/base/asynchttprequest.h"
-#include "talk/base/basicdefs.h"
-#include "talk/base/common.h"
-#include "talk/base/helpers.h"
-#include "talk/base/logging.h"
-#include "talk/base/nethelpers.h"
-#include "talk/base/signalthread.h"
-#include "talk/base/stringencode.h"
+#include "webrtc/base/asynchttprequest.h"
+#include "webrtc/base/basicdefs.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/nethelpers.h"
+#include "webrtc/base/signalthread.h"
+#include "webrtc/base/stringencode.h"
namespace {
@@ -95,22 +95,22 @@
const char HttpPortAllocatorBase::kCreateSessionURL[] = "/create_session";
HttpPortAllocatorBase::HttpPortAllocatorBase(
- talk_base::NetworkManager* network_manager,
- talk_base::PacketSocketFactory* socket_factory,
+ rtc::NetworkManager* network_manager,
+ rtc::PacketSocketFactory* socket_factory,
const std::string &user_agent)
: BasicPortAllocator(network_manager, socket_factory), agent_(user_agent) {
relay_hosts_.push_back("relay.google.com");
stun_hosts_.push_back(
- talk_base::SocketAddress("stun.l.google.com", 19302));
+ rtc::SocketAddress("stun.l.google.com", 19302));
}
HttpPortAllocatorBase::HttpPortAllocatorBase(
- talk_base::NetworkManager* network_manager,
+ rtc::NetworkManager* network_manager,
const std::string &user_agent)
: BasicPortAllocator(network_manager), agent_(user_agent) {
relay_hosts_.push_back("relay.google.com");
stun_hosts_.push_back(
- talk_base::SocketAddress("stun.l.google.com", 19302));
+ rtc::SocketAddress("stun.l.google.com", 19302));
}
HttpPortAllocatorBase::~HttpPortAllocatorBase() {
@@ -124,7 +124,7 @@
int component,
const std::string& ice_ufrag,
const std::string& ice_pwd,
- const std::vector<talk_base::SocketAddress>& stun_hosts,
+ const std::vector<rtc::SocketAddress>& stun_hosts,
const std::vector<std::string>& relay_hosts,
const std::string& relay_token,
const std::string& user_agent)
@@ -142,7 +142,13 @@
// but for now is done here and added to the initial config. Note any later
// configs will have unresolved stun ips and will be discarded by the
// AllocationSequence.
- PortConfiguration* config = new PortConfiguration(stun_hosts_[0],
+ ServerAddresses hosts;
+ for (std::vector<rtc::SocketAddress>::iterator it = stun_hosts_.begin();
+ it != stun_hosts_.end(); ++it) {
+ hosts.insert(*it);
+ }
+
+ PortConfiguration* config = new PortConfiguration(hosts,
username(),
password());
ConfigReady(config);
@@ -174,7 +180,7 @@
LOG(LS_WARNING) << "No relay auth token found.";
}
- SendSessionRequest(host, talk_base::HTTP_SECURE_PORT);
+ SendSessionRequest(host, rtc::HTTP_SECURE_PORT);
}
std::string HttpPortAllocatorSessionBase::GetSessionRequestUrl() {
@@ -182,8 +188,8 @@
if (allocator()->flags() & PORTALLOCATOR_ENABLE_SHARED_UFRAG) {
ASSERT(!username().empty());
ASSERT(!password().empty());
- url = url + "?username=" + talk_base::s_url_encode(username()) +
- "&password=" + talk_base::s_url_encode(password());
+ url = url + "?username=" + rtc::s_url_encode(username()) +
+ "&password=" + rtc::s_url_encode(password());
}
return url;
}
@@ -206,21 +212,27 @@
std::string relay_tcp_port = map["relay.tcp_port"];
std::string relay_ssltcp_port = map["relay.ssltcp_port"];
- PortConfiguration* config = new PortConfiguration(stun_hosts_[0],
+ ServerAddresses hosts;
+ for (std::vector<rtc::SocketAddress>::iterator it = stun_hosts_.begin();
+ it != stun_hosts_.end(); ++it) {
+ hosts.insert(*it);
+ }
+
+ PortConfiguration* config = new PortConfiguration(hosts,
map["username"],
map["password"]);
RelayServerConfig relay_config(RELAY_GTURN);
if (!relay_udp_port.empty()) {
- talk_base::SocketAddress address(relay_ip, atoi(relay_udp_port.c_str()));
+ rtc::SocketAddress address(relay_ip, atoi(relay_udp_port.c_str()));
relay_config.ports.push_back(ProtocolAddress(address, PROTO_UDP));
}
if (!relay_tcp_port.empty()) {
- talk_base::SocketAddress address(relay_ip, atoi(relay_tcp_port.c_str()));
+ rtc::SocketAddress address(relay_ip, atoi(relay_tcp_port.c_str()));
relay_config.ports.push_back(ProtocolAddress(address, PROTO_TCP));
}
if (!relay_ssltcp_port.empty()) {
- talk_base::SocketAddress address(relay_ip, atoi(relay_ssltcp_port.c_str()));
+ rtc::SocketAddress address(relay_ip, atoi(relay_ssltcp_port.c_str()));
relay_config.ports.push_back(ProtocolAddress(address, PROTO_SSLTCP));
}
config->AddRelay(relay_config);
@@ -230,14 +242,14 @@
// HttpPortAllocator
HttpPortAllocator::HttpPortAllocator(
- talk_base::NetworkManager* network_manager,
- talk_base::PacketSocketFactory* socket_factory,
+ rtc::NetworkManager* network_manager,
+ rtc::PacketSocketFactory* socket_factory,
const std::string &user_agent)
: HttpPortAllocatorBase(network_manager, socket_factory, user_agent) {
}
HttpPortAllocator::HttpPortAllocator(
- talk_base::NetworkManager* network_manager,
+ rtc::NetworkManager* network_manager,
const std::string &user_agent)
: HttpPortAllocatorBase(network_manager, user_agent) {
}
@@ -261,7 +273,7 @@
int component,
const std::string& ice_ufrag,
const std::string& ice_pwd,
- const std::vector<talk_base::SocketAddress>& stun_hosts,
+ const std::vector<rtc::SocketAddress>& stun_hosts,
const std::vector<std::string>& relay_hosts,
const std::string& relay,
const std::string& agent)
@@ -271,7 +283,7 @@
}
HttpPortAllocatorSession::~HttpPortAllocatorSession() {
- for (std::list<talk_base::AsyncHttpRequest*>::iterator it = requests_.begin();
+ for (std::list<rtc::AsyncHttpRequest*>::iterator it = requests_.begin();
it != requests_.end(); ++it) {
(*it)->Destroy(true);
}
@@ -280,15 +292,15 @@
void HttpPortAllocatorSession::SendSessionRequest(const std::string& host,
int port) {
// Initiate an HTTP request to create a session through the chosen host.
- talk_base::AsyncHttpRequest* request =
- new talk_base::AsyncHttpRequest(user_agent());
+ rtc::AsyncHttpRequest* request =
+ new rtc::AsyncHttpRequest(user_agent());
request->SignalWorkDone.connect(this,
&HttpPortAllocatorSession::OnRequestDone);
- request->set_secure(port == talk_base::HTTP_SECURE_PORT);
+ request->set_secure(port == rtc::HTTP_SECURE_PORT);
request->set_proxy(allocator()->proxy());
- request->response().document.reset(new talk_base::MemoryStream);
- request->request().verb = talk_base::HV_GET;
+ request->response().document.reset(new rtc::MemoryStream);
+ request->request().verb = rtc::HV_GET;
request->request().path = GetSessionRequestUrl();
request->request().addHeader("X-Talk-Google-Relay-Auth", relay_token(), true);
request->request().addHeader("X-Stream-Type", "video_rtp", true);
@@ -300,12 +312,12 @@
requests_.push_back(request);
}
-void HttpPortAllocatorSession::OnRequestDone(talk_base::SignalThread* data) {
- talk_base::AsyncHttpRequest* request =
- static_cast<talk_base::AsyncHttpRequest*>(data);
+void HttpPortAllocatorSession::OnRequestDone(rtc::SignalThread* data) {
+ rtc::AsyncHttpRequest* request =
+ static_cast<rtc::AsyncHttpRequest*>(data);
// Remove the request from the list of active requests.
- std::list<talk_base::AsyncHttpRequest*>::iterator it =
+ std::list<rtc::AsyncHttpRequest*>::iterator it =
std::find(requests_.begin(), requests_.end(), request);
if (it != requests_.end()) {
requests_.erase(it);
@@ -319,8 +331,8 @@
}
LOG(LS_INFO) << "HTTPPortAllocator: request succeeded";
- talk_base::MemoryStream* stream =
- static_cast<talk_base::MemoryStream*>(request->response().document.get());
+ rtc::MemoryStream* stream =
+ static_cast<rtc::MemoryStream*>(request->response().document.get());
stream->Rewind();
size_t length;
stream->GetSize(&length);
diff --git a/p2p/client/httpportallocator.h b/p2p/client/httpportallocator.h
index a0ef3b7..7ace943 100644
--- a/p2p/client/httpportallocator.h
+++ b/p2p/client/httpportallocator.h
@@ -36,7 +36,7 @@
class HttpPortAllocatorTest_TestSessionRequestUrl_Test;
-namespace talk_base {
+namespace rtc {
class AsyncHttpRequest;
class SignalThread;
}
@@ -51,10 +51,10 @@
// Records the URL that we will GET in order to create a session.
static const char kCreateSessionURL[];
- HttpPortAllocatorBase(talk_base::NetworkManager* network_manager,
+ HttpPortAllocatorBase(rtc::NetworkManager* network_manager,
const std::string& user_agent);
- HttpPortAllocatorBase(talk_base::NetworkManager* network_manager,
- talk_base::PacketSocketFactory* socket_factory,
+ HttpPortAllocatorBase(rtc::NetworkManager* network_manager,
+ rtc::PacketSocketFactory* socket_factory,
const std::string& user_agent);
virtual ~HttpPortAllocatorBase();
@@ -66,7 +66,7 @@
const std::string& ice_ufrag,
const std::string& ice_pwd) = 0;
- void SetStunHosts(const std::vector<talk_base::SocketAddress>& hosts) {
+ void SetStunHosts(const std::vector<rtc::SocketAddress>& hosts) {
if (!hosts.empty()) {
stun_hosts_ = hosts;
}
@@ -78,7 +78,7 @@
}
void SetRelayToken(const std::string& relay) { relay_token_ = relay; }
- const std::vector<talk_base::SocketAddress>& stun_hosts() const {
+ const std::vector<rtc::SocketAddress>& stun_hosts() const {
return stun_hosts_;
}
@@ -95,7 +95,7 @@
}
private:
- std::vector<talk_base::SocketAddress> stun_hosts_;
+ std::vector<rtc::SocketAddress> stun_hosts_;
std::vector<std::string> relay_hosts_;
std::string relay_token_;
std::string agent_;
@@ -111,7 +111,7 @@
int component,
const std::string& ice_ufrag,
const std::string& ice_pwd,
- const std::vector<talk_base::SocketAddress>& stun_hosts,
+ const std::vector<rtc::SocketAddress>& stun_hosts,
const std::vector<std::string>& relay_hosts,
const std::string& relay,
const std::string& agent);
@@ -141,7 +141,7 @@
private:
std::vector<std::string> relay_hosts_;
- std::vector<talk_base::SocketAddress> stun_hosts_;
+ std::vector<rtc::SocketAddress> stun_hosts_;
std::string relay_token_;
std::string agent_;
int attempts_;
@@ -149,10 +149,10 @@
class HttpPortAllocator : public HttpPortAllocatorBase {
public:
- HttpPortAllocator(talk_base::NetworkManager* network_manager,
+ HttpPortAllocator(rtc::NetworkManager* network_manager,
const std::string& user_agent);
- HttpPortAllocator(talk_base::NetworkManager* network_manager,
- talk_base::PacketSocketFactory* socket_factory,
+ HttpPortAllocator(rtc::NetworkManager* network_manager,
+ rtc::PacketSocketFactory* socket_factory,
const std::string& user_agent);
virtual ~HttpPortAllocator();
virtual PortAllocatorSession* CreateSessionInternal(
@@ -169,7 +169,7 @@
int component,
const std::string& ice_ufrag,
const std::string& ice_pwd,
- const std::vector<talk_base::SocketAddress>& stun_hosts,
+ const std::vector<rtc::SocketAddress>& stun_hosts,
const std::vector<std::string>& relay_hosts,
const std::string& relay,
const std::string& agent);
@@ -179,10 +179,10 @@
protected:
// Protected for diagnostics.
- virtual void OnRequestDone(talk_base::SignalThread* request);
+ virtual void OnRequestDone(rtc::SignalThread* request);
private:
- std::list<talk_base::AsyncHttpRequest*> requests_;
+ std::list<rtc::AsyncHttpRequest*> requests_;
};
} // namespace cricket
diff --git a/p2p/client/portallocator_unittest.cc b/p2p/client/portallocator_unittest.cc
index b9def30..bddf0c3 100644
--- a/p2p/client/portallocator_unittest.cc
+++ b/p2p/client/portallocator_unittest.cc
@@ -25,19 +25,19 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/fakenetwork.h"
-#include "talk/base/firewallsocketserver.h"
-#include "talk/base/gunit.h"
-#include "talk/base/helpers.h"
-#include "talk/base/logging.h"
-#include "talk/base/natserver.h"
-#include "talk/base/natsocketfactory.h"
-#include "talk/base/network.h"
-#include "talk/base/physicalsocketserver.h"
-#include "talk/base/socketaddress.h"
-#include "talk/base/ssladapter.h"
-#include "talk/base/thread.h"
-#include "talk/base/virtualsocketserver.h"
+#include "webrtc/base/fakenetwork.h"
+#include "webrtc/base/firewallsocketserver.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/natserver.h"
+#include "webrtc/base/natsocketfactory.h"
+#include "webrtc/base/network.h"
+#include "webrtc/base/physicalsocketserver.h"
+#include "webrtc/base/socketaddress.h"
+#include "webrtc/base/ssladapter.h"
+#include "webrtc/base/thread.h"
+#include "webrtc/base/virtualsocketserver.h"
#include "talk/p2p/base/basicpacketsocketfactory.h"
#include "talk/p2p/base/constants.h"
#include "talk/p2p/base/p2ptransportchannel.h"
@@ -48,14 +48,15 @@
#include "talk/p2p/client/basicportallocator.h"
#include "talk/p2p/client/httpportallocator.h"
-using talk_base::SocketAddress;
-using talk_base::Thread;
+using cricket::ServerAddresses;
+using rtc::SocketAddress;
+using rtc::Thread;
static const SocketAddress kClientAddr("11.11.11.11", 0);
static const SocketAddress kClientIPv6Addr(
"2401:fa00:4:1000:be30:5bff:fee5:c3", 0);
static const SocketAddress kClientAddr2("22.22.22.22", 0);
-static const SocketAddress kNatAddr("77.77.77.77", talk_base::NAT_SERVER_PORT);
+static const SocketAddress kNatAddr("77.77.77.77", rtc::NAT_SERVER_PORT);
static const SocketAddress kRemoteClientAddr("22.22.22.22", 0);
static const SocketAddress kStunAddr("99.99.99.1", cricket::STUN_SERVER_PORT);
static const SocketAddress kRelayUdpIntAddr("99.99.99.2", 5000);
@@ -96,17 +97,17 @@
class PortAllocatorTest : public testing::Test, public sigslot::has_slots<> {
public:
static void SetUpTestCase() {
- talk_base::InitializeSSL();
+ rtc::InitializeSSL();
}
static void TearDownTestCase() {
- talk_base::CleanupSSL();
+ rtc::CleanupSSL();
}
PortAllocatorTest()
- : pss_(new talk_base::PhysicalSocketServer),
- vss_(new talk_base::VirtualSocketServer(pss_.get())),
- fss_(new talk_base::FirewallSocketServer(vss_.get())),
+ : pss_(new rtc::PhysicalSocketServer),
+ vss_(new rtc::VirtualSocketServer(pss_.get())),
+ fss_(new rtc::FirewallSocketServer(vss_.get())),
ss_scope_(fss_.get()),
nat_factory_(vss_.get(), kNatAddr),
nat_socket_factory_(&nat_factory_),
@@ -115,10 +116,13 @@
kRelayTcpIntAddr, kRelayTcpExtAddr,
kRelaySslTcpIntAddr, kRelaySslTcpExtAddr),
turn_server_(Thread::Current(), kTurnUdpIntAddr, kTurnUdpExtAddr),
- allocator_(new cricket::BasicPortAllocator(
- &network_manager_, kStunAddr,
- kRelayUdpIntAddr, kRelayTcpIntAddr, kRelaySslTcpIntAddr)),
candidate_allocation_done_(false) {
+ cricket::ServerAddresses stun_servers;
+ stun_servers.insert(kStunAddr);
+ allocator_.reset(new cricket::BasicPortAllocator(
+ &network_manager_,
+ stun_servers,
+ kRelayUdpIntAddr, kRelayTcpIntAddr, kRelaySslTcpIntAddr));
allocator_->set_step_delay(cricket::kMinimumStepDelay);
}
@@ -128,9 +132,9 @@
bool SetPortRange(int min_port, int max_port) {
return allocator_->SetPortRange(min_port, max_port);
}
- talk_base::NATServer* CreateNatServer(const SocketAddress& addr,
- talk_base::NATType type) {
- return new talk_base::NATServer(type, vss_.get(), addr, vss_.get(), addr);
+ rtc::NATServer* CreateNatServer(const SocketAddress& addr,
+ rtc::NATType type) {
+ return new rtc::NATServer(type, vss_.get(), addr, vss_.get(), addr);
}
bool CreateSession(int component) {
@@ -181,7 +185,7 @@
((addr.port() == 0 && (c.address().port() != 0)) ||
(c.address().port() == addr.port())));
}
- static bool CheckPort(const talk_base::SocketAddress& addr,
+ static bool CheckPort(const rtc::SocketAddress& addr,
int min_port, int max_port) {
return (addr.port() >= min_port && addr.port() <= max_port);
}
@@ -203,10 +207,10 @@
int send_buffer_size;
if (expected == -1) {
EXPECT_EQ(SOCKET_ERROR,
- (*it)->GetOption(talk_base::Socket::OPT_SNDBUF,
+ (*it)->GetOption(rtc::Socket::OPT_SNDBUF,
&send_buffer_size));
} else {
- EXPECT_EQ(0, (*it)->GetOption(talk_base::Socket::OPT_SNDBUF,
+ EXPECT_EQ(0, (*it)->GetOption(rtc::Socket::OPT_SNDBUF,
&send_buffer_size));
ASSERT_EQ(expected, send_buffer_size);
}
@@ -245,18 +249,18 @@
return false;
}
- talk_base::scoped_ptr<talk_base::PhysicalSocketServer> pss_;
- talk_base::scoped_ptr<talk_base::VirtualSocketServer> vss_;
- talk_base::scoped_ptr<talk_base::FirewallSocketServer> fss_;
- talk_base::SocketServerScope ss_scope_;
- talk_base::NATSocketFactory nat_factory_;
- talk_base::BasicPacketSocketFactory nat_socket_factory_;
+ rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_;
+ rtc::scoped_ptr<rtc::VirtualSocketServer> vss_;
+ rtc::scoped_ptr<rtc::FirewallSocketServer> fss_;
+ rtc::SocketServerScope ss_scope_;
+ rtc::NATSocketFactory nat_factory_;
+ rtc::BasicPacketSocketFactory nat_socket_factory_;
cricket::TestStunServer stun_server_;
cricket::TestRelayServer relay_server_;
cricket::TestTurnServer turn_server_;
- talk_base::FakeNetworkManager network_manager_;
- talk_base::scoped_ptr<cricket::BasicPortAllocator> allocator_;
- talk_base::scoped_ptr<cricket::PortAllocatorSession> session_;
+ rtc::FakeNetworkManager network_manager_;
+ rtc::scoped_ptr<cricket::BasicPortAllocator> allocator_;
+ rtc::scoped_ptr<cricket::PortAllocatorSession> session_;
std::vector<cricket::PortInterface*> ports_;
std::vector<cricket::Candidate> candidates_;
bool candidate_allocation_done_;
@@ -265,7 +269,7 @@
// Tests that we can init the port allocator and create a session.
TEST_F(PortAllocatorTest, TestBasic) {
EXPECT_EQ(&network_manager_, allocator().network_manager());
- EXPECT_EQ(kStunAddr, allocator().stun_address());
+ EXPECT_EQ(kStunAddr, *allocator().stun_servers().begin());
ASSERT_EQ(1u, allocator().relays().size());
EXPECT_EQ(cricket::RELAY_GTURN, allocator().relays()[0].type);
// Empty relay credentials are used for GTURN.
@@ -288,7 +292,7 @@
// called OnAllocate multiple times. In old behavior it's called every 250ms.
// When there are no network interfaces, each execution of OnAllocate will
// result in SignalCandidatesAllocationDone signal.
- talk_base::Thread::Current()->ProcessMessages(1000);
+ rtc::Thread::Current()->ProcessMessages(1000);
EXPECT_TRUE(candidate_allocation_done_);
EXPECT_EQ(0U, candidates_.size());
}
@@ -404,7 +408,7 @@
TEST_F(PortAllocatorTest, TestGetAllPortsNoAdapters) {
EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
session_->StartGettingPorts();
- talk_base::Thread::Current()->ProcessMessages(100);
+ rtc::Thread::Current()->ProcessMessages(100);
// Without network adapter, we should not get any candidate.
EXPECT_EQ(0U, candidates_.size());
EXPECT_TRUE(candidate_allocation_done_);
@@ -420,7 +424,7 @@
cricket::PORTALLOCATOR_DISABLE_RELAY |
cricket::PORTALLOCATOR_DISABLE_TCP);
session_->StartGettingPorts();
- talk_base::Thread::Current()->ProcessMessages(100);
+ rtc::Thread::Current()->ProcessMessages(100);
EXPECT_EQ(0U, candidates_.size());
EXPECT_TRUE(candidate_allocation_done_);
}
@@ -487,7 +491,7 @@
// Testing STUN timeout.
TEST_F(PortAllocatorTest, TestGetAllPortsNoUdpAllowed) {
- fss_->AddRule(false, talk_base::FP_UDP, talk_base::FD_ANY, kClientAddr);
+ fss_->AddRule(false, rtc::FP_UDP, rtc::FD_ANY, kClientAddr);
AddInterface(kClientAddr);
EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
session_->StartGettingPorts();
@@ -546,9 +550,9 @@
AddInterface(kClientAddr);
allocator().set_flags(cricket::PORTALLOCATOR_ENABLE_BUNDLE);
// Session ID - session1.
- talk_base::scoped_ptr<cricket::PortAllocatorSession> session1(
+ rtc::scoped_ptr<cricket::PortAllocatorSession> session1(
CreateSession("session1", cricket::ICE_CANDIDATE_COMPONENT_RTP));
- talk_base::scoped_ptr<cricket::PortAllocatorSession> session2(
+ rtc::scoped_ptr<cricket::PortAllocatorSession> session2(
CreateSession("session1", cricket::ICE_CANDIDATE_COMPONENT_RTCP));
session1->StartGettingPorts();
session2->StartGettingPorts();
@@ -556,7 +560,7 @@
ASSERT_EQ_WAIT(14U, candidates_.size(), kDefaultAllocationTimeout);
EXPECT_EQ(8U, ports_.size());
- talk_base::scoped_ptr<cricket::PortAllocatorSession> session3(
+ rtc::scoped_ptr<cricket::PortAllocatorSession> session3(
CreateSession("session1", cricket::ICE_CANDIDATE_COMPONENT_RTP));
session3->StartGettingPorts();
// Already allocated candidates and ports will be sent to the newly
@@ -573,7 +577,7 @@
AddInterface(kClientAddr);
allocator().set_flags(cricket::PORTALLOCATOR_ENABLE_BUNDLE);
// Session ID - session1.
- talk_base::scoped_ptr<cricket::PortAllocatorSession> session1(
+ rtc::scoped_ptr<cricket::PortAllocatorSession> session1(
CreateSession("session1", kContentName,
cricket::ICE_CANDIDATE_COMPONENT_RTP,
kIceUfrag0, kIcePwd0));
@@ -582,7 +586,7 @@
EXPECT_EQ(4U, ports_.size());
// Allocate a different session with sid |session1| and different ice_ufrag.
- talk_base::scoped_ptr<cricket::PortAllocatorSession> session2(
+ rtc::scoped_ptr<cricket::PortAllocatorSession> session2(
CreateSession("session1", kContentName,
cricket::ICE_CANDIDATE_COMPONENT_RTP,
"TestIceUfrag", kIcePwd0));
@@ -597,7 +601,7 @@
// Allocating a different session with sid |session1| and
// different ice_pwd.
- talk_base::scoped_ptr<cricket::PortAllocatorSession> session3(
+ rtc::scoped_ptr<cricket::PortAllocatorSession> session3(
CreateSession("session1", kContentName,
cricket::ICE_CANDIDATE_COMPONENT_RTP,
kIceUfrag0, "TestIcePwd"));
@@ -610,7 +614,7 @@
EXPECT_NE(candidates_[8].address(), candidates_[15].address());
// Allocating a session with by changing both ice_ufrag and ice_pwd.
- talk_base::scoped_ptr<cricket::PortAllocatorSession> session4(
+ rtc::scoped_ptr<cricket::PortAllocatorSession> session4(
CreateSession("session1", kContentName,
cricket::ICE_CANDIDATE_COMPONENT_RTP,
"TestIceUfrag", "TestIcePwd"));
@@ -694,10 +698,12 @@
// local candidates as client behind a nat.
TEST_F(PortAllocatorTest, TestSharedSocketWithNat) {
AddInterface(kClientAddr);
- talk_base::scoped_ptr<talk_base::NATServer> nat_server(
- CreateNatServer(kNatAddr, talk_base::NAT_OPEN_CONE));
+ rtc::scoped_ptr<rtc::NATServer> nat_server(
+ CreateNatServer(kNatAddr, rtc::NAT_OPEN_CONE));
+ ServerAddresses stun_servers;
+ stun_servers.insert(kStunAddr);
allocator_.reset(new cricket::BasicPortAllocator(
- &network_manager_, &nat_socket_factory_, kStunAddr));
+ &network_manager_, &nat_socket_factory_, stun_servers));
allocator_->set_step_delay(cricket::kMinimumStepDelay);
allocator_->set_flags(allocator().flags() |
cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG |
@@ -710,7 +716,7 @@
cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp", kClientAddr);
EXPECT_PRED5(CheckCandidate, candidates_[1],
cricket::ICE_CANDIDATE_COMPONENT_RTP, "stun", "udp",
- talk_base::SocketAddress(kNatAddr.ipaddr(), 0));
+ rtc::SocketAddress(kNatAddr.ipaddr(), 0));
EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
EXPECT_EQ(3U, candidates_.size());
}
@@ -744,10 +750,10 @@
cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp", kClientAddr);
EXPECT_PRED5(CheckCandidate, candidates_[1],
cricket::ICE_CANDIDATE_COMPONENT_RTP, "relay", "udp",
- talk_base::SocketAddress(kTurnUdpExtAddr.ipaddr(), 0));
+ rtc::SocketAddress(kTurnUdpExtAddr.ipaddr(), 0));
EXPECT_PRED5(CheckCandidate, candidates_[2],
cricket::ICE_CANDIDATE_COMPONENT_RTP, "relay", "udp",
- talk_base::SocketAddress(kTurnUdpExtAddr.ipaddr(), 0));
+ rtc::SocketAddress(kTurnUdpExtAddr.ipaddr(), 0));
EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
EXPECT_EQ(3U, candidates_.size());
}
@@ -755,7 +761,7 @@
// Testing DNS resolve for the TURN server, this will test AllocationSequence
// handling the unresolved address signal from TurnPort.
TEST_F(PortAllocatorTest, TestSharedSocketWithServerAddressResolve) {
- turn_server_.AddInternalSocket(talk_base::SocketAddress("127.0.0.1", 3478),
+ turn_server_.AddInternalSocket(rtc::SocketAddress("127.0.0.1", 3478),
cricket::PROTO_UDP);
AddInterface(kClientAddr);
allocator_.reset(new cricket::BasicPortAllocator(&network_manager_));
@@ -763,7 +769,7 @@
cricket::RelayCredentials credentials(kTurnUsername, kTurnPassword);
relay_server.credentials = credentials;
relay_server.ports.push_back(cricket::ProtocolAddress(
- talk_base::SocketAddress("localhost", 3478),
+ rtc::SocketAddress("localhost", 3478),
cricket::PROTO_UDP, false));
allocator_->AddRelay(relay_server);
@@ -784,10 +790,12 @@
// stun and turn candidates.
TEST_F(PortAllocatorTest, TestSharedSocketWithNatUsingTurn) {
AddInterface(kClientAddr);
- talk_base::scoped_ptr<talk_base::NATServer> nat_server(
- CreateNatServer(kNatAddr, talk_base::NAT_OPEN_CONE));
+ rtc::scoped_ptr<rtc::NATServer> nat_server(
+ CreateNatServer(kNatAddr, rtc::NAT_OPEN_CONE));
+ ServerAddresses stun_servers;
+ stun_servers.insert(kStunAddr);
allocator_.reset(new cricket::BasicPortAllocator(
- &network_manager_, &nat_socket_factory_, kStunAddr));
+ &network_manager_, &nat_socket_factory_, stun_servers));
cricket::RelayServerConfig relay_server(cricket::RELAY_TURN);
cricket::RelayCredentials credentials(kTurnUsername, kTurnPassword);
relay_server.credentials = credentials;
@@ -810,10 +818,10 @@
cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp", kClientAddr);
EXPECT_PRED5(CheckCandidate, candidates_[1],
cricket::ICE_CANDIDATE_COMPONENT_RTP, "stun", "udp",
- talk_base::SocketAddress(kNatAddr.ipaddr(), 0));
+ rtc::SocketAddress(kNatAddr.ipaddr(), 0));
EXPECT_PRED5(CheckCandidate, candidates_[2],
cricket::ICE_CANDIDATE_COMPONENT_RTP, "relay", "udp",
- talk_base::SocketAddress(kTurnUdpExtAddr.ipaddr(), 0));
+ rtc::SocketAddress(kTurnUdpExtAddr.ipaddr(), 0));
EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
EXPECT_EQ(3U, candidates_.size());
// Local port will be created first and then TURN port.
@@ -830,7 +838,7 @@
cricket::PORTALLOCATOR_DISABLE_TCP |
cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG |
cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET);
- fss_->AddRule(false, talk_base::FP_UDP, talk_base::FD_ANY, kClientAddr);
+ fss_->AddRule(false, rtc::FP_UDP, rtc::FD_ANY, kClientAddr);
AddInterface(kClientAddr);
EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
session_->StartGettingPorts();
@@ -876,13 +884,13 @@
// Test that the httpportallocator correctly maintains its lists of stun and
// relay servers, by never allowing an empty list.
TEST(HttpPortAllocatorTest, TestHttpPortAllocatorHostLists) {
- talk_base::FakeNetworkManager network_manager;
+ rtc::FakeNetworkManager network_manager;
cricket::HttpPortAllocator alloc(&network_manager, "unit test agent");
EXPECT_EQ(1U, alloc.relay_hosts().size());
EXPECT_EQ(1U, alloc.stun_hosts().size());
std::vector<std::string> relay_servers;
- std::vector<talk_base::SocketAddress> stun_servers;
+ std::vector<rtc::SocketAddress> stun_servers;
alloc.SetRelayHosts(relay_servers);
alloc.SetStunHosts(stun_servers);
@@ -892,9 +900,10 @@
relay_servers.push_back("1.unittest.corp.google.com");
relay_servers.push_back("2.unittest.corp.google.com");
stun_servers.push_back(
- talk_base::SocketAddress("1.unittest.corp.google.com", 0));
+ rtc::SocketAddress("1.unittest.corp.google.com", 0));
stun_servers.push_back(
- talk_base::SocketAddress("2.unittest.corp.google.com", 0));
+ rtc::SocketAddress("2.unittest.corp.google.com", 0));
+
alloc.SetRelayHosts(relay_servers);
alloc.SetStunHosts(stun_servers);
EXPECT_EQ(2U, alloc.relay_hosts().size());
@@ -903,12 +912,12 @@
// Test that the HttpPortAllocator uses correct URL to create sessions.
TEST(HttpPortAllocatorTest, TestSessionRequestUrl) {
- talk_base::FakeNetworkManager network_manager;
+ rtc::FakeNetworkManager network_manager;
cricket::HttpPortAllocator alloc(&network_manager, "unit test agent");
// Disable PORTALLOCATOR_ENABLE_SHARED_UFRAG.
alloc.set_flags(alloc.flags() & ~cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG);
- talk_base::scoped_ptr<cricket::HttpPortAllocatorSessionBase> session(
+ rtc::scoped_ptr<cricket::HttpPortAllocatorSessionBase> session(
static_cast<cricket::HttpPortAllocatorSession*>(
alloc.CreateSessionInternal(
"test content", 0, kIceUfrag0, kIcePwd0)));
@@ -923,19 +932,19 @@
url = session->GetSessionRequestUrl();
LOG(LS_INFO) << "url: " << url;
std::vector<std::string> parts;
- talk_base::split(url, '?', &parts);
+ rtc::split(url, '?', &parts);
ASSERT_EQ(2U, parts.size());
std::vector<std::string> args_parts;
- talk_base::split(parts[1], '&', &args_parts);
+ rtc::split(parts[1], '&', &args_parts);
std::map<std::string, std::string> args;
for (std::vector<std::string>::iterator it = args_parts.begin();
it != args_parts.end(); ++it) {
std::vector<std::string> parts;
- talk_base::split(*it, '=', &parts);
+ rtc::split(*it, '=', &parts);
ASSERT_EQ(2U, parts.size());
- args[talk_base::s_url_decode(parts[0])] = talk_base::s_url_decode(parts[1]);
+ args[rtc::s_url_decode(parts[0])] = rtc::s_url_decode(parts[1]);
}
EXPECT_EQ(kIceUfrag0, args["username"]);
diff --git a/p2p/client/sessionsendtask.h b/p2p/client/sessionsendtask.h
index 6c7508a..208386e 100644
--- a/p2p/client/sessionsendtask.h
+++ b/p2p/client/sessionsendtask.h
@@ -28,7 +28,7 @@
#ifndef TALK_P2P_CLIENT_SESSIONSENDTASK_H_
#define TALK_P2P_CLIENT_SESSIONSENDTASK_H_
-#include "talk/base/common.h"
+#include "webrtc/base/common.h"
#include "talk/xmpp/constants.h"
#include "talk/xmpp/xmppclient.h"
#include "talk/xmpp/xmppengine.h"
@@ -137,7 +137,7 @@
private:
SessionManager *session_manager_;
- talk_base::scoped_ptr<buzz::XmlElement> stanza_;
+ rtc::scoped_ptr<buzz::XmlElement> stanza_;
};
}
diff --git a/p2p/client/socketmonitor.cc b/p2p/client/socketmonitor.cc
index e0c75d4..1924c70 100644
--- a/p2p/client/socketmonitor.cc
+++ b/p2p/client/socketmonitor.cc
@@ -27,7 +27,7 @@
#include "talk/p2p/client/socketmonitor.h"
-#include "talk/base/common.h"
+#include "webrtc/base/common.h"
namespace cricket {
@@ -39,8 +39,8 @@
};
SocketMonitor::SocketMonitor(TransportChannel* channel,
- talk_base::Thread* worker_thread,
- talk_base::Thread* monitor_thread) {
+ rtc::Thread* worker_thread,
+ rtc::Thread* monitor_thread) {
channel_ = channel;
channel_thread_ = worker_thread;
monitoring_thread_ = monitor_thread;
@@ -63,11 +63,11 @@
channel_thread_->Post(this, MSG_MONITOR_STOP);
}
-void SocketMonitor::OnMessage(talk_base::Message *message) {
- talk_base::CritScope cs(&crit_);
+void SocketMonitor::OnMessage(rtc::Message *message) {
+ rtc::CritScope cs(&crit_);
switch (message->message_id) {
case MSG_MONITOR_START:
- ASSERT(talk_base::Thread::Current() == channel_thread_);
+ ASSERT(rtc::Thread::Current() == channel_thread_);
if (!monitoring_) {
monitoring_ = true;
PollSocket(true);
@@ -75,7 +75,7 @@
break;
case MSG_MONITOR_STOP:
- ASSERT(talk_base::Thread::Current() == channel_thread_);
+ ASSERT(rtc::Thread::Current() == channel_thread_);
if (monitoring_) {
monitoring_ = false;
channel_thread_->Clear(this);
@@ -83,12 +83,12 @@
break;
case MSG_MONITOR_POLL:
- ASSERT(talk_base::Thread::Current() == channel_thread_);
+ ASSERT(rtc::Thread::Current() == channel_thread_);
PollSocket(true);
break;
case MSG_MONITOR_SIGNAL: {
- ASSERT(talk_base::Thread::Current() == monitoring_thread_);
+ ASSERT(rtc::Thread::Current() == monitoring_thread_);
std::vector<ConnectionInfo> infos = connection_infos_;
crit_.Leave();
SignalUpdate(this, infos);
@@ -99,8 +99,8 @@
}
void SocketMonitor::PollSocket(bool poll) {
- ASSERT(talk_base::Thread::Current() == channel_thread_);
- talk_base::CritScope cs(&crit_);
+ ASSERT(rtc::Thread::Current() == channel_thread_);
+ rtc::CritScope cs(&crit_);
// Gather connection infos
channel_->GetStats(&connection_infos_);
diff --git a/p2p/client/socketmonitor.h b/p2p/client/socketmonitor.h
index f24ad66..dd540c8 100644
--- a/p2p/client/socketmonitor.h
+++ b/p2p/client/socketmonitor.h
@@ -30,38 +30,38 @@
#include <vector>
-#include "talk/base/criticalsection.h"
-#include "talk/base/sigslot.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/criticalsection.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/thread.h"
#include "talk/p2p/base/transportchannel.h"
namespace cricket {
-class SocketMonitor : public talk_base::MessageHandler,
+class SocketMonitor : public rtc::MessageHandler,
public sigslot::has_slots<> {
public:
SocketMonitor(TransportChannel* channel,
- talk_base::Thread* worker_thread,
- talk_base::Thread* monitor_thread);
+ rtc::Thread* worker_thread,
+ rtc::Thread* monitor_thread);
~SocketMonitor();
void Start(int cms);
void Stop();
- talk_base::Thread* monitor_thread() { return monitoring_thread_; }
+ rtc::Thread* monitor_thread() { return monitoring_thread_; }
sigslot::signal2<SocketMonitor*,
const std::vector<ConnectionInfo>&> SignalUpdate;
protected:
- void OnMessage(talk_base::Message* message);
+ void OnMessage(rtc::Message* message);
void PollSocket(bool poll);
std::vector<ConnectionInfo> connection_infos_;
TransportChannel* channel_;
- talk_base::Thread* channel_thread_;
- talk_base::Thread* monitoring_thread_;
- talk_base::CriticalSection crit_;
+ rtc::Thread* channel_thread_;
+ rtc::Thread* monitoring_thread_;
+ rtc::CriticalSection crit_;
uint32 rate_;
bool monitoring_;
};
diff --git a/session/media/audiomonitor.cc b/session/media/audiomonitor.cc
index c3a2eb0..dc4a42a 100644
--- a/session/media/audiomonitor.cc
+++ b/session/media/audiomonitor.cc
@@ -37,7 +37,7 @@
const uint32 MSG_MONITOR_SIGNAL = 4;
AudioMonitor::AudioMonitor(VoiceChannel *voice_channel,
- talk_base::Thread *monitor_thread) {
+ rtc::Thread *monitor_thread) {
voice_channel_ = voice_channel;
monitoring_thread_ = monitor_thread;
monitoring_ = false;
@@ -59,12 +59,12 @@
voice_channel_->worker_thread()->Post(this, MSG_MONITOR_STOP);
}
-void AudioMonitor::OnMessage(talk_base::Message *message) {
- talk_base::CritScope cs(&crit_);
+void AudioMonitor::OnMessage(rtc::Message *message) {
+ rtc::CritScope cs(&crit_);
switch (message->message_id) {
case MSG_MONITOR_START:
- assert(talk_base::Thread::Current() == voice_channel_->worker_thread());
+ assert(rtc::Thread::Current() == voice_channel_->worker_thread());
if (!monitoring_) {
monitoring_ = true;
PollVoiceChannel();
@@ -72,7 +72,7 @@
break;
case MSG_MONITOR_STOP:
- assert(talk_base::Thread::Current() == voice_channel_->worker_thread());
+ assert(rtc::Thread::Current() == voice_channel_->worker_thread());
if (monitoring_) {
monitoring_ = false;
voice_channel_->worker_thread()->Clear(this);
@@ -80,13 +80,13 @@
break;
case MSG_MONITOR_POLL:
- assert(talk_base::Thread::Current() == voice_channel_->worker_thread());
+ assert(rtc::Thread::Current() == voice_channel_->worker_thread());
PollVoiceChannel();
break;
case MSG_MONITOR_SIGNAL:
{
- assert(talk_base::Thread::Current() == monitoring_thread_);
+ assert(rtc::Thread::Current() == monitoring_thread_);
AudioInfo info = audio_info_;
crit_.Leave();
SignalUpdate(this, info);
@@ -97,8 +97,8 @@
}
void AudioMonitor::PollVoiceChannel() {
- talk_base::CritScope cs(&crit_);
- assert(talk_base::Thread::Current() == voice_channel_->worker_thread());
+ rtc::CritScope cs(&crit_);
+ assert(rtc::Thread::Current() == voice_channel_->worker_thread());
// Gather connection infos
audio_info_.input_level = voice_channel_->GetInputLevel_w();
@@ -114,7 +114,7 @@
return voice_channel_;
}
-talk_base::Thread *AudioMonitor::monitor_thread() {
+rtc::Thread *AudioMonitor::monitor_thread() {
return monitoring_thread_;
}
diff --git a/session/media/audiomonitor.h b/session/media/audiomonitor.h
index 5aff8fd..632ba07 100644
--- a/session/media/audiomonitor.h
+++ b/session/media/audiomonitor.h
@@ -28,8 +28,8 @@
#ifndef TALK_SESSION_MEDIA_AUDIOMONITOR_H_
#define TALK_SESSION_MEDIA_AUDIOMONITOR_H_
-#include "talk/base/sigslot.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/thread.h"
#include "talk/p2p/base/port.h"
#include <vector>
@@ -44,28 +44,28 @@
StreamList active_streams; // ssrcs contributing to output_level
};
-class AudioMonitor : public talk_base::MessageHandler,
+class AudioMonitor : public rtc::MessageHandler,
public sigslot::has_slots<> {
public:
- AudioMonitor(VoiceChannel* voice_channel, talk_base::Thread *monitor_thread);
+ AudioMonitor(VoiceChannel* voice_channel, rtc::Thread *monitor_thread);
~AudioMonitor();
void Start(int cms);
void Stop();
VoiceChannel* voice_channel();
- talk_base::Thread *monitor_thread();
+ rtc::Thread *monitor_thread();
sigslot::signal2<AudioMonitor*, const AudioInfo&> SignalUpdate;
protected:
- void OnMessage(talk_base::Message *message);
+ void OnMessage(rtc::Message *message);
void PollVoiceChannel();
AudioInfo audio_info_;
VoiceChannel* voice_channel_;
- talk_base::Thread* monitoring_thread_;
- talk_base::CriticalSection crit_;
+ rtc::Thread* monitoring_thread_;
+ rtc::CriticalSection crit_;
uint32 rate_;
bool monitoring_;
};
diff --git a/session/media/bundlefilter.cc b/session/media/bundlefilter.cc
index d3b51c4..5b23f11 100755
--- a/session/media/bundlefilter.cc
+++ b/session/media/bundlefilter.cc
@@ -27,7 +27,7 @@
#include "talk/session/media/bundlefilter.h"
-#include "talk/base/logging.h"
+#include "webrtc/base/logging.h"
#include "talk/media/base/rtputils.h"
namespace cricket {
diff --git a/session/media/bundlefilter.h b/session/media/bundlefilter.h
index 34bc330..9df742a 100755
--- a/session/media/bundlefilter.h
+++ b/session/media/bundlefilter.h
@@ -31,7 +31,7 @@
#include <set>
#include <vector>
-#include "talk/base/basictypes.h"
+#include "webrtc/base/basictypes.h"
#include "talk/media/base/streamparams.h"
namespace cricket {
diff --git a/session/media/bundlefilter_unittest.cc b/session/media/bundlefilter_unittest.cc
index a3e58c1..4cf6cb0 100755
--- a/session/media/bundlefilter_unittest.cc
+++ b/session/media/bundlefilter_unittest.cc
@@ -25,7 +25,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/gunit.h"
+#include "webrtc/base/gunit.h"
#include "talk/session/media/bundlefilter.h"
using cricket::StreamParams;
diff --git a/session/media/call.cc b/session/media/call.cc
index 91fe146..fc22eb4 100644
--- a/session/media/call.cc
+++ b/session/media/call.cc
@@ -26,10 +26,10 @@
*/
#include <string>
-#include "talk/base/helpers.h"
-#include "talk/base/logging.h"
-#include "talk/base/thread.h"
-#include "talk/base/window.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/thread.h"
+#include "webrtc/base/window.h"
#include "talk/media/base/constants.h"
#include "talk/media/base/screencastid.h"
#include "talk/p2p/base/parsing.h"
@@ -92,7 +92,7 @@
}
Call::Call(MediaSessionClient* session_client)
- : id_(talk_base::CreateRandomId()),
+ : id_(rtc::CreateRandomId()),
session_client_(session_client),
local_renderer_(NULL),
has_video_(false),
@@ -110,7 +110,7 @@
RemoveSession(session);
session_client_->session_manager()->DestroySession(session);
}
- talk_base::Thread::Current()->Clear(this);
+ rtc::Thread::Current()->Clear(this);
}
Session* Call::InitiateSession(const buzz::Jid& to,
@@ -226,7 +226,7 @@
}
}
-void Call::OnMessage(talk_base::Message* message) {
+void Call::OnMessage(rtc::Message* message) {
switch (message->message_id) {
case MSG_CHECKAUTODESTROY:
// If no more sessions for this call, delete it
@@ -390,7 +390,7 @@
SignalRemoveSession(this, session);
// The call auto destroys when the last session is removed
- talk_base::Thread::Current()->Post(this, MSG_CHECKAUTODESTROY);
+ rtc::Thread::Current()->Post(this, MSG_CHECKAUTODESTROY);
}
VoiceChannel* Call::GetVoiceChannel(Session* session) const {
@@ -458,7 +458,7 @@
bool Call::SendData(Session* session,
const SendDataParams& params,
- const talk_base::Buffer& payload,
+ const rtc::Buffer& payload,
SendDataResult* result) {
DataChannel* data_channel = GetDataChannel(session);
if (!data_channel) {
@@ -617,7 +617,7 @@
void Call::SendVideoStreamUpdate(
Session* session, VideoContentDescription* video) {
// Takes the ownership of |video|.
- talk_base::scoped_ptr<VideoContentDescription> description(video);
+ rtc::scoped_ptr<VideoContentDescription> description(video);
const ContentInfo* video_info =
GetFirstVideoContent(session->local_description());
if (video_info == NULL) {
@@ -652,7 +652,7 @@
// Post a message to play the next tone or at least clear the playing_dtmf_
// bit.
- talk_base::Thread::Current()->PostDelayed(kDTMFDelay, this, MSG_PLAYDTMF);
+ rtc::Thread::Current()->PostDelayed(kDTMFDelay, this, MSG_PLAYDTMF);
}
}
@@ -794,7 +794,7 @@
void Call::OnDataReceived(DataChannel* channel,
const ReceiveDataParams& params,
- const talk_base::Buffer& payload) {
+ const rtc::Buffer& payload) {
SignalDataReceived(this, params, payload);
}
diff --git a/session/media/call.h b/session/media/call.h
index 063447a..e61fec8 100644
--- a/session/media/call.h
+++ b/session/media/call.h
@@ -33,7 +33,7 @@
#include <string>
#include <vector>
-#include "talk/base/messagequeue.h"
+#include "webrtc/base/messagequeue.h"
#include "talk/media/base/mediachannel.h"
#include "talk/media/base/screencastid.h"
#include "talk/media/base/streamparams.h"
@@ -80,7 +80,7 @@
Call* call_;
};
-class Call : public talk_base::MessageHandler, public sigslot::has_slots<> {
+class Call : public rtc::MessageHandler, public sigslot::has_slots<> {
public:
explicit Call(MediaSessionClient* session_client);
~Call();
@@ -110,7 +110,7 @@
void MuteVideo(bool mute);
bool SendData(Session* session,
const SendDataParams& params,
- const talk_base::Buffer& payload,
+ const rtc::Buffer& payload,
SendDataResult* result);
void PressDTMF(int event);
bool StartScreencast(Session* session,
@@ -187,12 +187,12 @@
const MediaStreams&> SignalMediaStreamsUpdate;
sigslot::signal3<Call*,
const ReceiveDataParams&,
- const talk_base::Buffer&> SignalDataReceived;
+ const rtc::Buffer&> SignalDataReceived;
AudioSourceProxy* GetAudioSourceProxy();
private:
- void OnMessage(talk_base::Message* message);
+ void OnMessage(rtc::Message* message);
void OnSessionState(BaseSession* base_session, BaseSession::State state);
void OnSessionError(BaseSession* base_session, Session::Error error);
void OnSessionInfoMessage(
@@ -219,7 +219,7 @@
void OnMediaMonitor(VideoChannel* channel, const VideoMediaInfo& info);
void OnDataReceived(DataChannel* channel,
const ReceiveDataParams& params,
- const talk_base::Buffer& payload);
+ const rtc::Buffer& payload);
MediaStreams* GetMediaStreams(Session* session) const;
void UpdateRemoteMediaStreams(Session* session,
const ContentInfos& updated_contents,
@@ -300,7 +300,7 @@
VoiceMediaInfo last_voice_media_info_;
- talk_base::scoped_ptr<AudioSourceProxy> audio_source_proxy_;
+ rtc::scoped_ptr<AudioSourceProxy> audio_source_proxy_;
friend class MediaSessionClient;
};
diff --git a/session/media/channel.cc b/session/media/channel.cc
index d705d4d..67bd2da 100644
--- a/session/media/channel.cc
+++ b/session/media/channel.cc
@@ -27,12 +27,12 @@
#include "talk/session/media/channel.h"
-#include "talk/base/bind.h"
-#include "talk/base/buffer.h"
-#include "talk/base/byteorder.h"
-#include "talk/base/common.h"
-#include "talk/base/dscp.h"
-#include "talk/base/logging.h"
+#include "webrtc/base/bind.h"
+#include "webrtc/base/buffer.h"
+#include "webrtc/base/byteorder.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/dscp.h"
+#include "webrtc/base/logging.h"
#include "talk/media/base/constants.h"
#include "talk/media/base/rtputils.h"
#include "talk/p2p/base/transportchannel.h"
@@ -43,7 +43,7 @@
namespace cricket {
-using talk_base::Bind;
+using rtc::Bind;
enum {
MSG_EARLYMEDIATIMEOUT = 1,
@@ -87,21 +87,21 @@
return new NullScreenCapturerFactory();
}
-struct PacketMessageData : public talk_base::MessageData {
- talk_base::Buffer packet;
- talk_base::DiffServCodePoint dscp;
+struct PacketMessageData : public rtc::MessageData {
+ rtc::Buffer packet;
+ rtc::DiffServCodePoint dscp;
};
-struct ScreencastEventMessageData : public talk_base::MessageData {
- ScreencastEventMessageData(uint32 s, talk_base::WindowEvent we)
+struct ScreencastEventMessageData : public rtc::MessageData {
+ ScreencastEventMessageData(uint32 s, rtc::WindowEvent we)
: ssrc(s),
event(we) {
}
uint32 ssrc;
- talk_base::WindowEvent event;
+ rtc::WindowEvent event;
};
-struct VoiceChannelErrorMessageData : public talk_base::MessageData {
+struct VoiceChannelErrorMessageData : public rtc::MessageData {
VoiceChannelErrorMessageData(uint32 in_ssrc,
VoiceMediaChannel::Error in_error)
: ssrc(in_ssrc),
@@ -111,7 +111,7 @@
VoiceMediaChannel::Error error;
};
-struct VideoChannelErrorMessageData : public talk_base::MessageData {
+struct VideoChannelErrorMessageData : public rtc::MessageData {
VideoChannelErrorMessageData(uint32 in_ssrc,
VideoMediaChannel::Error in_error)
: ssrc(in_ssrc),
@@ -121,7 +121,7 @@
VideoMediaChannel::Error error;
};
-struct DataChannelErrorMessageData : public talk_base::MessageData {
+struct DataChannelErrorMessageData : public rtc::MessageData {
DataChannelErrorMessageData(uint32 in_ssrc,
DataMediaChannel::Error in_error)
: ssrc(in_ssrc),
@@ -144,7 +144,7 @@
return (!rtcp) ? "RTP" : "RTCP";
}
-static bool ValidPacket(bool rtcp, const talk_base::Buffer* packet) {
+static bool ValidPacket(bool rtcp, const rtc::Buffer* packet) {
// Check the packet size. We could check the header too if needed.
return (packet &&
packet->length() >= (!rtcp ? kMinRtpPacketLen : kMinRtcpPacketLen) &&
@@ -166,7 +166,7 @@
return static_cast<const MediaContentDescription*>(cinfo->description);
}
-BaseChannel::BaseChannel(talk_base::Thread* thread,
+BaseChannel::BaseChannel(rtc::Thread* thread,
MediaEngineInterface* media_engine,
MediaChannel* media_channel, BaseSession* session,
const std::string& content_name, bool rtcp)
@@ -189,12 +189,12 @@
dtls_keyed_(false),
secure_required_(false),
rtp_abs_sendtime_extn_id_(-1) {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
LOG(LS_INFO) << "Created channel for " << content_name;
}
BaseChannel::~BaseChannel() {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
Deinit();
StopConnectionMonitor();
FlushRtcpMessages(); // Send any outstanding RTCP packets.
@@ -296,7 +296,7 @@
void BaseChannel::StartConnectionMonitor(int cms) {
socket_monitor_.reset(new SocketMonitor(transport_channel_,
worker_thread(),
- talk_base::Thread::Current()));
+ rtc::Thread::Current()));
socket_monitor_->SignalUpdate.connect(
this, &BaseChannel::OnConnectionMonitorUpdate);
socket_monitor_->Start(cms);
@@ -343,17 +343,17 @@
was_ever_writable();
}
-bool BaseChannel::SendPacket(talk_base::Buffer* packet,
- talk_base::DiffServCodePoint dscp) {
+bool BaseChannel::SendPacket(rtc::Buffer* packet,
+ rtc::DiffServCodePoint dscp) {
return SendPacket(false, packet, dscp);
}
-bool BaseChannel::SendRtcp(talk_base::Buffer* packet,
- talk_base::DiffServCodePoint dscp) {
+bool BaseChannel::SendRtcp(rtc::Buffer* packet,
+ rtc::DiffServCodePoint dscp) {
return SendPacket(true, packet, dscp);
}
-int BaseChannel::SetOption(SocketType type, talk_base::Socket::Option opt,
+int BaseChannel::SetOption(SocketType type, rtc::Socket::Option opt,
int value) {
TransportChannel* channel = NULL;
switch (type) {
@@ -379,15 +379,15 @@
void BaseChannel::OnChannelRead(TransportChannel* channel,
const char* data, size_t len,
- const talk_base::PacketTime& packet_time,
+ const rtc::PacketTime& packet_time,
int flags) {
// OnChannelRead gets called from P2PSocket; now pass data to MediaEngine
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
// When using RTCP multiplexing we might get RTCP packets on the RTP
// transport. We feed RTP traffic into the demuxer to determine if it is RTCP.
bool rtcp = PacketIsRtcp(channel, data, len);
- talk_base::Buffer packet(data, len);
+ rtc::Buffer packet(data, len);
HandlePacket(rtcp, &packet, packet_time);
}
@@ -421,8 +421,8 @@
rtcp_mux_filter_.DemuxRtcp(data, static_cast<int>(len)));
}
-bool BaseChannel::SendPacket(bool rtcp, talk_base::Buffer* packet,
- talk_base::DiffServCodePoint dscp) {
+bool BaseChannel::SendPacket(bool rtcp, rtc::Buffer* packet,
+ rtc::DiffServCodePoint dscp) {
// SendPacket gets called from MediaEngine, typically on an encoder thread.
// If the thread is not our worker thread, we will post to our worker
// so that the real work happens on our worker. This avoids us having to
@@ -430,7 +430,7 @@
// SRTP and the inner workings of the transport channels.
// The only downside is that we can't return a proper failure code if
// needed. Since UDP is unreliable anyway, this should be a non-issue.
- if (talk_base::Thread::Current() != worker_thread_) {
+ if (rtc::Thread::Current() != worker_thread_) {
// Avoid a copy by transferring the ownership of the packet data.
int message_id = (!rtcp) ? MSG_RTPPACKET : MSG_RTCPPACKET;
PacketMessageData* data = new PacketMessageData;
@@ -460,11 +460,11 @@
// Signal to the media sink before protecting the packet.
{
- talk_base::CritScope cs(&signal_send_packet_cs_);
+ rtc::CritScope cs(&signal_send_packet_cs_);
SignalSendPacketPreCrypto(packet->data(), packet->length(), rtcp);
}
- talk_base::PacketOptions options(dscp);
+ rtc::PacketOptions options(dscp);
// Protect if needed.
if (srtp_filter_.IsActive()) {
bool res;
@@ -534,7 +534,7 @@
// Signal to the media sink after protecting the packet.
{
- talk_base::CritScope cs(&signal_send_packet_cs_);
+ rtc::CritScope cs(&signal_send_packet_cs_);
SignalSendPacketPostCrypto(packet->data(), packet->length(), rtcp);
}
@@ -551,7 +551,7 @@
return true;
}
-bool BaseChannel::WantsPacket(bool rtcp, talk_base::Buffer* packet) {
+bool BaseChannel::WantsPacket(bool rtcp, rtc::Buffer* packet) {
// Protect ourselves against crazy data.
if (!ValidPacket(rtcp, packet)) {
LOG(LS_ERROR) << "Dropping incoming " << content_name_ << " "
@@ -564,8 +564,8 @@
return bundle_filter_.DemuxPacket(packet->data(), packet->length(), rtcp);
}
-void BaseChannel::HandlePacket(bool rtcp, talk_base::Buffer* packet,
- const talk_base::PacketTime& packet_time) {
+void BaseChannel::HandlePacket(bool rtcp, rtc::Buffer* packet,
+ const rtc::PacketTime& packet_time) {
if (!WantsPacket(rtcp, packet)) {
return;
}
@@ -577,7 +577,7 @@
// Signal to the media sink before unprotecting the packet.
{
- talk_base::CritScope cs(&signal_recv_packet_cs_);
+ rtc::CritScope cs(&signal_recv_packet_cs_);
SignalRecvPacketPostCrypto(packet->data(), packet->length(), rtcp);
}
@@ -628,7 +628,7 @@
// Signal to the media sink after unprotecting the packet.
{
- talk_base::CritScope cs(&signal_recv_packet_cs_);
+ rtc::CritScope cs(&signal_recv_packet_cs_);
SignalRecvPacketPreCrypto(packet->data(), packet->length(), rtcp);
}
@@ -669,7 +669,7 @@
}
void BaseChannel::EnableMedia_w() {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
if (enabled_)
return;
@@ -679,7 +679,7 @@
}
void BaseChannel::DisableMedia_w() {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
if (!enabled_)
return;
@@ -689,7 +689,7 @@
}
bool BaseChannel::MuteStream_w(uint32 ssrc, bool mute) {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
bool ret = media_channel()->MuteStream(ssrc, mute);
if (ret) {
if (mute)
@@ -701,12 +701,12 @@
}
bool BaseChannel::IsStreamMuted_w(uint32 ssrc) {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
return muted_streams_.find(ssrc) != muted_streams_.end();
}
void BaseChannel::ChannelWritable_w() {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
if (writable_)
return;
@@ -832,13 +832,13 @@
&dtls_buffer[offset], SRTP_MASTER_KEY_SALT_LEN);
std::vector<unsigned char> *send_key, *recv_key;
- talk_base::SSLRole role;
+ rtc::SSLRole role;
if (!channel->GetSslRole(&role)) {
LOG(LS_WARNING) << "GetSslRole failed";
return false;
}
- if (role == talk_base::SSL_SERVER) {
+ if (role == rtc::SSL_SERVER) {
send_key = &server_write_key;
recv_key = &client_write_key;
} else {
@@ -873,7 +873,7 @@
}
void BaseChannel::ChannelNotWritable_w() {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
if (!writable_)
return;
@@ -1022,7 +1022,7 @@
}
bool BaseChannel::AddRecvStream_w(const StreamParams& sp) {
- ASSERT(worker_thread() == talk_base::Thread::Current());
+ ASSERT(worker_thread() == rtc::Thread::Current());
if (!media_channel()->AddRecvStream(sp))
return false;
@@ -1030,7 +1030,7 @@
}
bool BaseChannel::RemoveRecvStream_w(uint32 ssrc) {
- ASSERT(worker_thread() == talk_base::Thread::Current());
+ ASSERT(worker_thread() == rtc::Thread::Current());
bundle_filter_.RemoveStream(ssrc);
return media_channel()->RemoveRecvStream(ssrc);
}
@@ -1236,7 +1236,7 @@
send_time_extension ? send_time_extension->id : -1;
}
-void BaseChannel::OnMessage(talk_base::Message *pmsg) {
+void BaseChannel::OnMessage(rtc::Message *pmsg) {
switch (pmsg->message_id) {
case MSG_RTPPACKET:
case MSG_RTCPPACKET: {
@@ -1255,16 +1255,16 @@
void BaseChannel::FlushRtcpMessages() {
// Flush all remaining RTCP messages. This should only be called in
// destructor.
- ASSERT(talk_base::Thread::Current() == worker_thread_);
- talk_base::MessageList rtcp_messages;
+ ASSERT(rtc::Thread::Current() == worker_thread_);
+ rtc::MessageList rtcp_messages;
worker_thread_->Clear(this, MSG_RTCPPACKET, &rtcp_messages);
- for (talk_base::MessageList::iterator it = rtcp_messages.begin();
+ for (rtc::MessageList::iterator it = rtcp_messages.begin();
it != rtcp_messages.end(); ++it) {
worker_thread_->Send(this, MSG_RTCPPACKET, it->pdata);
}
}
-VoiceChannel::VoiceChannel(talk_base::Thread* thread,
+VoiceChannel::VoiceChannel(rtc::Thread* thread,
MediaEngineInterface* media_engine,
VoiceMediaChannel* media_channel,
BaseSession* session,
@@ -1365,7 +1365,7 @@
void VoiceChannel::StartMediaMonitor(int cms) {
media_monitor_.reset(new VoiceMediaMonitor(media_channel(), worker_thread(),
- talk_base::Thread::Current()));
+ rtc::Thread::Current()));
media_monitor_->SignalUpdate.connect(
this, &VoiceChannel::OnMediaMonitorUpdate);
media_monitor_->Start(cms);
@@ -1380,7 +1380,7 @@
}
void VoiceChannel::StartAudioMonitor(int cms) {
- audio_monitor_.reset(new AudioMonitor(this, talk_base::Thread::Current()));
+ audio_monitor_.reset(new AudioMonitor(this, rtc::Thread::Current()));
audio_monitor_
->SignalUpdate.connect(this, &VoiceChannel::OnAudioMonitorUpdate);
audio_monitor_->Start(cms);
@@ -1431,7 +1431,7 @@
void VoiceChannel::OnChannelRead(TransportChannel* channel,
const char* data, size_t len,
- const talk_base::PacketTime& packet_time,
+ const rtc::PacketTime& packet_time,
int flags) {
BaseChannel::OnChannelRead(channel, data, len, packet_time, flags);
@@ -1470,7 +1470,7 @@
bool VoiceChannel::SetLocalContent_w(const MediaContentDescription* content,
ContentAction action,
std::string* error_desc) {
- ASSERT(worker_thread() == talk_base::Thread::Current());
+ ASSERT(worker_thread() == rtc::Thread::Current());
LOG(LS_INFO) << "Setting local voice description";
const AudioContentDescription* audio =
@@ -1508,7 +1508,7 @@
bool VoiceChannel::SetRemoteContent_w(const MediaContentDescription* content,
ContentAction action,
std::string* error_desc) {
- ASSERT(worker_thread() == talk_base::Thread::Current());
+ ASSERT(worker_thread() == rtc::Thread::Current());
LOG(LS_INFO) << "Setting remote voice description";
const AudioContentDescription* audio =
@@ -1559,12 +1559,12 @@
}
bool VoiceChannel::SetRingbackTone_w(const void* buf, int len) {
- ASSERT(worker_thread() == talk_base::Thread::Current());
+ ASSERT(worker_thread() == rtc::Thread::Current());
return media_channel()->SetRingbackTone(static_cast<const char*>(buf), len);
}
bool VoiceChannel::PlayRingbackTone_w(uint32 ssrc, bool play, bool loop) {
- ASSERT(worker_thread() == talk_base::Thread::Current());
+ ASSERT(worker_thread() == rtc::Thread::Current());
if (play) {
LOG(LS_INFO) << "Playing ringback tone, loop=" << loop;
} else {
@@ -1595,7 +1595,7 @@
media_channel(), options));
}
-void VoiceChannel::OnMessage(talk_base::Message *pmsg) {
+void VoiceChannel::OnMessage(rtc::Message *pmsg) {
switch (pmsg->message_id) {
case MSG_EARLYMEDIATIMEOUT:
HandleEarlyMediaTimeout();
@@ -1663,7 +1663,7 @@
GetSupportedAudioCryptoSuites(ciphers);
}
-VideoChannel::VideoChannel(talk_base::Thread* thread,
+VideoChannel::VideoChannel(rtc::Thread* thread,
MediaEngineInterface* media_engine,
VideoMediaChannel* media_channel,
BaseSession* session,
@@ -1675,7 +1675,7 @@
voice_channel_(voice_channel),
renderer_(NULL),
screencapture_factory_(CreateScreenCapturerFactory()),
- previous_we_(talk_base::WE_CLOSE) {
+ previous_we_(rtc::WE_CLOSE) {
}
bool VideoChannel::Init() {
@@ -1809,7 +1809,7 @@
void VideoChannel::StartMediaMonitor(int cms) {
media_monitor_.reset(new VideoMediaMonitor(media_channel(), worker_thread(),
- talk_base::Thread::Current()));
+ rtc::Thread::Current()));
media_monitor_->SignalUpdate.connect(
this, &VideoChannel::OnMediaMonitorUpdate);
media_monitor_->Start(cms);
@@ -1830,7 +1830,7 @@
bool VideoChannel::SetLocalContent_w(const MediaContentDescription* content,
ContentAction action,
std::string* error_desc) {
- ASSERT(worker_thread() == talk_base::Thread::Current());
+ ASSERT(worker_thread() == rtc::Thread::Current());
LOG(LS_INFO) << "Setting local video description";
const VideoContentDescription* video =
@@ -1877,7 +1877,7 @@
bool VideoChannel::SetRemoteContent_w(const MediaContentDescription* content,
ContentAction action,
std::string* error_desc) {
- ASSERT(worker_thread() == talk_base::Thread::Current());
+ ASSERT(worker_thread() == rtc::Thread::Current());
LOG(LS_INFO) << "Setting remote video description";
const VideoContentDescription* video =
@@ -2013,8 +2013,8 @@
}
void VideoChannel::OnScreencastWindowEvent_s(uint32 ssrc,
- talk_base::WindowEvent we) {
- ASSERT(signaling_thread() == talk_base::Thread::Current());
+ rtc::WindowEvent we) {
+ ASSERT(signaling_thread() == rtc::Thread::Current());
SignalScreencastWindowEvent(ssrc, we);
}
@@ -2023,7 +2023,7 @@
media_channel(), options));
}
-void VideoChannel::OnMessage(talk_base::Message *pmsg) {
+void VideoChannel::OnMessage(rtc::Message *pmsg) {
switch (pmsg->message_id) {
case MSG_SCREENCASTWINDOWEVENT: {
const ScreencastEventMessageData* data =
@@ -2059,7 +2059,7 @@
}
void VideoChannel::OnScreencastWindowEvent(uint32 ssrc,
- talk_base::WindowEvent event) {
+ rtc::WindowEvent event) {
ScreencastEventMessageData* pdata =
new ScreencastEventMessageData(ssrc, event);
signaling_thread()->Post(this, MSG_SCREENCASTWINDOWEVENT, pdata);
@@ -2068,13 +2068,13 @@
void VideoChannel::OnStateChange(VideoCapturer* capturer, CaptureState ev) {
// Map capturer events to window events. In the future we may want to simply
// pass these events up directly.
- talk_base::WindowEvent we;
+ rtc::WindowEvent we;
if (ev == CS_STOPPED) {
- we = talk_base::WE_CLOSE;
+ we = rtc::WE_CLOSE;
} else if (ev == CS_PAUSED) {
- we = talk_base::WE_MINIMIZE;
- } else if (ev == CS_RUNNING && previous_we_ == talk_base::WE_MINIMIZE) {
- we = talk_base::WE_RESTORE;
+ we = rtc::WE_MINIMIZE;
+ } else if (ev == CS_RUNNING && previous_we_ == rtc::WE_MINIMIZE) {
+ we = rtc::WE_RESTORE;
} else {
return;
}
@@ -2137,7 +2137,7 @@
GetSupportedVideoCryptoSuites(ciphers);
}
-DataChannel::DataChannel(talk_base::Thread* thread,
+DataChannel::DataChannel(rtc::Thread* thread,
DataMediaChannel* media_channel,
BaseSession* session,
const std::string& content_name,
@@ -2178,7 +2178,7 @@
}
bool DataChannel::SendData(const SendDataParams& params,
- const talk_base::Buffer& payload,
+ const rtc::Buffer& payload,
SendDataResult* result) {
return InvokeOnWorker(Bind(&DataMediaChannel::SendData,
media_channel(), params, payload, result));
@@ -2189,7 +2189,7 @@
return GetFirstDataContent(sdesc);
}
-bool DataChannel::WantsPacket(bool rtcp, talk_base::Buffer* packet) {
+bool DataChannel::WantsPacket(bool rtcp, rtc::Buffer* packet) {
if (data_channel_type_ == DCT_SCTP) {
// TODO(pthatcher): Do this in a more robust way by checking for
// SCTP or DTLS.
@@ -2234,7 +2234,7 @@
bool DataChannel::SetLocalContent_w(const MediaContentDescription* content,
ContentAction action,
std::string* error_desc) {
- ASSERT(worker_thread() == talk_base::Thread::Current());
+ ASSERT(worker_thread() == rtc::Thread::Current());
LOG(LS_INFO) << "Setting local data description";
const DataContentDescription* data =
@@ -2288,7 +2288,7 @@
bool DataChannel::SetRemoteContent_w(const MediaContentDescription* content,
ContentAction action,
std::string* error_desc) {
- ASSERT(worker_thread() == talk_base::Thread::Current());
+ ASSERT(worker_thread() == rtc::Thread::Current());
const DataContentDescription* data =
static_cast<const DataContentDescription*>(content);
@@ -2377,7 +2377,7 @@
LOG(LS_INFO) << "Changing data state, recv=" << recv << " send=" << send;
}
-void DataChannel::OnMessage(talk_base::Message *pmsg) {
+void DataChannel::OnMessage(rtc::Message *pmsg) {
switch (pmsg->message_id) {
case MSG_READYTOSENDDATA: {
DataChannelReadyToSendMessageData* data =
@@ -2402,8 +2402,8 @@
break;
}
case MSG_STREAMCLOSEDREMOTELY: {
- talk_base::TypedMessageData<uint32>* data =
- static_cast<talk_base::TypedMessageData<uint32>*>(pmsg->pdata);
+ rtc::TypedMessageData<uint32>* data =
+ static_cast<rtc::TypedMessageData<uint32>*>(pmsg->pdata);
SignalStreamClosedRemotely(data->data());
delete data;
break;
@@ -2421,7 +2421,7 @@
void DataChannel::StartMediaMonitor(int cms) {
media_monitor_.reset(new DataMediaMonitor(media_channel(), worker_thread(),
- talk_base::Thread::Current()));
+ rtc::Thread::Current()));
media_monitor_->SignalUpdate.connect(
this, &DataChannel::OnMediaMonitorUpdate);
media_monitor_->Start(cms);
@@ -2495,8 +2495,8 @@
}
void DataChannel::OnStreamClosedRemotely(uint32 sid) {
- talk_base::TypedMessageData<uint32>* message =
- new talk_base::TypedMessageData<uint32>(sid);
+ rtc::TypedMessageData<uint32>* message =
+ new rtc::TypedMessageData<uint32>(sid);
signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message);
}
diff --git a/session/media/channel.h b/session/media/channel.h
index 340caa7..2480f45 100644
--- a/session/media/channel.h
+++ b/session/media/channel.h
@@ -31,11 +31,11 @@
#include <string>
#include <vector>
-#include "talk/base/asyncudpsocket.h"
-#include "talk/base/criticalsection.h"
-#include "talk/base/network.h"
-#include "talk/base/sigslot.h"
-#include "talk/base/window.h"
+#include "webrtc/base/asyncudpsocket.h"
+#include "webrtc/base/criticalsection.h"
+#include "webrtc/base/network.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/window.h"
#include "talk/media/base/mediachannel.h"
#include "talk/media/base/mediaengine.h"
#include "talk/media/base/screencastid.h"
@@ -73,10 +73,10 @@
// NetworkInterface.
class BaseChannel
- : public talk_base::MessageHandler, public sigslot::has_slots<>,
+ : public rtc::MessageHandler, public sigslot::has_slots<>,
public MediaChannel::NetworkInterface {
public:
- BaseChannel(talk_base::Thread* thread, MediaEngineInterface* media_engine,
+ BaseChannel(rtc::Thread* thread, MediaEngineInterface* media_engine,
MediaChannel* channel, BaseSession* session,
const std::string& content_name, bool rtcp);
virtual ~BaseChannel();
@@ -86,7 +86,7 @@
// done.
void Deinit();
- talk_base::Thread* worker_thread() const { return worker_thread_; }
+ rtc::Thread* worker_thread() const { return worker_thread_; }
BaseSession* session() const { return session_; }
const std::string& content_name() { return content_name_; }
TransportChannel* transport_channel() const {
@@ -151,7 +151,7 @@
void RegisterSendSink(T* sink,
void (T::*OnPacket)(const void*, size_t, bool),
SinkType type) {
- talk_base::CritScope cs(&signal_send_packet_cs_);
+ rtc::CritScope cs(&signal_send_packet_cs_);
if (SINK_POST_CRYPTO == type) {
SignalSendPacketPostCrypto.disconnect(sink);
SignalSendPacketPostCrypto.connect(sink, OnPacket);
@@ -163,7 +163,7 @@
void UnregisterSendSink(sigslot::has_slots<>* sink,
SinkType type) {
- talk_base::CritScope cs(&signal_send_packet_cs_);
+ rtc::CritScope cs(&signal_send_packet_cs_);
if (SINK_POST_CRYPTO == type) {
SignalSendPacketPostCrypto.disconnect(sink);
} else {
@@ -172,7 +172,7 @@
}
bool HasSendSinks(SinkType type) {
- talk_base::CritScope cs(&signal_send_packet_cs_);
+ rtc::CritScope cs(&signal_send_packet_cs_);
if (SINK_POST_CRYPTO == type) {
return !SignalSendPacketPostCrypto.is_empty();
} else {
@@ -184,7 +184,7 @@
void RegisterRecvSink(T* sink,
void (T::*OnPacket)(const void*, size_t, bool),
SinkType type) {
- talk_base::CritScope cs(&signal_recv_packet_cs_);
+ rtc::CritScope cs(&signal_recv_packet_cs_);
if (SINK_POST_CRYPTO == type) {
SignalRecvPacketPostCrypto.disconnect(sink);
SignalRecvPacketPostCrypto.connect(sink, OnPacket);
@@ -196,7 +196,7 @@
void UnregisterRecvSink(sigslot::has_slots<>* sink,
SinkType type) {
- talk_base::CritScope cs(&signal_recv_packet_cs_);
+ rtc::CritScope cs(&signal_recv_packet_cs_);
if (SINK_POST_CRYPTO == type) {
SignalRecvPacketPostCrypto.disconnect(sink);
} else {
@@ -205,7 +205,7 @@
}
bool HasRecvSinks(SinkType type) {
- talk_base::CritScope cs(&signal_recv_packet_cs_);
+ rtc::CritScope cs(&signal_recv_packet_cs_);
if (SINK_POST_CRYPTO == type) {
return !SignalRecvPacketPostCrypto.is_empty();
} else {
@@ -244,35 +244,35 @@
}
bool IsReadyToReceive() const;
bool IsReadyToSend() const;
- talk_base::Thread* signaling_thread() { return session_->signaling_thread(); }
+ rtc::Thread* signaling_thread() { return session_->signaling_thread(); }
SrtpFilter* srtp_filter() { return &srtp_filter_; }
bool rtcp() const { return rtcp_; }
void FlushRtcpMessages();
// NetworkInterface implementation, called by MediaEngine
- virtual bool SendPacket(talk_base::Buffer* packet,
- talk_base::DiffServCodePoint dscp);
- virtual bool SendRtcp(talk_base::Buffer* packet,
- talk_base::DiffServCodePoint dscp);
- virtual int SetOption(SocketType type, talk_base::Socket::Option o, int val);
+ virtual bool SendPacket(rtc::Buffer* packet,
+ rtc::DiffServCodePoint dscp);
+ virtual bool SendRtcp(rtc::Buffer* packet,
+ rtc::DiffServCodePoint dscp);
+ virtual int SetOption(SocketType type, rtc::Socket::Option o, int val);
// From TransportChannel
void OnWritableState(TransportChannel* channel);
virtual void OnChannelRead(TransportChannel* channel,
const char* data,
size_t len,
- const talk_base::PacketTime& packet_time,
+ const rtc::PacketTime& packet_time,
int flags);
void OnReadyToSend(TransportChannel* channel);
bool PacketIsRtcp(const TransportChannel* channel, const char* data,
size_t len);
- bool SendPacket(bool rtcp, talk_base::Buffer* packet,
- talk_base::DiffServCodePoint dscp);
- virtual bool WantsPacket(bool rtcp, talk_base::Buffer* packet);
- void HandlePacket(bool rtcp, talk_base::Buffer* packet,
- const talk_base::PacketTime& packet_time);
+ bool SendPacket(bool rtcp, rtc::Buffer* packet,
+ rtc::DiffServCodePoint dscp);
+ virtual bool WantsPacket(bool rtcp, rtc::Buffer* packet);
+ void HandlePacket(bool rtcp, rtc::Buffer* packet,
+ const rtc::PacketTime& packet_time);
// Apply the new local/remote session description.
void OnNewLocalDescription(BaseSession* session, ContentAction action);
@@ -344,7 +344,7 @@
std::string* error_desc);
// From MessageHandler
- virtual void OnMessage(talk_base::Message* pmsg);
+ virtual void OnMessage(rtc::Message* pmsg);
// Handled in derived classes
// Get the SRTP ciphers to use for RTP media
@@ -363,10 +363,10 @@
sigslot::signal3<const void*, size_t, bool> SignalSendPacketPostCrypto;
sigslot::signal3<const void*, size_t, bool> SignalRecvPacketPreCrypto;
sigslot::signal3<const void*, size_t, bool> SignalRecvPacketPostCrypto;
- talk_base::CriticalSection signal_send_packet_cs_;
- talk_base::CriticalSection signal_recv_packet_cs_;
+ rtc::CriticalSection signal_send_packet_cs_;
+ rtc::CriticalSection signal_recv_packet_cs_;
- talk_base::Thread* worker_thread_;
+ rtc::Thread* worker_thread_;
MediaEngineInterface* media_engine_;
BaseSession* session_;
MediaChannel* media_channel_;
@@ -380,7 +380,7 @@
SrtpFilter srtp_filter_;
RtcpMuxFilter rtcp_mux_filter_;
BundleFilter bundle_filter_;
- talk_base::scoped_ptr<SocketMonitor> socket_monitor_;
+ rtc::scoped_ptr<SocketMonitor> socket_monitor_;
bool enabled_;
bool writable_;
bool rtp_ready_to_send_;
@@ -399,7 +399,7 @@
// and input/output level monitoring.
class VoiceChannel : public BaseChannel {
public:
- VoiceChannel(talk_base::Thread* thread, MediaEngineInterface* media_engine,
+ VoiceChannel(rtc::Thread* thread, MediaEngineInterface* media_engine,
VoiceMediaChannel* channel, BaseSession* session,
const std::string& content_name, bool rtcp);
~VoiceChannel();
@@ -470,7 +470,7 @@
// overrides from BaseChannel
virtual void OnChannelRead(TransportChannel* channel,
const char* data, size_t len,
- const talk_base::PacketTime& packet_time,
+ const rtc::PacketTime& packet_time,
int flags);
virtual void ChangeState();
virtual const ContentInfo* GetFirstContent(const SessionDescription* sdesc);
@@ -487,7 +487,7 @@
bool SetOutputScaling_w(uint32 ssrc, double left, double right);
bool GetStats_w(VoiceMediaInfo* stats);
- virtual void OnMessage(talk_base::Message* pmsg);
+ virtual void OnMessage(rtc::Message* pmsg);
virtual void GetSrtpCiphers(std::vector<std::string>* ciphers) const;
virtual void OnConnectionMonitorUpdate(
SocketMonitor* monitor, const std::vector<ConnectionInfo>& infos);
@@ -500,9 +500,9 @@
static const int kEarlyMediaTimeout = 1000;
bool received_media_;
- talk_base::scoped_ptr<VoiceMediaMonitor> media_monitor_;
- talk_base::scoped_ptr<AudioMonitor> audio_monitor_;
- talk_base::scoped_ptr<TypingMonitor> typing_monitor_;
+ rtc::scoped_ptr<VoiceMediaMonitor> media_monitor_;
+ rtc::scoped_ptr<AudioMonitor> audio_monitor_;
+ rtc::scoped_ptr<TypingMonitor> typing_monitor_;
};
// VideoChannel is a specialization for video.
@@ -516,7 +516,7 @@
virtual ~ScreenCapturerFactory() {}
};
- VideoChannel(talk_base::Thread* thread, MediaEngineInterface* media_engine,
+ VideoChannel(rtc::Thread* thread, MediaEngineInterface* media_engine,
VideoMediaChannel* channel, BaseSession* session,
const std::string& content_name, bool rtcp,
VoiceChannel* voice_channel);
@@ -545,7 +545,7 @@
void StartMediaMonitor(int cms);
void StopMediaMonitor();
sigslot::signal2<VideoChannel*, const VideoMediaInfo&> SignalMediaMonitor;
- sigslot::signal2<uint32, talk_base::WindowEvent> SignalScreencastWindowEvent;
+ sigslot::signal2<uint32, rtc::WindowEvent> SignalScreencastWindowEvent;
bool SendIntraFrame();
bool RequestIntraFrame();
@@ -581,21 +581,21 @@
VideoCapturer* AddScreencast_w(uint32 ssrc, const ScreencastId& id);
bool RemoveScreencast_w(uint32 ssrc);
- void OnScreencastWindowEvent_s(uint32 ssrc, talk_base::WindowEvent we);
+ void OnScreencastWindowEvent_s(uint32 ssrc, rtc::WindowEvent we);
bool IsScreencasting_w() const;
void GetScreencastDetails_w(ScreencastDetailsData* d) const;
void SetScreenCaptureFactory_w(
ScreenCapturerFactory* screencapture_factory);
bool GetStats_w(VideoMediaInfo* stats);
- virtual void OnMessage(talk_base::Message* pmsg);
+ virtual void OnMessage(rtc::Message* pmsg);
virtual void GetSrtpCiphers(std::vector<std::string>* ciphers) const;
virtual void OnConnectionMonitorUpdate(
SocketMonitor* monitor, const std::vector<ConnectionInfo>& infos);
virtual void OnMediaMonitorUpdate(
VideoMediaChannel* media_channel, const VideoMediaInfo& info);
virtual void OnScreencastWindowEvent(uint32 ssrc,
- talk_base::WindowEvent event);
+ rtc::WindowEvent event);
virtual void OnStateChange(VideoCapturer* capturer, CaptureState ev);
bool GetLocalSsrc(const VideoCapturer* capturer, uint32* ssrc);
@@ -604,17 +604,17 @@
VoiceChannel* voice_channel_;
VideoRenderer* renderer_;
- talk_base::scoped_ptr<ScreenCapturerFactory> screencapture_factory_;
+ rtc::scoped_ptr<ScreenCapturerFactory> screencapture_factory_;
ScreencastMap screencast_capturers_;
- talk_base::scoped_ptr<VideoMediaMonitor> media_monitor_;
+ rtc::scoped_ptr<VideoMediaMonitor> media_monitor_;
- talk_base::WindowEvent previous_we_;
+ rtc::WindowEvent previous_we_;
};
// DataChannel is a specialization for data.
class DataChannel : public BaseChannel {
public:
- DataChannel(talk_base::Thread* thread,
+ DataChannel(rtc::Thread* thread,
DataMediaChannel* media_channel,
BaseSession* session,
const std::string& content_name,
@@ -623,7 +623,7 @@
bool Init();
virtual bool SendData(const SendDataParams& params,
- const talk_base::Buffer& payload,
+ const rtc::Buffer& payload,
SendDataResult* result);
void StartMediaMonitor(int cms);
@@ -641,7 +641,7 @@
SignalMediaError;
sigslot::signal3<DataChannel*,
const ReceiveDataParams&,
- const talk_base::Buffer&>
+ const rtc::Buffer&>
SignalDataReceived;
// Signal for notifying when the channel becomes ready to send data.
// That occurs when the channel is enabled, the transport is writable,
@@ -657,9 +657,9 @@
}
private:
- struct SendDataMessageData : public talk_base::MessageData {
+ struct SendDataMessageData : public rtc::MessageData {
SendDataMessageData(const SendDataParams& params,
- const talk_base::Buffer* payload,
+ const rtc::Buffer* payload,
SendDataResult* result)
: params(params),
payload(payload),
@@ -668,12 +668,12 @@
}
const SendDataParams& params;
- const talk_base::Buffer* payload;
+ const rtc::Buffer* payload;
SendDataResult* result;
bool succeeded;
};
- struct DataReceivedMessageData : public talk_base::MessageData {
+ struct DataReceivedMessageData : public rtc::MessageData {
// We copy the data because the data will become invalid after we
// handle DataMediaChannel::SignalDataReceived but before we fire
// SignalDataReceived.
@@ -683,10 +683,10 @@
payload(data, len) {
}
const ReceiveDataParams params;
- const talk_base::Buffer payload;
+ const rtc::Buffer payload;
};
- typedef talk_base::TypedMessageData<bool> DataChannelReadyToSendMessageData;
+ typedef rtc::TypedMessageData<bool> DataChannelReadyToSendMessageData;
// overrides from BaseChannel
virtual const ContentInfo* GetFirstContent(const SessionDescription* sdesc);
@@ -706,9 +706,9 @@
ContentAction action,
std::string* error_desc);
virtual void ChangeState();
- virtual bool WantsPacket(bool rtcp, talk_base::Buffer* packet);
+ virtual bool WantsPacket(bool rtcp, rtc::Buffer* packet);
- virtual void OnMessage(talk_base::Message* pmsg);
+ virtual void OnMessage(rtc::Message* pmsg);
virtual void GetSrtpCiphers(std::vector<std::string>* ciphers) const;
virtual void OnConnectionMonitorUpdate(
SocketMonitor* monitor, const std::vector<ConnectionInfo>& infos);
@@ -722,7 +722,7 @@
void OnSrtpError(uint32 ssrc, SrtpFilter::Mode mode, SrtpFilter::Error error);
void OnStreamClosedRemotely(uint32 sid);
- talk_base::scoped_ptr<DataMediaMonitor> media_monitor_;
+ rtc::scoped_ptr<DataMediaMonitor> media_monitor_;
// TODO(pthatcher): Make a separate SctpDataChannel and
// RtpDataChannel instead of using this.
DataChannelType data_channel_type_;
diff --git a/session/media/channel_unittest.cc b/session/media/channel_unittest.cc
index cb0bdc0..cf0aad8 100644
--- a/session/media/channel_unittest.cc
+++ b/session/media/channel_unittest.cc
@@ -23,15 +23,15 @@
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include "talk/base/fileutils.h"
-#include "talk/base/gunit.h"
-#include "talk/base/helpers.h"
-#include "talk/base/logging.h"
-#include "talk/base/pathutils.h"
-#include "talk/base/signalthread.h"
-#include "talk/base/ssladapter.h"
-#include "talk/base/sslidentity.h"
-#include "talk/base/window.h"
+#include "webrtc/base/fileutils.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/pathutils.h"
+#include "webrtc/base/signalthread.h"
+#include "webrtc/base/ssladapter.h"
+#include "webrtc/base/sslidentity.h"
+#include "webrtc/base/window.h"
#include "talk/media/base/fakemediaengine.h"
#include "talk/media/base/fakertp.h"
#include "talk/media/base/fakevideocapturer.h"
@@ -47,7 +47,7 @@
#include "talk/session/media/typingmonitor.h"
#define MAYBE_SKIP_TEST(feature) \
- if (!(talk_base::SSLStreamAdapter::feature())) { \
+ if (!(rtc::SSLStreamAdapter::feature())) { \
LOG(LS_INFO) << "Feature disabled... skipping"; \
return; \
}
@@ -60,7 +60,7 @@
using cricket::ScreencastId;
using cricket::StreamParams;
using cricket::TransportChannel;
-using talk_base::WindowId;
+using rtc::WindowId;
static const cricket::AudioCodec kPcmuCodec(0, "PCMU", 64000, 8000, 1, 0);
static const cricket::AudioCodec kPcmaCodec(8, "PCMA", 64000, 8000, 1, 0);
@@ -157,9 +157,9 @@
};
-talk_base::StreamInterface* Open(const std::string& path) {
- return talk_base::Filesystem::OpenFile(
- talk_base::Pathname(path), "wb");
+rtc::StreamInterface* Open(const std::string& path) {
+ return rtc::Filesystem::OpenFile(
+ rtc::Pathname(path), "wb");
}
// Base class for Voice/VideoChannel tests
@@ -186,38 +186,38 @@
}
static void SetUpTestCase() {
- talk_base::InitializeSSL();
+ rtc::InitializeSSL();
}
static void TearDownTestCase() {
- talk_base::CleanupSSL();
+ rtc::CleanupSSL();
}
void CreateChannels(int flags1, int flags2) {
CreateChannels(new typename T::MediaChannel(NULL),
new typename T::MediaChannel(NULL),
- flags1, flags2, talk_base::Thread::Current());
+ flags1, flags2, rtc::Thread::Current());
}
void CreateChannels(int flags) {
CreateChannels(new typename T::MediaChannel(NULL),
new typename T::MediaChannel(NULL),
- flags, talk_base::Thread::Current());
+ flags, rtc::Thread::Current());
}
void CreateChannels(int flags1, int flags2,
- talk_base::Thread* thread) {
+ rtc::Thread* thread) {
CreateChannels(new typename T::MediaChannel(NULL),
new typename T::MediaChannel(NULL),
flags1, flags2, thread);
}
void CreateChannels(int flags,
- talk_base::Thread* thread) {
+ rtc::Thread* thread) {
CreateChannels(new typename T::MediaChannel(NULL),
new typename T::MediaChannel(NULL),
flags, thread);
}
void CreateChannels(
typename T::MediaChannel* ch1, typename T::MediaChannel* ch2,
- int flags1, int flags2, talk_base::Thread* thread) {
+ int flags1, int flags2, rtc::Thread* thread) {
media_channel1_ = ch1;
media_channel2_ = ch2;
channel1_.reset(CreateChannel(thread, &media_engine_, ch1, &session1_,
@@ -246,11 +246,11 @@
CopyContent(local_media_content2_, &remote_media_content2_);
if (flags1 & DTLS) {
- identity1_.reset(talk_base::SSLIdentity::Generate("session1"));
+ identity1_.reset(rtc::SSLIdentity::Generate("session1"));
session1_.set_ssl_identity(identity1_.get());
}
if (flags2 & DTLS) {
- identity2_.reset(talk_base::SSLIdentity::Generate("session2"));
+ identity2_.reset(rtc::SSLIdentity::Generate("session2"));
session2_.set_ssl_identity(identity2_.get());
}
@@ -271,7 +271,7 @@
void CreateChannels(
typename T::MediaChannel* ch1, typename T::MediaChannel* ch2,
- int flags, talk_base::Thread* thread) {
+ int flags, rtc::Thread* thread) {
media_channel1_ = ch1;
media_channel2_ = ch2;
@@ -304,7 +304,7 @@
}
}
- typename T::Channel* CreateChannel(talk_base::Thread* thread,
+ typename T::Channel* CreateChannel(rtc::Thread* thread,
cricket::MediaEngineInterface* engine,
typename T::MediaChannel* ch,
cricket::BaseSession* session,
@@ -470,17 +470,17 @@
std::string CreateRtpData(uint32 ssrc, int sequence_number, int pl_type) {
std::string data(rtp_packet_);
// Set SSRC in the rtp packet copy.
- talk_base::SetBE32(const_cast<char*>(data.c_str()) + 8, ssrc);
- talk_base::SetBE16(const_cast<char*>(data.c_str()) + 2, sequence_number);
+ rtc::SetBE32(const_cast<char*>(data.c_str()) + 8, ssrc);
+ rtc::SetBE16(const_cast<char*>(data.c_str()) + 2, sequence_number);
if (pl_type >= 0) {
- talk_base::Set8(const_cast<char*>(data.c_str()), 1, pl_type);
+ rtc::Set8(const_cast<char*>(data.c_str()), 1, pl_type);
}
return data;
}
std::string CreateRtcpData(uint32 ssrc) {
std::string data(rtcp_packet_);
// Set SSRC in the rtcp packet copy.
- talk_base::SetBE32(const_cast<char*>(data.c_str()) + 4, ssrc);
+ rtc::SetBE32(const_cast<char*>(data.c_str()) + 4, ssrc);
return data;
}
@@ -520,7 +520,7 @@
return sdesc;
}
- class CallThread : public talk_base::SignalThread {
+ class CallThread : public rtc::SignalThread {
public:
typedef bool (ChannelTest<T>::*Method)();
CallThread(ChannelTest<T>* obj, Method method, bool* result)
@@ -1077,7 +1077,7 @@
};
CreateChannels(new LastWordMediaChannel(), new LastWordMediaChannel(),
RTCP | RTCP_MUX, RTCP | RTCP_MUX,
- talk_base::Thread::Current());
+ rtc::Thread::Current());
EXPECT_TRUE(SendInitiate());
EXPECT_TRUE(SendAccept());
EXPECT_TRUE(SendTerminate());
@@ -1533,10 +1533,10 @@
EXPECT_FALSE(channel1_->HasSendSinks(cricket::SINK_PRE_CRYPTO));
EXPECT_FALSE(channel1_->HasRecvSinks(cricket::SINK_PRE_CRYPTO));
- talk_base::Pathname path;
- EXPECT_TRUE(talk_base::Filesystem::GetTemporaryFolder(path, true, NULL));
+ rtc::Pathname path;
+ EXPECT_TRUE(rtc::Filesystem::GetTemporaryFolder(path, true, NULL));
path.SetFilename("sink-test.rtpdump");
- talk_base::scoped_ptr<cricket::RtpDumpSink> sink(
+ rtc::scoped_ptr<cricket::RtpDumpSink> sink(
new cricket::RtpDumpSink(Open(path.pathname())));
sink->set_packet_filter(cricket::PF_ALL);
EXPECT_TRUE(sink->Enable(true));
@@ -1562,27 +1562,27 @@
sink.reset(); // This will close the file.
// Read the recorded file and verify two packets.
- talk_base::scoped_ptr<talk_base::StreamInterface> stream(
- talk_base::Filesystem::OpenFile(path, "rb"));
+ rtc::scoped_ptr<rtc::StreamInterface> stream(
+ rtc::Filesystem::OpenFile(path, "rb"));
cricket::RtpDumpReader reader(stream.get());
cricket::RtpDumpPacket packet;
- EXPECT_EQ(talk_base::SR_SUCCESS, reader.ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_SUCCESS, reader.ReadPacket(&packet));
std::string read_packet(reinterpret_cast<const char*>(&packet.data[0]),
packet.data.size());
EXPECT_EQ(rtp_packet_, read_packet);
- EXPECT_EQ(talk_base::SR_SUCCESS, reader.ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_SUCCESS, reader.ReadPacket(&packet));
size_t len = 0;
packet.GetRtpHeaderLen(&len);
EXPECT_EQ(len, packet.data.size());
EXPECT_EQ(0, memcmp(&packet.data[0], rtp_packet_.c_str(), len));
- EXPECT_EQ(talk_base::SR_EOS, reader.ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_EOS, reader.ReadPacket(&packet));
// Delete the file for media recording.
stream.reset();
- EXPECT_TRUE(talk_base::Filesystem::DeleteFile(path));
+ EXPECT_TRUE(rtc::Filesystem::DeleteFile(path));
}
void TestSetContentFailure() {
@@ -1796,7 +1796,7 @@
// The next 1 sec failures will not trigger an error.
EXPECT_FALSE(media_channel2_->SendRtp(kBadPacket, sizeof(kBadPacket)));
// Wait for a while to ensure no message comes in.
- talk_base::Thread::Current()->ProcessMessages(210);
+ rtc::Thread::Current()->ProcessMessages(210);
EXPECT_EQ(T::MediaChannel::ERROR_NONE, error_);
// The error will be triggered again.
EXPECT_FALSE(media_channel2_->SendRtp(kBadPacket, sizeof(kBadPacket)));
@@ -1808,7 +1808,7 @@
channel2_->transport_channel();
transport_channel->SignalReadPacket(
transport_channel, reinterpret_cast<const char*>(kBadPacket),
- sizeof(kBadPacket), talk_base::PacketTime(), 0);
+ sizeof(kBadPacket), rtc::PacketTime(), 0);
EXPECT_EQ_WAIT(T::MediaChannel::ERROR_PLAY_SRTP_ERROR, error_, 500);
}
@@ -1863,14 +1863,14 @@
// The media channels are owned by the voice channel objects below.
typename T::MediaChannel* media_channel1_;
typename T::MediaChannel* media_channel2_;
- talk_base::scoped_ptr<typename T::Channel> channel1_;
- talk_base::scoped_ptr<typename T::Channel> channel2_;
+ rtc::scoped_ptr<typename T::Channel> channel1_;
+ rtc::scoped_ptr<typename T::Channel> channel2_;
typename T::Content local_media_content1_;
typename T::Content local_media_content2_;
typename T::Content remote_media_content1_;
typename T::Content remote_media_content2_;
- talk_base::scoped_ptr<talk_base::SSLIdentity> identity1_;
- talk_base::scoped_ptr<talk_base::SSLIdentity> identity2_;
+ rtc::scoped_ptr<rtc::SSLIdentity> identity1_;
+ rtc::scoped_ptr<rtc::SSLIdentity> identity2_;
// The RTP and RTCP packets to send in the tests.
std::string rtp_packet_;
std::string rtcp_packet_;
@@ -1895,7 +1895,7 @@
if (flags & SECURE) {
audio->AddCrypto(cricket::CryptoParams(
1, cricket::CS_AES_CM_128_HMAC_SHA1_32,
- "inline:" + talk_base::CreateRandomString(40), ""));
+ "inline:" + rtc::CreateRandomString(40), ""));
}
}
@@ -1956,7 +1956,7 @@
// override to add NULL parameter
template<>
cricket::VideoChannel* ChannelTest<VideoTraits>::CreateChannel(
- talk_base::Thread* thread, cricket::MediaEngineInterface* engine,
+ rtc::Thread* thread, cricket::MediaEngineInterface* engine,
cricket::FakeVideoMediaChannel* ch, cricket::BaseSession* session,
bool rtcp) {
cricket::VideoChannel* channel = new cricket::VideoChannel(
@@ -1985,7 +1985,7 @@
if (flags & SECURE) {
video->AddCrypto(cricket::CryptoParams(
1, cricket::CS_AES_CM_128_HMAC_SHA1_80,
- "inline:" + talk_base::CreateRandomString(40), ""));
+ "inline:" + rtc::CreateRandomString(40), ""));
}
}
@@ -2214,7 +2214,7 @@
// Typing doesn't mute automatically unless typing monitor has been installed
media_channel1_->TriggerError(0, e);
- talk_base::Thread::Current()->ProcessMessages(0);
+ rtc::Thread::Current()->ProcessMessages(0);
EXPECT_EQ(e, error_);
EXPECT_FALSE(media_channel1_->IsStreamMuted(0));
EXPECT_FALSE(mute_callback_recved_);
@@ -2223,7 +2223,7 @@
o.mute_period = 1500;
channel1_->StartTypingMonitor(o);
media_channel1_->TriggerError(0, e);
- talk_base::Thread::Current()->ProcessMessages(0);
+ rtc::Thread::Current()->ProcessMessages(0);
EXPECT_TRUE(media_channel1_->IsStreamMuted(0));
EXPECT_TRUE(mute_callback_recved_);
}
@@ -2482,13 +2482,13 @@
kTimeoutMs);
screencapture_factory->window_capturer()->SignalStateChange(
screencapture_factory->window_capturer(), cricket::CS_PAUSED);
- EXPECT_EQ_WAIT(talk_base::WE_MINIMIZE, catcher.event(), kTimeoutMs);
+ EXPECT_EQ_WAIT(rtc::WE_MINIMIZE, catcher.event(), kTimeoutMs);
screencapture_factory->window_capturer()->SignalStateChange(
screencapture_factory->window_capturer(), cricket::CS_RUNNING);
- EXPECT_EQ_WAIT(talk_base::WE_RESTORE, catcher.event(), kTimeoutMs);
+ EXPECT_EQ_WAIT(rtc::WE_RESTORE, catcher.event(), kTimeoutMs);
screencapture_factory->window_capturer()->SignalStateChange(
screencapture_factory->window_capturer(), cricket::CS_STOPPED);
- EXPECT_EQ_WAIT(talk_base::WE_CLOSE, catcher.event(), kTimeoutMs);
+ EXPECT_EQ_WAIT(rtc::WE_CLOSE, catcher.event(), kTimeoutMs);
EXPECT_TRUE(channel1_->RemoveScreencast(0));
ASSERT_TRUE(screencapture_factory->window_capturer() == NULL);
}
@@ -2748,7 +2748,7 @@
// Override to avoid engine channel parameter.
template<>
cricket::DataChannel* ChannelTest<DataTraits>::CreateChannel(
- talk_base::Thread* thread, cricket::MediaEngineInterface* engine,
+ rtc::Thread* thread, cricket::MediaEngineInterface* engine,
cricket::FakeDataMediaChannel* ch, cricket::BaseSession* session,
bool rtcp) {
cricket::DataChannel* channel = new cricket::DataChannel(
@@ -2771,7 +2771,7 @@
if (flags & SECURE) {
data->AddCrypto(cricket::CryptoParams(
1, cricket::CS_AES_CM_128_HMAC_SHA1_32,
- "inline:" + talk_base::CreateRandomString(40), ""));
+ "inline:" + rtc::CreateRandomString(40), ""));
}
}
@@ -2929,7 +2929,7 @@
unsigned char data[] = {
'f', 'o', 'o'
};
- talk_base::Buffer payload(data, 3);
+ rtc::Buffer payload(data, 3);
cricket::SendDataResult result;
ASSERT_TRUE(media_channel1_->SendData(params, payload, &result));
EXPECT_EQ(params.ssrc,
diff --git a/session/media/channelmanager.cc b/session/media/channelmanager.cc
index 88316b5..684e9a9 100644
--- a/session/media/channelmanager.cc
+++ b/session/media/channelmanager.cc
@@ -33,12 +33,12 @@
#include <algorithm>
-#include "talk/base/bind.h"
-#include "talk/base/common.h"
-#include "talk/base/logging.h"
-#include "talk/base/sigslotrepeater.h"
-#include "talk/base/stringencode.h"
-#include "talk/base/stringutils.h"
+#include "webrtc/base/bind.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/sigslotrepeater.h"
+#include "webrtc/base/stringencode.h"
+#include "webrtc/base/stringutils.h"
#include "talk/media/base/capturemanager.h"
#include "talk/media/base/hybriddataengine.h"
#include "talk/media/base/rtpdataengine.h"
@@ -56,11 +56,11 @@
MSG_VIDEOCAPTURESTATE = 1,
};
-using talk_base::Bind;
+using rtc::Bind;
static const int kNotSetOutputVolume = -1;
-struct CaptureStateParams : public talk_base::MessageData {
+struct CaptureStateParams : public rtc::MessageData {
CaptureStateParams(cricket::VideoCapturer* c, cricket::CaptureState s)
: capturer(c),
state(s) {}
@@ -77,7 +77,7 @@
}
#if !defined(DISABLE_MEDIA_ENGINE_FACTORY)
-ChannelManager::ChannelManager(talk_base::Thread* worker_thread) {
+ChannelManager::ChannelManager(rtc::Thread* worker_thread) {
Construct(MediaEngineFactory::Create(),
ConstructDataEngine(),
cricket::DeviceManagerFactory::Create(),
@@ -90,13 +90,13 @@
DataEngineInterface* dme,
DeviceManagerInterface* dm,
CaptureManager* cm,
- talk_base::Thread* worker_thread) {
+ rtc::Thread* worker_thread) {
Construct(me, dme, dm, cm, worker_thread);
}
ChannelManager::ChannelManager(MediaEngineInterface* me,
DeviceManagerInterface* dm,
- talk_base::Thread* worker_thread) {
+ rtc::Thread* worker_thread) {
Construct(me,
ConstructDataEngine(),
dm,
@@ -108,13 +108,13 @@
DataEngineInterface* dme,
DeviceManagerInterface* dm,
CaptureManager* cm,
- talk_base::Thread* worker_thread) {
+ rtc::Thread* worker_thread) {
media_engine_.reset(me);
data_media_engine_.reset(dme);
device_manager_.reset(dm);
capture_manager_.reset(cm);
initialized_ = false;
- main_thread_ = talk_base::Thread::Current();
+ main_thread_ = rtc::Thread::Current();
worker_thread_ = worker_thread;
// Get the default audio options from the media engine.
audio_options_ = media_engine_->GetAudioOptions();
@@ -217,11 +217,7 @@
}
ASSERT(worker_thread_ != NULL);
- ASSERT(worker_thread_->RunningForChannelManager());
- // TODO(fischman): remove the if below (and
- // Thread::RunningForChannelManager()) once the ASSERT above has stuck for a
- // month (2014/06/22).
- if (worker_thread_ && worker_thread_->RunningForChannelManager()) {
+ if (worker_thread_) {
if (media_engine_->Init(worker_thread_)) {
initialized_ = true;
@@ -301,7 +297,7 @@
}
void ChannelManager::Terminate_w() {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
// Need to destroy the voice/video channels
while (!video_channels_.empty()) {
DestroyVideoChannel_w(video_channels_.back());
@@ -474,7 +470,7 @@
Soundclip* ChannelManager::CreateSoundclip_w() {
ASSERT(initialized_);
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
SoundclipMedia* soundclip_media = media_engine_->CreateSoundclip();
if (!soundclip_media) {
@@ -560,7 +556,7 @@
bool ChannelManager::SetAudioOptions_w(
const AudioOptions& options, int delay_offset,
const Device* in_dev, const Device* out_dev) {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
ASSERT(initialized_);
// Set audio options
@@ -595,7 +591,7 @@
}
bool ChannelManager::SetEngineAudioOptions_w(const AudioOptions& options) {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
ASSERT(initialized_);
return media_engine_->SetAudioOptions(options);
@@ -715,7 +711,7 @@
}
bool ChannelManager::SetCaptureDevice_w(const Device* cam_device) {
- ASSERT(worker_thread_ == talk_base::Thread::Current());
+ ASSERT(worker_thread_ == rtc::Thread::Current());
ASSERT(initialized_);
if (!cam_device) {
@@ -904,7 +900,7 @@
new CaptureStateParams(capturer, result));
}
-void ChannelManager::OnMessage(talk_base::Message* message) {
+void ChannelManager::OnMessage(rtc::Message* message) {
switch (message->message_id) {
case MSG_VIDEOCAPTURESTATE: {
CaptureStateParams* data =
@@ -966,7 +962,7 @@
Bind(&MediaEngineInterface::GetStartCaptureFormat, media_engine_.get()));
}
-bool ChannelManager::StartAecDump(talk_base::PlatformFile file) {
+bool ChannelManager::StartAecDump(rtc::PlatformFile file) {
return worker_thread_->Invoke<bool>(
Bind(&MediaEngineInterface::StartAecDump, media_engine_.get(), file));
}
diff --git a/session/media/channelmanager.h b/session/media/channelmanager.h
index e8d6c0e..d742280 100644
--- a/session/media/channelmanager.h
+++ b/session/media/channelmanager.h
@@ -31,10 +31,10 @@
#include <string>
#include <vector>
-#include "talk/base/criticalsection.h"
-#include "talk/base/fileutils.h"
-#include "talk/base/sigslotrepeater.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/criticalsection.h"
+#include "webrtc/base/fileutils.h"
+#include "webrtc/base/sigslotrepeater.h"
+#include "webrtc/base/thread.h"
#include "talk/media/base/capturemanager.h"
#include "talk/media/base/mediaengine.h"
#include "talk/p2p/base/session.h"
@@ -55,12 +55,12 @@
// voice or just video channels.
// ChannelManager also allows the application to discover what devices it has
// using device manager.
-class ChannelManager : public talk_base::MessageHandler,
+class ChannelManager : public rtc::MessageHandler,
public sigslot::has_slots<> {
public:
#if !defined(DISABLE_MEDIA_ENGINE_FACTORY)
// Creates the channel manager, and specifies the worker thread to use.
- explicit ChannelManager(talk_base::Thread* worker);
+ explicit ChannelManager(rtc::Thread* worker);
#endif
// For testing purposes. Allows the media engine and data media
@@ -70,17 +70,17 @@
DataEngineInterface* dme,
DeviceManagerInterface* dm,
CaptureManager* cm,
- talk_base::Thread* worker);
+ rtc::Thread* worker);
// Same as above, but gives an easier default DataEngine.
ChannelManager(MediaEngineInterface* me,
DeviceManagerInterface* dm,
- talk_base::Thread* worker);
+ rtc::Thread* worker);
~ChannelManager();
// Accessors for the worker thread, allowing it to be set after construction,
// but before Init. set_worker_thread will return false if called after Init.
- talk_base::Thread* worker_thread() const { return worker_thread_; }
- bool set_worker_thread(talk_base::Thread* thread) {
+ rtc::Thread* worker_thread() const { return worker_thread_; }
+ bool set_worker_thread(rtc::Thread* thread) {
if (initialized_) return false;
worker_thread_ = thread;
return true;
@@ -218,7 +218,7 @@
const VideoFormat& max_format);
// Starts AEC dump using existing file.
- bool StartAecDump(talk_base::PlatformFile file);
+ bool StartAecDump(rtc::PlatformFile file);
sigslot::repeater0<> SignalDevicesChange;
sigslot::signal2<VideoCapturer*, CaptureState> SignalVideoCaptureStateChange;
@@ -251,7 +251,7 @@
DataEngineInterface* dme,
DeviceManagerInterface* dm,
CaptureManager* cm,
- talk_base::Thread* worker_thread);
+ rtc::Thread* worker_thread);
void Terminate_w();
VoiceChannel* CreateVoiceChannel_w(
BaseSession* session, const std::string& content_name, bool rtcp);
@@ -277,15 +277,15 @@
bool UnregisterVideoProcessor_w(VideoCapturer* capturer,
VideoProcessor* processor);
bool IsScreencastRunning_w() const;
- virtual void OnMessage(talk_base::Message *message);
+ virtual void OnMessage(rtc::Message *message);
- talk_base::scoped_ptr<MediaEngineInterface> media_engine_;
- talk_base::scoped_ptr<DataEngineInterface> data_media_engine_;
- talk_base::scoped_ptr<DeviceManagerInterface> device_manager_;
- talk_base::scoped_ptr<CaptureManager> capture_manager_;
+ rtc::scoped_ptr<MediaEngineInterface> media_engine_;
+ rtc::scoped_ptr<DataEngineInterface> data_media_engine_;
+ rtc::scoped_ptr<DeviceManagerInterface> device_manager_;
+ rtc::scoped_ptr<CaptureManager> capture_manager_;
bool initialized_;
- talk_base::Thread* main_thread_;
- talk_base::Thread* worker_thread_;
+ rtc::Thread* main_thread_;
+ rtc::Thread* worker_thread_;
VoiceChannels voice_channels_;
VideoChannels video_channels_;
diff --git a/session/media/channelmanager_unittest.cc b/session/media/channelmanager_unittest.cc
index cbf19f8..f301829 100644
--- a/session/media/channelmanager_unittest.cc
+++ b/session/media/channelmanager_unittest.cc
@@ -23,9 +23,9 @@
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include "talk/base/gunit.h"
-#include "talk/base/logging.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/thread.h"
#include "talk/media/base/fakecapturemanager.h"
#include "talk/media/base/fakemediaengine.h"
#include "talk/media/base/fakemediaprocessor.h"
@@ -62,7 +62,7 @@
fdm_ = new cricket::FakeDeviceManager();
fcm_ = new cricket::FakeCaptureManager();
cm_ = new cricket::ChannelManager(
- fme_, fdme_, fdm_, fcm_, talk_base::Thread::Current());
+ fme_, fdme_, fdm_, fcm_, rtc::Thread::Current());
session_ = new cricket::FakeSession(true);
std::vector<std::string> in_device_list, out_device_list, vid_device_list;
@@ -87,7 +87,7 @@
fme_ = NULL;
}
- talk_base::Thread worker_;
+ rtc::Thread worker_;
cricket::FakeMediaEngine* fme_;
cricket::FakeDataEngine* fdme_;
cricket::FakeDeviceManager* fdm_;
@@ -99,7 +99,7 @@
// Test that we startup/shutdown properly.
TEST_F(ChannelManagerTest, StartupShutdown) {
EXPECT_FALSE(cm_->initialized());
- EXPECT_EQ(talk_base::Thread::Current(), cm_->worker_thread());
+ EXPECT_EQ(rtc::Thread::Current(), cm_->worker_thread());
EXPECT_TRUE(cm_->Init());
EXPECT_TRUE(cm_->initialized());
cm_->Terminate();
@@ -110,26 +110,17 @@
TEST_F(ChannelManagerTest, StartupShutdownOnThread) {
worker_.Start();
EXPECT_FALSE(cm_->initialized());
- EXPECT_EQ(talk_base::Thread::Current(), cm_->worker_thread());
+ EXPECT_EQ(rtc::Thread::Current(), cm_->worker_thread());
EXPECT_TRUE(cm_->set_worker_thread(&worker_));
EXPECT_EQ(&worker_, cm_->worker_thread());
EXPECT_TRUE(cm_->Init());
EXPECT_TRUE(cm_->initialized());
// Setting the worker thread while initialized should fail.
- EXPECT_FALSE(cm_->set_worker_thread(talk_base::Thread::Current()));
+ EXPECT_FALSE(cm_->set_worker_thread(rtc::Thread::Current()));
cm_->Terminate();
EXPECT_FALSE(cm_->initialized());
}
-// Test that we fail to startup if we're given an unstarted thread.
-// TODO(fischman): delete once Thread::RunningForChannelManager() is gone
-// (webrtc:3388).
-TEST_F(ChannelManagerTest, DISABLED_StartupShutdownOnUnstartedThread) {
- EXPECT_TRUE(cm_->set_worker_thread(&worker_));
- EXPECT_FALSE(cm_->Init());
- EXPECT_FALSE(cm_->initialized());
-}
-
// Test that we can create and destroy a voice and video channel.
TEST_F(ChannelManagerTest, CreateDestroyChannels) {
EXPECT_TRUE(cm_->Init());
@@ -537,27 +528,27 @@
// Test that logging options set before Init are applied properly,
// and retained even after Init.
TEST_F(ChannelManagerTest, SetLoggingBeforeInit) {
- cm_->SetVoiceLogging(talk_base::LS_INFO, "test-voice");
- cm_->SetVideoLogging(talk_base::LS_VERBOSE, "test-video");
- EXPECT_EQ(talk_base::LS_INFO, fme_->voice_loglevel());
+ cm_->SetVoiceLogging(rtc::LS_INFO, "test-voice");
+ cm_->SetVideoLogging(rtc::LS_VERBOSE, "test-video");
+ EXPECT_EQ(rtc::LS_INFO, fme_->voice_loglevel());
EXPECT_STREQ("test-voice", fme_->voice_logfilter().c_str());
- EXPECT_EQ(talk_base::LS_VERBOSE, fme_->video_loglevel());
+ EXPECT_EQ(rtc::LS_VERBOSE, fme_->video_loglevel());
EXPECT_STREQ("test-video", fme_->video_logfilter().c_str());
EXPECT_TRUE(cm_->Init());
- EXPECT_EQ(talk_base::LS_INFO, fme_->voice_loglevel());
+ EXPECT_EQ(rtc::LS_INFO, fme_->voice_loglevel());
EXPECT_STREQ("test-voice", fme_->voice_logfilter().c_str());
- EXPECT_EQ(talk_base::LS_VERBOSE, fme_->video_loglevel());
+ EXPECT_EQ(rtc::LS_VERBOSE, fme_->video_loglevel());
EXPECT_STREQ("test-video", fme_->video_logfilter().c_str());
}
// Test that logging options set after Init are applied properly.
TEST_F(ChannelManagerTest, SetLogging) {
EXPECT_TRUE(cm_->Init());
- cm_->SetVoiceLogging(talk_base::LS_INFO, "test-voice");
- cm_->SetVideoLogging(talk_base::LS_VERBOSE, "test-video");
- EXPECT_EQ(talk_base::LS_INFO, fme_->voice_loglevel());
+ cm_->SetVoiceLogging(rtc::LS_INFO, "test-voice");
+ cm_->SetVideoLogging(rtc::LS_VERBOSE, "test-video");
+ EXPECT_EQ(rtc::LS_INFO, fme_->voice_loglevel());
EXPECT_STREQ("test-voice", fme_->voice_logfilter().c_str());
- EXPECT_EQ(talk_base::LS_VERBOSE, fme_->video_loglevel());
+ EXPECT_EQ(rtc::LS_VERBOSE, fme_->video_loglevel());
EXPECT_STREQ("test-video", fme_->video_logfilter().c_str());
}
diff --git a/session/media/currentspeakermonitor.cc b/session/media/currentspeakermonitor.cc
index 8965cde..900ec1e 100644
--- a/session/media/currentspeakermonitor.cc
+++ b/session/media/currentspeakermonitor.cc
@@ -27,7 +27,7 @@
#include "talk/session/media/currentspeakermonitor.h"
-#include "talk/base/logging.h"
+#include "webrtc/base/logging.h"
#include "talk/media/base/streamparams.h"
#include "talk/session/media/audiomonitor.h"
#include "talk/session/media/mediamessages.h"
@@ -183,7 +183,7 @@
// We avoid over-switching by disabling switching for a period of time after
// a switch is done.
- uint32 now = talk_base::Time();
+ uint32 now = rtc::Time();
if (earliest_permitted_switch_time_ <= now &&
current_speaker_ssrc_ != loudest_speaker_ssrc) {
current_speaker_ssrc_ = loudest_speaker_ssrc;
diff --git a/session/media/currentspeakermonitor.h b/session/media/currentspeakermonitor.h
index 8e05c8e..0397a6d 100644
--- a/session/media/currentspeakermonitor.h
+++ b/session/media/currentspeakermonitor.h
@@ -33,8 +33,8 @@
#include <map>
-#include "talk/base/basictypes.h"
-#include "talk/base/sigslot.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/sigslot.h"
namespace cricket {
diff --git a/session/media/currentspeakermonitor_unittest.cc b/session/media/currentspeakermonitor_unittest.cc
index b65611f..8798f86 100644
--- a/session/media/currentspeakermonitor_unittest.cc
+++ b/session/media/currentspeakermonitor_unittest.cc
@@ -25,8 +25,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/gunit.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/thread.h"
#include "talk/session/media/call.h"
#include "talk/session/media/currentspeakermonitor.h"
@@ -165,7 +165,7 @@
EXPECT_EQ(num_changes_, 1);
// Wait so the changes don't come so rapidly.
- talk_base::Thread::SleepMs(kSleepTimeBetweenSwitches);
+ rtc::Thread::SleepMs(kSleepTimeBetweenSwitches);
info.active_streams.push_back(std::make_pair(kSsrc1, 9));
info.active_streams.push_back(std::make_pair(kSsrc2, 1));
@@ -201,7 +201,7 @@
EXPECT_EQ(num_changes_, 1);
// Wait so the changes don't come so rapidly.
- talk_base::Thread::SleepMs(kSleepTimeBetweenSwitches);
+ rtc::Thread::SleepMs(kSleepTimeBetweenSwitches);
info.active_streams.push_back(std::make_pair(kSsrc1, 3));
info.active_streams.push_back(std::make_pair(kSsrc2, 0));
diff --git a/session/media/externalhmac.cc b/session/media/externalhmac.cc
index 470668d..82d316d 100644
--- a/session/media/externalhmac.cc
+++ b/session/media/externalhmac.cc
@@ -37,7 +37,7 @@
#include "third_party/libsrtp/include/srtp.h"
#endif // SRTP_RELATIVE_PATH
-#include "talk/base/logging.h"
+#include "webrtc/base/logging.h"
// Begin test case 0 */
static const uint8_t kExternalHmacTestCase0Key[20] = {
diff --git a/session/media/externalhmac.h b/session/media/externalhmac.h
index 287d968..0ab1919 100644
--- a/session/media/externalhmac.h
+++ b/session/media/externalhmac.h
@@ -46,7 +46,7 @@
// crypto_kernel_replace_auth_type function.
#if defined(HAVE_SRTP) && defined(ENABLE_EXTERNAL_AUTH)
-#include "talk/base/basictypes.h"
+#include "webrtc/base/basictypes.h"
#ifdef SRTP_RELATIVE_PATH
#include "auth.h" // NOLINT
#else
diff --git a/session/media/mediamessages.cc b/session/media/mediamessages.cc
index 45c6c79..933c1ee 100644
--- a/session/media/mediamessages.cc
+++ b/session/media/mediamessages.cc
@@ -31,8 +31,8 @@
#include "talk/session/media/mediamessages.h"
-#include "talk/base/logging.h"
-#include "talk/base/stringencode.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/stringencode.h"
#include "talk/p2p/base/constants.h"
#include "talk/p2p/base/parsing.h"
#include "talk/session/media/mediasessionclient.h"
@@ -49,7 +49,7 @@
}
bool ParseSsrc(const std::string& string, uint32* ssrc) {
- return talk_base::FromString(string, ssrc);
+ return rtc::FromString(string, ssrc);
}
// Builds a <view> element according to the following spec:
diff --git a/session/media/mediamessages.h b/session/media/mediamessages.h
index dcb48a8..032bca8 100644
--- a/session/media/mediamessages.h
+++ b/session/media/mediamessages.h
@@ -39,7 +39,7 @@
#include <string>
#include <vector>
-#include "talk/base/basictypes.h"
+#include "webrtc/base/basictypes.h"
#include "talk/media/base/mediachannel.h" // For RtpHeaderExtension
#include "talk/media/base/streamparams.h"
#include "talk/p2p/base/parsing.h"
diff --git a/session/media/mediamessages_unittest.cc b/session/media/mediamessages_unittest.cc
index c7c81c3..0700801 100644
--- a/session/media/mediamessages_unittest.cc
+++ b/session/media/mediamessages_unittest.cc
@@ -30,8 +30,8 @@
#include <string>
#include <vector>
-#include "talk/base/gunit.h"
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/p2p/base/constants.h"
#include "talk/session/media/mediasessionclient.h"
#include "talk/xmllite/xmlelement.h"
@@ -161,7 +161,7 @@
return size;
}
- talk_base::scoped_ptr<cricket::SessionDescription> remote_description_;
+ rtc::scoped_ptr<cricket::SessionDescription> remote_description_;
};
} // anonymous namespace
@@ -170,7 +170,7 @@
TEST_F(MediaMessagesTest, ViewNoneToFromXml) {
buzz::XmlElement* expected_view_elem =
buzz::XmlElement::ForStr(kViewVideoNoneXml);
- talk_base::scoped_ptr<buzz::XmlElement> action_elem(
+ rtc::scoped_ptr<buzz::XmlElement> action_elem(
new buzz::XmlElement(QN_JINGLE));
EXPECT_FALSE(cricket::IsJingleViewRequest(action_elem.get()));
@@ -197,7 +197,7 @@
// Test serializing/deserializing an a simple vga <view> message.
TEST_F(MediaMessagesTest, ViewVgaToFromXml) {
- talk_base::scoped_ptr<buzz::XmlElement> action_elem(
+ rtc::scoped_ptr<buzz::XmlElement> action_elem(
new buzz::XmlElement(QN_JINGLE));
buzz::XmlElement* expected_view_elem1 =
buzz::XmlElement::ForStr(ViewVideoStaticVgaXml("1234"));
@@ -238,7 +238,7 @@
// Test deserializing bad view XML.
TEST_F(MediaMessagesTest, ParseBadViewXml) {
- talk_base::scoped_ptr<buzz::XmlElement> action_elem(
+ rtc::scoped_ptr<buzz::XmlElement> action_elem(
new buzz::XmlElement(QN_JINGLE));
buzz::XmlElement* view_elem =
buzz::XmlElement::ForStr(ViewVideoStaticVgaXml("not-an-ssrc"));
@@ -253,7 +253,7 @@
// Test serializing/deserializing typical streams xml.
TEST_F(MediaMessagesTest, StreamsToFromXml) {
- talk_base::scoped_ptr<buzz::XmlElement> expected_streams_elem(
+ rtc::scoped_ptr<buzz::XmlElement> expected_streams_elem(
buzz::XmlElement::ForStr(
StreamsXml(
StreamXml("nick1", "stream1", "101", "102",
@@ -267,7 +267,7 @@
expected_streams.push_back(CreateStream("nick2", "stream2", 201U, 202U,
"semantics2", "type2", "display2"));
- talk_base::scoped_ptr<buzz::XmlElement> actual_desc_elem(
+ rtc::scoped_ptr<buzz::XmlElement> actual_desc_elem(
new buzz::XmlElement(QN_JINGLE_RTP_CONTENT));
cricket::WriteJingleStreams(expected_streams, actual_desc_elem.get());
@@ -276,7 +276,7 @@
ASSERT_TRUE(actual_streams_elem != NULL);
EXPECT_EQ(expected_streams_elem->Str(), actual_streams_elem->Str());
- talk_base::scoped_ptr<buzz::XmlElement> expected_desc_elem(
+ rtc::scoped_ptr<buzz::XmlElement> expected_desc_elem(
new buzz::XmlElement(QN_JINGLE_RTP_CONTENT));
expected_desc_elem->AddElement(new buzz::XmlElement(
*expected_streams_elem));
@@ -293,14 +293,14 @@
// Test deserializing bad streams xml.
TEST_F(MediaMessagesTest, StreamsFromBadXml) {
- talk_base::scoped_ptr<buzz::XmlElement> streams_elem(
+ rtc::scoped_ptr<buzz::XmlElement> streams_elem(
buzz::XmlElement::ForStr(
StreamsXml(
StreamXml("nick1", "name1", "101", "not-an-ssrc",
"semantics1", "type1", "display1"),
StreamXml("nick2", "name2", "202", "not-an-ssrc",
"semantics2", "type2", "display2"))));
- talk_base::scoped_ptr<buzz::XmlElement> desc_elem(
+ rtc::scoped_ptr<buzz::XmlElement> desc_elem(
new buzz::XmlElement(QN_JINGLE_RTP_CONTENT));
desc_elem->AddElement(new buzz::XmlElement(*streams_elem));
@@ -312,7 +312,7 @@
// Test serializing/deserializing typical RTP Header Extension xml.
TEST_F(MediaMessagesTest, HeaderExtensionsToFromXml) {
- talk_base::scoped_ptr<buzz::XmlElement> expected_desc_elem(
+ rtc::scoped_ptr<buzz::XmlElement> expected_desc_elem(
buzz::XmlElement::ForStr(
HeaderExtensionsXml(
HeaderExtensionXml("abc", "123"),
@@ -322,7 +322,7 @@
expected_hdrexts.push_back(RtpHeaderExtension("abc", 123));
expected_hdrexts.push_back(RtpHeaderExtension("def", 456));
- talk_base::scoped_ptr<buzz::XmlElement> actual_desc_elem(
+ rtc::scoped_ptr<buzz::XmlElement> actual_desc_elem(
new buzz::XmlElement(QN_JINGLE_RTP_CONTENT));
cricket::WriteJingleRtpHeaderExtensions(expected_hdrexts, actual_desc_elem.get());
@@ -343,7 +343,7 @@
std::vector<cricket::RtpHeaderExtension> actual_hdrexts;
cricket::ParseError parse_error;
- talk_base::scoped_ptr<buzz::XmlElement> desc_elem(
+ rtc::scoped_ptr<buzz::XmlElement> desc_elem(
buzz::XmlElement::ForStr(
HeaderExtensionsXml(
HeaderExtensionXml("abc", "123"),
diff --git a/session/media/mediamonitor.cc b/session/media/mediamonitor.cc
index 844180e..6c74bf9 100644
--- a/session/media/mediamonitor.cc
+++ b/session/media/mediamonitor.cc
@@ -25,7 +25,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/common.h"
+#include "webrtc/base/common.h"
#include "talk/session/media/channelmanager.h"
#include "talk/session/media/mediamonitor.h"
@@ -38,8 +38,8 @@
MSG_MONITOR_SIGNAL = 4
};
-MediaMonitor::MediaMonitor(talk_base::Thread* worker_thread,
- talk_base::Thread* monitor_thread)
+MediaMonitor::MediaMonitor(rtc::Thread* worker_thread,
+ rtc::Thread* monitor_thread)
: worker_thread_(worker_thread),
monitor_thread_(monitor_thread), monitoring_(false), rate_(0) {
}
@@ -62,12 +62,12 @@
rate_ = 0;
}
-void MediaMonitor::OnMessage(talk_base::Message* message) {
- talk_base::CritScope cs(&crit_);
+void MediaMonitor::OnMessage(rtc::Message* message) {
+ rtc::CritScope cs(&crit_);
switch (message->message_id) {
case MSG_MONITOR_START:
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ ASSERT(rtc::Thread::Current() == worker_thread_);
if (!monitoring_) {
monitoring_ = true;
PollMediaChannel();
@@ -75,7 +75,7 @@
break;
case MSG_MONITOR_STOP:
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ ASSERT(rtc::Thread::Current() == worker_thread_);
if (monitoring_) {
monitoring_ = false;
worker_thread_->Clear(this);
@@ -83,20 +83,20 @@
break;
case MSG_MONITOR_POLL:
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ ASSERT(rtc::Thread::Current() == worker_thread_);
PollMediaChannel();
break;
case MSG_MONITOR_SIGNAL:
- ASSERT(talk_base::Thread::Current() == monitor_thread_);
+ ASSERT(rtc::Thread::Current() == monitor_thread_);
Update();
break;
}
}
void MediaMonitor::PollMediaChannel() {
- talk_base::CritScope cs(&crit_);
- ASSERT(talk_base::Thread::Current() == worker_thread_);
+ rtc::CritScope cs(&crit_);
+ ASSERT(rtc::Thread::Current() == worker_thread_);
GetStats();
diff --git a/session/media/mediamonitor.h b/session/media/mediamonitor.h
index a9ce889..11dc419 100644
--- a/session/media/mediamonitor.h
+++ b/session/media/mediamonitor.h
@@ -30,33 +30,33 @@
#ifndef TALK_SESSION_MEDIA_MEDIAMONITOR_H_
#define TALK_SESSION_MEDIA_MEDIAMONITOR_H_
-#include "talk/base/criticalsection.h"
-#include "talk/base/sigslot.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/criticalsection.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/thread.h"
#include "talk/media/base/mediachannel.h"
namespace cricket {
// The base MediaMonitor class, independent of voice and video.
-class MediaMonitor : public talk_base::MessageHandler,
+class MediaMonitor : public rtc::MessageHandler,
public sigslot::has_slots<> {
public:
- MediaMonitor(talk_base::Thread* worker_thread,
- talk_base::Thread* monitor_thread);
+ MediaMonitor(rtc::Thread* worker_thread,
+ rtc::Thread* monitor_thread);
~MediaMonitor();
void Start(uint32 milliseconds);
void Stop();
protected:
- void OnMessage(talk_base::Message *message);
+ void OnMessage(rtc::Message *message);
void PollMediaChannel();
virtual void GetStats() = 0;
virtual void Update() = 0;
- talk_base::CriticalSection crit_;
- talk_base::Thread* worker_thread_;
- talk_base::Thread* monitor_thread_;
+ rtc::CriticalSection crit_;
+ rtc::Thread* worker_thread_;
+ rtc::Thread* monitor_thread_;
bool monitoring_;
uint32 rate_;
};
@@ -65,8 +65,8 @@
template<class MC, class MI>
class MediaMonitorT : public MediaMonitor {
public:
- MediaMonitorT(MC* media_channel, talk_base::Thread* worker_thread,
- talk_base::Thread* monitor_thread)
+ MediaMonitorT(MC* media_channel, rtc::Thread* worker_thread,
+ rtc::Thread* monitor_thread)
: MediaMonitor(worker_thread, monitor_thread),
media_channel_(media_channel) {}
sigslot::signal2<MC*, const MI&> SignalUpdate;
diff --git a/session/media/mediarecorder.cc b/session/media/mediarecorder.cc
index 0aed63a..8d9d7e5 100644
--- a/session/media/mediarecorder.cc
+++ b/session/media/mediarecorder.cc
@@ -31,9 +31,9 @@
#include <string>
-#include "talk/base/fileutils.h"
-#include "talk/base/logging.h"
-#include "talk/base/pathutils.h"
+#include "webrtc/base/fileutils.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/pathutils.h"
#include "talk/media/base/rtpdump.h"
@@ -42,7 +42,7 @@
///////////////////////////////////////////////////////////////////////////
// Implementation of RtpDumpSink.
///////////////////////////////////////////////////////////////////////////
-RtpDumpSink::RtpDumpSink(talk_base::StreamInterface* stream)
+RtpDumpSink::RtpDumpSink(rtc::StreamInterface* stream)
: max_size_(INT_MAX),
recording_(false),
packet_filter_(PF_NONE) {
@@ -52,12 +52,12 @@
RtpDumpSink::~RtpDumpSink() {}
void RtpDumpSink::SetMaxSize(size_t size) {
- talk_base::CritScope cs(&critical_section_);
+ rtc::CritScope cs(&critical_section_);
max_size_ = size;
}
bool RtpDumpSink::Enable(bool enable) {
- talk_base::CritScope cs(&critical_section_);
+ rtc::CritScope cs(&critical_section_);
recording_ = enable;
@@ -75,7 +75,7 @@
}
void RtpDumpSink::OnPacket(const void* data, size_t size, bool rtcp) {
- talk_base::CritScope cs(&critical_section_);
+ rtc::CritScope cs(&critical_section_);
if (recording_ && writer_) {
size_t current_size;
@@ -91,7 +91,7 @@
}
void RtpDumpSink::set_packet_filter(int filter) {
- talk_base::CritScope cs(&critical_section_);
+ rtc::CritScope cs(&critical_section_);
packet_filter_ = filter;
if (writer_) {
writer_->set_packet_filter(packet_filter_);
@@ -99,7 +99,7 @@
}
void RtpDumpSink::Flush() {
- talk_base::CritScope cs(&critical_section_);
+ rtc::CritScope cs(&critical_section_);
if (stream_) {
stream_->Flush();
}
@@ -111,7 +111,7 @@
MediaRecorder::MediaRecorder() {}
MediaRecorder::~MediaRecorder() {
- talk_base::CritScope cs(&critical_section_);
+ rtc::CritScope cs(&critical_section_);
std::map<BaseChannel*, SinkPair*>::iterator itr;
for (itr = sinks_.begin(); itr != sinks_.end(); ++itr) {
delete itr->second;
@@ -119,15 +119,15 @@
}
bool MediaRecorder::AddChannel(VoiceChannel* channel,
- talk_base::StreamInterface* send_stream,
- talk_base::StreamInterface* recv_stream,
+ rtc::StreamInterface* send_stream,
+ rtc::StreamInterface* recv_stream,
int filter) {
return InternalAddChannel(channel, false, send_stream, recv_stream,
filter);
}
bool MediaRecorder::AddChannel(VideoChannel* channel,
- talk_base::StreamInterface* send_stream,
- talk_base::StreamInterface* recv_stream,
+ rtc::StreamInterface* send_stream,
+ rtc::StreamInterface* recv_stream,
int filter) {
return InternalAddChannel(channel, true, send_stream, recv_stream,
filter);
@@ -135,14 +135,14 @@
bool MediaRecorder::InternalAddChannel(BaseChannel* channel,
bool video_channel,
- talk_base::StreamInterface* send_stream,
- talk_base::StreamInterface* recv_stream,
+ rtc::StreamInterface* send_stream,
+ rtc::StreamInterface* recv_stream,
int filter) {
if (!channel) {
return false;
}
- talk_base::CritScope cs(&critical_section_);
+ rtc::CritScope cs(&critical_section_);
if (sinks_.end() != sinks_.find(channel)) {
return false; // The channel was added already.
}
@@ -161,7 +161,7 @@
void MediaRecorder::RemoveChannel(BaseChannel* channel,
SinkType type) {
- talk_base::CritScope cs(&critical_section_);
+ rtc::CritScope cs(&critical_section_);
std::map<BaseChannel*, SinkPair*>::iterator itr = sinks_.find(channel);
if (sinks_.end() != itr) {
channel->UnregisterSendSink(itr->second->send_sink.get(), type);
@@ -174,7 +174,7 @@
bool MediaRecorder::EnableChannel(
BaseChannel* channel, bool enable_send, bool enable_recv,
SinkType type) {
- talk_base::CritScope cs(&critical_section_);
+ rtc::CritScope cs(&critical_section_);
std::map<BaseChannel*, SinkPair*>::iterator itr = sinks_.find(channel);
if (sinks_.end() == itr) {
return false;
@@ -213,7 +213,7 @@
}
void MediaRecorder::FlushSinks() {
- talk_base::CritScope cs(&critical_section_);
+ rtc::CritScope cs(&critical_section_);
std::map<BaseChannel*, SinkPair*>::iterator itr;
for (itr = sinks_.begin(); itr != sinks_.end(); ++itr) {
itr->second->send_sink->Flush();
diff --git a/session/media/mediarecorder.h b/session/media/mediarecorder.h
index df22e98..aba6cf1 100644
--- a/session/media/mediarecorder.h
+++ b/session/media/mediarecorder.h
@@ -31,13 +31,13 @@
#include <map>
#include <string>
-#include "talk/base/criticalsection.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/sigslot.h"
+#include "webrtc/base/criticalsection.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/sigslot.h"
#include "talk/session/media/channel.h"
#include "talk/session/media/mediasink.h"
-namespace talk_base {
+namespace rtc {
class Pathname;
class FileStream;
}
@@ -54,7 +54,7 @@
class RtpDumpSink : public MediaSinkInterface, public sigslot::has_slots<> {
public:
// Takes ownership of stream.
- explicit RtpDumpSink(talk_base::StreamInterface* stream);
+ explicit RtpDumpSink(rtc::StreamInterface* stream);
virtual ~RtpDumpSink();
virtual void SetMaxSize(size_t size);
@@ -69,9 +69,9 @@
size_t max_size_;
bool recording_;
int packet_filter_;
- talk_base::scoped_ptr<talk_base::StreamInterface> stream_;
- talk_base::scoped_ptr<RtpDumpWriter> writer_;
- talk_base::CriticalSection critical_section_;
+ rtc::scoped_ptr<rtc::StreamInterface> stream_;
+ rtc::scoped_ptr<RtpDumpWriter> writer_;
+ rtc::CriticalSection critical_section_;
DISALLOW_COPY_AND_ASSIGN(RtpDumpSink);
};
@@ -82,12 +82,12 @@
virtual ~MediaRecorder();
bool AddChannel(VoiceChannel* channel,
- talk_base::StreamInterface* send_stream,
- talk_base::StreamInterface* recv_stream,
+ rtc::StreamInterface* send_stream,
+ rtc::StreamInterface* recv_stream,
int filter);
bool AddChannel(VideoChannel* channel,
- talk_base::StreamInterface* send_stream,
- talk_base::StreamInterface* recv_stream,
+ rtc::StreamInterface* send_stream,
+ rtc::StreamInterface* recv_stream,
int filter);
void RemoveChannel(BaseChannel* channel, SinkType type);
bool EnableChannel(BaseChannel* channel, bool enable_send, bool enable_recv,
@@ -98,18 +98,18 @@
struct SinkPair {
bool video_channel;
int filter;
- talk_base::scoped_ptr<RtpDumpSink> send_sink;
- talk_base::scoped_ptr<RtpDumpSink> recv_sink;
+ rtc::scoped_ptr<RtpDumpSink> send_sink;
+ rtc::scoped_ptr<RtpDumpSink> recv_sink;
};
bool InternalAddChannel(BaseChannel* channel,
bool video_channel,
- talk_base::StreamInterface* send_stream,
- talk_base::StreamInterface* recv_stream,
+ rtc::StreamInterface* send_stream,
+ rtc::StreamInterface* recv_stream,
int filter);
std::map<BaseChannel*, SinkPair*> sinks_;
- talk_base::CriticalSection critical_section_;
+ rtc::CriticalSection critical_section_;
DISALLOW_COPY_AND_ASSIGN(MediaRecorder);
};
diff --git a/session/media/mediarecorder_unittest.cc b/session/media/mediarecorder_unittest.cc
index 5155e6d..2b3d892 100644
--- a/session/media/mediarecorder_unittest.cc
+++ b/session/media/mediarecorder_unittest.cc
@@ -25,11 +25,11 @@
#include <string>
-#include "talk/base/bytebuffer.h"
-#include "talk/base/fileutils.h"
-#include "talk/base/gunit.h"
-#include "talk/base/pathutils.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/bytebuffer.h"
+#include "webrtc/base/fileutils.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/pathutils.h"
+#include "webrtc/base/thread.h"
#include "talk/media/base/fakemediaengine.h"
#include "talk/media/base/rtpdump.h"
#include "talk/media/base/testutils.h"
@@ -39,9 +39,9 @@
namespace cricket {
-talk_base::StreamInterface* Open(const std::string& path) {
- return talk_base::Filesystem::OpenFile(
- talk_base::Pathname(path), "wb");
+rtc::StreamInterface* Open(const std::string& path) {
+ return rtc::Filesystem::OpenFile(
+ rtc::Pathname(path), "wb");
}
/////////////////////////////////////////////////////////////////////////
@@ -50,7 +50,7 @@
class RtpDumpSinkTest : public testing::Test {
public:
virtual void SetUp() {
- EXPECT_TRUE(talk_base::Filesystem::GetTemporaryFolder(path_, true, NULL));
+ EXPECT_TRUE(rtc::Filesystem::GetTemporaryFolder(path_, true, NULL));
path_.SetFilename("sink-test.rtpdump");
sink_.reset(new RtpDumpSink(Open(path_.pathname())));
@@ -62,30 +62,30 @@
virtual void TearDown() {
stream_.reset();
- EXPECT_TRUE(talk_base::Filesystem::DeleteFile(path_));
+ EXPECT_TRUE(rtc::Filesystem::DeleteFile(path_));
}
protected:
void OnRtpPacket(const RawRtpPacket& raw) {
- talk_base::ByteBuffer buf;
+ rtc::ByteBuffer buf;
raw.WriteToByteBuffer(RtpTestUtility::kDefaultSsrc, &buf);
sink_->OnPacket(buf.Data(), buf.Length(), false);
}
- talk_base::StreamResult ReadPacket(RtpDumpPacket* packet) {
+ rtc::StreamResult ReadPacket(RtpDumpPacket* packet) {
if (!stream_.get()) {
sink_.reset(); // This will close the file. So we can read it.
- stream_.reset(talk_base::Filesystem::OpenFile(path_, "rb"));
+ stream_.reset(rtc::Filesystem::OpenFile(path_, "rb"));
reader_.reset(new RtpDumpReader(stream_.get()));
}
return reader_->ReadPacket(packet);
}
- talk_base::Pathname path_;
- talk_base::scoped_ptr<RtpDumpSink> sink_;
- talk_base::ByteBuffer rtp_buf_[3];
- talk_base::scoped_ptr<talk_base::StreamInterface> stream_;
- talk_base::scoped_ptr<RtpDumpReader> reader_;
+ rtc::Pathname path_;
+ rtc::scoped_ptr<RtpDumpSink> sink_;
+ rtc::ByteBuffer rtp_buf_[3];
+ rtc::scoped_ptr<rtc::StreamInterface> stream_;
+ rtc::scoped_ptr<RtpDumpReader> reader_;
};
TEST_F(RtpDumpSinkTest, TestRtpDumpSink) {
@@ -97,7 +97,7 @@
// Enable the sink. The 2nd packet is written.
EXPECT_TRUE(sink_->Enable(true));
EXPECT_TRUE(sink_->IsEnabled());
- EXPECT_TRUE(talk_base::Filesystem::IsFile(path_.pathname()));
+ EXPECT_TRUE(rtc::Filesystem::IsFile(path_.pathname()));
OnRtpPacket(RtpTestUtility::kTestRawRtpPackets[1]);
// Disable the sink. The 3rd packet is not written.
@@ -107,10 +107,10 @@
// Read the recorded file and verify it contains only the 2nd packet.
RtpDumpPacket packet;
- EXPECT_EQ(talk_base::SR_SUCCESS, ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_SUCCESS, ReadPacket(&packet));
EXPECT_TRUE(RtpTestUtility::VerifyPacket(
&packet, &RtpTestUtility::kTestRawRtpPackets[1], false));
- EXPECT_EQ(talk_base::SR_EOS, ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_EOS, ReadPacket(&packet));
}
TEST_F(RtpDumpSinkTest, TestRtpDumpSinkMaxSize) {
@@ -128,10 +128,10 @@
// Read the recorded file and verify that it contains only the first packet.
RtpDumpPacket packet;
- EXPECT_EQ(talk_base::SR_SUCCESS, ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_SUCCESS, ReadPacket(&packet));
EXPECT_TRUE(RtpTestUtility::VerifyPacket(
&packet, &RtpTestUtility::kTestRawRtpPackets[0], false));
- EXPECT_EQ(talk_base::SR_EOS, ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_EOS, ReadPacket(&packet));
}
TEST_F(RtpDumpSinkTest, TestRtpDumpSinkFilter) {
@@ -158,13 +158,13 @@
// Read the recorded file and verify the header of the first packet and
// the whole packet for the second packet.
RtpDumpPacket packet;
- EXPECT_EQ(talk_base::SR_SUCCESS, ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_SUCCESS, ReadPacket(&packet));
EXPECT_TRUE(RtpTestUtility::VerifyPacket(
&packet, &RtpTestUtility::kTestRawRtpPackets[0], true));
- EXPECT_EQ(talk_base::SR_SUCCESS, ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_SUCCESS, ReadPacket(&packet));
EXPECT_TRUE(RtpTestUtility::VerifyPacket(
&packet, &RtpTestUtility::kTestRawRtpPackets[1], false));
- EXPECT_EQ(talk_base::SR_EOS, ReadPacket(&packet));
+ EXPECT_EQ(rtc::SR_EOS, ReadPacket(&packet));
}
/////////////////////////////////////////////////////////////////////////
@@ -174,7 +174,7 @@
FakeVideoMediaChannel* video_media_channel,
int filter) {
// Create media recorder.
- talk_base::scoped_ptr<MediaRecorder> recorder(new MediaRecorder);
+ rtc::scoped_ptr<MediaRecorder> recorder(new MediaRecorder);
// Fail to EnableChannel before AddChannel.
EXPECT_FALSE(recorder->EnableChannel(channel, true, true, SINK_PRE_CRYPTO));
EXPECT_FALSE(channel->HasSendSinks(SINK_PRE_CRYPTO));
@@ -183,8 +183,8 @@
EXPECT_FALSE(channel->HasRecvSinks(SINK_POST_CRYPTO));
// Add the channel to the recorder.
- talk_base::Pathname path;
- EXPECT_TRUE(talk_base::Filesystem::GetTemporaryFolder(path, true, NULL));
+ rtc::Pathname path;
+ EXPECT_TRUE(rtc::Filesystem::GetTemporaryFolder(path, true, NULL));
path.SetFilename("send.rtpdump");
std::string send_file = path.pathname();
path.SetFilename("recv.rtpdump");
@@ -247,8 +247,8 @@
// Delete all files.
recorder.reset();
- EXPECT_TRUE(talk_base::Filesystem::DeleteFile(send_file));
- EXPECT_TRUE(talk_base::Filesystem::DeleteFile(recv_file));
+ EXPECT_TRUE(rtc::Filesystem::DeleteFile(send_file));
+ EXPECT_TRUE(rtc::Filesystem::DeleteFile(recv_file));
}
// Fisrt start recording header and then start recording media. Verify that
@@ -256,10 +256,10 @@
void TestRecordHeaderAndMedia(BaseChannel* channel,
FakeVideoMediaChannel* video_media_channel) {
// Create RTP header recorder.
- talk_base::scoped_ptr<MediaRecorder> header_recorder(new MediaRecorder);
+ rtc::scoped_ptr<MediaRecorder> header_recorder(new MediaRecorder);
- talk_base::Pathname path;
- EXPECT_TRUE(talk_base::Filesystem::GetTemporaryFolder(path, true, NULL));
+ rtc::Pathname path;
+ EXPECT_TRUE(rtc::Filesystem::GetTemporaryFolder(path, true, NULL));
path.SetFilename("send-header.rtpdump");
std::string send_header_file = path.pathname();
path.SetFilename("recv-header.rtpdump");
@@ -287,11 +287,11 @@
}
// Verify that header files are created.
- EXPECT_TRUE(talk_base::Filesystem::IsFile(send_header_file));
- EXPECT_TRUE(talk_base::Filesystem::IsFile(recv_header_file));
+ EXPECT_TRUE(rtc::Filesystem::IsFile(send_header_file));
+ EXPECT_TRUE(rtc::Filesystem::IsFile(recv_header_file));
// Create RTP header recorder.
- talk_base::scoped_ptr<MediaRecorder> recorder(new MediaRecorder);
+ rtc::scoped_ptr<MediaRecorder> recorder(new MediaRecorder);
path.SetFilename("send.rtpdump");
std::string send_file = path.pathname();
path.SetFilename("recv.rtpdump");
@@ -318,23 +318,23 @@
}
// Verify that media files are created.
- EXPECT_TRUE(talk_base::Filesystem::IsFile(send_file));
- EXPECT_TRUE(talk_base::Filesystem::IsFile(recv_file));
+ EXPECT_TRUE(rtc::Filesystem::IsFile(send_file));
+ EXPECT_TRUE(rtc::Filesystem::IsFile(recv_file));
// Delete all files.
header_recorder.reset();
recorder.reset();
- EXPECT_TRUE(talk_base::Filesystem::DeleteFile(send_header_file));
- EXPECT_TRUE(talk_base::Filesystem::DeleteFile(recv_header_file));
- EXPECT_TRUE(talk_base::Filesystem::DeleteFile(send_file));
- EXPECT_TRUE(talk_base::Filesystem::DeleteFile(recv_file));
+ EXPECT_TRUE(rtc::Filesystem::DeleteFile(send_header_file));
+ EXPECT_TRUE(rtc::Filesystem::DeleteFile(recv_header_file));
+ EXPECT_TRUE(rtc::Filesystem::DeleteFile(send_file));
+ EXPECT_TRUE(rtc::Filesystem::DeleteFile(recv_file));
}
TEST(MediaRecorderTest, TestMediaRecorderVoiceChannel) {
// Create the voice channel.
FakeSession session(true);
FakeMediaEngine media_engine;
- VoiceChannel channel(talk_base::Thread::Current(), &media_engine,
+ VoiceChannel channel(rtc::Thread::Current(), &media_engine,
new FakeVoiceMediaChannel(NULL), &session, "", false);
EXPECT_TRUE(channel.Init());
TestMediaRecorder(&channel, NULL, PF_RTPPACKET);
@@ -347,7 +347,7 @@
FakeSession session(true);
FakeMediaEngine media_engine;
FakeVideoMediaChannel* media_channel = new FakeVideoMediaChannel(NULL);
- VideoChannel channel(talk_base::Thread::Current(), &media_engine,
+ VideoChannel channel(rtc::Thread::Current(), &media_engine,
media_channel, &session, "", false, NULL);
EXPECT_TRUE(channel.Init());
TestMediaRecorder(&channel, media_channel, PF_RTPPACKET);
diff --git a/session/media/mediasession.cc b/session/media/mediasession.cc
index a5b1eb0..a250632 100644
--- a/session/media/mediasession.cc
+++ b/session/media/mediasession.cc
@@ -32,10 +32,10 @@
#include <set>
#include <utility>
-#include "talk/base/helpers.h"
-#include "talk/base/logging.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/stringutils.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/stringutils.h"
#include "talk/media/base/constants.h"
#include "talk/media/base/cryptoparams.h"
#include "talk/p2p/base/constants.h"
@@ -55,7 +55,7 @@
namespace cricket {
-using talk_base::scoped_ptr;
+using rtc::scoped_ptr;
// RTP Profile names
// http://www.iana.org/assignments/rtp-parameters/rtp-parameters.xml
@@ -89,7 +89,7 @@
std::string key;
key.reserve(SRTP_MASTER_KEY_BASE64_LEN);
- if (!talk_base::CreateRandomString(SRTP_MASTER_KEY_BASE64_LEN, &key)) {
+ if (!rtc::CreateRandomString(SRTP_MASTER_KEY_BASE64_LEN, &key)) {
return false;
}
out->tag = tag;
@@ -236,7 +236,7 @@
// Generate a random string for the RTCP CNAME, as stated in RFC 6222.
// This string is only used for synchronization, and therefore is opaque.
do {
- if (!talk_base::CreateRandomString(16, cname)) {
+ if (!rtc::CreateRandomString(16, cname)) {
ASSERT(false);
return false;
}
@@ -254,7 +254,7 @@
for (int i = 0; i < num_ssrcs; i++) {
uint32 candidate;
do {
- candidate = talk_base::CreateRandomNonZeroId();
+ candidate = rtc::CreateRandomNonZeroId();
} while (GetStreamBySsrc(params_vec, candidate, NULL) ||
std::count(ssrcs->begin(), ssrcs->end(), candidate) > 0);
ssrcs->push_back(candidate);
@@ -270,7 +270,7 @@
return false;
}
while (true) {
- uint32 candidate = talk_base::CreateRandomNonZeroId() % kMaxSctpSid;
+ uint32 candidate = rtc::CreateRandomNonZeroId() % kMaxSctpSid;
if (!GetStreamBySsrc(params_vec, candidate, NULL)) {
*sid = candidate;
return true;
@@ -610,7 +610,7 @@
return false;
}
is_rtp = media_desc->protocol().empty() ||
- talk_base::starts_with(media_desc->protocol().data(),
+ rtc::starts_with(media_desc->protocol().data(),
kMediaProtocolRtpPrefix);
}
return is_rtp;
@@ -820,7 +820,7 @@
if (!FindMatchingCodec<C>(*offered_codecs, *it, NULL) && IsRtxCodec(*it)) {
C rtx_codec = *it;
int referenced_pl_type =
- talk_base::FromString<int>(0,
+ rtc::FromString<int>(0,
rtx_codec.params[kCodecParamAssociatedPayloadType]);
new_rtx_codecs.insert(std::pair<int, C>(referenced_pl_type,
rtx_codec));
@@ -843,7 +843,7 @@
if (rtx_it != new_rtx_codecs.end()) {
C& rtx_codec = rtx_it->second;
rtx_codec.params[kCodecParamAssociatedPayloadType] =
- talk_base::ToString(codec.id);
+ rtc::ToString(codec.id);
}
}
}
@@ -1592,7 +1592,7 @@
return false;
const TransportDescription* current_tdesc =
GetTransportDescription(content_name, current_desc);
- talk_base::scoped_ptr<TransportDescription> new_tdesc(
+ rtc::scoped_ptr<TransportDescription> new_tdesc(
transport_desc_factory_->CreateOffer(transport_options, current_tdesc));
bool ret = (new_tdesc.get() != NULL &&
offer_desc->AddTransportInfo(TransportInfo(content_name, *new_tdesc)));
diff --git a/session/media/mediasession.h b/session/media/mediasession.h
index 5041de0..6abee3a 100644
--- a/session/media/mediasession.h
+++ b/session/media/mediasession.h
@@ -34,7 +34,7 @@
#include <vector>
#include <algorithm>
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/media/base/codec.h"
#include "talk/media/base/constants.h"
#include "talk/media/base/cryptoparams.h"
diff --git a/session/media/mediasession_unittest.cc b/session/media/mediasession_unittest.cc
index b76cce4..78c162f 100644
--- a/session/media/mediasession_unittest.cc
+++ b/session/media/mediasession_unittest.cc
@@ -28,10 +28,10 @@
#include <string>
#include <vector>
-#include "talk/base/gunit.h"
-#include "talk/base/fakesslidentity.h"
-#include "talk/base/messagedigest.h"
-#include "talk/base/ssladapter.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/fakesslidentity.h"
+#include "webrtc/base/messagedigest.h"
+#include "webrtc/base/ssladapter.h"
#include "talk/media/base/codec.h"
#include "talk/media/base/testutils.h"
#include "talk/p2p/base/constants.h"
@@ -198,11 +198,11 @@
}
static void SetUpTestCase() {
- talk_base::InitializeSSL();
+ rtc::InitializeSSL();
}
static void TearDownTestCase() {
- talk_base::CleanupSSL();
+ rtc::CleanupSSL();
}
// Create a video StreamParamsVec object with:
@@ -252,8 +252,8 @@
const std::string current_video_pwd = "current_video_pwd";
const std::string current_data_ufrag = "current_data_ufrag";
const std::string current_data_pwd = "current_data_pwd";
- talk_base::scoped_ptr<SessionDescription> current_desc;
- talk_base::scoped_ptr<SessionDescription> desc;
+ rtc::scoped_ptr<SessionDescription> current_desc;
+ rtc::scoped_ptr<SessionDescription> desc;
if (has_current_desc) {
current_desc.reset(new SessionDescription());
EXPECT_TRUE(current_desc->AddTransportInfo(
@@ -275,7 +275,7 @@
if (offer) {
desc.reset(f1_.CreateOffer(options, current_desc.get()));
} else {
- talk_base::scoped_ptr<SessionDescription> offer;
+ rtc::scoped_ptr<SessionDescription> offer;
offer.reset(f1_.CreateOffer(options, NULL));
desc.reset(f1_.CreateAnswer(offer.get(), options, current_desc.get()));
}
@@ -348,8 +348,8 @@
options.has_audio = true;
options.has_video = true;
options.data_channel_type = cricket::DCT_RTP;
- talk_base::scoped_ptr<SessionDescription> ref_desc;
- talk_base::scoped_ptr<SessionDescription> desc;
+ rtc::scoped_ptr<SessionDescription> ref_desc;
+ rtc::scoped_ptr<SessionDescription> desc;
if (offer) {
options.bundle_enabled = false;
ref_desc.reset(f1_.CreateOffer(options, NULL));
@@ -399,7 +399,7 @@
cricket::MediaContentDirection expected_direction_in_answer) {
MediaSessionOptions opts;
opts.has_video = true;
- talk_base::scoped_ptr<SessionDescription> offer(
+ rtc::scoped_ptr<SessionDescription> offer(
f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
ContentInfo* ac_offer= offer->GetContentByName("audio");
@@ -413,7 +413,7 @@
static_cast<VideoContentDescription*>(vc_offer->description);
vcd_offer->set_direction(direction_in_offer);
- talk_base::scoped_ptr<SessionDescription> answer(
+ rtc::scoped_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
const AudioContentDescription* acd_answer =
GetFirstAudioContentDescription(answer.get());
@@ -441,14 +441,14 @@
MediaSessionDescriptionFactory f2_;
TransportDescriptionFactory tdf1_;
TransportDescriptionFactory tdf2_;
- talk_base::FakeSSLIdentity id1_;
- talk_base::FakeSSLIdentity id2_;
+ rtc::FakeSSLIdentity id1_;
+ rtc::FakeSSLIdentity id2_;
};
// Create a typical audio offer, and ensure it matches what we expect.
TEST_F(MediaSessionDescriptionFactoryTest, TestCreateAudioOffer) {
f1_.set_secure(SEC_ENABLED);
- talk_base::scoped_ptr<SessionDescription> offer(
+ rtc::scoped_ptr<SessionDescription> offer(
f1_.CreateOffer(MediaSessionOptions(), NULL));
ASSERT_TRUE(offer.get() != NULL);
const ContentInfo* ac = offer->GetContentByName("audio");
@@ -472,7 +472,7 @@
MediaSessionOptions opts;
opts.has_video = true;
f1_.set_secure(SEC_ENABLED);
- talk_base::scoped_ptr<SessionDescription>
+ rtc::scoped_ptr<SessionDescription>
offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
const ContentInfo* ac = offer->GetContentByName("audio");
@@ -516,7 +516,7 @@
opts.has_video = true;
opts.data_channel_type = cricket::DCT_RTP;
opts.bundle_enabled = true;
- talk_base::scoped_ptr<SessionDescription>
+ rtc::scoped_ptr<SessionDescription>
offer(f2_.CreateOffer(opts, NULL));
const VideoContentDescription* vcd =
GetFirstVideoContentDescription(offer.get());
@@ -546,8 +546,8 @@
opts.has_video = false;
opts.data_channel_type = cricket::DCT_NONE;
opts.bundle_enabled = true;
- talk_base::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
- talk_base::scoped_ptr<SessionDescription> answer(
+ rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
+ rtc::scoped_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
MediaSessionOptions updated_opts;
@@ -555,7 +555,7 @@
updated_opts.has_video = true;
updated_opts.data_channel_type = cricket::DCT_RTP;
updated_opts.bundle_enabled = true;
- talk_base::scoped_ptr<SessionDescription> updated_offer(f1_.CreateOffer(
+ rtc::scoped_ptr<SessionDescription> updated_offer(f1_.CreateOffer(
updated_opts, answer.get()));
const AudioContentDescription* acd =
@@ -580,7 +580,7 @@
MediaSessionOptions opts;
opts.data_channel_type = cricket::DCT_RTP;
f1_.set_secure(SEC_ENABLED);
- talk_base::scoped_ptr<SessionDescription>
+ rtc::scoped_ptr<SessionDescription>
offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
const ContentInfo* ac = offer->GetContentByName("audio");
@@ -617,7 +617,7 @@
opts.bundle_enabled = true;
opts.data_channel_type = cricket::DCT_SCTP;
f1_.set_secure(SEC_ENABLED);
- talk_base::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
+ rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
EXPECT_TRUE(offer.get() != NULL);
EXPECT_TRUE(offer->GetContentByName("data") != NULL);
}
@@ -628,7 +628,7 @@
MediaSessionOptions opts;
opts.has_video = true;
f1_.set_add_legacy_streams(false);
- talk_base::scoped_ptr<SessionDescription>
+ rtc::scoped_ptr<SessionDescription>
offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
const ContentInfo* ac = offer->GetContentByName("audio");
@@ -648,10 +648,10 @@
TEST_F(MediaSessionDescriptionFactoryTest, TestCreateAudioAnswer) {
f1_.set_secure(SEC_ENABLED);
f2_.set_secure(SEC_ENABLED);
- talk_base::scoped_ptr<SessionDescription> offer(
+ rtc::scoped_ptr<SessionDescription> offer(
f1_.CreateOffer(MediaSessionOptions(), NULL));
ASSERT_TRUE(offer.get() != NULL);
- talk_base::scoped_ptr<SessionDescription> answer(
+ rtc::scoped_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), MediaSessionOptions(), NULL));
const ContentInfo* ac = answer->GetContentByName("audio");
const ContentInfo* vc = answer->GetContentByName("video");
@@ -675,9 +675,9 @@
opts.has_video = true;
f1_.set_secure(SEC_ENABLED);
f2_.set_secure(SEC_ENABLED);
- talk_base::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
+ rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
- talk_base::scoped_ptr<SessionDescription> answer(
+ rtc::scoped_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
const ContentInfo* ac = answer->GetContentByName("audio");
const ContentInfo* vc = answer->GetContentByName("video");
@@ -708,9 +708,9 @@
opts.data_channel_type = cricket::DCT_RTP;
f1_.set_secure(SEC_ENABLED);
f2_.set_secure(SEC_ENABLED);
- talk_base::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
+ rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
- talk_base::scoped_ptr<SessionDescription> answer(
+ rtc::scoped_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
const ContentInfo* ac = answer->GetContentByName("audio");
const ContentInfo* vc = answer->GetContentByName("data");
@@ -768,7 +768,7 @@
opts.has_audio = false;
f1_.set_secure(SEC_ENABLED);
f2_.set_secure(SEC_ENABLED);
- talk_base::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
+ rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
ContentInfo* dc_offer= offer->GetContentByName("data");
ASSERT_TRUE(dc_offer != NULL);
DataContentDescription* dcd_offer =
@@ -777,7 +777,7 @@
std::string protocol = "a weird unknown protocol";
dcd_offer->set_protocol(protocol);
- talk_base::scoped_ptr<SessionDescription> answer(
+ rtc::scoped_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
const ContentInfo* dc_answer = answer->GetContentByName("data");
@@ -797,13 +797,13 @@
tdf1_.set_secure(SEC_DISABLED);
tdf2_.set_secure(SEC_DISABLED);
- talk_base::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
+ rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
const AudioContentDescription* offer_acd =
GetFirstAudioContentDescription(offer.get());
ASSERT_TRUE(offer_acd != NULL);
EXPECT_EQ(std::string(cricket::kMediaProtocolAvpf), offer_acd->protocol());
- talk_base::scoped_ptr<SessionDescription> answer(
+ rtc::scoped_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
const ContentInfo* ac_answer = answer->GetContentByName("audio");
@@ -827,9 +827,9 @@
f2_.set_audio_rtp_header_extensions(MAKE_VECTOR(kAudioRtpExtension2));
f2_.set_video_rtp_header_extensions(MAKE_VECTOR(kVideoRtpExtension2));
- talk_base::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
+ rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
- talk_base::scoped_ptr<SessionDescription> answer(
+ rtc::scoped_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
EXPECT_EQ(MAKE_VECTOR(kAudioRtpExtension1),
@@ -854,9 +854,9 @@
opts.data_channel_type = cricket::DCT_RTP;
f1_.set_add_legacy_streams(false);
f2_.set_add_legacy_streams(false);
- talk_base::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
+ rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
- talk_base::scoped_ptr<SessionDescription> answer(
+ rtc::scoped_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
const ContentInfo* ac = answer->GetContentByName("audio");
const ContentInfo* vc = answer->GetContentByName("video");
@@ -880,7 +880,7 @@
opts.has_video = true;
opts.data_channel_type = cricket::DCT_RTP;
f1_.set_secure(SEC_ENABLED);
- talk_base::scoped_ptr<SessionDescription>
+ rtc::scoped_ptr<SessionDescription>
offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
const ContentInfo* ac = offer->GetContentByName("audio");
@@ -921,8 +921,8 @@
answer_opts.data_channel_type = cricket::DCT_RTP;
offer_opts.data_channel_type = cricket::DCT_RTP;
- talk_base::scoped_ptr<SessionDescription> offer;
- talk_base::scoped_ptr<SessionDescription> answer;
+ rtc::scoped_ptr<SessionDescription> offer;
+ rtc::scoped_ptr<SessionDescription> answer;
offer_opts.rtcp_mux_enabled = true;
answer_opts.rtcp_mux_enabled = true;
@@ -1001,10 +1001,10 @@
TEST_F(MediaSessionDescriptionFactoryTest, TestCreateAudioAnswerToVideo) {
MediaSessionOptions opts;
opts.has_video = true;
- talk_base::scoped_ptr<SessionDescription>
+ rtc::scoped_ptr<SessionDescription>
offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
- talk_base::scoped_ptr<SessionDescription> answer(
+ rtc::scoped_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), MediaSessionOptions(), NULL));
const ContentInfo* ac = answer->GetContentByName("audio");
const ContentInfo* vc = answer->GetContentByName("video");
@@ -1018,10 +1018,10 @@
TEST_F(MediaSessionDescriptionFactoryTest, TestCreateNoDataAnswerToDataOffer) {
MediaSessionOptions opts;
opts.data_channel_type = cricket::DCT_RTP;
- talk_base::scoped_ptr<SessionDescription>
+ rtc::scoped_ptr<SessionDescription>
offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
- talk_base::scoped_ptr<SessionDescription> answer(
+ rtc::scoped_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), MediaSessionOptions(), NULL));
const ContentInfo* ac = answer->GetContentByName("audio");
const ContentInfo* dc = answer->GetContentByName("data");
@@ -1037,7 +1037,7 @@
MediaSessionOptions opts;
opts.has_video = true;
opts.data_channel_type = cricket::DCT_RTP;
- talk_base::scoped_ptr<SessionDescription>
+ rtc::scoped_ptr<SessionDescription>
offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
ContentInfo* ac = offer->GetContentByName("audio");
@@ -1049,7 +1049,7 @@
ac->rejected = true;
vc->rejected = true;
dc->rejected = true;
- talk_base::scoped_ptr<SessionDescription> answer(
+ rtc::scoped_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
ac = answer->GetContentByName("audio");
vc = answer->GetContentByName("video");
@@ -1078,7 +1078,7 @@
opts.AddStream(MEDIA_TYPE_DATA, kDataTrack2, kMediaStream1);
f1_.set_secure(SEC_ENABLED);
- talk_base::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
+ rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
const ContentInfo* ac = offer->GetContentByName("audio");
@@ -1148,7 +1148,7 @@
opts.AddStream(MEDIA_TYPE_AUDIO, kAudioTrack3, kMediaStream1);
opts.RemoveStream(MEDIA_TYPE_DATA, kDataTrack2);
opts.AddStream(MEDIA_TYPE_DATA, kDataTrack3, kMediaStream1);
- talk_base::scoped_ptr<SessionDescription>
+ rtc::scoped_ptr<SessionDescription>
updated_offer(f1_.CreateOffer(opts, offer.get()));
ASSERT_TRUE(updated_offer.get() != NULL);
@@ -1206,7 +1206,7 @@
MediaSessionOptions opts;
const int num_sim_layers = 3;
opts.AddVideoStream(kVideoTrack1, kMediaStream1, num_sim_layers);
- talk_base::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
+ rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
const ContentInfo* vc = offer->GetContentByName("video");
@@ -1235,7 +1235,7 @@
offer_opts.data_channel_type = cricket::DCT_RTP;
f1_.set_secure(SEC_ENABLED);
f2_.set_secure(SEC_ENABLED);
- talk_base::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(offer_opts,
+ rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(offer_opts,
NULL));
MediaSessionOptions opts;
@@ -1246,7 +1246,7 @@
opts.AddStream(MEDIA_TYPE_DATA, kDataTrack1, kMediaStream1);
opts.AddStream(MEDIA_TYPE_DATA, kDataTrack2, kMediaStream1);
- talk_base::scoped_ptr<SessionDescription>
+ rtc::scoped_ptr<SessionDescription>
answer(f2_.CreateAnswer(offer.get(), opts, NULL));
ASSERT_TRUE(answer.get() != NULL);
@@ -1314,7 +1314,7 @@
opts.AddStream(MEDIA_TYPE_VIDEO, kVideoTrack2, kMediaStream2);
opts.RemoveStream(MEDIA_TYPE_AUDIO, kAudioTrack2);
opts.RemoveStream(MEDIA_TYPE_DATA, kDataTrack2);
- talk_base::scoped_ptr<SessionDescription>
+ rtc::scoped_ptr<SessionDescription>
updated_answer(f2_.CreateAnswer(offer.get(), opts, answer.get()));
ASSERT_TRUE(updated_answer.get() != NULL);
@@ -1370,8 +1370,8 @@
opts.has_audio = true;
opts.has_video = true;
- talk_base::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
- talk_base::scoped_ptr<SessionDescription> answer(
+ rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
+ rtc::scoped_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
const AudioContentDescription* acd =
@@ -1382,7 +1382,7 @@
GetFirstVideoContentDescription(answer.get());
EXPECT_EQ(MAKE_VECTOR(kVideoCodecsAnswer), vcd->codecs());
- talk_base::scoped_ptr<SessionDescription> updated_offer(
+ rtc::scoped_ptr<SessionDescription> updated_offer(
f2_.CreateOffer(opts, answer.get()));
// The expected audio codecs are the common audio codecs from the first
@@ -1428,7 +1428,7 @@
// This creates rtx for H264 with the payload type |f1_| uses.
rtx_f1.params[cricket::kCodecParamAssociatedPayloadType] =
- talk_base::ToString<int>(kVideoCodecs1[1].id);
+ rtc::ToString<int>(kVideoCodecs1[1].id);
f1_codecs.push_back(rtx_f1);
f1_.set_video_codecs(f1_codecs);
@@ -1439,13 +1439,13 @@
// This creates rtx for H264 with the payload type |f2_| uses.
rtx_f2.params[cricket::kCodecParamAssociatedPayloadType] =
- talk_base::ToString<int>(kVideoCodecs2[0].id);
+ rtc::ToString<int>(kVideoCodecs2[0].id);
f2_codecs.push_back(rtx_f2);
f2_.set_video_codecs(f2_codecs);
- talk_base::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
+ rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
- talk_base::scoped_ptr<SessionDescription> answer(
+ rtc::scoped_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
const VideoContentDescription* vcd =
@@ -1461,10 +1461,10 @@
// are different from |f1_|.
expected_codecs[0].preference = f1_codecs[1].preference;
- talk_base::scoped_ptr<SessionDescription> updated_offer(
+ rtc::scoped_ptr<SessionDescription> updated_offer(
f2_.CreateOffer(opts, answer.get()));
ASSERT_TRUE(updated_offer);
- talk_base::scoped_ptr<SessionDescription> updated_answer(
+ rtc::scoped_ptr<SessionDescription> updated_answer(
f1_.CreateAnswer(updated_offer.get(), opts, answer.get()));
const VideoContentDescription* updated_vcd =
@@ -1486,7 +1486,7 @@
// This creates rtx for H264 with the payload type |f1_| uses.
rtx_f1.params[cricket::kCodecParamAssociatedPayloadType] =
- talk_base::ToString<int>(kVideoCodecs1[1].id);
+ rtc::ToString<int>(kVideoCodecs1[1].id);
f1_codecs.push_back(rtx_f1);
f1_.set_video_codecs(f1_codecs);
@@ -1494,8 +1494,8 @@
opts.has_audio = true;
opts.has_video = false;
- talk_base::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
- talk_base::scoped_ptr<SessionDescription> answer(
+ rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
+ rtc::scoped_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
const AudioContentDescription* acd =
@@ -1515,14 +1515,14 @@
rtx_f2.id = 127;
rtx_f2.name = cricket::kRtxCodecName;
rtx_f2.params[cricket::kCodecParamAssociatedPayloadType] =
- talk_base::ToString<int>(used_pl_type);
+ rtc::ToString<int>(used_pl_type);
f2_codecs.push_back(rtx_f2);
f2_.set_video_codecs(f2_codecs);
- talk_base::scoped_ptr<SessionDescription> updated_offer(
+ rtc::scoped_ptr<SessionDescription> updated_offer(
f2_.CreateOffer(opts, answer.get()));
ASSERT_TRUE(updated_offer);
- talk_base::scoped_ptr<SessionDescription> updated_answer(
+ rtc::scoped_ptr<SessionDescription> updated_answer(
f1_.CreateAnswer(updated_offer.get(), opts, answer.get()));
const AudioContentDescription* updated_acd =
@@ -1537,7 +1537,7 @@
int new_h264_pl_type = updated_vcd->codecs()[0].id;
EXPECT_NE(used_pl_type, new_h264_pl_type);
VideoCodec rtx = updated_vcd->codecs()[1];
- int pt_referenced_by_rtx = talk_base::FromString<int>(
+ int pt_referenced_by_rtx = rtc::FromString<int>(
rtx.params[cricket::kCodecParamAssociatedPayloadType]);
EXPECT_EQ(new_h264_pl_type, pt_referenced_by_rtx);
}
@@ -1562,11 +1562,11 @@
// This creates rtx for H264 with the payload type |f2_| uses.
rtx_f2.SetParam(cricket::kCodecParamAssociatedPayloadType,
- talk_base::ToString<int>(kVideoCodecs2[0].id));
+ rtc::ToString<int>(kVideoCodecs2[0].id));
f2_codecs.push_back(rtx_f2);
f2_.set_video_codecs(f2_codecs);
- talk_base::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
+ rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
ASSERT_TRUE(offer.get() != NULL);
// kCodecParamAssociatedPayloadType will always be added to the offer when RTX
// is selected. Manually remove kCodecParamAssociatedPayloadType so that it
@@ -1585,7 +1585,7 @@
}
desc->set_codecs(codecs);
- talk_base::scoped_ptr<SessionDescription> answer(
+ rtc::scoped_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
const VideoContentDescription* vcd =
@@ -1611,8 +1611,8 @@
f2_.set_audio_rtp_header_extensions(MAKE_VECTOR(kAudioRtpExtension2));
f2_.set_video_rtp_header_extensions(MAKE_VECTOR(kVideoRtpExtension2));
- talk_base::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
- talk_base::scoped_ptr<SessionDescription> answer(
+ rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
+ rtc::scoped_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), opts, NULL));
EXPECT_EQ(MAKE_VECTOR(kAudioRtpExtensionAnswer),
@@ -1622,7 +1622,7 @@
GetFirstVideoContentDescription(
answer.get())->rtp_header_extensions());
- talk_base::scoped_ptr<SessionDescription> updated_offer(
+ rtc::scoped_ptr<SessionDescription> updated_offer(
f2_.CreateOffer(opts, answer.get()));
// The expected RTP header extensions in the new offer are the resulting
@@ -1668,7 +1668,7 @@
vcd->AddLegacyStream(2);
source.AddContent(cricket::CN_VIDEO, cricket::NS_JINGLE_RTP, vcd);
- talk_base::scoped_ptr<SessionDescription> copy(source.Copy());
+ rtc::scoped_ptr<SessionDescription> copy(source.Copy());
ASSERT_TRUE(copy.get() != NULL);
EXPECT_TRUE(copy->HasGroup(cricket::CN_AUDIO));
const ContentInfo* ac = copy->GetContentByName("audio");
@@ -1808,7 +1808,7 @@
tdf1_.set_secure(SEC_DISABLED);
tdf2_.set_secure(SEC_DISABLED);
- talk_base::scoped_ptr<SessionDescription> offer(
+ rtc::scoped_ptr<SessionDescription> offer(
f1_.CreateOffer(MediaSessionOptions(), NULL));
ASSERT_TRUE(offer.get() != NULL);
ContentInfo* offer_content = offer->GetContentByName("audio");
@@ -1817,7 +1817,7 @@
static_cast<AudioContentDescription*>(offer_content->description);
offer_audio_desc->set_protocol(cricket::kMediaProtocolDtlsSavpf);
- talk_base::scoped_ptr<SessionDescription> answer(
+ rtc::scoped_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), MediaSessionOptions(), NULL));
ASSERT_TRUE(answer != NULL);
ContentInfo* answer_content = answer->GetContentByName("audio");
@@ -1834,7 +1834,7 @@
tdf1_.set_secure(SEC_ENABLED);
tdf2_.set_secure(SEC_ENABLED);
- talk_base::scoped_ptr<SessionDescription> offer(
+ rtc::scoped_ptr<SessionDescription> offer(
f1_.CreateOffer(MediaSessionOptions(), NULL));
ASSERT_TRUE(offer.get() != NULL);
ContentInfo* offer_content = offer->GetContentByName("audio");
@@ -1843,7 +1843,7 @@
static_cast<AudioContentDescription*>(offer_content->description);
offer_audio_desc->set_protocol(cricket::kMediaProtocolDtlsSavpf);
- talk_base::scoped_ptr<SessionDescription> answer(
+ rtc::scoped_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), MediaSessionOptions(), NULL));
ASSERT_TRUE(answer != NULL);
@@ -1867,7 +1867,7 @@
MediaSessionOptions options;
options.has_audio = true;
options.has_video = true;
- talk_base::scoped_ptr<SessionDescription> offer, answer;
+ rtc::scoped_ptr<SessionDescription> offer, answer;
const cricket::MediaContentDescription* audio_media_desc;
const cricket::MediaContentDescription* video_media_desc;
const cricket::TransportDescription* audio_trans_desc;
@@ -1968,10 +1968,10 @@
f2_.set_secure(SEC_REQUIRED);
tdf1_.set_secure(SEC_ENABLED);
- talk_base::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(options,
+ rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(options,
NULL));
ASSERT_TRUE(offer.get() != NULL);
- talk_base::scoped_ptr<SessionDescription> answer(
+ rtc::scoped_ptr<SessionDescription> answer(
f2_.CreateAnswer(offer.get(), options, NULL));
EXPECT_TRUE(answer.get() == NULL);
}
@@ -1988,7 +1988,7 @@
options.has_video = true;
options.data_channel_type = cricket::DCT_RTP;
- talk_base::scoped_ptr<SessionDescription> offer, answer;
+ rtc::scoped_ptr<SessionDescription> offer, answer;
// Generate an offer with DTLS but without SDES.
offer.reset(f1_.CreateOffer(options, NULL));
@@ -2035,7 +2035,7 @@
MediaSessionOptions options;
options.has_audio = true;
options.has_video = true;
- talk_base::scoped_ptr<SessionDescription> offer(
+ rtc::scoped_ptr<SessionDescription> offer(
f1_.CreateOffer(options, NULL));
ASSERT_TRUE(offer.get() != NULL);
const ContentInfo* audio_content = offer->GetContentByName("audio");
@@ -2046,7 +2046,7 @@
ASSERT_TRUE(offer.get() != NULL);
audio_content = offer->GetContentByName("audio");
EXPECT_TRUE(VerifyNoCNCodecs(audio_content));
- talk_base::scoped_ptr<SessionDescription> answer(
+ rtc::scoped_ptr<SessionDescription> answer(
f1_.CreateAnswer(offer.get(), options, NULL));
ASSERT_TRUE(answer.get() != NULL);
audio_content = answer->GetContentByName("audio");
diff --git a/session/media/mediasessionclient.cc b/session/media/mediasessionclient.cc
index 2ada987..8847c37 100644
--- a/session/media/mediasessionclient.cc
+++ b/session/media/mediasessionclient.cc
@@ -29,10 +29,10 @@
#include "talk/session/media/mediasessionclient.h"
-#include "talk/base/helpers.h"
-#include "talk/base/logging.h"
-#include "talk/base/stringencode.h"
-#include "talk/base/stringutils.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/stringencode.h"
+#include "webrtc/base/stringutils.h"
#include "talk/media/base/cryptoparams.h"
#include "talk/media/base/capturemanager.h"
#include "talk/media/sctp/sctpdataengine.h"
@@ -283,7 +283,7 @@
ParseError* error) {
if (!ssrc_str.empty()) {
uint32 ssrc;
- if (!talk_base::FromString(ssrc_str, &ssrc)) {
+ if (!rtc::FromString(ssrc_str, &ssrc)) {
return BadParse("Missing or invalid ssrc.", error);
}
@@ -361,7 +361,7 @@
MediaContentDescription* media) {
const buzz::XmlElement* bw_elem = GetXmlChild(parent_elem, LN_BANDWIDTH);
int bandwidth_kbps = -1;
- if (bw_elem && talk_base::FromString(bw_elem->BodyText(), &bandwidth_kbps)) {
+ if (bw_elem && rtc::FromString(bw_elem->BodyText(), &bandwidth_kbps)) {
if (bandwidth_kbps >= 0) {
media->set_bandwidth(bandwidth_kbps * 1000);
}
@@ -569,7 +569,7 @@
bool ParseJingleAudioContent(const buzz::XmlElement* content_elem,
ContentDescription** content,
ParseError* error) {
- talk_base::scoped_ptr<AudioContentDescription> audio(
+ rtc::scoped_ptr<AudioContentDescription> audio(
new AudioContentDescription());
FeedbackParams content_feedback_params;
@@ -611,7 +611,7 @@
bool ParseJingleVideoContent(const buzz::XmlElement* content_elem,
ContentDescription** content,
ParseError* error) {
- talk_base::scoped_ptr<VideoContentDescription> video(
+ rtc::scoped_ptr<VideoContentDescription> video(
new VideoContentDescription());
FeedbackParams content_feedback_params;
@@ -654,7 +654,7 @@
bool ParseJingleSctpDataContent(const buzz::XmlElement* content_elem,
ContentDescription** content,
ParseError* error) {
- talk_base::scoped_ptr<DataContentDescription> data(
+ rtc::scoped_ptr<DataContentDescription> data(
new DataContentDescription());
data->set_protocol(kMediaProtocolSctp);
@@ -666,7 +666,7 @@
stream.groupid = stream_elem->Attr(QN_NICK);
stream.id = stream_elem->Attr(QN_NAME);
uint32 sid;
- if (!talk_base::FromString(stream_elem->Attr(QN_SID), &sid)) {
+ if (!rtc::FromString(stream_elem->Attr(QN_SID), &sid)) {
return BadParse("Missing or invalid sid.", error);
}
if (sid > kMaxSctpSid) {
@@ -1152,7 +1152,7 @@
}
} else {
return BadWrite("Unknown content type: " +
- talk_base::ToString<int>(media->type()), error);
+ rtc::ToString<int>(media->type()), error);
}
return true;
diff --git a/session/media/mediasessionclient.h b/session/media/mediasessionclient.h
index d0034ca..33750fc 100644
--- a/session/media/mediasessionclient.h
+++ b/session/media/mediasessionclient.h
@@ -32,10 +32,10 @@
#include <vector>
#include <map>
#include <algorithm>
-#include "talk/base/messagequeue.h"
-#include "talk/base/sigslot.h"
-#include "talk/base/sigslotrepeater.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/messagequeue.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/sigslotrepeater.h"
+#include "webrtc/base/thread.h"
#include "talk/media/base/cryptoparams.h"
#include "talk/p2p/base/session.h"
#include "talk/p2p/base/sessionclient.h"
diff --git a/session/media/mediasessionclient_unittest.cc b/session/media/mediasessionclient_unittest.cc
index 3f3c4fa..98299d0 100644
--- a/session/media/mediasessionclient_unittest.cc
+++ b/session/media/mediasessionclient_unittest.cc
@@ -28,9 +28,9 @@
#include <string>
#include <vector>
-#include "talk/base/gunit.h"
-#include "talk/base/logging.h"
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/media/base/fakemediaengine.h"
#include "talk/media/base/testutils.h"
#include "talk/media/devices/fakedevicemanager.h"
@@ -1333,7 +1333,7 @@
}
private:
- talk_base::scoped_ptr<buzz::XmlElement> action_;
+ rtc::scoped_ptr<buzz::XmlElement> action_;
};
class GingleSessionTestParser : public MediaSessionTestParser {
@@ -1459,7 +1459,7 @@
public:
explicit MediaSessionClientTest(MediaSessionTestParser* parser,
cricket::SignalingProtocol initial_protocol) {
- nm_ = new talk_base::BasicNetworkManager();
+ nm_ = new rtc::BasicNetworkManager();
pa_ = new cricket::BasicPortAllocator(nm_);
sm_ = new cricket::SessionManager(pa_, NULL);
fme_ = new cricket::FakeMediaEngine();
@@ -1714,7 +1714,7 @@
buzz::XmlElement** element) {
*element = NULL;
- talk_base::scoped_ptr<buzz::XmlElement> el(
+ rtc::scoped_ptr<buzz::XmlElement> el(
buzz::XmlElement::ForStr(initiate_string));
client_->session_manager()->OnIncomingMessage(el.get());
ASSERT_TRUE(call_ != NULL);
@@ -1778,7 +1778,7 @@
buzz::XmlElement** element) {
*element = NULL;
- talk_base::scoped_ptr<buzz::XmlElement> el(
+ rtc::scoped_ptr<buzz::XmlElement> el(
buzz::XmlElement::ForStr(initiate_string));
client_->session_manager()->OnIncomingMessage(el.get());
ASSERT_TRUE(call_ != NULL);
@@ -1842,7 +1842,7 @@
}
void TestBadIncomingInitiate(const std::string& initiate_string) {
- talk_base::scoped_ptr<buzz::XmlElement> el(
+ rtc::scoped_ptr<buzz::XmlElement> el(
buzz::XmlElement::ForStr(initiate_string));
client_->session_manager()->OnIncomingMessage(el.get());
ASSERT_TRUE(call_ != NULL);
@@ -2034,7 +2034,7 @@
} else {
ASSERT_TRUE(bandwidth != NULL);
ASSERT_EQ("AS", bandwidth->Attr(buzz::QName("", "type")));
- ASSERT_EQ(talk_base::ToString(options.video_bandwidth / 1000),
+ ASSERT_EQ(rtc::ToString(options.video_bandwidth / 1000),
bandwidth->BodyText());
}
@@ -2346,7 +2346,7 @@
buzz::XmlElement** element) {
*element = NULL;
- talk_base::scoped_ptr<buzz::XmlElement> el(
+ rtc::scoped_ptr<buzz::XmlElement> el(
buzz::XmlElement::ForStr(initiate_string));
client_->session_manager()->OnIncomingMessage(el.get());
@@ -2393,7 +2393,7 @@
ClearStanzas();
// We need to insert the session ID into the session accept message.
- talk_base::scoped_ptr<buzz::XmlElement> el(
+ rtc::scoped_ptr<buzz::XmlElement> el(
buzz::XmlElement::ForStr(accept_string));
const std::string sid = call_->sessions()[0]->id();
if (initial_protocol_ == cricket::PROTOCOL_JINGLE) {
@@ -2451,12 +2451,12 @@
cricket::StreamParams stream;
stream.id = "test-stream";
stream.ssrcs.push_back(1001);
- talk_base::scoped_ptr<buzz::XmlElement> expected_stream_add(
+ rtc::scoped_ptr<buzz::XmlElement> expected_stream_add(
buzz::XmlElement::ForStr(
JingleOutboundStreamAdd(
call_->sessions()[0]->id(),
"video", stream.id, "1001")));
- talk_base::scoped_ptr<buzz::XmlElement> expected_stream_remove(
+ rtc::scoped_ptr<buzz::XmlElement> expected_stream_remove(
buzz::XmlElement::ForStr(
JingleOutboundStreamRemove(
call_->sessions()[0]->id(),
@@ -2489,7 +2489,7 @@
ASSERT_EQ(0U, last_streams_removed_.audio().size());
ASSERT_EQ(0U, last_streams_removed_.video().size());
- talk_base::scoped_ptr<buzz::XmlElement> accept_stanza(
+ rtc::scoped_ptr<buzz::XmlElement> accept_stanza(
buzz::XmlElement::ForStr(kJingleAcceptWithSsrcs));
SetJingleSid(accept_stanza.get());
client_->session_manager()->OnIncomingMessage(accept_stanza.get());
@@ -2505,7 +2505,7 @@
call_->sessions()[0]->SetState(cricket::Session::STATE_INPROGRESS);
- talk_base::scoped_ptr<buzz::XmlElement> streams_stanza(
+ rtc::scoped_ptr<buzz::XmlElement> streams_stanza(
buzz::XmlElement::ForStr(
JingleStreamAdd("video", "Bob", "video1", "ABC")));
SetJingleSid(streams_stanza.get());
@@ -2593,7 +2593,7 @@
cricket::StaticVideoView staticVideoView(
cricket::StreamSelector(5678U), 640, 480, 30);
viewRequest.static_video_views.push_back(staticVideoView);
- talk_base::scoped_ptr<buzz::XmlElement> expected_view_elem(
+ rtc::scoped_ptr<buzz::XmlElement> expected_view_elem(
buzz::XmlElement::ForStr(JingleView("5678", "640", "480", "30")));
SetJingleSid(expected_view_elem.get());
@@ -2731,7 +2731,7 @@
last_streams_removed_.CopyFrom(removed);
}
- talk_base::NetworkManager* nm_;
+ rtc::NetworkManager* nm_;
cricket::PortAllocator* pa_;
cricket::SessionManager* sm_;
cricket::FakeMediaEngine* fme_;
@@ -2764,8 +2764,8 @@
}
TEST(MediaSessionTest, JingleGoodInitiateWithRtcpFb) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
- talk_base::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
cricket::CallOptions options = VideoCallOptions();
options.data_channel_type = cricket::DCT_SCTP;
@@ -2775,32 +2775,32 @@
}
TEST(MediaSessionTest, JingleGoodVideoInitiate) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
- talk_base::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
test->TestGoodIncomingInitiate(
kJingleVideoInitiate, VideoCallOptions(), elem.use());
test->TestCodecsOfVideoInitiate(elem.get());
}
TEST(MediaSessionTest, JingleGoodVideoInitiateWithBandwidth) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
- talk_base::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
test->ExpectVideoBandwidth(42000);
test->TestGoodIncomingInitiate(
kJingleVideoInitiateWithBandwidth, VideoCallOptions(), elem.use());
}
TEST(MediaSessionTest, JingleGoodVideoInitiateWithRtcpMux) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
- talk_base::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
test->ExpectVideoRtcpMux(true);
test->TestGoodIncomingInitiate(
kJingleVideoInitiateWithRtcpMux, VideoCallOptions(), elem.use());
}
TEST(MediaSessionTest, JingleGoodVideoInitiateWithRtpData) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
- talk_base::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
cricket::CallOptions options = VideoCallOptions();
options.data_channel_type = cricket::DCT_RTP;
test->TestGoodIncomingInitiate(
@@ -2810,8 +2810,8 @@
}
TEST(MediaSessionTest, JingleGoodVideoInitiateWithSctpData) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
- talk_base::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
cricket::CallOptions options = VideoCallOptions();
options.data_channel_type = cricket::DCT_SCTP;
test->TestGoodIncomingInitiate(kJingleVideoInitiateWithSctpData,
@@ -2820,8 +2820,8 @@
}
TEST(MediaSessionTest, JingleRejectAudio) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
- talk_base::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
cricket::CallOptions options = VideoCallOptions();
options.has_audio = false;
options.data_channel_type = cricket::DCT_RTP;
@@ -2829,30 +2829,30 @@
}
TEST(MediaSessionTest, JingleRejectVideo) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
- talk_base::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
cricket::CallOptions options = AudioCallOptions();
options.data_channel_type = cricket::DCT_RTP;
test->TestRejectOffer(kJingleVideoInitiateWithRtpData, options, elem.use());
}
TEST(MediaSessionTest, JingleRejectData) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
- talk_base::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
test->TestRejectOffer(
kJingleVideoInitiateWithRtpData, VideoCallOptions(), elem.use());
}
TEST(MediaSessionTest, JingleRejectVideoAndData) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
- talk_base::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
test->TestRejectOffer(
kJingleVideoInitiateWithRtpData, AudioCallOptions(), elem.use());
}
TEST(MediaSessionTest, JingleGoodInitiateAllSupportedAudioCodecs) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
- talk_base::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
test->TestGoodIncomingInitiate(
kJingleInitiate, AudioCallOptions(), elem.use());
test->TestHasAllSupportedAudioCodecs(elem.get());
@@ -2862,89 +2862,89 @@
// preference order than the incoming offer.
// Verifies the answer accepts the preference order of the remote peer.
TEST(MediaSessionTest, JingleGoodInitiateDifferentPreferenceAudioCodecs) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
test->fme()->SetAudioCodecs(MAKE_VECTOR(kAudioCodecsDifferentPreference));
- talk_base::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<buzz::XmlElement> elem;
test->TestGoodIncomingInitiate(
kJingleInitiate, AudioCallOptions(), elem.use());
test->TestHasAllSupportedAudioCodecs(elem.get());
}
TEST(MediaSessionTest, JingleGoodInitiateSomeUnsupportedAudioCodecs) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
- talk_base::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
test->TestGoodIncomingInitiate(
kJingleInitiateSomeUnsupported, AudioCallOptions(), elem.use());
test->TestHasAudioCodecsFromInitiateSomeUnsupported(elem.get());
}
TEST(MediaSessionTest, JingleGoodInitiateDynamicAudioCodecs) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
- talk_base::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
test->TestGoodIncomingInitiate(
kJingleInitiateDynamicAudioCodecs, AudioCallOptions(), elem.use());
test->TestHasAudioCodecsFromInitiateDynamicAudioCodecs(elem.get());
}
TEST(MediaSessionTest, JingleGoodInitiateStaticAudioCodecs) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
- talk_base::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
test->TestGoodIncomingInitiate(
kJingleInitiateStaticAudioCodecs, AudioCallOptions(), elem.use());
test->TestHasAudioCodecsFromInitiateStaticAudioCodecs(elem.get());
}
TEST(MediaSessionTest, JingleBadInitiateNoAudioCodecs) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
test->TestBadIncomingInitiate(kJingleInitiateNoAudioCodecs);
}
TEST(MediaSessionTest, JingleBadInitiateNoSupportedAudioCodecs) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
test->TestBadIncomingInitiate(kJingleInitiateNoSupportedAudioCodecs);
}
TEST(MediaSessionTest, JingleBadInitiateWrongClockrates) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
test->TestBadIncomingInitiate(kJingleInitiateWrongClockrates);
}
TEST(MediaSessionTest, JingleBadInitiateWrongChannels) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
test->TestBadIncomingInitiate(kJingleInitiateWrongChannels);
}
TEST(MediaSessionTest, JingleBadInitiateNoPayloadTypes) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
test->TestBadIncomingInitiate(kJingleInitiateNoPayloadTypes);
}
TEST(MediaSessionTest, JingleBadInitiateDynamicWithoutNames) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
test->TestBadIncomingInitiate(kJingleInitiateDynamicWithoutNames);
}
TEST(MediaSessionTest, JingleGoodOutgoingInitiate) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
test->TestGoodOutgoingInitiate(AudioCallOptions());
}
TEST(MediaSessionTest, JingleGoodOutgoingInitiateWithBandwidth) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
cricket::CallOptions options = VideoCallOptions();
options.video_bandwidth = 42000;
test->TestGoodOutgoingInitiate(options);
}
TEST(MediaSessionTest, JingleGoodOutgoingInitiateWithRtcpMux) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
cricket::CallOptions options = VideoCallOptions();
options.rtcp_mux_enabled = true;
test->TestGoodOutgoingInitiate(options);
}
TEST(MediaSessionTest, JingleGoodOutgoingInitiateWithRtpData) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
cricket::CallOptions options;
options.data_channel_type = cricket::DCT_RTP;
test->ExpectCrypto(cricket::SEC_ENABLED);
@@ -2952,7 +2952,7 @@
}
TEST(MediaSessionTest, JingleGoodOutgoingInitiateWithSctpData) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
cricket::CallOptions options;
options.data_channel_type = cricket::DCT_SCTP;
test->TestGoodOutgoingInitiate(options);
@@ -2962,8 +2962,8 @@
// Offer has crypto but the session is not secured, just ignore it.
TEST(MediaSessionTest, JingleInitiateWithCryptoIsIgnoredWhenNotSecured) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
- talk_base::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
test->TestGoodIncomingInitiate(
AddEncryption(kJingleVideoInitiate, kJingleCryptoOffer),
VideoCallOptions(),
@@ -2972,22 +2972,22 @@
// Offer has crypto required but the session is not secure, fail.
TEST(MediaSessionTest, JingleInitiateWithCryptoRequiredWhenNotSecured) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
test->TestBadIncomingInitiate(AddEncryption(kJingleVideoInitiate,
kJingleRequiredCryptoOffer));
}
// Offer has no crypto but the session is secure required, fail.
TEST(MediaSessionTest, JingleInitiateWithNoCryptoFailsWhenSecureRequired) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
test->ExpectCrypto(cricket::SEC_REQUIRED);
test->TestBadIncomingInitiate(kJingleInitiate);
}
// Offer has crypto and session is secure, expect crypto in the answer.
TEST(MediaSessionTest, JingleInitiateWithCryptoWhenSecureEnabled) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
- talk_base::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
test->ExpectCrypto(cricket::SEC_ENABLED);
test->TestGoodIncomingInitiate(
AddEncryption(kJingleVideoInitiate, kJingleCryptoOffer),
@@ -2998,8 +2998,8 @@
// Offer has crypto and session is secure required, expect crypto in
// the answer.
TEST(MediaSessionTest, JingleInitiateWithCryptoWhenSecureRequired) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
- talk_base::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
test->ExpectCrypto(cricket::SEC_REQUIRED);
test->TestGoodIncomingInitiate(
AddEncryption(kJingleVideoInitiate, kJingleCryptoOffer),
@@ -3010,8 +3010,8 @@
// Offer has unsupported crypto and session is secure, no crypto in
// the answer.
TEST(MediaSessionTest, JingleInitiateWithUnsupportedCrypto) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
- talk_base::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
test->MakeSignalingSecure(cricket::SEC_ENABLED);
test->TestGoodIncomingInitiate(
AddEncryption(kJingleInitiate, kJingleUnsupportedCryptoOffer),
@@ -3021,14 +3021,14 @@
// Offer has unsupported REQUIRED crypto and session is not secure, fail.
TEST(MediaSessionTest, JingleInitiateWithRequiredUnsupportedCrypto) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
test->TestBadIncomingInitiate(
AddEncryption(kJingleInitiate, kJingleRequiredUnsupportedCryptoOffer));
}
// Offer has unsupported REQUIRED crypto and session is secure, fail.
TEST(MediaSessionTest, JingleInitiateWithRequiredUnsupportedCryptoWhenSecure) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
test->MakeSignalingSecure(cricket::SEC_ENABLED);
test->TestBadIncomingInitiate(
AddEncryption(kJingleInitiate, kJingleRequiredUnsupportedCryptoOffer));
@@ -3037,7 +3037,7 @@
// Offer has unsupported REQUIRED crypto and session is required secure, fail.
TEST(MediaSessionTest,
JingleInitiateWithRequiredUnsupportedCryptoWhenSecureRequired) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
test->MakeSignalingSecure(cricket::SEC_REQUIRED);
test->TestBadIncomingInitiate(
AddEncryption(kJingleInitiate, kJingleRequiredUnsupportedCryptoOffer));
@@ -3045,26 +3045,26 @@
TEST(MediaSessionTest, JingleGoodOutgoingInitiateWithCrypto) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
test->ExpectCrypto(cricket::SEC_ENABLED);
test->TestGoodOutgoingInitiate(AudioCallOptions());
}
TEST(MediaSessionTest, JingleGoodOutgoingInitiateWithCryptoRequired) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
test->ExpectCrypto(cricket::SEC_REQUIRED);
test->TestGoodOutgoingInitiate(AudioCallOptions());
}
TEST(MediaSessionTest, JingleIncomingAcceptWithSsrcs) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
cricket::CallOptions options = VideoCallOptions();
options.is_muc = true;
test->TestIncomingAcceptWithSsrcs(kJingleAcceptWithSsrcs, options);
}
TEST(MediaSessionTest, JingleIncomingAcceptWithRtpDataSsrcs) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
cricket::CallOptions options = VideoCallOptions();
options.is_muc = true;
options.data_channel_type = cricket::DCT_RTP;
@@ -3072,7 +3072,7 @@
}
TEST(MediaSessionTest, JingleIncomingAcceptWithSctpData) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
cricket::CallOptions options = VideoCallOptions();
options.is_muc = true;
options.data_channel_type = cricket::DCT_SCTP;
@@ -3080,44 +3080,44 @@
}
TEST(MediaSessionTest, JingleStreamsUpdateAndView) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
test->TestStreamsUpdateAndViewRequests();
}
TEST(MediaSessionTest, JingleSendVideoStreamUpdate) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(JingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(JingleTest());
test->TestSendVideoStreamUpdate();
}
// Gingle tests
TEST(MediaSessionTest, GingleGoodVideoInitiate) {
- talk_base::scoped_ptr<buzz::XmlElement> elem;
- talk_base::scoped_ptr<MediaSessionClientTest> test(GingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(GingleTest());
test->TestGoodIncomingInitiate(
kGingleVideoInitiate, VideoCallOptions(), elem.use());
test->TestCodecsOfVideoInitiate(elem.get());
}
TEST(MediaSessionTest, GingleGoodVideoInitiateWithBandwidth) {
- talk_base::scoped_ptr<buzz::XmlElement> elem;
- talk_base::scoped_ptr<MediaSessionClientTest> test(GingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(GingleTest());
test->ExpectVideoBandwidth(42000);
test->TestGoodIncomingInitiate(
kGingleVideoInitiateWithBandwidth, VideoCallOptions(), elem.use());
}
TEST(MediaSessionTest, GingleGoodInitiateAllSupportedAudioCodecs) {
- talk_base::scoped_ptr<buzz::XmlElement> elem;
- talk_base::scoped_ptr<MediaSessionClientTest> test(GingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(GingleTest());
test->TestGoodIncomingInitiate(
kGingleInitiate, AudioCallOptions(), elem.use());
test->TestHasAllSupportedAudioCodecs(elem.get());
}
TEST(MediaSessionTest, GingleGoodInitiateAllSupportedAudioCodecsWithCrypto) {
- talk_base::scoped_ptr<buzz::XmlElement> elem;
- talk_base::scoped_ptr<MediaSessionClientTest> test(GingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(GingleTest());
test->ExpectCrypto(cricket::SEC_ENABLED);
test->TestGoodIncomingInitiate(
AddEncryption(kGingleInitiate, kGingleCryptoOffer),
@@ -3130,79 +3130,79 @@
// preference order than the incoming offer.
// Verifies the answer accepts the preference order of the remote peer.
TEST(MediaSessionTest, GingleGoodInitiateDifferentPreferenceAudioCodecs) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(GingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(GingleTest());
test->fme()->SetAudioCodecs(MAKE_VECTOR(kAudioCodecsDifferentPreference));
- talk_base::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<buzz::XmlElement> elem;
test->TestGoodIncomingInitiate(
kGingleInitiate, AudioCallOptions(), elem.use());
test->TestHasAllSupportedAudioCodecs(elem.get());
}
TEST(MediaSessionTest, GingleGoodInitiateSomeUnsupportedAudioCodecs) {
- talk_base::scoped_ptr<buzz::XmlElement> elem;
- talk_base::scoped_ptr<MediaSessionClientTest> test(GingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(GingleTest());
test->TestGoodIncomingInitiate(
kGingleInitiateSomeUnsupported, AudioCallOptions(), elem.use());
test->TestHasAudioCodecsFromInitiateSomeUnsupported(elem.get());
}
TEST(MediaSessionTest, GingleGoodInitiateDynamicAudioCodecs) {
- talk_base::scoped_ptr<buzz::XmlElement> elem;
- talk_base::scoped_ptr<MediaSessionClientTest> test(GingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(GingleTest());
test->TestGoodIncomingInitiate(
kGingleInitiateDynamicAudioCodecs, AudioCallOptions(), elem.use());
test->TestHasAudioCodecsFromInitiateDynamicAudioCodecs(elem.get());
}
TEST(MediaSessionTest, GingleGoodInitiateStaticAudioCodecs) {
- talk_base::scoped_ptr<buzz::XmlElement> elem;
- talk_base::scoped_ptr<MediaSessionClientTest> test(GingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(GingleTest());
test->TestGoodIncomingInitiate(
kGingleInitiateStaticAudioCodecs, AudioCallOptions(), elem.use());
test->TestHasAudioCodecsFromInitiateStaticAudioCodecs(elem.get());
}
TEST(MediaSessionTest, GingleGoodInitiateNoAudioCodecs) {
- talk_base::scoped_ptr<buzz::XmlElement> elem;
- talk_base::scoped_ptr<MediaSessionClientTest> test(GingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(GingleTest());
test->TestGoodIncomingInitiate(
kGingleInitiateNoAudioCodecs, AudioCallOptions(), elem.use());
test->TestHasDefaultAudioCodecs(elem.get());
}
TEST(MediaSessionTest, GingleBadInitiateNoSupportedAudioCodecs) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(GingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(GingleTest());
test->TestBadIncomingInitiate(kGingleInitiateNoSupportedAudioCodecs);
}
TEST(MediaSessionTest, GingleBadInitiateWrongClockrates) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(GingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(GingleTest());
test->TestBadIncomingInitiate(kGingleInitiateWrongClockrates);
}
TEST(MediaSessionTest, GingleBadInitiateWrongChannels) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(GingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(GingleTest());
test->TestBadIncomingInitiate(kGingleInitiateWrongChannels);
}
TEST(MediaSessionTest, GingleBadInitiateNoPayloadTypes) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(GingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(GingleTest());
test->TestBadIncomingInitiate(kGingleInitiateNoPayloadTypes);
}
TEST(MediaSessionTest, GingleBadInitiateDynamicWithoutNames) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(GingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(GingleTest());
test->TestBadIncomingInitiate(kGingleInitiateDynamicWithoutNames);
}
TEST(MediaSessionTest, GingleGoodOutgoingInitiate) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(GingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(GingleTest());
test->TestGoodOutgoingInitiate(AudioCallOptions());
}
TEST(MediaSessionTest, GingleGoodOutgoingInitiateWithBandwidth) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(GingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(GingleTest());
cricket::CallOptions options = VideoCallOptions();
options.video_bandwidth = 42000;
test->TestGoodOutgoingInitiate(options);
@@ -3212,8 +3212,8 @@
// Offer has crypto but the session is not secured, just ignore it.
TEST(MediaSessionTest, GingleInitiateWithCryptoIsIgnoredWhenNotSecured) {
- talk_base::scoped_ptr<buzz::XmlElement> elem;
- talk_base::scoped_ptr<MediaSessionClientTest> test(GingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(GingleTest());
test->TestGoodIncomingInitiate(
AddEncryption(kGingleInitiate, kGingleCryptoOffer),
VideoCallOptions(),
@@ -3222,22 +3222,22 @@
// Offer has crypto required but the session is not secure, fail.
TEST(MediaSessionTest, GingleInitiateWithCryptoRequiredWhenNotSecured) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(GingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(GingleTest());
test->TestBadIncomingInitiate(AddEncryption(kGingleInitiate,
kGingleRequiredCryptoOffer));
}
// Offer has no crypto but the session is secure required, fail.
TEST(MediaSessionTest, GingleInitiateWithNoCryptoFailsWhenSecureRequired) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(GingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(GingleTest());
test->ExpectCrypto(cricket::SEC_REQUIRED);
test->TestBadIncomingInitiate(kGingleInitiate);
}
// Offer has crypto and session is secure, expect crypto in the answer.
TEST(MediaSessionTest, GingleInitiateWithCryptoWhenSecureEnabled) {
- talk_base::scoped_ptr<buzz::XmlElement> elem;
- talk_base::scoped_ptr<MediaSessionClientTest> test(GingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(GingleTest());
test->ExpectCrypto(cricket::SEC_ENABLED);
test->TestGoodIncomingInitiate(
AddEncryption(kGingleInitiate, kGingleCryptoOffer),
@@ -3248,8 +3248,8 @@
// Offer has crypto and session is secure required, expect crypto in
// the answer.
TEST(MediaSessionTest, GingleInitiateWithCryptoWhenSecureRequired) {
- talk_base::scoped_ptr<buzz::XmlElement> elem;
- talk_base::scoped_ptr<MediaSessionClientTest> test(GingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(GingleTest());
test->ExpectCrypto(cricket::SEC_REQUIRED);
test->TestGoodIncomingInitiate(
AddEncryption(kGingleInitiate, kGingleCryptoOffer),
@@ -3260,8 +3260,8 @@
// Offer has unsupported crypto and session is secure, no crypto in
// the answer.
TEST(MediaSessionTest, GingleInitiateWithUnsupportedCrypto) {
- talk_base::scoped_ptr<buzz::XmlElement> elem;
- talk_base::scoped_ptr<MediaSessionClientTest> test(GingleTest());
+ rtc::scoped_ptr<buzz::XmlElement> elem;
+ rtc::scoped_ptr<MediaSessionClientTest> test(GingleTest());
test->MakeSignalingSecure(cricket::SEC_ENABLED);
test->TestGoodIncomingInitiate(
AddEncryption(kGingleInitiate, kGingleUnsupportedCryptoOffer),
@@ -3271,14 +3271,14 @@
// Offer has unsupported REQUIRED crypto and session is not secure, fail.
TEST(MediaSessionTest, GingleInitiateWithRequiredUnsupportedCrypto) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(GingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(GingleTest());
test->TestBadIncomingInitiate(
AddEncryption(kGingleInitiate, kGingleRequiredUnsupportedCryptoOffer));
}
// Offer has unsupported REQUIRED crypto and session is secure, fail.
TEST(MediaSessionTest, GingleInitiateWithRequiredUnsupportedCryptoWhenSecure) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(GingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(GingleTest());
test->MakeSignalingSecure(cricket::SEC_ENABLED);
test->TestBadIncomingInitiate(
AddEncryption(kGingleInitiate, kGingleRequiredUnsupportedCryptoOffer));
@@ -3287,33 +3287,33 @@
// Offer has unsupported REQUIRED crypto and session is required secure, fail.
TEST(MediaSessionTest,
GingleInitiateWithRequiredUnsupportedCryptoWhenSecureRequired) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(GingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(GingleTest());
test->MakeSignalingSecure(cricket::SEC_REQUIRED);
test->TestBadIncomingInitiate(
AddEncryption(kGingleInitiate, kGingleRequiredUnsupportedCryptoOffer));
}
TEST(MediaSessionTest, GingleGoodOutgoingInitiateWithCrypto) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(GingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(GingleTest());
test->ExpectCrypto(cricket::SEC_ENABLED);
test->TestGoodOutgoingInitiate(AudioCallOptions());
}
TEST(MediaSessionTest, GingleGoodOutgoingInitiateWithCryptoRequired) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(GingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(GingleTest());
test->ExpectCrypto(cricket::SEC_REQUIRED);
test->TestGoodOutgoingInitiate(AudioCallOptions());
}
TEST(MediaSessionTest, GingleIncomingAcceptWithSsrcs) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(GingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(GingleTest());
cricket::CallOptions options = VideoCallOptions();
options.is_muc = true;
test->TestIncomingAcceptWithSsrcs(kGingleAcceptWithSsrcs, options);
}
TEST(MediaSessionTest, GingleGoodOutgoingInitiateWithRtpData) {
- talk_base::scoped_ptr<MediaSessionClientTest> test(GingleTest());
+ rtc::scoped_ptr<MediaSessionClientTest> test(GingleTest());
cricket::CallOptions options;
options.data_channel_type = cricket::DCT_RTP;
test->ExpectCrypto(cricket::SEC_ENABLED);
diff --git a/session/media/planarfunctions_unittest.cc b/session/media/planarfunctions_unittest.cc
index 32cacf9..3eeb64f 100644
--- a/session/media/planarfunctions_unittest.cc
+++ b/session/media/planarfunctions_unittest.cc
@@ -31,9 +31,9 @@
#include "libyuv/format_conversion.h"
#include "libyuv/mjpeg_decoder.h"
#include "libyuv/planar_functions.h"
-#include "talk/base/flags.h"
-#include "talk/base/gunit.h"
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/flags.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/media/base/testutils.h"
#include "talk/media/base/videocommon.h"
@@ -512,12 +512,12 @@
int repeat_;
// Y, U, V and R, G, B channels of testing colors.
- talk_base::scoped_ptr<uint8[]> testing_color_y_;
- talk_base::scoped_ptr<uint8[]> testing_color_u_;
- talk_base::scoped_ptr<uint8[]> testing_color_v_;
- talk_base::scoped_ptr<uint8[]> testing_color_r_;
- talk_base::scoped_ptr<uint8[]> testing_color_g_;
- talk_base::scoped_ptr<uint8[]> testing_color_b_;
+ rtc::scoped_ptr<uint8[]> testing_color_y_;
+ rtc::scoped_ptr<uint8[]> testing_color_u_;
+ rtc::scoped_ptr<uint8[]> testing_color_v_;
+ rtc::scoped_ptr<uint8[]> testing_color_r_;
+ rtc::scoped_ptr<uint8[]> testing_color_g_;
+ rtc::scoped_ptr<uint8[]> testing_color_b_;
};
TEST_F(PlanarFunctionsTest, I420Copy) {
@@ -529,12 +529,12 @@
int uv_size = ((kHeight + 1) >> 1) * ((kWidth + 1) >> 1);
int block_size = 3;
// Generate a fake input image.
- talk_base::scoped_ptr<uint8[]> yuv_input(
+ rtc::scoped_ptr<uint8[]> yuv_input(
CreateFakeYuvTestingImage(kHeight, kWidth, block_size,
libyuv::kJpegYuv420,
y_pointer, u_pointer, v_pointer));
// Allocate space for the output image.
- talk_base::scoped_ptr<uint8[]> yuv_output(
+ rtc::scoped_ptr<uint8[]> yuv_output(
new uint8[I420_SIZE(kHeight, kWidth) + kAlignment]);
uint8 *y_output_pointer = ALIGNP(yuv_output.get(), kAlignment);
uint8 *u_output_pointer = y_output_pointer + y_size;
@@ -566,12 +566,12 @@
int uv_size = ((kHeight + 1) >> 1) * ((kWidth + 1) >> 1);
int block_size = 2;
// Generate a fake input image.
- talk_base::scoped_ptr<uint8[]> yuv_input(
+ rtc::scoped_ptr<uint8[]> yuv_input(
CreateFakeYuvTestingImage(kHeight, kWidth, block_size,
libyuv::kJpegYuv422,
y_pointer, u_pointer, v_pointer));
// Allocate space for the output image.
- talk_base::scoped_ptr<uint8[]> yuv_output(
+ rtc::scoped_ptr<uint8[]> yuv_output(
new uint8[I420_SIZE(kHeight, kWidth) + kAlignment]);
uint8 *y_output_pointer = ALIGNP(yuv_output.get(), kAlignment);
uint8 *u_output_pointer = y_output_pointer + y_size;
@@ -579,7 +579,7 @@
// Generate the expected output.
uint8 *y_expected_pointer = NULL, *u_expected_pointer = NULL,
*v_expected_pointer = NULL;
- talk_base::scoped_ptr<uint8[]> yuv_output_expected(
+ rtc::scoped_ptr<uint8[]> yuv_output_expected(
CreateFakeYuvTestingImage(kHeight, kWidth, block_size,
libyuv::kJpegYuv420,
y_expected_pointer, u_expected_pointer, v_expected_pointer));
@@ -615,11 +615,11 @@
int uv_size = ((kHeight + 1) >> 1) * ((kWidth + 1) >> 1);
int block_size = 2;
// Generate a fake input image.
- talk_base::scoped_ptr<uint8[]> yuv_input(
+ rtc::scoped_ptr<uint8[]> yuv_input(
CreateFakeQ420TestingImage(kHeight, kWidth, block_size,
y_pointer, yuy2_pointer));
// Allocate space for the output image.
- talk_base::scoped_ptr<uint8[]> yuv_output(
+ rtc::scoped_ptr<uint8[]> yuv_output(
new uint8[I420_SIZE(kHeight, kWidth) + kAlignment + unalignment]);
uint8 *y_output_pointer = ALIGNP(yuv_output.get(), kAlignment) +
unalignment;
@@ -628,7 +628,7 @@
// Generate the expected output.
uint8 *y_expected_pointer = NULL, *u_expected_pointer = NULL,
*v_expected_pointer = NULL;
- talk_base::scoped_ptr<uint8[]> yuv_output_expected(
+ rtc::scoped_ptr<uint8[]> yuv_output_expected(
CreateFakeYuvTestingImage(kHeight, kWidth, block_size,
libyuv::kJpegYuv420,
y_expected_pointer, u_expected_pointer, v_expected_pointer));
@@ -662,10 +662,10 @@
int uv_size = ((kHeight + 1) >> 1) * ((kWidth + 1) >> 1);
int block_size = 2;
// Generate a fake input image.
- talk_base::scoped_ptr<uint8[]> yuv_input(
+ rtc::scoped_ptr<uint8[]> yuv_input(
CreateFakeM420TestingImage(kHeight, kWidth, block_size, m420_pointer));
// Allocate space for the output image.
- talk_base::scoped_ptr<uint8[]> yuv_output(
+ rtc::scoped_ptr<uint8[]> yuv_output(
new uint8[I420_SIZE(kHeight, kWidth) + kAlignment + unalignment]);
uint8 *y_output_pointer = ALIGNP(yuv_output.get(), kAlignment) + unalignment;
uint8 *u_output_pointer = y_output_pointer + y_size;
@@ -673,7 +673,7 @@
// Generate the expected output.
uint8 *y_expected_pointer = NULL, *u_expected_pointer = NULL,
*v_expected_pointer = NULL;
- talk_base::scoped_ptr<uint8[]> yuv_output_expected(
+ rtc::scoped_ptr<uint8[]> yuv_output_expected(
CreateFakeYuvTestingImage(kHeight, kWidth, block_size,
libyuv::kJpegYuv420,
y_expected_pointer, u_expected_pointer, v_expected_pointer));
@@ -706,11 +706,11 @@
int uv_size = ((kHeight + 1) >> 1) * ((kWidth + 1) >> 1);
int block_size = 2;
// Generate a fake input image.
- talk_base::scoped_ptr<uint8[]> yuv_input(
+ rtc::scoped_ptr<uint8[]> yuv_input(
CreateFakeNV12TestingImage(kHeight, kWidth, block_size,
y_pointer, uv_pointer));
// Allocate space for the output image.
- talk_base::scoped_ptr<uint8[]> yuv_output(
+ rtc::scoped_ptr<uint8[]> yuv_output(
new uint8[I420_SIZE(kHeight, kWidth) + kAlignment + unalignment]);
uint8 *y_output_pointer = ALIGNP(yuv_output.get(), kAlignment) + unalignment;
uint8 *u_output_pointer = y_output_pointer + y_size;
@@ -718,7 +718,7 @@
// Generate the expected output.
uint8 *y_expected_pointer = NULL, *u_expected_pointer = NULL,
*v_expected_pointer = NULL;
- talk_base::scoped_ptr<uint8[]> yuv_output_expected(
+ rtc::scoped_ptr<uint8[]> yuv_output_expected(
CreateFakeYuvTestingImage(kHeight, kWidth, block_size,
libyuv::kJpegYuv420,
y_expected_pointer, u_expected_pointer, v_expected_pointer));
@@ -754,11 +754,11 @@
int uv_size = ((kHeight + 1) >> 1) * ((kWidth + 1) >> 1); \
int block_size = 2; \
/* Generate a fake input image.*/ \
- talk_base::scoped_ptr<uint8[]> yuv_input( \
+ rtc::scoped_ptr<uint8[]> yuv_input( \
CreateFakeInterleaveYuvTestingImage(kHeight, kWidth, BLOCK_SIZE, \
yuv_pointer, FOURCC_##SRC_NAME)); \
/* Allocate space for the output image.*/ \
- talk_base::scoped_ptr<uint8[]> yuv_output( \
+ rtc::scoped_ptr<uint8[]> yuv_output( \
new uint8[I420_SIZE(kHeight, kWidth) + kAlignment + unalignment]); \
uint8 *y_output_pointer = ALIGNP(yuv_output.get(), kAlignment) + \
unalignment; \
@@ -767,7 +767,7 @@
/* Generate the expected output.*/ \
uint8 *y_expected_pointer = NULL, *u_expected_pointer = NULL, \
*v_expected_pointer = NULL; \
- talk_base::scoped_ptr<uint8[]> yuv_output_expected( \
+ rtc::scoped_ptr<uint8[]> yuv_output_expected( \
CreateFakeYuvTestingImage(kHeight, kWidth, block_size, \
libyuv::kJpegYuv420, \
y_expected_pointer, u_expected_pointer, v_expected_pointer)); \
@@ -800,15 +800,15 @@
int u_pitch = (kWidth + 1) >> 1; \
int v_pitch = (kWidth + 1) >> 1; \
/* Generate a fake input image.*/ \
- talk_base::scoped_ptr<uint8[]> yuv_input( \
+ rtc::scoped_ptr<uint8[]> yuv_input( \
CreateFakeYuvTestingImage(kHeight, kWidth, BLOCK_SIZE, JPG_TYPE, \
y_pointer, u_pointer, v_pointer)); \
/* Generate the expected output.*/ \
- talk_base::scoped_ptr<uint8[]> argb_expected( \
+ rtc::scoped_ptr<uint8[]> argb_expected( \
CreateFakeArgbTestingImage(kHeight, kWidth, BLOCK_SIZE, \
argb_expected_pointer, FOURCC_##DST_NAME)); \
/* Allocate space for the output.*/ \
- talk_base::scoped_ptr<uint8[]> argb_output( \
+ rtc::scoped_ptr<uint8[]> argb_output( \
new uint8[kHeight * kWidth * 4 + kAlignment]); \
uint8 *argb_pointer = ALIGNP(argb_expected.get(), kAlignment); \
for (int i = 0; i < repeat_; ++i) { \
@@ -844,7 +844,7 @@
int v_pitch = (kWidth + 1) >> 1;
int block_size = 3;
// Generate a fake input image.
- talk_base::scoped_ptr<uint8[]> yuv_input(
+ rtc::scoped_ptr<uint8[]> yuv_input(
CreateFakeYuvTestingImage(kHeight, kWidth, block_size,
libyuv::kJpegYuv420,
y_pointer, u_pointer, v_pointer));
@@ -852,14 +852,14 @@
// U and V channels to be 128) using an I420 converter.
int uv_size = ((kHeight + 1) >> 1) * ((kWidth + 1) >> 1);
- talk_base::scoped_ptr<uint8[]> uv(new uint8[uv_size + kAlignment]);
+ rtc::scoped_ptr<uint8[]> uv(new uint8[uv_size + kAlignment]);
u_pointer = v_pointer = ALIGNP(uv.get(), kAlignment);
memset(u_pointer, 128, uv_size);
// Allocate space for the output image and generate the expected output.
- talk_base::scoped_ptr<uint8[]> argb_expected(
+ rtc::scoped_ptr<uint8[]> argb_expected(
new uint8[kHeight * kWidth * 4 + kAlignment]);
- talk_base::scoped_ptr<uint8[]> argb_output(
+ rtc::scoped_ptr<uint8[]> argb_output(
new uint8[kHeight * kWidth * 4 + kAlignment]);
uint8 *argb_expected_pointer = ALIGNP(argb_expected.get(), kAlignment);
uint8 *argb_pointer = ALIGNP(argb_output.get(), kAlignment);
@@ -890,7 +890,7 @@
int v_pitch = (kWidth + 1) >> 1;
int block_size = 3;
// Generate a fake input image.
- talk_base::scoped_ptr<uint8[]> yuv_input(
+ rtc::scoped_ptr<uint8[]> yuv_input(
CreateFakeYuvTestingImage(kHeight, kWidth, block_size,
libyuv::kJpegYuv420,
y_pointer, u_pointer, v_pointer));
@@ -899,17 +899,17 @@
int uv_size = ((kHeight + 1) >> 1) * ((kWidth + 1) >> 1);
// 1 byte extra if in the unaligned mode.
- talk_base::scoped_ptr<uint8[]> uv(new uint8[uv_size * 2 + kAlignment]);
+ rtc::scoped_ptr<uint8[]> uv(new uint8[uv_size * 2 + kAlignment]);
u_pointer = ALIGNP(uv.get(), kAlignment);
v_pointer = u_pointer + uv_size;
memset(u_pointer, 128, uv_size);
memset(v_pointer, 128, uv_size);
// Allocate space for the output image and generate the expected output.
- talk_base::scoped_ptr<uint8[]> argb_expected(
+ rtc::scoped_ptr<uint8[]> argb_expected(
new uint8[kHeight * kWidth * 4 + kAlignment]);
// 1 byte extra if in the misalinged mode.
- talk_base::scoped_ptr<uint8[]> argb_output(
+ rtc::scoped_ptr<uint8[]> argb_output(
new uint8[kHeight * kWidth * 4 + kAlignment + unalignment]);
uint8 *argb_expected_pointer = ALIGNP(argb_expected.get(), kAlignment);
uint8 *argb_pointer = ALIGNP(argb_output.get(), kAlignment) + unalignment;
@@ -940,16 +940,16 @@
uint8 *argb_pointer = NULL;
int block_size = 3;
// Generate a fake input image.
- talk_base::scoped_ptr<uint8[]> argb_input(
+ rtc::scoped_ptr<uint8[]> argb_input(
CreateFakeArgbTestingImage(kHeight, kWidth, block_size,
argb_pointer, FOURCC_ARGB));
// Generate the expected output. Only Y channel is used
- talk_base::scoped_ptr<uint8[]> yuv_expected(
+ rtc::scoped_ptr<uint8[]> yuv_expected(
CreateFakeYuvTestingImage(kHeight, kWidth, block_size,
libyuv::kJpegYuv420,
y_pointer, u_pointer, v_pointer));
// Allocate space for the Y output.
- talk_base::scoped_ptr<uint8[]> y_output(
+ rtc::scoped_ptr<uint8[]> y_output(
new uint8[kHeight * kWidth + kAlignment + unalignment]);
uint8 *y_output_pointer = ALIGNP(y_output.get(), kAlignment) + unalignment;
@@ -972,15 +972,15 @@
int unalignment = GetParam(); /* Get the unalignment offset.*/ \
uint8 *argb_expected_pointer = NULL, *src_pointer = NULL; \
/* Generate a fake input image.*/ \
- talk_base::scoped_ptr<uint8[]> src_input( \
+ rtc::scoped_ptr<uint8[]> src_input( \
CreateFakeArgbTestingImage(kHeight, kWidth, BLOCK_SIZE, \
src_pointer, FOURCC_##FC_ID)); \
/* Generate the expected output.*/ \
- talk_base::scoped_ptr<uint8[]> argb_expected( \
+ rtc::scoped_ptr<uint8[]> argb_expected( \
CreateFakeArgbTestingImage(kHeight, kWidth, BLOCK_SIZE, \
argb_expected_pointer, FOURCC_ARGB)); \
/* Allocate space for the output; 1 byte extra if in the unaligned mode.*/ \
- talk_base::scoped_ptr<uint8[]> argb_output( \
+ rtc::scoped_ptr<uint8[]> argb_output( \
new uint8[kHeight * kWidth * 4 + kAlignment + unalignment]); \
uint8 *argb_pointer = ALIGNP(argb_output.get(), kAlignment) + unalignment; \
for (int i = 0; i < repeat_; ++i) { \
diff --git a/session/media/rtcpmuxfilter.cc b/session/media/rtcpmuxfilter.cc
index 7091952..f951992 100644
--- a/session/media/rtcpmuxfilter.cc
+++ b/session/media/rtcpmuxfilter.cc
@@ -27,7 +27,7 @@
#include "talk/session/media/rtcpmuxfilter.h"
-#include "talk/base/logging.h"
+#include "webrtc/base/logging.h"
namespace cricket {
diff --git a/session/media/rtcpmuxfilter.h b/session/media/rtcpmuxfilter.h
index a5bb85e..131c25b 100644
--- a/session/media/rtcpmuxfilter.h
+++ b/session/media/rtcpmuxfilter.h
@@ -28,7 +28,7 @@
#ifndef TALK_SESSION_MEDIA_RTCPMUXFILTER_H_
#define TALK_SESSION_MEDIA_RTCPMUXFILTER_H_
-#include "talk/base/basictypes.h"
+#include "webrtc/base/basictypes.h"
#include "talk/p2p/base/sessiondescription.h"
namespace cricket {
diff --git a/session/media/rtcpmuxfilter_unittest.cc b/session/media/rtcpmuxfilter_unittest.cc
index ad33498..9475b52 100644
--- a/session/media/rtcpmuxfilter_unittest.cc
+++ b/session/media/rtcpmuxfilter_unittest.cc
@@ -25,7 +25,7 @@
#include "talk/session/media/rtcpmuxfilter.h"
-#include "talk/base/gunit.h"
+#include "webrtc/base/gunit.h"
#include "talk/media/base/testutils.h"
TEST(RtcpMuxFilterTest, DemuxRtcpSender) {
diff --git a/session/media/soundclip.cc b/session/media/soundclip.cc
index 44f457c..70a3b18 100644
--- a/session/media/soundclip.cc
+++ b/session/media/soundclip.cc
@@ -33,7 +33,7 @@
MSG_PLAYSOUND = 1,
};
-struct PlaySoundMessageData : talk_base::MessageData {
+struct PlaySoundMessageData : rtc::MessageData {
PlaySoundMessageData(const void *c,
int l,
SoundclipMedia::SoundclipFlags f)
@@ -49,7 +49,7 @@
bool result;
};
-Soundclip::Soundclip(talk_base::Thread *thread, SoundclipMedia *soundclip_media)
+Soundclip::Soundclip(rtc::Thread *thread, SoundclipMedia *soundclip_media)
: worker_thread_(thread),
soundclip_media_(soundclip_media) {
}
@@ -70,7 +70,7 @@
flags);
}
-void Soundclip::OnMessage(talk_base::Message *message) {
+void Soundclip::OnMessage(rtc::Message *message) {
ASSERT(message->message_id == MSG_PLAYSOUND);
PlaySoundMessageData *data =
static_cast<PlaySoundMessageData *>(message->pdata);
diff --git a/session/media/soundclip.h b/session/media/soundclip.h
index f057d8d..9d5e521 100644
--- a/session/media/soundclip.h
+++ b/session/media/soundclip.h
@@ -28,10 +28,10 @@
#ifndef TALK_SESSION_MEDIA_SOUNDCLIP_H_
#define TALK_SESSION_MEDIA_SOUNDCLIP_H_
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/media/base/mediaengine.h"
-namespace talk_base {
+namespace rtc {
class Thread;
@@ -41,9 +41,9 @@
// Soundclip wraps SoundclipMedia to support marshalling calls to the proper
// thread.
-class Soundclip : private talk_base::MessageHandler {
+class Soundclip : private rtc::MessageHandler {
public:
- Soundclip(talk_base::Thread* thread, SoundclipMedia* soundclip_media);
+ Soundclip(rtc::Thread* thread, SoundclipMedia* soundclip_media);
// Plays a sound out to the speakers with the given audio stream. The stream
// must be 16-bit little-endian 16 kHz PCM. If a stream is already playing
@@ -59,10 +59,10 @@
SoundclipMedia::SoundclipFlags flags);
// From MessageHandler
- virtual void OnMessage(talk_base::Message* message);
+ virtual void OnMessage(rtc::Message* message);
- talk_base::Thread* worker_thread_;
- talk_base::scoped_ptr<SoundclipMedia> soundclip_media_;
+ rtc::Thread* worker_thread_;
+ rtc::scoped_ptr<SoundclipMedia> soundclip_media_;
};
} // namespace cricket
diff --git a/session/media/srtpfilter.cc b/session/media/srtpfilter.cc
index 10e9514..d189343 100644
--- a/session/media/srtpfilter.cc
+++ b/session/media/srtpfilter.cc
@@ -33,10 +33,10 @@
#include <algorithm>
-#include "talk/base/base64.h"
-#include "talk/base/logging.h"
-#include "talk/base/stringencode.h"
-#include "talk/base/timeutils.h"
+#include "webrtc/base/base64.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/stringencode.h"
+#include "webrtc/base/timeutils.h"
#include "talk/media/base/rtputils.h"
// Enable this line to turn on SRTP debugging
@@ -449,7 +449,7 @@
// Fail if base64 decode fails, or the key is the wrong size.
std::string key_b64(key_params.substr(7)), key_str;
- if (!talk_base::Base64::Decode(key_b64, talk_base::Base64::DO_STRICT,
+ if (!rtc::Base64::Decode(key_b64, rtc::Base64::DO_STRICT,
&key_str, NULL) ||
static_cast<int>(key_str.size()) != len) {
return false;
@@ -869,9 +869,9 @@
if (key.error != SrtpFilter::ERROR_NONE) {
// For errors, signal first time and wait for 1 sec.
FailureStat* stat = &(failures_[key]);
- uint32 current_time = talk_base::Time();
+ uint32 current_time = rtc::Time();
if (stat->last_signal_time == 0 ||
- talk_base::TimeDiff(current_time, stat->last_signal_time) >
+ rtc::TimeDiff(current_time, stat->last_signal_time) >
static_cast<int>(signal_silent_time_)) {
SignalSrtpError(key.ssrc, key.mode, key.error);
stat->last_signal_time = current_time;
diff --git a/session/media/srtpfilter.h b/session/media/srtpfilter.h
index bc1735a..5160023 100644
--- a/session/media/srtpfilter.h
+++ b/session/media/srtpfilter.h
@@ -33,9 +33,9 @@
#include <string>
#include <vector>
-#include "talk/base/basictypes.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/sigslotrepeater.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/sigslotrepeater.h"
#include "talk/media/base/cryptoparams.h"
#include "talk/p2p/base/sessiondescription.h"
@@ -182,10 +182,10 @@
State state_;
uint32 signal_silent_time_in_ms_;
std::vector<CryptoParams> offer_params_;
- talk_base::scoped_ptr<SrtpSession> send_session_;
- talk_base::scoped_ptr<SrtpSession> recv_session_;
- talk_base::scoped_ptr<SrtpSession> send_rtcp_session_;
- talk_base::scoped_ptr<SrtpSession> recv_rtcp_session_;
+ rtc::scoped_ptr<SrtpSession> send_session_;
+ rtc::scoped_ptr<SrtpSession> recv_session_;
+ rtc::scoped_ptr<SrtpSession> send_rtcp_session_;
+ rtc::scoped_ptr<SrtpSession> recv_rtcp_session_;
CryptoParams applied_send_params_;
CryptoParams applied_recv_params_;
};
@@ -241,7 +241,7 @@
srtp_t session_;
int rtp_auth_tag_len_;
int rtcp_auth_tag_len_;
- talk_base::scoped_ptr<SrtpStat> srtp_stat_;
+ rtc::scoped_ptr<SrtpStat> srtp_stat_;
static bool inited_;
int last_send_seq_num_;
DISALLOW_COPY_AND_ASSIGN(SrtpSession);
diff --git a/session/media/srtpfilter_unittest.cc b/session/media/srtpfilter_unittest.cc
index 4f0ebd4..2cbe8ef 100644
--- a/session/media/srtpfilter_unittest.cc
+++ b/session/media/srtpfilter_unittest.cc
@@ -25,9 +25,9 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/byteorder.h"
-#include "talk/base/gunit.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/byteorder.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/thread.h"
#include "talk/media/base/cryptoparams.h"
#include "talk/media/base/fakertp.h"
#include "talk/p2p/base/sessiondescription.h"
@@ -94,7 +94,7 @@
memcpy(rtp_packet, kPcmuFrame, rtp_len);
// In order to be able to run this test function multiple times we can not
// use the same sequence number twice. Increase the sequence number by one.
- talk_base::SetBE16(reinterpret_cast<uint8*>(rtp_packet) + 2,
+ rtc::SetBE16(reinterpret_cast<uint8*>(rtp_packet) + 2,
++sequence_number_);
memcpy(original_rtp_packet, rtp_packet, rtp_len);
memcpy(rtcp_packet, kRtcpReport, rtcp_len);
@@ -679,36 +679,36 @@
EXPECT_TRUE(s2_.SetRecv(CS_AES_CM_128_HMAC_SHA1_80, kTestKey1, kTestKeyLen));
// Initial sequence number.
- talk_base::SetBE16(reinterpret_cast<uint8*>(rtp_packet_) + 2, seqnum_big);
+ rtc::SetBE16(reinterpret_cast<uint8*>(rtp_packet_) + 2, seqnum_big);
EXPECT_TRUE(s1_.ProtectRtp(rtp_packet_, rtp_len_, sizeof(rtp_packet_),
&out_len));
// Replay within the 1024 window should succeed.
- talk_base::SetBE16(reinterpret_cast<uint8*>(rtp_packet_) + 2,
+ rtc::SetBE16(reinterpret_cast<uint8*>(rtp_packet_) + 2,
seqnum_big - replay_window + 1);
EXPECT_TRUE(s1_.ProtectRtp(rtp_packet_, rtp_len_, sizeof(rtp_packet_),
&out_len));
// Replay out side of the 1024 window should fail.
- talk_base::SetBE16(reinterpret_cast<uint8*>(rtp_packet_) + 2,
+ rtc::SetBE16(reinterpret_cast<uint8*>(rtp_packet_) + 2,
seqnum_big - replay_window - 1);
EXPECT_FALSE(s1_.ProtectRtp(rtp_packet_, rtp_len_, sizeof(rtp_packet_),
&out_len));
// Increment sequence number to a small number.
- talk_base::SetBE16(reinterpret_cast<uint8*>(rtp_packet_) + 2, seqnum_small);
+ rtc::SetBE16(reinterpret_cast<uint8*>(rtp_packet_) + 2, seqnum_small);
EXPECT_TRUE(s1_.ProtectRtp(rtp_packet_, rtp_len_, sizeof(rtp_packet_),
&out_len));
// Replay around 0 but out side of the 1024 window should fail.
- talk_base::SetBE16(reinterpret_cast<uint8*>(rtp_packet_) + 2,
+ rtc::SetBE16(reinterpret_cast<uint8*>(rtp_packet_) + 2,
kMaxSeqnum + seqnum_small - replay_window - 1);
EXPECT_FALSE(s1_.ProtectRtp(rtp_packet_, rtp_len_, sizeof(rtp_packet_),
&out_len));
// Replay around 0 but within the 1024 window should succeed.
for (uint16 seqnum = 65000; seqnum < 65003; ++seqnum) {
- talk_base::SetBE16(reinterpret_cast<uint8*>(rtp_packet_) + 2, seqnum);
+ rtc::SetBE16(reinterpret_cast<uint8*>(rtp_packet_) + 2, seqnum);
EXPECT_TRUE(s1_.ProtectRtp(rtp_packet_, rtp_len_, sizeof(rtp_packet_),
&out_len));
}
@@ -718,7 +718,7 @@
// without the fix, the loop above would keep incrementing local sequence
// number in libsrtp, eventually the new sequence number would go out side
// of the window.
- talk_base::SetBE16(reinterpret_cast<uint8*>(rtp_packet_) + 2,
+ rtc::SetBE16(reinterpret_cast<uint8*>(rtp_packet_) + 2,
seqnum_small + 1);
EXPECT_TRUE(s1_.ProtectRtp(rtp_packet_, rtp_len_, sizeof(rtp_packet_),
&out_len));
@@ -782,7 +782,7 @@
EXPECT_EQ(cricket::SrtpFilter::ERROR_NONE, error_);
// Now the error will be triggered again.
Reset();
- talk_base::Thread::Current()->SleepMs(210);
+ rtc::Thread::Current()->SleepMs(210);
srtp_stat_.AddProtectRtpResult(1, err_status_fail);
EXPECT_EQ(1U, ssrc_);
EXPECT_EQ(cricket::SrtpFilter::PROTECT, mode_);
@@ -806,7 +806,7 @@
EXPECT_EQ(cricket::SrtpFilter::UNPROTECT, mode_);
EXPECT_EQ(cricket::SrtpFilter::ERROR_REPLAY, error_);
Reset();
- talk_base::Thread::Current()->SleepMs(210);
+ rtc::Thread::Current()->SleepMs(210);
srtp_stat_.AddUnprotectRtpResult(1, err_status_replay_old);
EXPECT_EQ(1U, ssrc_);
EXPECT_EQ(cricket::SrtpFilter::UNPROTECT, mode_);
@@ -824,7 +824,7 @@
EXPECT_EQ(cricket::SrtpFilter::ERROR_NONE, error_);
// Now the error will be triggered again.
Reset();
- talk_base::Thread::Current()->SleepMs(210);
+ rtc::Thread::Current()->SleepMs(210);
srtp_stat_.AddUnprotectRtpResult(1, err_status_fail);
EXPECT_EQ(1U, ssrc_);
EXPECT_EQ(cricket::SrtpFilter::UNPROTECT, mode_);
@@ -851,7 +851,7 @@
EXPECT_EQ(cricket::SrtpFilter::ERROR_NONE, error_);
// Now the error will be triggered again.
Reset();
- talk_base::Thread::Current()->SleepMs(210);
+ rtc::Thread::Current()->SleepMs(210);
srtp_stat_.AddProtectRtcpResult(err_status_fail);
EXPECT_EQ(cricket::SrtpFilter::PROTECT, mode_);
EXPECT_EQ(cricket::SrtpFilter::ERROR_FAIL, error_);
@@ -871,7 +871,7 @@
EXPECT_EQ(cricket::SrtpFilter::UNPROTECT, mode_);
EXPECT_EQ(cricket::SrtpFilter::ERROR_REPLAY, error_);
Reset();
- talk_base::Thread::Current()->SleepMs(210);
+ rtc::Thread::Current()->SleepMs(210);
srtp_stat_.AddUnprotectRtcpResult(err_status_replay_fail);
EXPECT_EQ(cricket::SrtpFilter::UNPROTECT, mode_);
EXPECT_EQ(cricket::SrtpFilter::ERROR_REPLAY, error_);
@@ -886,7 +886,7 @@
EXPECT_EQ(cricket::SrtpFilter::ERROR_NONE, error_);
// Now the error will be triggered again.
Reset();
- talk_base::Thread::Current()->SleepMs(210);
+ rtc::Thread::Current()->SleepMs(210);
srtp_stat_.AddUnprotectRtcpResult(err_status_fail);
EXPECT_EQ(cricket::SrtpFilter::UNPROTECT, mode_);
EXPECT_EQ(cricket::SrtpFilter::ERROR_FAIL, error_);
diff --git a/session/media/typewrapping.h.pump b/session/media/typewrapping.h.pump
index 3b52927..2cbb20f 100644
--- a/session/media/typewrapping.h.pump
+++ b/session/media/typewrapping.h.pump
@@ -83,7 +83,7 @@
#ifndef TALK_SESSION_PHONE_TYPEWRAPPING_H_
#define TALK_SESSION_PHONE_TYPEWRAPPING_H_
-#include "talk/base/common.h"
+#include "webrtc/base/common.h"
#ifdef OSX
// XCode's GCC doesn't respect typedef-equivalence when casting function pointer
diff --git a/session/media/typingmonitor.cc b/session/media/typingmonitor.cc
index 3c5d387..d37aabf 100644
--- a/session/media/typingmonitor.cc
+++ b/session/media/typingmonitor.cc
@@ -27,14 +27,14 @@
#include "talk/session/media/typingmonitor.h"
-#include "talk/base/logging.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/thread.h"
#include "talk/session/media/channel.h"
namespace cricket {
TypingMonitor::TypingMonitor(VoiceChannel* channel,
- talk_base::Thread* worker_thread,
+ rtc::Thread* worker_thread,
const TypingMonitorOptions& settings)
: channel_(channel),
worker_thread_(worker_thread),
@@ -52,7 +52,7 @@
TypingMonitor::~TypingMonitor() {
// Shortcut any pending unmutes.
if (has_pending_unmute_) {
- talk_base::MessageList messages;
+ rtc::MessageList messages;
worker_thread_->Clear(this, 0, &messages);
ASSERT(messages.size() == 1);
channel_->MuteStream(0, false);
@@ -75,7 +75,7 @@
channel_->MuteStream(0, true);
SignalMuted(channel_, true);
has_pending_unmute_ = true;
- muted_at_ = talk_base::Time();
+ muted_at_ = rtc::Time();
worker_thread_->PostDelayed(mute_period_, this, 0);
LOG(LS_INFO) << "Muting for at least " << mute_period_ << "ms.";
@@ -89,7 +89,7 @@
*/
void TypingMonitor::OnChannelMuted() {
if (has_pending_unmute_) {
- talk_base::MessageList removed;
+ rtc::MessageList removed;
worker_thread_->Clear(this, 0, &removed);
ASSERT(removed.size() == 1);
has_pending_unmute_ = false;
@@ -102,13 +102,13 @@
* elapse since they finished and try to unmute again. Should be called on the
* worker thread.
*/
-void TypingMonitor::OnMessage(talk_base::Message* msg) {
+void TypingMonitor::OnMessage(rtc::Message* msg) {
if (!channel_->IsStreamMuted(0) || !has_pending_unmute_) return;
int silence_period = channel_->media_channel()->GetTimeSinceLastTyping();
int expiry_time = mute_period_ - silence_period;
if (silence_period < 0 || expiry_time < 50) {
LOG(LS_INFO) << "Mute timeout hit, last typing " << silence_period
- << "ms ago, unmuting after " << talk_base::TimeSince(muted_at_)
+ << "ms ago, unmuting after " << rtc::TimeSince(muted_at_)
<< "ms total.";
has_pending_unmute_ = false;
channel_->MuteStream(0, false);
@@ -116,7 +116,7 @@
} else {
LOG(LS_INFO) << "Mute timeout hit, last typing " << silence_period
<< "ms ago, check again in " << expiry_time << "ms.";
- talk_base::Thread::Current()->PostDelayed(expiry_time, this, 0);
+ rtc::Thread::Current()->PostDelayed(expiry_time, this, 0);
}
}
diff --git a/session/media/typingmonitor.h b/session/media/typingmonitor.h
index c9b64e7..7d93e1b 100644
--- a/session/media/typingmonitor.h
+++ b/session/media/typingmonitor.h
@@ -28,10 +28,10 @@
#ifndef TALK_SESSION_MEDIA_TYPINGMONITOR_H_
#define TALK_SESSION_MEDIA_TYPINGMONITOR_H_
-#include "talk/base/messagehandler.h"
+#include "webrtc/base/messagehandler.h"
#include "talk/media/base/mediachannel.h"
-namespace talk_base {
+namespace rtc {
class Thread;
}
@@ -57,9 +57,9 @@
* a conference with loud keystroke audio signals.
*/
class TypingMonitor
- : public talk_base::MessageHandler, public sigslot::has_slots<> {
+ : public rtc::MessageHandler, public sigslot::has_slots<> {
public:
- TypingMonitor(VoiceChannel* channel, talk_base::Thread* worker_thread,
+ TypingMonitor(VoiceChannel* channel, rtc::Thread* worker_thread,
const TypingMonitorOptions& params);
~TypingMonitor();
@@ -69,10 +69,10 @@
private:
void OnVoiceChannelError(uint32 ssrc, VoiceMediaChannel::Error error);
- void OnMessage(talk_base::Message* msg);
+ void OnMessage(rtc::Message* msg);
VoiceChannel* channel_;
- talk_base::Thread* worker_thread_;
+ rtc::Thread* worker_thread_;
int mute_period_;
int muted_at_;
bool has_pending_unmute_;
diff --git a/session/media/typingmonitor_unittest.cc b/session/media/typingmonitor_unittest.cc
index eb8c5bc..e2ee3f4 100644
--- a/session/media/typingmonitor_unittest.cc
+++ b/session/media/typingmonitor_unittest.cc
@@ -25,7 +25,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/gunit.h"
+#include "webrtc/base/gunit.h"
#include "talk/media/base/fakemediaengine.h"
#include "talk/p2p/base/fakesession.h"
#include "talk/session/media/channel.h"
@@ -37,13 +37,13 @@
class TypingMonitorTest : public testing::Test {
protected:
TypingMonitorTest() : session_(true) {
- vc_.reset(new VoiceChannel(talk_base::Thread::Current(), &engine_,
+ vc_.reset(new VoiceChannel(rtc::Thread::Current(), &engine_,
engine_.CreateChannel(), &session_, "", false));
engine_.GetVoiceChannel(0)->set_time_since_last_typing(1000);
TypingMonitorOptions settings = {10, 20, 30, 40, 50};
monitor_.reset(new TypingMonitor(vc_.get(),
- talk_base::Thread::Current(),
+ rtc::Thread::Current(),
settings));
}
@@ -51,8 +51,8 @@
vc_.reset();
}
- talk_base::scoped_ptr<TypingMonitor> monitor_;
- talk_base::scoped_ptr<VoiceChannel> vc_;
+ rtc::scoped_ptr<TypingMonitor> monitor_;
+ rtc::scoped_ptr<VoiceChannel> vc_;
FakeMediaEngine engine_;
FakeSession session_;
};
diff --git a/session/media/yuvscaler_unittest.cc b/session/media/yuvscaler_unittest.cc
index 93ac534..d732bb3 100644
--- a/session/media/yuvscaler_unittest.cc
+++ b/session/media/yuvscaler_unittest.cc
@@ -29,10 +29,10 @@
#include "libyuv/cpu_id.h"
#include "libyuv/scale.h"
-#include "talk/base/basictypes.h"
-#include "talk/base/flags.h"
-#include "talk/base/gunit.h"
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/flags.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/media/base/testutils.h"
#if defined(_MSC_VER)
@@ -43,7 +43,7 @@
using cricket::LoadPlanarYuvTestImage;
using cricket::DumpPlanarYuvTestImage;
-using talk_base::scoped_ptr;
+using rtc::scoped_ptr;
DEFINE_bool(yuvscaler_dump, false,
"whether to write out scaled images for inspection");
@@ -88,8 +88,8 @@
class YuvScalerTest : public testing::Test {
protected:
virtual void SetUp() {
- dump_ = *FlagList::Lookup("yuvscaler_dump")->bool_variable();
- repeat_ = *FlagList::Lookup("yuvscaler_repeat")->int_variable();
+ dump_ = *rtc::FlagList::Lookup("yuvscaler_dump")->bool_variable();
+ repeat_ = *rtc::FlagList::Lookup("yuvscaler_repeat")->int_variable();
}
// Scale an image and compare against a Lanczos-filtered test image.
diff --git a/session/tunnel/pseudotcpchannel.cc b/session/tunnel/pseudotcpchannel.cc
index d95dc85..e407274 100644
--- a/session/tunnel/pseudotcpchannel.cc
+++ b/session/tunnel/pseudotcpchannel.cc
@@ -26,20 +26,20 @@
*/
#include <string>
-#include "talk/base/basictypes.h"
-#include "talk/base/common.h"
-#include "talk/base/logging.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/stringutils.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/stringutils.h"
#include "talk/p2p/base/candidate.h"
#include "talk/p2p/base/transportchannel.h"
#include "pseudotcpchannel.h"
-using namespace talk_base;
+using namespace rtc;
namespace cricket {
-extern const talk_base::ConstantLabel SESSION_STATES[];
+extern const rtc::ConstantLabel SESSION_STATES[];
// MSG_WK_* - worker thread messages
// MSG_ST_* - stream thread messages
@@ -341,7 +341,7 @@
void PseudoTcpChannel::OnChannelRead(TransportChannel* channel,
const char* data, size_t size,
- const talk_base::PacketTime& packet_time,
+ const rtc::PacketTime& packet_time,
int flags) {
//LOG_F(LS_VERBOSE) << "(" << size << ")";
ASSERT(worker_thread_->IsCurrent());
@@ -378,7 +378,7 @@
int family = candidate.address().family();
Socket* socket =
worker_thread_->socketserver()->CreateAsyncSocket(family, SOCK_DGRAM);
- talk_base::scoped_ptr<Socket> mtu_socket(socket);
+ rtc::scoped_ptr<Socket> mtu_socket(socket);
if (socket == NULL) {
LOG_F(LS_WARNING) << "Couldn't create socket while estimating MTU.";
} else {
@@ -504,7 +504,7 @@
ASSERT(cs_.CurrentThreadIsOwner());
ASSERT(tcp == tcp_);
ASSERT(NULL != channel_);
- talk_base::PacketOptions packet_options;
+ rtc::PacketOptions packet_options;
int sent = channel_->SendPacket(buffer, len, packet_options);
if (sent > 0) {
//LOG_F(LS_VERBOSE) << "(" << sent << ") Sent";
diff --git a/session/tunnel/pseudotcpchannel.h b/session/tunnel/pseudotcpchannel.h
index 31cd9a1..f8fe72e 100644
--- a/session/tunnel/pseudotcpchannel.h
+++ b/session/tunnel/pseudotcpchannel.h
@@ -28,13 +28,13 @@
#ifndef TALK_SESSION_TUNNEL_PSEUDOTCPCHANNEL_H_
#define TALK_SESSION_TUNNEL_PSEUDOTCPCHANNEL_H_
-#include "talk/base/criticalsection.h"
-#include "talk/base/messagequeue.h"
-#include "talk/base/stream.h"
+#include "webrtc/base/criticalsection.h"
+#include "webrtc/base/messagequeue.h"
+#include "webrtc/base/stream.h"
#include "talk/p2p/base/pseudotcp.h"
#include "talk/p2p/base/session.h"
-namespace talk_base {
+namespace rtc {
class Thread;
}
@@ -64,17 +64,17 @@
class PseudoTcpChannel
: public IPseudoTcpNotify,
- public talk_base::MessageHandler,
+ public rtc::MessageHandler,
public sigslot::has_slots<> {
public:
// Signal thread methods
- PseudoTcpChannel(talk_base::Thread* stream_thread,
+ PseudoTcpChannel(rtc::Thread* stream_thread,
Session* session);
bool Connect(const std::string& content_name,
const std::string& channel_name,
int component);
- talk_base::StreamInterface* GetStream();
+ rtc::StreamInterface* GetStream();
sigslot::signal1<PseudoTcpChannel*> SignalChannelClosed;
@@ -93,15 +93,15 @@
virtual ~PseudoTcpChannel();
// Stream thread methods
- talk_base::StreamState GetState() const;
- talk_base::StreamResult Read(void* buffer, size_t buffer_len,
+ rtc::StreamState GetState() const;
+ rtc::StreamResult Read(void* buffer, size_t buffer_len,
size_t* read, int* error);
- talk_base::StreamResult Write(const void* data, size_t data_len,
+ rtc::StreamResult Write(const void* data, size_t data_len,
size_t* written, int* error);
void Close();
// Multi-thread methods
- void OnMessage(talk_base::Message* pmsg);
+ void OnMessage(rtc::Message* pmsg);
void AdjustClock(bool clear = true);
void CheckDestroy();
@@ -111,7 +111,7 @@
// Worker thread methods
void OnChannelWritableState(TransportChannel* channel);
void OnChannelRead(TransportChannel* channel, const char* data, size_t size,
- const talk_base::PacketTime& packet_time, int flags);
+ const rtc::PacketTime& packet_time, int flags);
void OnChannelConnectionChanged(TransportChannel* channel,
const Candidate& candidate);
@@ -123,7 +123,7 @@
const char* buffer,
size_t len);
- talk_base::Thread* signal_thread_, * worker_thread_, * stream_thread_;
+ rtc::Thread* signal_thread_, * worker_thread_, * stream_thread_;
Session* session_;
TransportChannel* channel_;
std::string content_name_;
@@ -132,7 +132,7 @@
InternalStream* stream_;
bool stream_readable_, pending_read_event_;
bool ready_to_connect_;
- mutable talk_base::CriticalSection cs_;
+ mutable rtc::CriticalSection cs_;
};
} // namespace cricket
diff --git a/session/tunnel/securetunnelsessionclient.cc b/session/tunnel/securetunnelsessionclient.cc
index 55f4083..743a762 100644
--- a/session/tunnel/securetunnelsessionclient.cc
+++ b/session/tunnel/securetunnelsessionclient.cc
@@ -28,14 +28,14 @@
// SecureTunnelSessionClient and SecureTunnelSession implementation.
#include "talk/session/tunnel/securetunnelsessionclient.h"
-#include "talk/base/basicdefs.h"
-#include "talk/base/basictypes.h"
-#include "talk/base/common.h"
-#include "talk/base/helpers.h"
-#include "talk/base/logging.h"
-#include "talk/base/stringutils.h"
-#include "talk/base/sslidentity.h"
-#include "talk/base/sslstreamadapter.h"
+#include "webrtc/base/basicdefs.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/stringutils.h"
+#include "webrtc/base/sslidentity.h"
+#include "webrtc/base/sslstreamadapter.h"
#include "talk/p2p/base/transportchannel.h"
#include "talk/xmllite/xmlelement.h"
#include "talk/session/tunnel/pseudotcpchannel.h"
@@ -84,14 +84,14 @@
: TunnelSessionClient(jid, manager, NS_SECURE_TUNNEL) {
}
-void SecureTunnelSessionClient::SetIdentity(talk_base::SSLIdentity* identity) {
+void SecureTunnelSessionClient::SetIdentity(rtc::SSLIdentity* identity) {
ASSERT(identity_.get() == NULL);
identity_.reset(identity);
}
bool SecureTunnelSessionClient::GenerateIdentity() {
ASSERT(identity_.get() == NULL);
- identity_.reset(talk_base::SSLIdentity::Generate(
+ identity_.reset(rtc::SSLIdentity::Generate(
// The name on the certificate does not matter: the peer will
// make sure the cert it gets during SSL negotiation matches the
// one it got from XMPP. It would be neat to put something
@@ -112,7 +112,7 @@
return true;
}
-talk_base::SSLIdentity& SecureTunnelSessionClient::GetIdentity() const {
+rtc::SSLIdentity& SecureTunnelSessionClient::GetIdentity() const {
ASSERT(identity_.get() != NULL);
return *identity_;
}
@@ -120,15 +120,15 @@
// Parses a certificate from a PEM encoded string.
// Returns NULL on failure.
// The caller is responsible for freeing the returned object.
-static talk_base::SSLCertificate* ParseCertificate(
+static rtc::SSLCertificate* ParseCertificate(
const std::string& pem_cert) {
if (pem_cert.empty())
return NULL;
- return talk_base::SSLCertificate::FromPEMString(pem_cert);
+ return rtc::SSLCertificate::FromPEMString(pem_cert);
}
TunnelSession* SecureTunnelSessionClient::MakeTunnelSession(
- Session* session, talk_base::Thread* stream_thread,
+ Session* session, rtc::Thread* stream_thread,
TunnelSessionRole role) {
return new SecureTunnelSession(this, session, stream_thread, role);
}
@@ -156,7 +156,7 @@
}
// Validate the certificate
- talk_base::scoped_ptr<talk_base::SSLCertificate> peer_cert(
+ rtc::scoped_ptr<rtc::SSLCertificate> peer_cert(
ParseCertificate(content->client_pem_certificate));
if (peer_cert.get() == NULL) {
LOG(LS_ERROR)
@@ -309,16 +309,16 @@
SecureTunnelSession::SecureTunnelSession(
SecureTunnelSessionClient* client, Session* session,
- talk_base::Thread* stream_thread, TunnelSessionRole role)
+ rtc::Thread* stream_thread, TunnelSessionRole role)
: TunnelSession(client, session, stream_thread),
role_(role) {
}
-talk_base::StreamInterface* SecureTunnelSession::MakeSecureStream(
- talk_base::StreamInterface* stream) {
- talk_base::SSLStreamAdapter* ssl_stream =
- talk_base::SSLStreamAdapter::Create(stream);
- talk_base::SSLIdentity* identity =
+rtc::StreamInterface* SecureTunnelSession::MakeSecureStream(
+ rtc::StreamInterface* stream) {
+ rtc::SSLStreamAdapter* ssl_stream =
+ rtc::SSLStreamAdapter::Create(stream);
+ rtc::SSLIdentity* identity =
static_cast<SecureTunnelSessionClient*>(client_)->
GetIdentity().GetReference();
ssl_stream->SetIdentity(identity);
@@ -334,11 +334,11 @@
// OnAccept()). We won't Connect() the PseudoTcpChannel until we get
// that, so the stream will stay closed until then. Keep a handle
// on the streem so we can configure the peer certificate later.
- ssl_stream_reference_.reset(new talk_base::StreamReference(ssl_stream));
+ ssl_stream_reference_.reset(new rtc::StreamReference(ssl_stream));
return ssl_stream_reference_->NewReference();
}
-talk_base::StreamInterface* SecureTunnelSession::GetStream() {
+rtc::StreamInterface* SecureTunnelSession::GetStream() {
ASSERT(channel_ != NULL);
ASSERT(ssl_stream_reference_.get() == NULL);
return MakeSecureStream(channel_->GetStream());
@@ -360,7 +360,7 @@
const std::string& cert_pem =
role_ == INITIATOR ? remote_tunnel->server_pem_certificate :
remote_tunnel->client_pem_certificate;
- talk_base::scoped_ptr<talk_base::SSLCertificate> peer_cert(
+ rtc::scoped_ptr<rtc::SSLCertificate> peer_cert(
ParseCertificate(cert_pem));
if (peer_cert == NULL) {
ASSERT(role_ == INITIATOR); // when RESPONDER we validated it earlier
@@ -370,8 +370,8 @@
return;
}
ASSERT(ssl_stream_reference_.get() != NULL);
- talk_base::SSLStreamAdapter* ssl_stream =
- static_cast<talk_base::SSLStreamAdapter*>(
+ rtc::SSLStreamAdapter* ssl_stream =
+ static_cast<rtc::SSLStreamAdapter*>(
ssl_stream_reference_->GetStream());
std::string algorithm;
@@ -379,7 +379,7 @@
LOG(LS_ERROR) << "Failed to get the algorithm for the peer cert signature";
return;
}
- unsigned char digest[talk_base::MessageDigest::kMaxSize];
+ unsigned char digest[rtc::MessageDigest::kMaxSize];
size_t digest_len;
peer_cert->ComputeDigest(algorithm, digest, ARRAY_SIZE(digest), &digest_len);
ssl_stream->SetPeerCertificateDigest(algorithm, digest, digest_len);
diff --git a/session/tunnel/securetunnelsessionclient.h b/session/tunnel/securetunnelsessionclient.h
index 5c65b98..ef12c07 100644
--- a/session/tunnel/securetunnelsessionclient.h
+++ b/session/tunnel/securetunnelsessionclient.h
@@ -36,8 +36,8 @@
#include <string>
-#include "talk/base/sslidentity.h"
-#include "talk/base/sslstreamadapter.h"
+#include "webrtc/base/sslidentity.h"
+#include "webrtc/base/sslstreamadapter.h"
#include "talk/session/tunnel/tunnelsessionclient.h"
namespace cricket {
@@ -66,7 +66,7 @@
// Configures this client to use a preexisting SSLIdentity.
// The client takes ownership of the identity object.
// Use either SetIdentity or GenerateIdentity, and only once.
- void SetIdentity(talk_base::SSLIdentity* identity);
+ void SetIdentity(rtc::SSLIdentity* identity);
// Generates an identity from nothing.
// Returns true if generation was successful.
@@ -77,7 +77,7 @@
// SetIdentity() or generated by GenerateIdentity(). Call this
// method only after our identity has been successfully established
// by one of those methods.
- talk_base::SSLIdentity& GetIdentity() const;
+ rtc::SSLIdentity& GetIdentity() const;
// Inherited methods
virtual void OnIncomingTunnel(const buzz::Jid& jid, Session *session);
@@ -96,7 +96,7 @@
protected:
virtual TunnelSession* MakeTunnelSession(
- Session* session, talk_base::Thread* stream_thread,
+ Session* session, rtc::Thread* stream_thread,
TunnelSessionRole role);
private:
@@ -104,7 +104,7 @@
// certificate part will be communicated within the session
// description. The identity will be passed to the SSLStreamAdapter
// and used for SSL authentication.
- talk_base::scoped_ptr<talk_base::SSLIdentity> identity_;
+ rtc::scoped_ptr<rtc::SSLIdentity> identity_;
DISALLOW_EVIL_CONSTRUCTORS(SecureTunnelSessionClient);
};
@@ -123,13 +123,13 @@
// role is either INITIATOR or RESPONDER, depending on who is
// initiating the session.
SecureTunnelSession(SecureTunnelSessionClient* client, Session* session,
- talk_base::Thread* stream_thread,
+ rtc::Thread* stream_thread,
TunnelSessionRole role);
// Returns the stream that implements the actual P2P tunnel.
// This may be called only once. Caller is responsible for freeing
// the returned object.
- virtual talk_base::StreamInterface* GetStream();
+ virtual rtc::StreamInterface* GetStream();
protected:
// Inherited method: callback on accepting a session.
@@ -138,8 +138,8 @@
// Helper method for GetStream() that Instantiates the
// SSLStreamAdapter to wrap the PseudoTcpChannel's stream, and
// configures it with our identity and role.
- talk_base::StreamInterface* MakeSecureStream(
- talk_base::StreamInterface* stream);
+ rtc::StreamInterface* MakeSecureStream(
+ rtc::StreamInterface* stream);
// Our role in requesting the tunnel: INITIATOR or
// RESPONDER. Translates to our role in SSL negotiation:
@@ -155,7 +155,7 @@
// stream endpoint is returned early, but we need to keep a handle
// on it so we can setup the peer certificate when we receive it
// later.
- talk_base::scoped_ptr<talk_base::StreamReference> ssl_stream_reference_;
+ rtc::scoped_ptr<rtc::StreamReference> ssl_stream_reference_;
DISALLOW_EVIL_CONSTRUCTORS(SecureTunnelSession);
};
diff --git a/session/tunnel/tunnelsessionclient.cc b/session/tunnel/tunnelsessionclient.cc
index 71d0ce1..d8d6e3e 100644
--- a/session/tunnel/tunnelsessionclient.cc
+++ b/session/tunnel/tunnelsessionclient.cc
@@ -25,12 +25,12 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/basicdefs.h"
-#include "talk/base/basictypes.h"
-#include "talk/base/common.h"
-#include "talk/base/helpers.h"
-#include "talk/base/logging.h"
-#include "talk/base/stringutils.h"
+#include "webrtc/base/basicdefs.h"
+#include "webrtc/base/basictypes.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/stringutils.h"
#include "talk/p2p/base/constants.h"
#include "talk/p2p/base/transportchannel.h"
#include "talk/xmllite/xmlelement.h"
@@ -52,21 +52,21 @@
MSG_CREATE_TUNNEL,
};
-struct EventData : public talk_base::MessageData {
+struct EventData : public rtc::MessageData {
int event, error;
EventData(int ev, int err = 0) : event(ev), error(err) { }
};
-struct CreateTunnelData : public talk_base::MessageData {
+struct CreateTunnelData : public rtc::MessageData {
buzz::Jid jid;
std::string description;
- talk_base::Thread* thread;
- talk_base::StreamInterface* stream;
+ rtc::Thread* thread;
+ rtc::StreamInterface* stream;
};
-extern const talk_base::ConstantLabel SESSION_STATES[];
+extern const rtc::ConstantLabel SESSION_STATES[];
-const talk_base::ConstantLabel SESSION_STATES[] = {
+const rtc::ConstantLabel SESSION_STATES[] = {
KLABEL(Session::STATE_INIT),
KLABEL(Session::STATE_SENTINITIATE),
KLABEL(Session::STATE_RECEIVEDINITIATE),
@@ -124,7 +124,7 @@
ASSERT(session_manager_->signaling_thread()->IsCurrent());
if (received)
sessions_.push_back(
- MakeTunnelSession(session, talk_base::Thread::Current(), RESPONDER));
+ MakeTunnelSession(session, rtc::Thread::Current(), RESPONDER));
}
void TunnelSessionClientBase::OnSessionDestroy(Session* session) {
@@ -143,19 +143,19 @@
}
}
-talk_base::StreamInterface* TunnelSessionClientBase::CreateTunnel(
+rtc::StreamInterface* TunnelSessionClientBase::CreateTunnel(
const buzz::Jid& to, const std::string& description) {
// Valid from any thread
CreateTunnelData data;
data.jid = to;
data.description = description;
- data.thread = talk_base::Thread::Current();
+ data.thread = rtc::Thread::Current();
data.stream = NULL;
session_manager_->signaling_thread()->Send(this, MSG_CREATE_TUNNEL, &data);
return data.stream;
}
-talk_base::StreamInterface* TunnelSessionClientBase::AcceptTunnel(
+rtc::StreamInterface* TunnelSessionClientBase::AcceptTunnel(
Session* session) {
ASSERT(session_manager_->signaling_thread()->IsCurrent());
TunnelSession* tunnel = NULL;
@@ -182,7 +182,7 @@
session->Reject(STR_TERMINATE_DECLINE);
}
-void TunnelSessionClientBase::OnMessage(talk_base::Message* pmsg) {
+void TunnelSessionClientBase::OnMessage(rtc::Message* pmsg) {
if (pmsg->message_id == MSG_CREATE_TUNNEL) {
ASSERT(session_manager_->signaling_thread()->IsCurrent());
CreateTunnelData* data = static_cast<CreateTunnelData*>(pmsg->pdata);
@@ -201,7 +201,7 @@
}
TunnelSession* TunnelSessionClientBase::MakeTunnelSession(
- Session* session, talk_base::Thread* stream_thread,
+ Session* session, rtc::Thread* stream_thread,
TunnelSessionRole /*role*/) {
return new TunnelSession(this, session, stream_thread);
}
@@ -288,7 +288,7 @@
const buzz::Jid &jid, const std::string &description) {
SessionDescription* offer = NewTunnelSessionDescription(
CN_TUNNEL, new TunnelContentDescription(description));
- talk_base::scoped_ptr<TransportDescription> tdesc(
+ rtc::scoped_ptr<TransportDescription> tdesc(
session_manager_->transport_desc_factory()->CreateOffer(
TransportOptions(), NULL));
if (tdesc.get()) {
@@ -313,7 +313,7 @@
if (tinfo) {
const TransportDescription* offer_tdesc = &tinfo->description;
ASSERT(offer_tdesc != NULL);
- talk_base::scoped_ptr<TransportDescription> tdesc(
+ rtc::scoped_ptr<TransportDescription> tdesc(
session_manager_->transport_desc_factory()->CreateAnswer(
offer_tdesc, TransportOptions(), NULL));
if (tdesc.get()) {
@@ -334,7 +334,7 @@
//
TunnelSession::TunnelSession(TunnelSessionClientBase* client, Session* session,
- talk_base::Thread* stream_thread)
+ rtc::Thread* stream_thread)
: client_(client), session_(session), channel_(NULL) {
ASSERT(client_ != NULL);
ASSERT(session_ != NULL);
@@ -349,7 +349,7 @@
ASSERT(channel_ == NULL);
}
-talk_base::StreamInterface* TunnelSession::GetStream() {
+rtc::StreamInterface* TunnelSession::GetStream() {
ASSERT(channel_ != NULL);
return channel_->GetStream();
}
@@ -375,8 +375,8 @@
void TunnelSession::OnSessionState(BaseSession* session,
BaseSession::State state) {
LOG(LS_INFO) << "TunnelSession::OnSessionState("
- << talk_base::nonnull(
- talk_base::FindLabel(state, SESSION_STATES), "Unknown")
+ << rtc::nonnull(
+ rtc::FindLabel(state, SESSION_STATES), "Unknown")
<< ")";
ASSERT(session == session_);
diff --git a/session/tunnel/tunnelsessionclient.h b/session/tunnel/tunnelsessionclient.h
index 55ce14a..1d9b061 100644
--- a/session/tunnel/tunnelsessionclient.h
+++ b/session/tunnel/tunnelsessionclient.h
@@ -30,8 +30,8 @@
#include <vector>
-#include "talk/base/criticalsection.h"
-#include "talk/base/stream.h"
+#include "webrtc/base/criticalsection.h"
+#include "webrtc/base/stream.h"
#include "talk/p2p/base/constants.h"
#include "talk/p2p/base/pseudotcp.h"
#include "talk/p2p/base/session.h"
@@ -54,7 +54,7 @@
// Base class is still abstract
class TunnelSessionClientBase
- : public SessionClient, public talk_base::MessageHandler {
+ : public SessionClient, public rtc::MessageHandler {
public:
TunnelSessionClientBase(const buzz::Jid& jid, SessionManager* manager,
const std::string &ns);
@@ -69,10 +69,10 @@
// This can be called on any thread. The stream interface is
// thread-safe, but notifications must be registered on the creating
// thread.
- talk_base::StreamInterface* CreateTunnel(const buzz::Jid& to,
+ rtc::StreamInterface* CreateTunnel(const buzz::Jid& to,
const std::string& description);
- talk_base::StreamInterface* AcceptTunnel(Session* session);
+ rtc::StreamInterface* AcceptTunnel(Session* session);
void DeclineTunnel(Session* session);
// Invoked on an incoming tunnel
@@ -88,13 +88,13 @@
protected:
- void OnMessage(talk_base::Message* pmsg);
+ void OnMessage(rtc::Message* pmsg);
// helper method to instantiate TunnelSession. By overriding this,
// subclasses of TunnelSessionClient are able to instantiate
// subclasses of TunnelSession instead.
virtual TunnelSession* MakeTunnelSession(Session* session,
- talk_base::Thread* stream_thread,
+ rtc::Thread* stream_thread,
TunnelSessionRole role);
buzz::Jid jid_;
@@ -155,9 +155,9 @@
public:
// Signalling thread methods
TunnelSession(TunnelSessionClientBase* client, Session* session,
- talk_base::Thread* stream_thread);
+ rtc::Thread* stream_thread);
- virtual talk_base::StreamInterface* GetStream();
+ virtual rtc::StreamInterface* GetStream();
bool HasSession(Session* session);
Session* ReleaseSession(bool channel_exists);
diff --git a/session/tunnel/tunnelsessionclient_unittest.cc b/session/tunnel/tunnelsessionclient_unittest.cc
index 7370351..bec0c6d 100644
--- a/session/tunnel/tunnelsessionclient_unittest.cc
+++ b/session/tunnel/tunnelsessionclient_unittest.cc
@@ -26,12 +26,12 @@
*/
#include <string>
-#include "talk/base/gunit.h"
-#include "talk/base/messagehandler.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/stream.h"
-#include "talk/base/thread.h"
-#include "talk/base/timeutils.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/messagehandler.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/stream.h"
+#include "webrtc/base/thread.h"
+#include "webrtc/base/timeutils.h"
#include "talk/p2p/base/sessionmanager.h"
#include "talk/p2p/base/transport.h"
#include "talk/p2p/client/fakeportallocator.h"
@@ -45,14 +45,14 @@
// This test fixture creates the necessary plumbing to create and run
// two TunnelSessionClients that talk to each other.
class TunnelSessionClientTest : public testing::Test,
- public talk_base::MessageHandler,
+ public rtc::MessageHandler,
public sigslot::has_slots<> {
public:
TunnelSessionClientTest()
- : local_pa_(talk_base::Thread::Current(), NULL),
- remote_pa_(talk_base::Thread::Current(), NULL),
- local_sm_(&local_pa_, talk_base::Thread::Current()),
- remote_sm_(&remote_pa_, talk_base::Thread::Current()),
+ : local_pa_(rtc::Thread::Current(), NULL),
+ remote_pa_(rtc::Thread::Current(), NULL),
+ local_sm_(&local_pa_, rtc::Thread::Current()),
+ remote_sm_(&remote_pa_, rtc::Thread::Current()),
local_client_(kLocalJid, &local_sm_),
remote_client_(kRemoteJid, &remote_sm_),
done_(false) {
@@ -104,19 +104,19 @@
void OnOutgoingMessage(cricket::SessionManager* manager,
const buzz::XmlElement* stanza) {
if (manager == &local_sm_) {
- talk_base::Thread::Current()->Post(this, MSG_LSIGNAL,
- talk_base::WrapMessageData(*stanza));
+ rtc::Thread::Current()->Post(this, MSG_LSIGNAL,
+ rtc::WrapMessageData(*stanza));
} else if (manager == &remote_sm_) {
- talk_base::Thread::Current()->Post(this, MSG_RSIGNAL,
- talk_base::WrapMessageData(*stanza));
+ rtc::Thread::Current()->Post(this, MSG_RSIGNAL,
+ rtc::WrapMessageData(*stanza));
}
}
// Need to add a "from=" attribute (normally added by the server)
// Then route the incoming signaling message to the "other" session manager.
- virtual void OnMessage(talk_base::Message* message) {
- talk_base::TypedMessageData<buzz::XmlElement>* data =
- static_cast<talk_base::TypedMessageData<buzz::XmlElement>*>(
+ virtual void OnMessage(rtc::Message* message) {
+ rtc::TypedMessageData<buzz::XmlElement>* data =
+ static_cast<rtc::TypedMessageData<buzz::XmlElement>*>(
message->pdata);
bool response = data->data().Attr(buzz::QN_TYPE) == buzz::STR_RESULT;
if (message->message_id == MSG_RSIGNAL) {
@@ -150,14 +150,14 @@
// Read bytes out into recv_stream_ as they arrive.
// End the test when we are notified that the local side has closed the
// tunnel. All data has been read out at this point.
- void OnStreamEvent(talk_base::StreamInterface* stream, int events,
+ void OnStreamEvent(rtc::StreamInterface* stream, int events,
int error) {
- if (events & talk_base::SE_READ) {
+ if (events & rtc::SE_READ) {
if (stream == remote_tunnel_.get()) {
ReadData();
}
}
- if (events & talk_base::SE_WRITE) {
+ if (events & rtc::SE_WRITE) {
if (stream == local_tunnel_.get()) {
bool done = false;
WriteData(&done);
@@ -166,7 +166,7 @@
}
}
}
- if (events & talk_base::SE_CLOSE) {
+ if (events & rtc::SE_CLOSE) {
if (stream == remote_tunnel_.get()) {
remote_tunnel_->Close();
done_ = true;
@@ -179,12 +179,12 @@
void ReadData() {
char block[kBlockSize];
size_t read, position;
- talk_base::StreamResult res;
+ rtc::StreamResult res;
while ((res = remote_tunnel_->Read(block, sizeof(block), &read, NULL)) ==
- talk_base::SR_SUCCESS) {
+ rtc::SR_SUCCESS) {
recv_stream_.Write(block, read, NULL, NULL);
}
- ASSERT(res != talk_base::SR_EOS);
+ ASSERT(res != rtc::SR_EOS);
recv_stream_.GetPosition(&position);
LOG(LS_VERBOSE) << "Recv position: " << position;
}
@@ -192,14 +192,14 @@
void WriteData(bool* done) {
char block[kBlockSize];
size_t leftover = 0, position;
- talk_base::StreamResult res = talk_base::Flow(&send_stream_,
+ rtc::StreamResult res = rtc::Flow(&send_stream_,
block, sizeof(block), local_tunnel_.get(), &leftover);
- if (res == talk_base::SR_BLOCK) {
+ if (res == rtc::SR_BLOCK) {
send_stream_.GetPosition(&position);
send_stream_.SetPosition(position - leftover);
LOG(LS_VERBOSE) << "Send position: " << position - leftover;
*done = false;
- } else if (res == talk_base::SR_SUCCESS) {
+ } else if (res == rtc::SR_SUCCESS) {
*done = true;
} else {
ASSERT(false); // shouldn't happen
@@ -213,10 +213,10 @@
cricket::SessionManager remote_sm_;
cricket::TunnelSessionClient local_client_;
cricket::TunnelSessionClient remote_client_;
- talk_base::scoped_ptr<talk_base::StreamInterface> local_tunnel_;
- talk_base::scoped_ptr<talk_base::StreamInterface> remote_tunnel_;
- talk_base::MemoryStream send_stream_;
- talk_base::MemoryStream recv_stream_;
+ rtc::scoped_ptr<rtc::StreamInterface> local_tunnel_;
+ rtc::scoped_ptr<rtc::StreamInterface> remote_tunnel_;
+ rtc::MemoryStream send_stream_;
+ rtc::MemoryStream recv_stream_;
bool done_;
};
diff --git a/sound/alsasoundsystem.cc b/sound/alsasoundsystem.cc
index 7a8857c..fa0a0d9 100644
--- a/sound/alsasoundsystem.cc
+++ b/sound/alsasoundsystem.cc
@@ -27,12 +27,12 @@
#include "talk/sound/alsasoundsystem.h"
-#include "talk/base/common.h"
-#include "talk/base/logging.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/stringutils.h"
-#include "talk/base/timeutils.h"
-#include "talk/base/worker.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/stringutils.h"
+#include "webrtc/base/timeutils.h"
+#include "webrtc/base/worker.h"
#include "talk/sound/sounddevicelocator.h"
#include "talk/sound/soundinputstreaminterface.h"
#include "talk/sound/soundoutputstreaminterface.h"
@@ -71,7 +71,7 @@
: SoundDeviceLocator(name, device_name) {
// The ALSA descriptions have newlines in them, which won't show up in
// a drop-down box. Replace them with hyphens.
- talk_base::replace_substrs(kAlsaDescriptionSearch,
+ rtc::replace_substrs(kAlsaDescriptionSearch,
sizeof(kAlsaDescriptionSearch) - 1,
kAlsaDescriptionReplace,
sizeof(kAlsaDescriptionReplace) - 1,
@@ -163,7 +163,7 @@
return 0;
}
// The delay is in frames. Convert to microseconds.
- return delay * talk_base::kNumMicrosecsPerSec / freq_;
+ return delay * rtc::kNumMicrosecsPerSec / freq_;
}
// Used to recover from certain recoverable errors, principally buffer overrun
@@ -246,7 +246,7 @@
// thread-safety.
class AlsaInputStream :
public SoundInputStreamInterface,
- private talk_base::Worker {
+ private rtc::Worker {
public:
AlsaInputStream(AlsaSoundSystem *alsa,
snd_pcm_t *handle,
@@ -342,7 +342,7 @@
}
AlsaStream stream_;
- talk_base::scoped_ptr<char[]> buffer_;
+ rtc::scoped_ptr<char[]> buffer_;
size_t buffer_size_;
DISALLOW_COPY_AND_ASSIGN(AlsaInputStream);
@@ -352,7 +352,7 @@
// regarding thread-safety.
class AlsaOutputStream :
public SoundOutputStreamInterface,
- private talk_base::Worker {
+ private rtc::Worker {
public:
AlsaOutputStream(AlsaSoundSystem *alsa,
snd_pcm_t *handle,
@@ -584,7 +584,7 @@
if (strcmp(name, ignore_default) != 0 &&
strcmp(name, ignore_null) != 0 &&
strcmp(name, ignore_pulse) != 0 &&
- !talk_base::starts_with(name, ignore_prefix)) {
+ !rtc::starts_with(name, ignore_prefix)) {
// Yes, we do.
char *desc = symbol_table_.snd_device_name_get_hint()(*list, "DESC");
@@ -672,12 +672,12 @@
} else {
// kLowLatency is 0, so we treat it the same as a request for zero latency.
// Compute what the user asked for.
- latency = talk_base::kNumMicrosecsPerSec *
+ latency = rtc::kNumMicrosecsPerSec *
params.latency /
params.freq /
FrameSize(params);
// And this is what we'll actually use.
- latency = talk_base::_max(latency, kMinimumLatencyUsecs);
+ latency = rtc::_max(latency, kMinimumLatencyUsecs);
}
ASSERT(static_cast<int>(params.format) <
@@ -708,7 +708,7 @@
FrameSize(params),
// We set the wait time to twice the requested latency, so that wait
// timeouts should be rare.
- 2 * latency / talk_base::kNumMicrosecsPerMillisec,
+ 2 * latency / rtc::kNumMicrosecsPerMillisec,
params.flags,
params.freq);
if (stream) {
diff --git a/sound/alsasoundsystem.h b/sound/alsasoundsystem.h
index 870f25e..1e08135 100644
--- a/sound/alsasoundsystem.h
+++ b/sound/alsasoundsystem.h
@@ -28,7 +28,7 @@
#ifndef TALK_SOUND_ALSASOUNDSYSTEM_H_
#define TALK_SOUND_ALSASOUNDSYSTEM_H_
-#include "talk/base/constructormagic.h"
+#include "webrtc/base/constructormagic.h"
#include "talk/sound/alsasymboltable.h"
#include "talk/sound/soundsysteminterface.h"
diff --git a/sound/alsasymboltable.cc b/sound/alsasymboltable.cc
index 290c729..570b4b4 100644
--- a/sound/alsasymboltable.cc
+++ b/sound/alsasymboltable.cc
@@ -32,6 +32,6 @@
#define LATE_BINDING_SYMBOL_TABLE_CLASS_NAME ALSA_SYMBOLS_CLASS_NAME
#define LATE_BINDING_SYMBOL_TABLE_SYMBOLS_LIST ALSA_SYMBOLS_LIST
#define LATE_BINDING_SYMBOL_TABLE_DLL_NAME "libasound.so.2"
-#include "talk/base/latebindingsymboltable.cc.def"
+#include "webrtc/base/latebindingsymboltable.cc.def"
} // namespace cricket
diff --git a/sound/alsasymboltable.h b/sound/alsasymboltable.h
index cf7803f..98f1645 100644
--- a/sound/alsasymboltable.h
+++ b/sound/alsasymboltable.h
@@ -30,7 +30,7 @@
#include <alsa/asoundlib.h>
-#include "talk/base/latebindingsymboltable.h"
+#include "webrtc/base/latebindingsymboltable.h"
namespace cricket {
@@ -59,7 +59,7 @@
#define LATE_BINDING_SYMBOL_TABLE_CLASS_NAME ALSA_SYMBOLS_CLASS_NAME
#define LATE_BINDING_SYMBOL_TABLE_SYMBOLS_LIST ALSA_SYMBOLS_LIST
-#include "talk/base/latebindingsymboltable.h.def"
+#include "webrtc/base/latebindingsymboltable.h.def"
} // namespace cricket
diff --git a/sound/automaticallychosensoundsystem.h b/sound/automaticallychosensoundsystem.h
index 026c080..afe62c3 100644
--- a/sound/automaticallychosensoundsystem.h
+++ b/sound/automaticallychosensoundsystem.h
@@ -28,9 +28,9 @@
#ifndef TALK_SOUND_AUTOMATICALLYCHOSENSOUNDSYSTEM_H_
#define TALK_SOUND_AUTOMATICALLYCHOSENSOUNDSYSTEM_H_
-#include "talk/base/common.h"
-#include "talk/base/logging.h"
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/sound/soundsysteminterface.h"
#include "talk/sound/soundsystemproxy.h"
@@ -54,7 +54,7 @@
virtual const char *GetName() const;
private:
- talk_base::scoped_ptr<SoundSystemInterface> sound_systems_[kNumSoundSystems];
+ rtc::scoped_ptr<SoundSystemInterface> sound_systems_[kNumSoundSystems];
};
template <const SoundSystemCreator kSoundSystemCreators[], int kNumSoundSystems>
diff --git a/sound/automaticallychosensoundsystem_unittest.cc b/sound/automaticallychosensoundsystem_unittest.cc
index a8afeec..a57b283 100644
--- a/sound/automaticallychosensoundsystem_unittest.cc
+++ b/sound/automaticallychosensoundsystem_unittest.cc
@@ -25,7 +25,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/gunit.h"
+#include "webrtc/base/gunit.h"
#include "talk/sound/automaticallychosensoundsystem.h"
#include "talk/sound/nullsoundsystem.h"
diff --git a/sound/nullsoundsystem.cc b/sound/nullsoundsystem.cc
index 2920008..fc16ccb 100644
--- a/sound/nullsoundsystem.cc
+++ b/sound/nullsoundsystem.cc
@@ -27,12 +27,12 @@
#include "talk/sound/nullsoundsystem.h"
-#include "talk/base/logging.h"
+#include "webrtc/base/logging.h"
#include "talk/sound/sounddevicelocator.h"
#include "talk/sound/soundinputstreaminterface.h"
#include "talk/sound/soundoutputstreaminterface.h"
-namespace talk_base {
+namespace rtc {
class Thread;
diff --git a/sound/platformsoundsystem.cc b/sound/platformsoundsystem.cc
index 9dff9ae..c39fc83 100644
--- a/sound/platformsoundsystem.cc
+++ b/sound/platformsoundsystem.cc
@@ -27,7 +27,7 @@
#include "talk/sound/platformsoundsystem.h"
-#include "talk/base/common.h"
+#include "webrtc/base/common.h"
#ifdef LINUX
#include "talk/sound/linuxsoundsystem.h"
#else
diff --git a/sound/pulseaudiosoundsystem.cc b/sound/pulseaudiosoundsystem.cc
index 7eb690a..1ffb24b 100644
--- a/sound/pulseaudiosoundsystem.cc
+++ b/sound/pulseaudiosoundsystem.cc
@@ -29,11 +29,11 @@
#ifdef HAVE_LIBPULSE
-#include "talk/base/common.h"
-#include "talk/base/fileutils.h" // for GetApplicationName()
-#include "talk/base/logging.h"
-#include "talk/base/worker.h"
-#include "talk/base/timeutils.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/fileutils.h" // for GetApplicationName()
+#include "webrtc/base/logging.h"
+#include "webrtc/base/worker.h"
+#include "webrtc/base/timeutils.h"
#include "talk/sound/sounddevicelocator.h"
#include "talk/sound/soundinputstreaminterface.h"
#include "talk/sound/soundoutputstreaminterface.h"
@@ -229,7 +229,7 @@
// thread-safety.
class PulseAudioInputStream :
public SoundInputStreamInterface,
- private talk_base::Worker {
+ private rtc::Worker {
struct GetVolumeCallbackData {
PulseAudioInputStream *instance;
@@ -593,7 +593,7 @@
// regarding thread-safety.
class PulseAudioOutputStream :
public SoundOutputStreamInterface,
- private talk_base::Worker {
+ private rtc::Worker {
struct GetVolumeCallbackData {
PulseAudioOutputStream *instance;
@@ -904,7 +904,7 @@
int new_latency = configured_latency_ +
bytes_per_sec * kPlaybackLatencyIncrementMsecs /
- talk_base::kNumMicrosecsPerSec;
+ rtc::kNumMicrosecsPerSec;
pa_buffer_attr new_attr = {0};
FillPlaybackBufferAttr(new_latency, &new_attr);
@@ -1181,7 +1181,7 @@
std::string app_name;
// TODO: Pulse etiquette says this name should be localized. Do
// we care?
- talk_base::Filesystem::GetApplicationName(&app_name);
+ rtc::Filesystem::GetApplicationName(&app_name);
pa_context *context = symbol_table_.pa_context_new()(
symbol_table_.pa_threaded_mainloop_get_api()(mainloop_),
app_name.c_str());
@@ -1458,11 +1458,11 @@
if (latency != kNoLatencyRequirements) {
// kLowLatency is 0, so we treat it the same as a request for zero latency.
ssize_t bytes_per_sec = symbol_table_.pa_bytes_per_second()(&spec);
- latency = talk_base::_max(
+ latency = rtc::_max(
latency,
static_cast<int>(
bytes_per_sec * kPlaybackLatencyMinimumMsecs /
- talk_base::kNumMicrosecsPerSec));
+ rtc::kNumMicrosecsPerSec));
FillPlaybackBufferAttr(latency, &attr);
pattr = &attr;
}
@@ -1494,13 +1494,13 @@
size_t bytes_per_sec = symbol_table_.pa_bytes_per_second()(&spec);
if (latency == kLowLatency) {
latency = bytes_per_sec * kLowCaptureLatencyMsecs /
- talk_base::kNumMicrosecsPerSec;
+ rtc::kNumMicrosecsPerSec;
}
// Note: fragsize specifies a maximum transfer size, not a minimum, so it is
// not possible to force a high latency setting, only a low one.
attr.fragsize = latency;
attr.maxlength = latency + bytes_per_sec * kCaptureBufferExtraMsecs /
- talk_base::kNumMicrosecsPerSec;
+ rtc::kNumMicrosecsPerSec;
LOG(LS_VERBOSE) << "Configuring latency = " << attr.fragsize
<< ", maxlength = " << attr.maxlength;
pattr = &attr;
diff --git a/sound/pulseaudiosoundsystem.h b/sound/pulseaudiosoundsystem.h
index 8a9fe49..53b9507 100644
--- a/sound/pulseaudiosoundsystem.h
+++ b/sound/pulseaudiosoundsystem.h
@@ -30,7 +30,7 @@
#ifdef HAVE_LIBPULSE
-#include "talk/base/constructormagic.h"
+#include "webrtc/base/constructormagic.h"
#include "talk/sound/pulseaudiosymboltable.h"
#include "talk/sound/soundsysteminterface.h"
diff --git a/sound/pulseaudiosymboltable.cc b/sound/pulseaudiosymboltable.cc
index 05213ec..344f354 100644
--- a/sound/pulseaudiosymboltable.cc
+++ b/sound/pulseaudiosymboltable.cc
@@ -34,7 +34,7 @@
#define LATE_BINDING_SYMBOL_TABLE_CLASS_NAME PULSE_AUDIO_SYMBOLS_CLASS_NAME
#define LATE_BINDING_SYMBOL_TABLE_SYMBOLS_LIST PULSE_AUDIO_SYMBOLS_LIST
#define LATE_BINDING_SYMBOL_TABLE_DLL_NAME "libpulse.so.0"
-#include "talk/base/latebindingsymboltable.cc.def"
+#include "webrtc/base/latebindingsymboltable.cc.def"
} // namespace cricket
diff --git a/sound/pulseaudiosymboltable.h b/sound/pulseaudiosymboltable.h
index ef65157..46bddea 100644
--- a/sound/pulseaudiosymboltable.h
+++ b/sound/pulseaudiosymboltable.h
@@ -35,7 +35,7 @@
#include <pulse/stream.h>
#include <pulse/thread-mainloop.h>
-#include "talk/base/latebindingsymboltable.h"
+#include "webrtc/base/latebindingsymboltable.h"
namespace cricket {
@@ -97,7 +97,7 @@
#define LATE_BINDING_SYMBOL_TABLE_CLASS_NAME PULSE_AUDIO_SYMBOLS_CLASS_NAME
#define LATE_BINDING_SYMBOL_TABLE_SYMBOLS_LIST PULSE_AUDIO_SYMBOLS_LIST
-#include "talk/base/latebindingsymboltable.h.def"
+#include "webrtc/base/latebindingsymboltable.h.def"
} // namespace cricket
diff --git a/sound/sounddevicelocator.h b/sound/sounddevicelocator.h
index e0a8970..420226f 100644
--- a/sound/sounddevicelocator.h
+++ b/sound/sounddevicelocator.h
@@ -30,7 +30,7 @@
#include <string>
-#include "talk/base/constructormagic.h"
+#include "webrtc/base/constructormagic.h"
namespace cricket {
diff --git a/sound/soundinputstreaminterface.h b/sound/soundinputstreaminterface.h
index de831a6..e557392 100644
--- a/sound/soundinputstreaminterface.h
+++ b/sound/soundinputstreaminterface.h
@@ -28,14 +28,14 @@
#ifndef TALK_SOUND_SOUNDINPUTSTREAMINTERFACE_H_
#define TALK_SOUND_SOUNDINPUTSTREAMINTERFACE_H_
-#include "talk/base/constructormagic.h"
-#include "talk/base/sigslot.h"
+#include "webrtc/base/constructormagic.h"
+#include "webrtc/base/sigslot.h"
namespace cricket {
// Interface for consuming an input stream from a recording device.
// Semantics and thread-safety of StartReading()/StopReading() are the same as
-// for talk_base::Worker.
+// for rtc::Worker.
class SoundInputStreamInterface {
public:
virtual ~SoundInputStreamInterface() {}
diff --git a/sound/soundoutputstreaminterface.h b/sound/soundoutputstreaminterface.h
index d096ba3..294906d 100644
--- a/sound/soundoutputstreaminterface.h
+++ b/sound/soundoutputstreaminterface.h
@@ -28,14 +28,14 @@
#ifndef TALK_SOUND_SOUNDOUTPUTSTREAMINTERFACE_H_
#define TALK_SOUND_SOUNDOUTPUTSTREAMINTERFACE_H_
-#include "talk/base/constructormagic.h"
-#include "talk/base/sigslot.h"
+#include "webrtc/base/constructormagic.h"
+#include "webrtc/base/sigslot.h"
namespace cricket {
// Interface for outputting a stream to a playback device.
// Semantics and thread-safety of EnableBufferMonitoring()/
-// DisableBufferMonitoring() are the same as for talk_base::Worker.
+// DisableBufferMonitoring() are the same as for rtc::Worker.
class SoundOutputStreamInterface {
public:
virtual ~SoundOutputStreamInterface() {}
diff --git a/sound/soundsystemfactory.h b/sound/soundsystemfactory.h
index 517220b..06a1c3f 100644
--- a/sound/soundsystemfactory.h
+++ b/sound/soundsystemfactory.h
@@ -28,16 +28,16 @@
#ifndef TALK_SOUND_SOUNDSYSTEMFACTORY_H_
#define TALK_SOUND_SOUNDSYSTEMFACTORY_H_
-#include "talk/base/referencecountedsingletonfactory.h"
+#include "webrtc/base/referencecountedsingletonfactory.h"
namespace cricket {
class SoundSystemInterface;
-typedef talk_base::ReferenceCountedSingletonFactory<SoundSystemInterface>
+typedef rtc::ReferenceCountedSingletonFactory<SoundSystemInterface>
SoundSystemFactory;
-typedef talk_base::rcsf_ptr<SoundSystemInterface> SoundSystemHandle;
+typedef rtc::rcsf_ptr<SoundSystemInterface> SoundSystemHandle;
} // namespace cricket
diff --git a/sound/soundsysteminterface.h b/sound/soundsysteminterface.h
index 7a059b0..5d3e84b 100644
--- a/sound/soundsysteminterface.h
+++ b/sound/soundsysteminterface.h
@@ -30,7 +30,7 @@
#include <vector>
-#include "talk/base/constructormagic.h"
+#include "webrtc/base/constructormagic.h"
namespace cricket {
diff --git a/sound/soundsystemproxy.h b/sound/soundsystemproxy.h
index 9ccace8..0570704 100644
--- a/sound/soundsystemproxy.h
+++ b/sound/soundsystemproxy.h
@@ -28,7 +28,7 @@
#ifndef TALK_SOUND_SOUNDSYSTEMPROXY_H_
#define TALK_SOUND_SOUNDSYSTEMPROXY_H_
-#include "talk/base/basictypes.h" // for NULL
+#include "webrtc/base/basictypes.h" // for NULL
#include "talk/sound/soundsysteminterface.h"
namespace cricket {
diff --git a/xmllite/qname_unittest.cc b/xmllite/qname_unittest.cc
index 976d822..7ae27fb 100644
--- a/xmllite/qname_unittest.cc
+++ b/xmllite/qname_unittest.cc
@@ -26,7 +26,7 @@
*/
#include <string>
-#include "talk/base/gunit.h"
+#include "webrtc/base/gunit.h"
#include "talk/xmllite/qname.h"
using buzz::StaticQName;
diff --git a/xmllite/xmlbuilder.cc b/xmllite/xmlbuilder.cc
index f71e542..e923a3d 100644
--- a/xmllite/xmlbuilder.cc
+++ b/xmllite/xmlbuilder.cc
@@ -29,7 +29,7 @@
#include <vector>
#include <set>
-#include "talk/base/common.h"
+#include "webrtc/base/common.h"
#include "talk/xmllite/xmlconstants.h"
#include "talk/xmllite/xmlelement.h"
@@ -107,8 +107,8 @@
void
XmlBuilder::EndElement(XmlParseContext * pctx, const char * name) {
- UNUSED(pctx);
- UNUSED(name);
+ RTC_UNUSED(pctx);
+ RTC_UNUSED(name);
pelCurrent_ = pvParents_->back();
pvParents_->pop_back();
}
@@ -116,7 +116,7 @@
void
XmlBuilder::CharacterData(XmlParseContext * pctx,
const char * text, int len) {
- UNUSED(pctx);
+ RTC_UNUSED(pctx);
if (pelCurrent_) {
pelCurrent_->AddParsedText(text, len);
}
@@ -124,8 +124,8 @@
void
XmlBuilder::Error(XmlParseContext * pctx, XML_Error err) {
- UNUSED(pctx);
- UNUSED(err);
+ RTC_UNUSED(pctx);
+ RTC_UNUSED(err);
pelRoot_.reset(NULL);
pelCurrent_ = NULL;
pvParents_->clear();
diff --git a/xmllite/xmlbuilder.h b/xmllite/xmlbuilder.h
index 984eee2..a80773e 100644
--- a/xmllite/xmlbuilder.h
+++ b/xmllite/xmlbuilder.h
@@ -30,7 +30,7 @@
#include <string>
#include <vector>
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/xmllite/xmlparser.h"
#ifdef EXPAT_RELATIVE_PATH
@@ -69,8 +69,8 @@
private:
XmlElement * pelCurrent_;
- talk_base::scoped_ptr<XmlElement> pelRoot_;
- talk_base::scoped_ptr<std::vector<XmlElement*> > pvParents_;
+ rtc::scoped_ptr<XmlElement> pelRoot_;
+ rtc::scoped_ptr<std::vector<XmlElement*> > pvParents_;
};
}
diff --git a/xmllite/xmlbuilder_unittest.cc b/xmllite/xmlbuilder_unittest.cc
index 9302276..0f0c1e5 100644
--- a/xmllite/xmlbuilder_unittest.cc
+++ b/xmllite/xmlbuilder_unittest.cc
@@ -28,8 +28,8 @@
#include <string>
#include <sstream>
#include <iostream>
-#include "talk/base/common.h"
-#include "talk/base/gunit.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/gunit.h"
#include "talk/xmllite/xmlbuilder.h"
#include "talk/xmllite/xmlelement.h"
#include "talk/xmllite/xmlparser.h"
diff --git a/xmllite/xmlelement.cc b/xmllite/xmlelement.cc
index 176ce5c..d8fb1e8 100644
--- a/xmllite/xmlelement.cc
+++ b/xmllite/xmlelement.cc
@@ -32,7 +32,7 @@
#include <string>
#include <vector>
-#include "talk/base/common.h"
+#include "webrtc/base/common.h"
#include "talk/xmllite/qname.h"
#include "talk/xmllite/xmlparser.h"
#include "talk/xmllite/xmlbuilder.h"
diff --git a/xmllite/xmlelement.h b/xmllite/xmlelement.h
index ffdc333..cdb6873 100644
--- a/xmllite/xmlelement.h
+++ b/xmllite/xmlelement.h
@@ -31,7 +31,7 @@
#include <iosfwd>
#include <string>
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/xmllite/qname.h"
namespace buzz {
diff --git a/xmllite/xmlelement_unittest.cc b/xmllite/xmlelement_unittest.cc
index 3c31ce4..88b0a40 100644
--- a/xmllite/xmlelement_unittest.cc
+++ b/xmllite/xmlelement_unittest.cc
@@ -28,9 +28,9 @@
#include <string>
#include <sstream>
#include <iostream>
-#include "talk/base/common.h"
-#include "talk/base/gunit.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/thread.h"
#include "talk/xmllite/xmlelement.h"
using buzz::QName;
@@ -230,7 +230,7 @@
delete element;
}
-class XmlElementCreatorThread : public talk_base::Thread {
+class XmlElementCreatorThread : public rtc::Thread {
public:
XmlElementCreatorThread(int count, buzz::QName qname) :
count_(count), qname_(qname) {}
@@ -261,7 +261,7 @@
int elem_count = 100; // Was 100000, but that's too slow.
buzz::QName qname("foo", "bar");
- std::vector<talk_base::Thread*> threads;
+ std::vector<rtc::Thread*> threads;
for (int i = 0; i < thread_count; i++) {
threads.push_back(
new XmlElementCreatorThread(elem_count, qname));
diff --git a/xmllite/xmlnsstack.h b/xmllite/xmlnsstack.h
index f6b4b81..3acc7d4 100644
--- a/xmllite/xmlnsstack.h
+++ b/xmllite/xmlnsstack.h
@@ -30,7 +30,7 @@
#include <string>
#include <vector>
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/xmllite/qname.h"
namespace buzz {
@@ -54,8 +54,8 @@
private:
- talk_base::scoped_ptr<std::vector<std::string> > pxmlnsStack_;
- talk_base::scoped_ptr<std::vector<size_t> > pxmlnsDepthStack_;
+ rtc::scoped_ptr<std::vector<std::string> > pxmlnsStack_;
+ rtc::scoped_ptr<std::vector<size_t> > pxmlnsDepthStack_;
};
}
diff --git a/xmllite/xmlnsstack_unittest.cc b/xmllite/xmlnsstack_unittest.cc
index 20b5972..4dc9042 100644
--- a/xmllite/xmlnsstack_unittest.cc
+++ b/xmllite/xmlnsstack_unittest.cc
@@ -31,8 +31,8 @@
#include <sstream>
#include <iostream>
-#include "talk/base/common.h"
-#include "talk/base/gunit.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/gunit.h"
#include "talk/xmllite/xmlconstants.h"
using buzz::NS_XML;
diff --git a/xmllite/xmlparser.cc b/xmllite/xmlparser.cc
index 8802231..f12040f 100644
--- a/xmllite/xmlparser.cc
+++ b/xmllite/xmlparser.cc
@@ -30,7 +30,7 @@
#include <string>
#include <vector>
-#include "talk/base/common.h"
+#include "webrtc/base/common.h"
#include "talk/xmllite/xmlconstants.h"
#include "talk/xmllite/xmlelement.h"
#include "talk/xmllite/xmlnsstack.h"
diff --git a/xmllite/xmlparser_unittest.cc b/xmllite/xmlparser_unittest.cc
index 24947fb..ae0867e 100644
--- a/xmllite/xmlparser_unittest.cc
+++ b/xmllite/xmlparser_unittest.cc
@@ -28,8 +28,8 @@
#include <string>
#include <sstream>
#include <iostream>
-#include "talk/base/common.h"
-#include "talk/base/gunit.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/gunit.h"
#include "talk/xmllite/qname.h"
#include "talk/xmllite/xmlparser.h"
@@ -51,17 +51,17 @@
ss_ << ") ";
}
virtual void EndElement(XmlParseContext * pctx, const char * name) {
- UNUSED(pctx);
- UNUSED(name);
+ RTC_UNUSED(pctx);
+ RTC_UNUSED(name);
ss_ << "END ";
}
virtual void CharacterData(XmlParseContext * pctx,
const char * text, int len) {
- UNUSED(pctx);
+ RTC_UNUSED(pctx);
ss_ << "TEXT (" << std::string(text, len) << ") ";
}
virtual void Error(XmlParseContext * pctx, XML_Error code) {
- UNUSED(pctx);
+ RTC_UNUSED(pctx);
ss_ << "ERROR (" << static_cast<int>(code) << ") ";
}
virtual ~XmlParserTestHandler() {
diff --git a/xmllite/xmlprinter_unittest.cc b/xmllite/xmlprinter_unittest.cc
index 60b0e42..309e507 100644
--- a/xmllite/xmlprinter_unittest.cc
+++ b/xmllite/xmlprinter_unittest.cc
@@ -30,8 +30,8 @@
#include <sstream>
#include <string>
-#include "talk/base/common.h"
-#include "talk/base/gunit.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/gunit.h"
#include "talk/xmllite/qname.h"
#include "talk/xmllite/xmlelement.h"
#include "talk/xmllite/xmlnsstack.h"
diff --git a/xmpp/asyncsocket.h b/xmpp/asyncsocket.h
index fb4ef02..e31e29e 100644
--- a/xmpp/asyncsocket.h
+++ b/xmpp/asyncsocket.h
@@ -28,9 +28,9 @@
#ifndef _ASYNCSOCKET_H_
#define _ASYNCSOCKET_H_
-#include "talk/base/sigslot.h"
+#include "webrtc/base/sigslot.h"
-namespace talk_base {
+namespace rtc {
class SocketAddress;
}
@@ -64,7 +64,7 @@
virtual Error error() = 0;
virtual int GetError() = 0; // winsock error code
- virtual bool Connect(const talk_base::SocketAddress& addr) = 0;
+ virtual bool Connect(const rtc::SocketAddress& addr) = 0;
virtual bool Read(char * data, size_t len, size_t* len_read) = 0;
virtual bool Write(const char * data, size_t len) = 0;
virtual bool Close() = 0;
diff --git a/xmpp/chatroommodule_unittest.cc b/xmpp/chatroommodule_unittest.cc
index a152f60..8c0c662 100644
--- a/xmpp/chatroommodule_unittest.cc
+++ b/xmpp/chatroommodule_unittest.cc
@@ -116,7 +116,7 @@
void ChatroomEnteredStatus(XmppChatroomModule* room,
XmppChatroomEnteredStatus status) {
- UNUSED(room);
+ RTC_UNUSED(room);
ss_ <<"[ChatroomEnteredStatus status: ";
WriteEnteredStatus(ss_, status);
ss_ <<"]";
@@ -125,7 +125,7 @@
void ChatroomExitedStatus(XmppChatroomModule* room,
XmppChatroomExitedStatus status) {
- UNUSED(room);
+ RTC_UNUSED(room);
ss_ <<"[ChatroomExitedStatus status: ";
WriteExitedStatus(ss_, status);
ss_ <<"]";
@@ -133,24 +133,24 @@
void MemberEntered(XmppChatroomModule* room,
const XmppChatroomMember* entered_member) {
- UNUSED(room);
+ RTC_UNUSED(room);
ss_ << "[MemberEntered " << entered_member->member_jid().Str() << "]";
}
void MemberExited(XmppChatroomModule* room,
const XmppChatroomMember* exited_member) {
- UNUSED(room);
+ RTC_UNUSED(room);
ss_ << "[MemberExited " << exited_member->member_jid().Str() << "]";
}
void MemberChanged(XmppChatroomModule* room,
const XmppChatroomMember* changed_member) {
- UNUSED(room);
+ RTC_UNUSED(room);
ss_ << "[MemberChanged " << changed_member->member_jid().Str() << "]";
}
virtual void MessageReceived(XmppChatroomModule* room, const XmlElement& message) {
- UNUSED2(room, message);
+ RTC_UNUSED2(room, message);
}
diff --git a/xmpp/chatroommoduleimpl.cc b/xmpp/chatroommoduleimpl.cc
index a12ff5e..6e94f28 100644
--- a/xmpp/chatroommoduleimpl.cc
+++ b/xmpp/chatroommoduleimpl.cc
@@ -31,7 +31,7 @@
#include <algorithm>
#include <sstream>
#include <iostream>
-#include "talk/base/common.h"
+#include "webrtc/base/common.h"
#include "talk/xmpp/constants.h"
#include "talk/xmpp/moduleimpl.h"
#include "talk/xmpp/chatroommodule.h"
@@ -74,7 +74,7 @@
virtual XmppReturnStatus SendMessage(const XmlElement& message);
// XmppModule
- virtual void IqResponse(XmppIqCookie cookie, const XmlElement * pelStanza) {UNUSED2(cookie, pelStanza);}
+ virtual void IqResponse(XmppIqCookie cookie, const XmlElement * pelStanza) {RTC_UNUSED2(cookie, pelStanza);}
virtual bool HandleStanza(const XmlElement *);
private:
@@ -121,7 +121,7 @@
const XmppPresence* presence() const;
private:
- talk_base::scoped_ptr<XmppPresence> presence_;
+ rtc::scoped_ptr<XmppPresence> presence_;
};
class XmppChatroomMemberEnumeratorImpl :
@@ -276,7 +276,7 @@
const std::string& password,
const std::string& client_version,
const std::string& locale) {
- UNUSED(password);
+ RTC_UNUSED(password);
if (!engine())
return XMPP_RETURN_BADSTATE;
@@ -446,7 +446,7 @@
XmppChatroomModuleImpl::FireEnteredStatus(const XmlElement* presence,
XmppChatroomEnteredStatus status) {
if (chatroom_handler_) {
- talk_base::scoped_ptr<XmppPresence> xmpp_presence(XmppPresence::Create());
+ rtc::scoped_ptr<XmppPresence> xmpp_presence(XmppPresence::Create());
xmpp_presence->set_raw_xml(presence);
chatroom_handler_->ChatroomEnteredStatus(this, xmpp_presence.get(), status);
}
@@ -488,7 +488,7 @@
XmppChatroomModuleImpl::ServerChangedOtherPresence(const XmlElement&
presence_element) {
XmppReturnStatus xmpp_status = XMPP_RETURN_OK;
- talk_base::scoped_ptr<XmppPresence> presence(XmppPresence::Create());
+ rtc::scoped_ptr<XmppPresence> presence(XmppPresence::Create());
IFR(presence->set_raw_xml(&presence_element));
JidMemberMap::iterator pos = chatroom_jid_members_.find(presence->jid());
@@ -542,7 +542,7 @@
XmppChatroomModuleImpl::ChangePresence(XmppChatroomState new_state,
const XmlElement* presence,
bool isServer) {
- UNUSED(presence);
+ RTC_UNUSED(presence);
XmppChatroomState old_state = chatroom_state_;
diff --git a/xmpp/constants.cc b/xmpp/constants.cc
index f69f84e..964d5c1 100644
--- a/xmpp/constants.cc
+++ b/xmpp/constants.cc
@@ -29,7 +29,7 @@
#include <string>
-#include "talk/base/basicdefs.h"
+#include "webrtc/base/basicdefs.h"
#include "talk/xmllite/xmlconstants.h"
#include "talk/xmllite/xmlelement.h"
#include "talk/xmllite/qname.h"
diff --git a/xmpp/discoitemsquerytask.cc b/xmpp/discoitemsquerytask.cc
index 7cdee2c..3671cb4 100644
--- a/xmpp/discoitemsquerytask.cc
+++ b/xmpp/discoitemsquerytask.cc
@@ -25,7 +25,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/xmpp/constants.h"
#include "talk/xmpp/discoitemsquerytask.h"
#include "talk/xmpp/xmpptask.h"
diff --git a/xmpp/fakexmppclient.h b/xmpp/fakexmppclient.h
index 83b8e82..3522ba9 100644
--- a/xmpp/fakexmppclient.h
+++ b/xmpp/fakexmppclient.h
@@ -42,7 +42,7 @@
class FakeXmppClient : public XmppTaskParentInterface,
public XmppClientInterface {
public:
- explicit FakeXmppClient(talk_base::TaskParent* parent)
+ explicit FakeXmppClient(rtc::TaskParent* parent)
: XmppTaskParentInterface(parent) {
}
diff --git a/xmpp/hangoutpubsubclient.cc b/xmpp/hangoutpubsubclient.cc
index aede563..63baecc 100644
--- a/xmpp/hangoutpubsubclient.cc
+++ b/xmpp/hangoutpubsubclient.cc
@@ -27,7 +27,7 @@
#include "talk/xmpp/hangoutpubsubclient.h"
-#include "talk/base/logging.h"
+#include "webrtc/base/logging.h"
#include "talk/xmpp/constants.h"
#include "talk/xmpp/jid.h"
#include "talk/xmllite/qname.h"
diff --git a/xmpp/hangoutpubsubclient.h b/xmpp/hangoutpubsubclient.h
index 2fcd691..3842c47 100644
--- a/xmpp/hangoutpubsubclient.h
+++ b/xmpp/hangoutpubsubclient.h
@@ -32,9 +32,9 @@
#include <string>
#include <vector>
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/sigslot.h"
-#include "talk/base/sigslotrepeater.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/sigslotrepeater.h"
#include "talk/xmpp/jid.h"
#include "talk/xmpp/pubsubclient.h"
#include "talk/xmpp/pubsubstateclient.h"
@@ -180,14 +180,14 @@
const XmlElement* stanza);
Jid mucjid_;
std::string nick_;
- talk_base::scoped_ptr<PubSubClient> media_client_;
- talk_base::scoped_ptr<PubSubClient> presenter_client_;
- talk_base::scoped_ptr<PubSubStateClient<bool> > presenter_state_client_;
- talk_base::scoped_ptr<PubSubStateClient<bool> > audio_mute_state_client_;
- talk_base::scoped_ptr<PubSubStateClient<bool> > video_mute_state_client_;
- talk_base::scoped_ptr<PubSubStateClient<bool> > video_pause_state_client_;
- talk_base::scoped_ptr<PubSubStateClient<bool> > recording_state_client_;
- talk_base::scoped_ptr<PubSubStateClient<bool> > media_block_state_client_;
+ rtc::scoped_ptr<PubSubClient> media_client_;
+ rtc::scoped_ptr<PubSubClient> presenter_client_;
+ rtc::scoped_ptr<PubSubStateClient<bool> > presenter_state_client_;
+ rtc::scoped_ptr<PubSubStateClient<bool> > audio_mute_state_client_;
+ rtc::scoped_ptr<PubSubStateClient<bool> > video_mute_state_client_;
+ rtc::scoped_ptr<PubSubStateClient<bool> > video_pause_state_client_;
+ rtc::scoped_ptr<PubSubStateClient<bool> > recording_state_client_;
+ rtc::scoped_ptr<PubSubStateClient<bool> > media_block_state_client_;
};
} // namespace buzz
diff --git a/xmpp/hangoutpubsubclient_unittest.cc b/xmpp/hangoutpubsubclient_unittest.cc
index 1d1c14b..5e8b852 100644
--- a/xmpp/hangoutpubsubclient_unittest.cc
+++ b/xmpp/hangoutpubsubclient_unittest.cc
@@ -3,9 +3,9 @@
#include <string>
-#include "talk/base/faketaskrunner.h"
-#include "talk/base/gunit.h"
-#include "talk/base/sigslot.h"
+#include "webrtc/base/faketaskrunner.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/sigslot.h"
#include "talk/xmllite/qname.h"
#include "talk/xmllite/xmlelement.h"
#include "talk/xmpp/constants.h"
@@ -181,7 +181,7 @@
pubsubjid("room@domain.com"),
nick("me") {
- runner.reset(new talk_base::FakeTaskRunner());
+ runner.reset(new rtc::FakeTaskRunner());
xmpp_client = new buzz::FakeXmppClient(runner.get());
client.reset(new buzz::HangoutPubSubClient(xmpp_client, pubsubjid, nick));
listener.reset(new TestHangoutPubSubListener());
@@ -221,11 +221,11 @@
listener.get(), &TestHangoutPubSubListener::OnMediaBlockError);
}
- talk_base::scoped_ptr<talk_base::FakeTaskRunner> runner;
+ rtc::scoped_ptr<rtc::FakeTaskRunner> runner;
// xmpp_client deleted by deleting runner.
buzz::FakeXmppClient* xmpp_client;
- talk_base::scoped_ptr<buzz::HangoutPubSubClient> client;
- talk_base::scoped_ptr<TestHangoutPubSubListener> listener;
+ rtc::scoped_ptr<buzz::HangoutPubSubClient> client;
+ rtc::scoped_ptr<TestHangoutPubSubListener> listener;
buzz::Jid pubsubjid;
std::string nick;
};
diff --git a/xmpp/iqtask.h b/xmpp/iqtask.h
index 2228e6f..34a62b1 100644
--- a/xmpp/iqtask.h
+++ b/xmpp/iqtask.h
@@ -57,7 +57,7 @@
virtual int OnTimeout();
Jid to_;
- talk_base::scoped_ptr<XmlElement> stanza_;
+ rtc::scoped_ptr<XmlElement> stanza_;
};
} // namespace buzz
diff --git a/xmpp/jid.cc b/xmpp/jid.cc
index 4583871..3a19e05 100644
--- a/xmpp/jid.cc
+++ b/xmpp/jid.cc
@@ -32,8 +32,8 @@
#include <algorithm>
#include <string>
-#include "talk/base/common.h"
-#include "talk/base/logging.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/logging.h"
#include "talk/xmpp/constants.h"
namespace buzz {
diff --git a/xmpp/jid.h b/xmpp/jid.h
index dcfc123..309048b 100644
--- a/xmpp/jid.h
+++ b/xmpp/jid.h
@@ -29,7 +29,7 @@
#define TALK_XMPP_JID_H_
#include <string>
-#include "talk/base/basictypes.h"
+#include "webrtc/base/basictypes.h"
#include "talk/xmllite/xmlconstants.h"
namespace buzz {
diff --git a/xmpp/jid_unittest.cc b/xmpp/jid_unittest.cc
index b9597da..c728bee 100644
--- a/xmpp/jid_unittest.cc
+++ b/xmpp/jid_unittest.cc
@@ -1,7 +1,7 @@
// Copyright 2004 Google Inc. All Rights Reserved
-#include "talk/base/gunit.h"
+#include "webrtc/base/gunit.h"
#include "talk/xmpp/jid.h"
using buzz::Jid;
diff --git a/xmpp/jingleinfotask.cc b/xmpp/jingleinfotask.cc
index cf3eac2..9727d96 100644
--- a/xmpp/jingleinfotask.cc
+++ b/xmpp/jingleinfotask.cc
@@ -27,7 +27,7 @@
#include "talk/xmpp/jingleinfotask.h"
-#include "talk/base/socketaddress.h"
+#include "webrtc/base/socketaddress.h"
#include "talk/xmpp/constants.h"
#include "talk/xmpp/xmppclient.h"
#include "talk/xmpp/xmpptask.h"
@@ -41,7 +41,7 @@
done_(false) {}
virtual int ProcessStart() {
- talk_base::scoped_ptr<XmlElement> get(
+ rtc::scoped_ptr<XmlElement> get(
MakeIq(STR_GET, Jid(), task_id()));
get->AddElement(new XmlElement(QN_JINGLE_INFO_QUERY, true));
if (SendStanza(get.get()) != XMPP_RETURN_OK) {
@@ -101,7 +101,7 @@
int
JingleInfoTask::ProcessStart() {
std::vector<std::string> relay_hosts;
- std::vector<talk_base::SocketAddress> stun_hosts;
+ std::vector<rtc::SocketAddress> stun_hosts;
std::string relay_token;
const XmlElement * stanza = NextStanza();
if (stanza == NULL)
@@ -116,7 +116,7 @@
std::string host = server->Attr(QN_JINGLE_INFO_HOST);
std::string port = server->Attr(QN_JINGLE_INFO_UDP);
if (host != STR_EMPTY && host != STR_EMPTY) {
- stun_hosts.push_back(talk_base::SocketAddress(host, atoi(port.c_str())));
+ stun_hosts.push_back(rtc::SocketAddress(host, atoi(port.c_str())));
}
}
}
diff --git a/xmpp/jingleinfotask.h b/xmpp/jingleinfotask.h
index dbc3fb0..5865a77 100644
--- a/xmpp/jingleinfotask.h
+++ b/xmpp/jingleinfotask.h
@@ -33,7 +33,7 @@
#include "talk/p2p/client/httpportallocator.h"
#include "talk/xmpp/xmppengine.h"
#include "talk/xmpp/xmpptask.h"
-#include "talk/base/sigslot.h"
+#include "webrtc/base/sigslot.h"
namespace buzz {
@@ -47,7 +47,7 @@
sigslot::signal3<const std::string &,
const std::vector<std::string> &,
- const std::vector<talk_base::SocketAddress> &>
+ const std::vector<rtc::SocketAddress> &>
SignalJingleInfo;
protected:
diff --git a/xmpp/moduleimpl.cc b/xmpp/moduleimpl.cc
index b23ca29..66a1eb1 100644
--- a/xmpp/moduleimpl.cc
+++ b/xmpp/moduleimpl.cc
@@ -25,7 +25,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/common.h"
+#include "webrtc/base/common.h"
#include "talk/xmpp/moduleimpl.h"
namespace buzz {
diff --git a/xmpp/mucroomconfigtask.cc b/xmpp/mucroomconfigtask.cc
index 272bd44..dded3a6 100644
--- a/xmpp/mucroomconfigtask.cc
+++ b/xmpp/mucroomconfigtask.cc
@@ -30,7 +30,7 @@
#include "talk/xmpp/mucroomconfigtask.h"
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/xmpp/constants.h"
namespace buzz {
diff --git a/xmpp/mucroomconfigtask_unittest.cc b/xmpp/mucroomconfigtask_unittest.cc
index e0a8aca..575c163 100644
--- a/xmpp/mucroomconfigtask_unittest.cc
+++ b/xmpp/mucroomconfigtask_unittest.cc
@@ -28,9 +28,9 @@
#include <string>
#include <vector>
-#include "talk/base/faketaskrunner.h"
-#include "talk/base/gunit.h"
-#include "talk/base/sigslot.h"
+#include "webrtc/base/faketaskrunner.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/sigslot.h"
#include "talk/xmllite/xmlelement.h"
#include "talk/xmpp/constants.h"
#include "talk/xmpp/fakexmppclient.h"
@@ -61,7 +61,7 @@
}
virtual void SetUp() {
- runner = new talk_base::FakeTaskRunner();
+ runner = new rtc::FakeTaskRunner();
xmpp_client = new buzz::FakeXmppClient(runner);
listener = new MucRoomConfigListener();
}
@@ -72,7 +72,7 @@
delete runner;
}
- talk_base::FakeTaskRunner* runner;
+ rtc::FakeTaskRunner* runner;
buzz::FakeXmppClient* xmpp_client;
MucRoomConfigListener* listener;
buzz::Jid room_jid;
diff --git a/xmpp/mucroomdiscoverytask_unittest.cc b/xmpp/mucroomdiscoverytask_unittest.cc
index 354503f..32c7cd2 100644
--- a/xmpp/mucroomdiscoverytask_unittest.cc
+++ b/xmpp/mucroomdiscoverytask_unittest.cc
@@ -28,9 +28,9 @@
#include <string>
#include <vector>
-#include "talk/base/faketaskrunner.h"
-#include "talk/base/gunit.h"
-#include "talk/base/sigslot.h"
+#include "webrtc/base/faketaskrunner.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/sigslot.h"
#include "talk/xmllite/xmlelement.h"
#include "talk/xmpp/constants.h"
#include "talk/xmpp/fakexmppclient.h"
@@ -75,7 +75,7 @@
}
virtual void SetUp() {
- runner = new talk_base::FakeTaskRunner();
+ runner = new rtc::FakeTaskRunner();
xmpp_client = new buzz::FakeXmppClient(runner);
listener = new MucRoomDiscoveryListener();
}
@@ -86,7 +86,7 @@
delete runner;
}
- talk_base::FakeTaskRunner* runner;
+ rtc::FakeTaskRunner* runner;
buzz::FakeXmppClient* xmpp_client;
MucRoomDiscoveryListener* listener;
buzz::Jid room_jid;
diff --git a/xmpp/mucroomlookuptask.cc b/xmpp/mucroomlookuptask.cc
index b78e5dd..5caa598 100644
--- a/xmpp/mucroomlookuptask.cc
+++ b/xmpp/mucroomlookuptask.cc
@@ -27,8 +27,8 @@
#include "talk/xmpp/mucroomlookuptask.h"
-#include "talk/base/logging.h"
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/xmpp/constants.h"
diff --git a/xmpp/mucroomlookuptask_unittest.cc b/xmpp/mucroomlookuptask_unittest.cc
index a662d53..9af0e4b 100644
--- a/xmpp/mucroomlookuptask_unittest.cc
+++ b/xmpp/mucroomlookuptask_unittest.cc
@@ -28,9 +28,9 @@
#include <string>
#include <vector>
-#include "talk/base/faketaskrunner.h"
-#include "talk/base/gunit.h"
-#include "talk/base/sigslot.h"
+#include "webrtc/base/faketaskrunner.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/sigslot.h"
#include "talk/xmllite/xmlelement.h"
#include "talk/xmpp/constants.h"
#include "talk/xmpp/fakexmppclient.h"
@@ -66,7 +66,7 @@
}
virtual void SetUp() {
- runner = new talk_base::FakeTaskRunner();
+ runner = new rtc::FakeTaskRunner();
xmpp_client = new buzz::FakeXmppClient(runner);
listener = new MucRoomLookupListener();
}
@@ -77,7 +77,7 @@
delete runner;
}
- talk_base::FakeTaskRunner* runner;
+ rtc::FakeTaskRunner* runner;
buzz::FakeXmppClient* xmpp_client;
MucRoomLookupListener* listener;
buzz::Jid lookup_server_jid;
diff --git a/xmpp/mucroomuniquehangoutidtask_unittest.cc b/xmpp/mucroomuniquehangoutidtask_unittest.cc
index 128bab3..35931ae 100644
--- a/xmpp/mucroomuniquehangoutidtask_unittest.cc
+++ b/xmpp/mucroomuniquehangoutidtask_unittest.cc
@@ -28,9 +28,9 @@
#include <string>
#include <vector>
-#include "talk/base/faketaskrunner.h"
-#include "talk/base/gunit.h"
-#include "talk/base/sigslot.h"
+#include "webrtc/base/faketaskrunner.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/sigslot.h"
#include "talk/xmllite/xmlelement.h"
#include "talk/xmpp/constants.h"
#include "talk/xmpp/fakexmppclient.h"
@@ -62,7 +62,7 @@
}
virtual void SetUp() {
- runner = new talk_base::FakeTaskRunner();
+ runner = new rtc::FakeTaskRunner();
xmpp_client = new buzz::FakeXmppClient(runner);
listener = new MucRoomUniqueHangoutIdListener();
}
@@ -73,7 +73,7 @@
delete runner;
}
- talk_base::FakeTaskRunner* runner;
+ rtc::FakeTaskRunner* runner;
buzz::FakeXmppClient* xmpp_client;
MucRoomUniqueHangoutIdListener* listener;
buzz::Jid lookup_server_jid;
diff --git a/xmpp/pingtask.cc b/xmpp/pingtask.cc
index 233062f..bf6eea2 100644
--- a/xmpp/pingtask.cc
+++ b/xmpp/pingtask.cc
@@ -3,14 +3,14 @@
#include "talk/xmpp/pingtask.h"
-#include "talk/base/logging.h"
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/xmpp/constants.h"
namespace buzz {
PingTask::PingTask(buzz::XmppTaskParentInterface* parent,
- talk_base::MessageQueue* message_queue,
+ rtc::MessageQueue* message_queue,
uint32 ping_period_millis,
uint32 ping_timeout_millis)
: buzz::XmppTask(parent, buzz::XmppEngine::HL_SINGLE),
@@ -49,7 +49,7 @@
ping_response_deadline_ = 0;
}
- uint32 now = talk_base::Time();
+ uint32 now = rtc::Time();
// If the ping timed out, signal.
if (ping_response_deadline_ != 0 && now >= ping_response_deadline_) {
@@ -59,7 +59,7 @@
// Send a ping if it's time.
if (now >= next_ping_time_) {
- talk_base::scoped_ptr<buzz::XmlElement> stanza(
+ rtc::scoped_ptr<buzz::XmlElement> stanza(
MakeIq(buzz::STR_GET, Jid(STR_EMPTY), task_id()));
stanza->AddElement(new buzz::XmlElement(QN_PING));
SendStanza(stanza.get());
@@ -76,7 +76,7 @@
return STATE_BLOCKED;
}
-void PingTask::OnMessage(talk_base::Message* msg) {
+void PingTask::OnMessage(rtc::Message* msg) {
// Get the task manager to run this task so we can send a ping or signal or
// process a ping response.
Wake();
diff --git a/xmpp/pingtask.h b/xmpp/pingtask.h
index 8375241..1bd1514 100644
--- a/xmpp/pingtask.h
+++ b/xmpp/pingtask.h
@@ -28,8 +28,8 @@
#ifndef TALK_XMPP_PINGTASK_H_
#define TALK_XMPP_PINGTASK_H_
-#include "talk/base/messagehandler.h"
-#include "talk/base/messagequeue.h"
+#include "webrtc/base/messagehandler.h"
+#include "webrtc/base/messagequeue.h"
#include "talk/xmpp/xmpptask.h"
namespace buzz {
@@ -42,10 +42,10 @@
// proxies.
// 2. It detects when the server has crashed or any other case in which the
// connection has broken without a fin or reset packet being sent to us.
-class PingTask : public buzz::XmppTask, private talk_base::MessageHandler {
+class PingTask : public buzz::XmppTask, private rtc::MessageHandler {
public:
PingTask(buzz::XmppTaskParentInterface* parent,
- talk_base::MessageQueue* message_queue, uint32 ping_period_millis,
+ rtc::MessageQueue* message_queue, uint32 ping_period_millis,
uint32 ping_timeout_millis);
virtual bool HandleStanza(const buzz::XmlElement* stanza);
@@ -57,9 +57,9 @@
private:
// Implementation of MessageHandler.
- virtual void OnMessage(talk_base::Message* msg);
+ virtual void OnMessage(rtc::Message* msg);
- talk_base::MessageQueue* message_queue_;
+ rtc::MessageQueue* message_queue_;
uint32 ping_period_millis_;
uint32 ping_timeout_millis_;
uint32 next_ping_time_;
diff --git a/xmpp/pingtask_unittest.cc b/xmpp/pingtask_unittest.cc
index 477847d..ef41670 100644
--- a/xmpp/pingtask_unittest.cc
+++ b/xmpp/pingtask_unittest.cc
@@ -28,9 +28,9 @@
#include <string>
#include <vector>
-#include "talk/base/faketaskrunner.h"
-#include "talk/base/gunit.h"
-#include "talk/base/sigslot.h"
+#include "webrtc/base/faketaskrunner.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/sigslot.h"
#include "talk/xmllite/xmlelement.h"
#include "talk/xmpp/constants.h"
#include "talk/xmpp/fakexmppclient.h"
@@ -40,7 +40,7 @@
class PingXmppClient : public buzz::FakeXmppClient {
public:
- PingXmppClient(talk_base::TaskParent* parent, PingTaskTest* tst) :
+ PingXmppClient(rtc::TaskParent* parent, PingTaskTest* tst) :
FakeXmppClient(parent), test(tst) {
}
@@ -56,7 +56,7 @@
}
virtual void SetUp() {
- runner = new talk_base::FakeTaskRunner();
+ runner = new rtc::FakeTaskRunner();
xmpp_client = new PingXmppClient(runner, this);
}
@@ -73,7 +73,7 @@
timed_out = true;
}
- talk_base::FakeTaskRunner* runner;
+ rtc::FakeTaskRunner* runner;
PingXmppClient* xmpp_client;
bool respond_to_pings;
bool timed_out;
@@ -93,7 +93,7 @@
TEST_F(PingTaskTest, TestSuccess) {
uint32 ping_period_millis = 100;
buzz::PingTask* task = new buzz::PingTask(xmpp_client,
- talk_base::Thread::Current(),
+ rtc::Thread::Current(),
ping_period_millis, ping_period_millis / 10);
ConnectTimeoutSignal(task);
task->Start();
@@ -108,7 +108,7 @@
respond_to_pings = false;
uint32 ping_timeout_millis = 200;
buzz::PingTask* task = new buzz::PingTask(xmpp_client,
- talk_base::Thread::Current(),
+ rtc::Thread::Current(),
ping_timeout_millis * 10, ping_timeout_millis);
ConnectTimeoutSignal(task);
task->Start();
diff --git a/xmpp/plainsaslhandler.h b/xmpp/plainsaslhandler.h
index e7d44b9..8d34f5e 100644
--- a/xmpp/plainsaslhandler.h
+++ b/xmpp/plainsaslhandler.h
@@ -35,7 +35,7 @@
class PlainSaslHandler : public SaslHandler {
public:
- PlainSaslHandler(const Jid & jid, const talk_base::CryptString & password,
+ PlainSaslHandler(const Jid & jid, const rtc::CryptString & password,
bool allow_plain) : jid_(jid), password_(password),
allow_plain_(allow_plain) {}
@@ -69,7 +69,7 @@
private:
Jid jid_;
- talk_base::CryptString password_;
+ rtc::CryptString password_;
bool allow_plain_;
};
diff --git a/xmpp/presenceouttask.cc b/xmpp/presenceouttask.cc
index cebd740..2974edc 100644
--- a/xmpp/presenceouttask.cc
+++ b/xmpp/presenceouttask.cc
@@ -27,7 +27,7 @@
#include <time.h>
#include <sstream>
-#include "talk/base/stringencode.h"
+#include "webrtc/base/stringencode.h"
#include "talk/xmpp/constants.h"
#include "talk/xmpp/presenceouttask.h"
#include "talk/xmpp/xmppclient.h"
@@ -117,7 +117,7 @@
}
std::string pri;
- talk_base::ToString(s.priority(), &pri);
+ rtc::ToString(s.priority(), &pri);
result->AddElement(new XmlElement(QN_PRIORITY));
result->AddText(pri, 1);
diff --git a/xmpp/presencereceivetask.cc b/xmpp/presencereceivetask.cc
index 80121dd..3a21ea7 100644
--- a/xmpp/presencereceivetask.cc
+++ b/xmpp/presencereceivetask.cc
@@ -27,7 +27,7 @@
#include "talk/xmpp/presencereceivetask.h"
-#include "talk/base/stringencode.h"
+#include "webrtc/base/stringencode.h"
#include "talk/xmpp/constants.h"
namespace buzz {
@@ -108,7 +108,7 @@
const XmlElement * priority = stanza->FirstNamed(QN_PRIORITY);
if (priority != NULL) {
int pri;
- if (talk_base::FromString(priority->BodyText(), &pri)) {
+ if (rtc::FromString(priority->BodyText(), &pri)) {
presence_status->set_priority(pri);
}
}
diff --git a/xmpp/presencereceivetask.h b/xmpp/presencereceivetask.h
index 2bd6494..6a090f3 100644
--- a/xmpp/presencereceivetask.h
+++ b/xmpp/presencereceivetask.h
@@ -28,7 +28,7 @@
#ifndef THIRD_PARTY_LIBJINGLE_FILES_TALK_XMPP_PRESENCERECEIVETASK_H_
#define THIRD_PARTY_LIBJINGLE_FILES_TALK_XMPP_PRESENCERECEIVETASK_H_
-#include "talk/base/sigslot.h"
+#include "webrtc/base/sigslot.h"
#include "talk/xmpp/presencestatus.h"
#include "talk/xmpp/xmpptask.h"
diff --git a/xmpp/prexmppauth.h b/xmpp/prexmppauth.h
index 3bc5ca6..83de5a4 100644
--- a/xmpp/prexmppauth.h
+++ b/xmpp/prexmppauth.h
@@ -28,11 +28,11 @@
#ifndef TALK_XMPP_PREXMPPAUTH_H_
#define TALK_XMPP_PREXMPPAUTH_H_
-#include "talk/base/cryptstring.h"
-#include "talk/base/sigslot.h"
+#include "webrtc/base/cryptstring.h"
+#include "webrtc/base/sigslot.h"
#include "talk/xmpp/saslhandler.h"
-namespace talk_base {
+namespace rtc {
class SocketAddress;
}
@@ -67,8 +67,8 @@
virtual void StartPreXmppAuth(
const Jid& jid,
- const talk_base::SocketAddress& server,
- const talk_base::CryptString& pass,
+ const rtc::SocketAddress& server,
+ const rtc::CryptString& pass,
const std::string& auth_mechanism,
const std::string& auth_token) = 0;
diff --git a/xmpp/pubsub_task.cc b/xmpp/pubsub_task.cc
index 91e2c72..36184c6 100644
--- a/xmpp/pubsub_task.cc
+++ b/xmpp/pubsub_task.cc
@@ -30,7 +30,7 @@
#include <map>
#include <string>
-#include "talk/base/common.h"
+#include "webrtc/base/common.h"
#include "talk/xmpp/constants.h"
#include "talk/xmpp/xmppengine.h"
@@ -99,7 +99,7 @@
bool PubsubTask::SubscribeToNode(const std::string& pubsub_node,
NodeHandler handler) {
subscribed_nodes_[pubsub_node] = handler;
- talk_base::scoped_ptr<buzz::XmlElement> get_iq_request(
+ rtc::scoped_ptr<buzz::XmlElement> get_iq_request(
MakeIq(buzz::STR_GET, pubsub_node_jid_, task_id()));
if (!get_iq_request) {
return false;
diff --git a/xmpp/pubsubclient.h b/xmpp/pubsubclient.h
index f0cd7a9..3212119 100644
--- a/xmpp/pubsubclient.h
+++ b/xmpp/pubsubclient.h
@@ -31,9 +31,9 @@
#include <string>
#include <vector>
-#include "talk/base/sigslot.h"
-#include "talk/base/sigslotrepeater.h"
-#include "talk/base/task.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/sigslotrepeater.h"
+#include "webrtc/base/task.h"
#include "talk/xmpp/jid.h"
#include "talk/xmpp/pubsubtasks.h"
diff --git a/xmpp/pubsubclient_unittest.cc b/xmpp/pubsubclient_unittest.cc
index 2e4c511..01dec5f 100644
--- a/xmpp/pubsubclient_unittest.cc
+++ b/xmpp/pubsubclient_unittest.cc
@@ -3,9 +3,9 @@
#include <string>
-#include "talk/base/faketaskrunner.h"
-#include "talk/base/gunit.h"
-#include "talk/base/sigslot.h"
+#include "webrtc/base/faketaskrunner.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/sigslot.h"
#include "talk/xmllite/qname.h"
#include "talk/xmllite/xmlelement.h"
#include "talk/xmpp/constants.h"
@@ -78,7 +78,7 @@
pubsubjid("room@domain.com"),
node("topic"),
itemid("key") {
- runner.reset(new talk_base::FakeTaskRunner());
+ runner.reset(new rtc::FakeTaskRunner());
xmpp_client = new buzz::FakeXmppClient(runner.get());
client.reset(new buzz::PubSubClient(xmpp_client, pubsubjid, node));
listener.reset(new TestPubSubItemsListener());
@@ -96,11 +96,11 @@
listener.get(), &TestPubSubItemsListener::OnRetractError);
}
- talk_base::scoped_ptr<talk_base::FakeTaskRunner> runner;
+ rtc::scoped_ptr<rtc::FakeTaskRunner> runner;
// xmpp_client deleted by deleting runner.
buzz::FakeXmppClient* xmpp_client;
- talk_base::scoped_ptr<buzz::PubSubClient> client;
- talk_base::scoped_ptr<TestPubSubItemsListener> listener;
+ rtc::scoped_ptr<buzz::PubSubClient> client;
+ rtc::scoped_ptr<TestPubSubItemsListener> listener;
buzz::Jid pubsubjid;
std::string node;
std::string itemid;
diff --git a/xmpp/pubsubstateclient.h b/xmpp/pubsubstateclient.h
index f38658d..17f4097 100644
--- a/xmpp/pubsubstateclient.h
+++ b/xmpp/pubsubstateclient.h
@@ -32,9 +32,9 @@
#include <string>
#include <vector>
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/sigslot.h"
-#include "talk/base/sigslotrepeater.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/sigslotrepeater.h"
#include "talk/xmpp/constants.h"
#include "talk/xmpp/jid.h"
#include "talk/xmpp/pubsubclient.h"
@@ -273,8 +273,8 @@
PubSubClient* client_;
const QName state_name_;
C default_state_;
- talk_base::scoped_ptr<PubSubStateKeySerializer> key_serializer_;
- talk_base::scoped_ptr<PubSubStateSerializer<C> > state_serializer_;
+ rtc::scoped_ptr<PubSubStateKeySerializer> key_serializer_;
+ rtc::scoped_ptr<PubSubStateSerializer<C> > state_serializer_;
// key => state
std::map<std::string, C> state_by_key_;
// itemid => StateItemInfo
diff --git a/xmpp/pubsubtasks.h b/xmpp/pubsubtasks.h
index 2ba618b..381667b 100644
--- a/xmpp/pubsubtasks.h
+++ b/xmpp/pubsubtasks.h
@@ -30,7 +30,7 @@
#include <vector>
-#include "talk/base/sigslot.h"
+#include "webrtc/base/sigslot.h"
#include "talk/xmpp/iqtask.h"
#include "talk/xmpp/receivetask.h"
diff --git a/xmpp/pubsubtasks_unittest.cc b/xmpp/pubsubtasks_unittest.cc
index 67fc306..bcfc696 100644
--- a/xmpp/pubsubtasks_unittest.cc
+++ b/xmpp/pubsubtasks_unittest.cc
@@ -3,9 +3,9 @@
#include <string>
-#include "talk/base/faketaskrunner.h"
-#include "talk/base/gunit.h"
-#include "talk/base/sigslot.h"
+#include "webrtc/base/faketaskrunner.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/sigslot.h"
#include "talk/xmllite/qname.h"
#include "talk/xmllite/xmlelement.h"
#include "talk/xmpp/constants.h"
@@ -68,15 +68,15 @@
pubsubjid("room@domain.com"),
node("topic"),
itemid("key") {
- runner.reset(new talk_base::FakeTaskRunner());
+ runner.reset(new rtc::FakeTaskRunner());
client = new buzz::FakeXmppClient(runner.get());
listener.reset(new TestPubSubTasksListener());
}
- talk_base::scoped_ptr<talk_base::FakeTaskRunner> runner;
+ rtc::scoped_ptr<rtc::FakeTaskRunner> runner;
// Client deleted by deleting runner.
buzz::FakeXmppClient* client;
- talk_base::scoped_ptr<TestPubSubTasksListener> listener;
+ rtc::scoped_ptr<TestPubSubTasksListener> listener;
buzz::Jid pubsubjid;
std::string node;
std::string itemid;
diff --git a/xmpp/rostermodule_unittest.cc b/xmpp/rostermodule_unittest.cc
index 9273eb5..4dbcabb 100644
--- a/xmpp/rostermodule_unittest.cc
+++ b/xmpp/rostermodule_unittest.cc
@@ -29,8 +29,8 @@
#include <sstream>
#include <iostream>
-#include "talk/base/gunit.h"
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/gunit.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/xmllite/xmlelement.h"
#include "talk/xmpp/xmppengine.h"
#include "talk/xmpp/rostermodule.h"
@@ -267,7 +267,7 @@
status->AddAttr(QN_STATUS, STR_PSTN_CONFERENCE_STATUS_CONNECTING);
XmlElement presence_xml(QN_PRESENCE);
presence_xml.AddElement(status);
- talk_base::scoped_ptr<XmppPresence> presence(XmppPresence::Create());
+ rtc::scoped_ptr<XmppPresence> presence(XmppPresence::Create());
presence->set_raw_xml(&presence_xml);
EXPECT_EQ(presence->connection_status(), XMPP_CONNECTION_STATUS_CONNECTING);
}
@@ -275,11 +275,11 @@
TEST_F(RosterModuleTest, TestOutgoingPresence) {
std::stringstream dump;
- talk_base::scoped_ptr<XmppEngine> engine(XmppEngine::Create());
+ rtc::scoped_ptr<XmppEngine> engine(XmppEngine::Create());
XmppTestHandler handler(engine.get());
XmppTestRosterHandler roster_handler;
- talk_base::scoped_ptr<XmppRosterModule> roster(XmppRosterModule::Create());
+ rtc::scoped_ptr<XmppRosterModule> roster(XmppRosterModule::Create());
roster->set_roster_handler(&roster_handler);
// Configure the roster module
@@ -381,7 +381,7 @@
EXPECT_EQ(handler.SessionActivity(), "");
// Construct a directed presence
- talk_base::scoped_ptr<XmppPresence> directed_presence(XmppPresence::Create());
+ rtc::scoped_ptr<XmppPresence> directed_presence(XmppPresence::Create());
TEST_OK(directed_presence->set_available(XMPP_PRESENCE_AVAILABLE));
TEST_OK(directed_presence->set_priority(120));
TEST_OK(directed_presence->set_status("*very* available"));
@@ -398,11 +398,11 @@
}
TEST_F(RosterModuleTest, TestIncomingPresence) {
- talk_base::scoped_ptr<XmppEngine> engine(XmppEngine::Create());
+ rtc::scoped_ptr<XmppEngine> engine(XmppEngine::Create());
XmppTestHandler handler(engine.get());
XmppTestRosterHandler roster_handler;
- talk_base::scoped_ptr<XmppRosterModule> roster(XmppRosterModule::Create());
+ rtc::scoped_ptr<XmppRosterModule> roster(XmppRosterModule::Create());
roster->set_roster_handler(&roster_handler);
// Configure the roster module
@@ -530,11 +530,11 @@
}
TEST_F(RosterModuleTest, TestPresenceSubscription) {
- talk_base::scoped_ptr<XmppEngine> engine(XmppEngine::Create());
+ rtc::scoped_ptr<XmppEngine> engine(XmppEngine::Create());
XmppTestHandler handler(engine.get());
XmppTestRosterHandler roster_handler;
- talk_base::scoped_ptr<XmppRosterModule> roster(XmppRosterModule::Create());
+ rtc::scoped_ptr<XmppRosterModule> roster(XmppRosterModule::Create());
roster->set_roster_handler(&roster_handler);
// Configure the roster module
@@ -593,11 +593,11 @@
}
TEST_F(RosterModuleTest, TestRosterReceive) {
- talk_base::scoped_ptr<XmppEngine> engine(XmppEngine::Create());
+ rtc::scoped_ptr<XmppEngine> engine(XmppEngine::Create());
XmppTestHandler handler(engine.get());
XmppTestRosterHandler roster_handler;
- talk_base::scoped_ptr<XmppRosterModule> roster(XmppRosterModule::Create());
+ rtc::scoped_ptr<XmppRosterModule> roster(XmppRosterModule::Create());
roster->set_roster_handler(&roster_handler);
// Configure the roster module
@@ -713,7 +713,7 @@
EXPECT_EQ(handler.SessionActivity(), "");
// Request that someone be added
- talk_base::scoped_ptr<XmppRosterContact> contact(XmppRosterContact::Create());
+ rtc::scoped_ptr<XmppRosterContact> contact(XmppRosterContact::Create());
TEST_OK(contact->set_jid(Jid("brandt@example.net")));
TEST_OK(contact->set_name("Brandt"));
TEST_OK(contact->AddGroup("Business Partners"));
diff --git a/xmpp/rostermoduleimpl.cc b/xmpp/rostermoduleimpl.cc
index 993cfa9..0ebf7e9 100644
--- a/xmpp/rostermoduleimpl.cc
+++ b/xmpp/rostermoduleimpl.cc
@@ -31,8 +31,8 @@
#include <algorithm>
#include <sstream>
#include <iostream>
-#include "talk/base/common.h"
-#include "talk/base/stringencode.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/stringencode.h"
#include "talk/xmpp/constants.h"
#include "talk/xmpp/rostermoduleimpl.h"
@@ -217,7 +217,7 @@
return 0;
int raw_priority = 0;
- if (!talk_base::FromString(raw_xml_->TextNamed(QN_PRIORITY), &raw_priority))
+ if (!rtc::FromString(raw_xml_->TextNamed(QN_PRIORITY), &raw_priority))
raw_priority = 0;
if (raw_priority < -128)
raw_priority = -128;
@@ -238,7 +238,7 @@
raw_xml_->ClearNamedChildren(QN_PRIORITY);
if (0 != priority) {
std::string priority_string;
- if (talk_base::ToString(priority, &priority_string)) {
+ if (rtc::ToString(priority, &priority_string)) {
raw_xml_->AddElement(new XmlElement(QN_PRIORITY));
raw_xml_->AddText(priority_string, 1);
}
diff --git a/xmpp/rostermoduleimpl.h b/xmpp/rostermoduleimpl.h
index df6b70f..a6b15cf 100644
--- a/xmpp/rostermoduleimpl.h
+++ b/xmpp/rostermoduleimpl.h
@@ -103,7 +103,7 @@
// Store everything in the XML element. If this becomes a perf issue we can
// cache the data.
- talk_base::scoped_ptr<XmlElement> raw_xml_;
+ rtc::scoped_ptr<XmlElement> raw_xml_;
};
//! A contact as given by the server
@@ -168,7 +168,7 @@
int group_count_;
int group_index_returned_;
XmlElement * group_returned_;
- talk_base::scoped_ptr<XmlElement> raw_xml_;
+ rtc::scoped_ptr<XmlElement> raw_xml_;
};
//! An XmppModule for handle roster and presence functionality
@@ -290,11 +290,11 @@
typedef std::vector<XmppPresenceImpl*> PresenceVector;
typedef std::map<Jid, PresenceVector*> JidPresenceVectorMap;
- talk_base::scoped_ptr<JidPresenceVectorMap> incoming_presence_map_;
- talk_base::scoped_ptr<PresenceVector> incoming_presence_vector_;
+ rtc::scoped_ptr<JidPresenceVectorMap> incoming_presence_map_;
+ rtc::scoped_ptr<PresenceVector> incoming_presence_vector_;
typedef std::vector<XmppRosterContactImpl*> ContactVector;
- talk_base::scoped_ptr<ContactVector> contacts_;
+ rtc::scoped_ptr<ContactVector> contacts_;
};
}
diff --git a/xmpp/saslmechanism.cc b/xmpp/saslmechanism.cc
index 2645ac0..77ffe9c 100644
--- a/xmpp/saslmechanism.cc
+++ b/xmpp/saslmechanism.cc
@@ -25,12 +25,12 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "talk/base/base64.h"
+#include "webrtc/base/base64.h"
#include "talk/xmllite/xmlelement.h"
#include "talk/xmpp/constants.h"
#include "talk/xmpp/saslmechanism.h"
-using talk_base::Base64;
+using rtc::Base64;
namespace buzz {
diff --git a/xmpp/saslplainmechanism.h b/xmpp/saslplainmechanism.h
index f0793b4..3491a93 100644
--- a/xmpp/saslplainmechanism.h
+++ b/xmpp/saslplainmechanism.h
@@ -28,7 +28,7 @@
#ifndef TALK_XMPP_SASLPLAINMECHANISM_H_
#define TALK_XMPP_SASLPLAINMECHANISM_H_
-#include "talk/base/cryptstring.h"
+#include "webrtc/base/cryptstring.h"
#include "talk/xmpp/saslmechanism.h"
namespace buzz {
@@ -36,7 +36,7 @@
class SaslPlainMechanism : public SaslMechanism {
public:
- SaslPlainMechanism(const buzz::Jid user_jid, const talk_base::CryptString & password) :
+ SaslPlainMechanism(const buzz::Jid user_jid, const rtc::CryptString & password) :
user_jid_(user_jid), password_(password) {}
virtual std::string GetMechanismName() { return "PLAIN"; }
@@ -46,7 +46,7 @@
XmlElement * el = new XmlElement(QN_SASL_AUTH, true);
el->AddAttr(QN_MECHANISM, "PLAIN");
- talk_base::FormatCryptString credential;
+ rtc::FormatCryptString credential;
credential.Append("\0", 1);
credential.Append(user_jid_.node());
credential.Append("\0", 1);
@@ -57,7 +57,7 @@
private:
Jid user_jid_;
- talk_base::CryptString password_;
+ rtc::CryptString password_;
};
}
diff --git a/xmpp/util_unittest.cc b/xmpp/util_unittest.cc
index 3d13007..390e7bc 100644
--- a/xmpp/util_unittest.cc
+++ b/xmpp/util_unittest.cc
@@ -4,7 +4,7 @@
#include <string>
#include <sstream>
#include <iostream>
-#include "talk/base/gunit.h"
+#include "webrtc/base/gunit.h"
#include "talk/xmllite/xmlelement.h"
#include "talk/xmpp/xmppengine.h"
#include "talk/xmpp/util_unittest.h"
diff --git a/xmpp/xmppauth.cc b/xmpp/xmppauth.cc
index efda967..d828475 100644
--- a/xmpp/xmppauth.cc
+++ b/xmpp/xmppauth.cc
@@ -40,8 +40,8 @@
}
void XmppAuth::StartPreXmppAuth(const buzz::Jid& jid,
- const talk_base::SocketAddress& server,
- const talk_base::CryptString& pass,
+ const rtc::SocketAddress& server,
+ const rtc::CryptString& pass,
const std::string& auth_mechanism,
const std::string& auth_token) {
jid_ = jid;
diff --git a/xmpp/xmppauth.h b/xmpp/xmppauth.h
index 5dd6963..504b11e 100644
--- a/xmpp/xmppauth.h
+++ b/xmpp/xmppauth.h
@@ -30,8 +30,8 @@
#include <vector>
-#include "talk/base/cryptstring.h"
-#include "talk/base/sigslot.h"
+#include "webrtc/base/cryptstring.h"
+#include "webrtc/base/sigslot.h"
#include "talk/xmpp/jid.h"
#include "talk/xmpp/saslhandler.h"
#include "talk/xmpp/prexmppauth.h"
@@ -44,8 +44,8 @@
// TODO: Just have one "secret" that is either pass or
// token?
virtual void StartPreXmppAuth(const buzz::Jid& jid,
- const talk_base::SocketAddress& server,
- const talk_base::CryptString& pass,
+ const rtc::SocketAddress& server,
+ const rtc::CryptString& pass,
const std::string& auth_mechanism,
const std::string& auth_token);
@@ -68,7 +68,7 @@
private:
buzz::Jid jid_;
- talk_base::CryptString passwd_;
+ rtc::CryptString passwd_;
std::string auth_mechanism_;
std::string auth_token_;
bool done_;
diff --git a/xmpp/xmppclient.cc b/xmpp/xmppclient.cc
index 8927dad..e378a01 100644
--- a/xmpp/xmppclient.cc
+++ b/xmpp/xmppclient.cc
@@ -27,10 +27,10 @@
#include "xmppclient.h"
#include "xmpptask.h"
-#include "talk/base/logging.h"
-#include "talk/base/sigslot.h"
-#include "talk/base/scoped_ptr.h"
-#include "talk/base/stringutils.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/stringutils.h"
#include "talk/xmpp/constants.h"
#include "talk/xmpp/saslplainmechanism.h"
#include "talk/xmpp/prexmppauth.h"
@@ -64,13 +64,13 @@
XmppClient* const client_;
// the two main objects
- talk_base::scoped_ptr<AsyncSocket> socket_;
- talk_base::scoped_ptr<XmppEngine> engine_;
- talk_base::scoped_ptr<PreXmppAuth> pre_auth_;
- talk_base::CryptString pass_;
+ rtc::scoped_ptr<AsyncSocket> socket_;
+ rtc::scoped_ptr<XmppEngine> engine_;
+ rtc::scoped_ptr<PreXmppAuth> pre_auth_;
+ rtc::CryptString pass_;
std::string auth_mechanism_;
std::string auth_token_;
- talk_base::SocketAddress server_;
+ rtc::SocketAddress server_;
std::string proxy_host_;
int proxy_port_;
XmppEngine::Error pre_engine_error_;
@@ -103,7 +103,7 @@
bool IsTestServer(const std::string& server_name,
const std::string& test_server_domain) {
return (!test_server_domain.empty() &&
- talk_base::ends_with(server_name.c_str(),
+ rtc::ends_with(server_name.c_str(),
test_server_domain.c_str()));
}
diff --git a/xmpp/xmppclient.h b/xmpp/xmppclient.h
index c8dd91e..e5b202e 100644
--- a/xmpp/xmppclient.h
+++ b/xmpp/xmppclient.h
@@ -29,9 +29,9 @@
#define TALK_XMPP_XMPPCLIENT_H_
#include <string>
-#include "talk/base/basicdefs.h"
-#include "talk/base/sigslot.h"
-#include "talk/base/task.h"
+#include "webrtc/base/basicdefs.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/task.h"
#include "talk/xmpp/asyncsocket.h"
#include "talk/xmpp/xmppclientsettings.h"
#include "talk/xmpp/xmppengine.h"
@@ -73,7 +73,7 @@
public sigslot::has_slots<>
{
public:
- explicit XmppClient(talk_base::TaskParent * parent);
+ explicit XmppClient(rtc::TaskParent * parent);
virtual ~XmppClient();
XmppReturnStatus Connect(const XmppClientSettings & settings,
@@ -154,7 +154,7 @@
class Private;
friend class Private;
- talk_base::scoped_ptr<Private> d_;
+ rtc::scoped_ptr<Private> d_;
bool delivering_signal_;
bool valid_;
diff --git a/xmpp/xmppclientsettings.h b/xmpp/xmppclientsettings.h
index 8851f18..8b5a4e2 100644
--- a/xmpp/xmppclientsettings.h
+++ b/xmpp/xmppclientsettings.h
@@ -29,7 +29,7 @@
#define TALK_XMPP_XMPPCLIENTSETTINGS_H_
#include "talk/p2p/base/port.h"
-#include "talk/base/cryptstring.h"
+#include "webrtc/base/cryptstring.h"
#include "talk/xmpp/xmppengine.h"
namespace buzz {
@@ -43,7 +43,7 @@
void set_user(const std::string& user) { user_ = user; }
void set_host(const std::string& host) { host_ = host; }
- void set_pass(const talk_base::CryptString& pass) { pass_ = pass; }
+ void set_pass(const rtc::CryptString& pass) { pass_ = pass; }
void set_auth_token(const std::string& mechanism,
const std::string& token) {
auth_mechanism_ = mechanism;
@@ -61,7 +61,7 @@
const std::string& user() const { return user_; }
const std::string& host() const { return host_; }
- const talk_base::CryptString& pass() const { return pass_; }
+ const rtc::CryptString& pass() const { return pass_; }
const std::string& auth_mechanism() const { return auth_mechanism_; }
const std::string& auth_token() const { return auth_token_; }
const std::string& resource() const { return resource_; }
@@ -73,7 +73,7 @@
private:
std::string user_;
std::string host_;
- talk_base::CryptString pass_;
+ rtc::CryptString pass_;
std::string auth_mechanism_;
std::string auth_token_;
std::string resource_;
@@ -87,40 +87,40 @@
public:
XmppClientSettings()
: protocol_(cricket::PROTO_TCP),
- proxy_(talk_base::PROXY_NONE),
+ proxy_(rtc::PROXY_NONE),
proxy_port_(80),
use_proxy_auth_(false) {
}
- void set_server(const talk_base::SocketAddress& server) {
+ void set_server(const rtc::SocketAddress& server) {
server_ = server;
}
void set_protocol(cricket::ProtocolType protocol) { protocol_ = protocol; }
- void set_proxy(talk_base::ProxyType f) { proxy_ = f; }
+ void set_proxy(rtc::ProxyType f) { proxy_ = f; }
void set_proxy_host(const std::string& host) { proxy_host_ = host; }
void set_proxy_port(int port) { proxy_port_ = port; };
void set_use_proxy_auth(bool f) { use_proxy_auth_ = f; }
void set_proxy_user(const std::string& user) { proxy_user_ = user; }
- void set_proxy_pass(const talk_base::CryptString& pass) { proxy_pass_ = pass; }
+ void set_proxy_pass(const rtc::CryptString& pass) { proxy_pass_ = pass; }
- const talk_base::SocketAddress& server() const { return server_; }
+ const rtc::SocketAddress& server() const { return server_; }
cricket::ProtocolType protocol() const { return protocol_; }
- talk_base::ProxyType proxy() const { return proxy_; }
+ rtc::ProxyType proxy() const { return proxy_; }
const std::string& proxy_host() const { return proxy_host_; }
int proxy_port() const { return proxy_port_; }
bool use_proxy_auth() const { return use_proxy_auth_; }
const std::string& proxy_user() const { return proxy_user_; }
- const talk_base::CryptString& proxy_pass() const { return proxy_pass_; }
+ const rtc::CryptString& proxy_pass() const { return proxy_pass_; }
private:
- talk_base::SocketAddress server_;
+ rtc::SocketAddress server_;
cricket::ProtocolType protocol_;
- talk_base::ProxyType proxy_;
+ rtc::ProxyType proxy_;
std::string proxy_host_;
int proxy_port_;
bool use_proxy_auth_;
std::string proxy_user_;
- talk_base::CryptString proxy_pass_;
+ rtc::CryptString proxy_pass_;
};
}
diff --git a/xmpp/xmppengine_unittest.cc b/xmpp/xmppengine_unittest.cc
index 46b79c6..779a7d8 100644
--- a/xmpp/xmppengine_unittest.cc
+++ b/xmpp/xmppengine_unittest.cc
@@ -4,8 +4,8 @@
#include <string>
#include <sstream>
#include <iostream>
-#include "talk/base/common.h"
-#include "talk/base/gunit.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/gunit.h"
#include "talk/xmllite/xmlelement.h"
#include "talk/xmpp/constants.h"
#include "talk/xmpp/util_unittest.h"
@@ -54,14 +54,14 @@
handler_.reset(new XmppTestHandler(engine_.get()));
Jid jid("david@my-server");
- talk_base::InsecureCryptStringImpl pass;
+ rtc::InsecureCryptStringImpl pass;
pass.password() = "david";
engine_->SetSessionHandler(handler_.get());
engine_->SetOutputHandler(handler_.get());
engine_->AddStanzaHandler(handler_.get());
engine_->SetUser(jid);
engine_->SetSaslHandler(
- new buzz::PlainSaslHandler(jid, talk_base::CryptString(pass), true));
+ new buzz::PlainSaslHandler(jid, rtc::CryptString(pass), true));
}
virtual void TearDown() {
handler_.reset();
@@ -70,8 +70,8 @@
void RunLogin();
private:
- talk_base::scoped_ptr<XmppEngine> engine_;
- talk_base::scoped_ptr<XmppTestHandler> handler_;
+ rtc::scoped_ptr<XmppEngine> engine_;
+ rtc::scoped_ptr<XmppTestHandler> handler_;
};
void XmppEngineTest::RunLogin() {
diff --git a/xmpp/xmppengineimpl.cc b/xmpp/xmppengineimpl.cc
index cf07ab7..fb288a0 100644
--- a/xmpp/xmppengineimpl.cc
+++ b/xmpp/xmppengineimpl.cc
@@ -31,7 +31,7 @@
#include <sstream>
#include <vector>
-#include "talk/base/common.h"
+#include "webrtc/base/common.h"
#include "talk/xmllite/xmlelement.h"
#include "talk/xmllite/xmlprinter.h"
#include "talk/xmpp/constants.h"
diff --git a/xmpp/xmppengineimpl.h b/xmpp/xmppengineimpl.h
index 8278681..4eacf2f 100644
--- a/xmpp/xmppengineimpl.h
+++ b/xmpp/xmppengineimpl.h
@@ -250,7 +250,7 @@
TlsOptions tls_option_;
std::string tls_server_hostname_;
std::string tls_server_domain_;
- talk_base::scoped_ptr<XmppLoginTask> login_task_;
+ rtc::scoped_ptr<XmppLoginTask> login_task_;
std::string lang_;
int next_id_;
@@ -259,7 +259,7 @@
bool encrypted_;
Error error_code_;
int subcode_;
- talk_base::scoped_ptr<XmlElement> stream_error_;
+ rtc::scoped_ptr<XmlElement> stream_error_;
bool raised_reset_;
XmppOutputHandler* output_handler_;
XmppSessionHandler* session_handler_;
@@ -267,14 +267,14 @@
XmlnsStack xmlns_stack_;
typedef std::vector<XmppStanzaHandler*> StanzaHandlerVector;
- talk_base::scoped_ptr<StanzaHandlerVector> stanza_handlers_[HL_COUNT];
+ rtc::scoped_ptr<StanzaHandlerVector> stanza_handlers_[HL_COUNT];
typedef std::vector<XmppIqEntry*> IqEntryVector;
- talk_base::scoped_ptr<IqEntryVector> iq_entries_;
+ rtc::scoped_ptr<IqEntryVector> iq_entries_;
- talk_base::scoped_ptr<SaslHandler> sasl_handler_;
+ rtc::scoped_ptr<SaslHandler> sasl_handler_;
- talk_base::scoped_ptr<std::stringstream> output_;
+ rtc::scoped_ptr<std::stringstream> output_;
};
} // namespace buzz
diff --git a/xmpp/xmppengineimpl_iq.cc b/xmpp/xmppengineimpl_iq.cc
index 5834b90..3f449d0 100644
--- a/xmpp/xmppengineimpl_iq.cc
+++ b/xmpp/xmppengineimpl_iq.cc
@@ -27,7 +27,7 @@
#include <vector>
#include <algorithm>
-#include "talk/base/common.h"
+#include "webrtc/base/common.h"
#include "talk/xmpp/xmppengineimpl.h"
#include "talk/xmpp/constants.h"
diff --git a/xmpp/xmpplogintask.cc b/xmpp/xmpplogintask.cc
index b3a2047..1ff6e22 100644
--- a/xmpp/xmpplogintask.cc
+++ b/xmpp/xmpplogintask.cc
@@ -30,15 +30,15 @@
#include <string>
#include <vector>
-#include "talk/base/base64.h"
-#include "talk/base/common.h"
+#include "webrtc/base/base64.h"
+#include "webrtc/base/common.h"
#include "talk/xmllite/xmlelement.h"
#include "talk/xmpp/constants.h"
#include "talk/xmpp/jid.h"
#include "talk/xmpp/saslmechanism.h"
#include "talk/xmpp/xmppengineimpl.h"
-using talk_base::ConstantLabel;
+using rtc::ConstantLabel;
namespace buzz {
@@ -103,7 +103,7 @@
#if _DEBUG
LOG(LS_VERBOSE) << "XmppLoginTask::Advance - "
- << talk_base::ErrorName(state_, LOGINTASK_STATES);
+ << rtc::ErrorName(state_, LOGINTASK_STATES);
#endif // _DEBUG
switch (state_) {
diff --git a/xmpp/xmpplogintask.h b/xmpp/xmpplogintask.h
index 9b3f5ae..61be0d2 100644
--- a/xmpp/xmpplogintask.h
+++ b/xmpp/xmpplogintask.h
@@ -31,8 +31,8 @@
#include <string>
#include <vector>
-#include "talk/base/logging.h"
-#include "talk/base/scoped_ptr.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/scoped_ptr.h"
#include "talk/xmpp/jid.h"
#include "talk/xmpp/xmppengine.h"
@@ -87,15 +87,15 @@
const XmlElement * pelStanza_;
bool isStart_;
std::string iqId_;
- talk_base::scoped_ptr<XmlElement> pelFeatures_;
+ rtc::scoped_ptr<XmlElement> pelFeatures_;
Jid fullJid_;
std::string streamId_;
- talk_base::scoped_ptr<std::vector<XmlElement *> > pvecQueuedStanzas_;
+ rtc::scoped_ptr<std::vector<XmlElement *> > pvecQueuedStanzas_;
- talk_base::scoped_ptr<SaslMechanism> sasl_mech_;
+ rtc::scoped_ptr<SaslMechanism> sasl_mech_;
#ifdef _DEBUG
- static const talk_base::ConstantLabel LOGINTASK_STATES[];
+ static const rtc::ConstantLabel LOGINTASK_STATES[];
#endif // _DEBUG
};
diff --git a/xmpp/xmpplogintask_unittest.cc b/xmpp/xmpplogintask_unittest.cc
index 51af81a..1a3b2d6 100644
--- a/xmpp/xmpplogintask_unittest.cc
+++ b/xmpp/xmpplogintask_unittest.cc
@@ -4,9 +4,9 @@
#include <string>
#include <sstream>
#include <iostream>
-#include "talk/base/common.h"
-#include "talk/base/cryptstring.h"
-#include "talk/base/gunit.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/cryptstring.h"
+#include "webrtc/base/gunit.h"
#include "talk/xmllite/xmlelement.h"
#include "talk/xmpp/util_unittest.h"
#include "talk/xmpp/constants.h"
@@ -43,14 +43,14 @@
handler_.reset(new XmppTestHandler(engine_.get()));
Jid jid("david@my-server");
- talk_base::InsecureCryptStringImpl pass;
+ rtc::InsecureCryptStringImpl pass;
pass.password() = "david";
engine_->SetSessionHandler(handler_.get());
engine_->SetOutputHandler(handler_.get());
engine_->AddStanzaHandler(handler_.get());
engine_->SetUser(jid);
engine_->SetSaslHandler(
- new buzz::PlainSaslHandler(jid, talk_base::CryptString(pass), true));
+ new buzz::PlainSaslHandler(jid, rtc::CryptString(pass), true));
}
virtual void TearDown() {
handler_.reset();
@@ -60,8 +60,8 @@
void SetTlsOptions(buzz::TlsOptions option);
private:
- talk_base::scoped_ptr<XmppEngine> engine_;
- talk_base::scoped_ptr<XmppTestHandler> handler_;
+ rtc::scoped_ptr<XmppEngine> engine_;
+ rtc::scoped_ptr<XmppTestHandler> handler_;
};
void XmppLoginTaskTest::SetTlsOptions(buzz::TlsOptions option) {
diff --git a/xmpp/xmpppump.cc b/xmpp/xmpppump.cc
index 5732986..cf7aa7b 100644
--- a/xmpp/xmpppump.cc
+++ b/xmpp/xmpppump.cc
@@ -63,14 +63,14 @@
}
void XmppPump::WakeTasks() {
- talk_base::Thread::Current()->Post(this);
+ rtc::Thread::Current()->Post(this);
}
int64 XmppPump::CurrentTime() {
- return (int64)talk_base::Time();
+ return (int64)rtc::Time();
}
-void XmppPump::OnMessage(talk_base::Message *pmsg) {
+void XmppPump::OnMessage(rtc::Message *pmsg) {
RunTasks();
}
diff --git a/xmpp/xmpppump.h b/xmpp/xmpppump.h
index 7a374cc..4dc4ba8 100644
--- a/xmpp/xmpppump.h
+++ b/xmpp/xmpppump.h
@@ -28,10 +28,10 @@
#ifndef TALK_XMPP_XMPPPUMP_H_
#define TALK_XMPP_XMPPPUMP_H_
-#include "talk/base/messagequeue.h"
-#include "talk/base/taskrunner.h"
-#include "talk/base/thread.h"
-#include "talk/base/timeutils.h"
+#include "webrtc/base/messagequeue.h"
+#include "webrtc/base/taskrunner.h"
+#include "webrtc/base/thread.h"
+#include "webrtc/base/timeutils.h"
#include "talk/xmpp/xmppclient.h"
#include "talk/xmpp/xmppengine.h"
#include "talk/xmpp/xmpptask.h"
@@ -46,7 +46,7 @@
virtual void OnStateChange(buzz::XmppEngine::State state) = 0;
};
-class XmppPump : public talk_base::MessageHandler, public talk_base::TaskRunner {
+class XmppPump : public rtc::MessageHandler, public rtc::TaskRunner {
public:
XmppPump(buzz::XmppPumpNotify * notify = NULL);
@@ -63,7 +63,7 @@
int64 CurrentTime();
- void OnMessage(talk_base::Message *pmsg);
+ void OnMessage(rtc::Message *pmsg);
buzz::XmppReturnStatus SendStanza(const buzz::XmlElement *stanza);
diff --git a/xmpp/xmppsocket.cc b/xmpp/xmppsocket.cc
index 31d1b69..67240ba 100644
--- a/xmpp/xmppsocket.cc
+++ b/xmpp/xmppsocket.cc
@@ -32,17 +32,17 @@
#endif
#include <errno.h>
-#include "talk/base/basicdefs.h"
-#include "talk/base/logging.h"
-#include "talk/base/thread.h"
+#include "webrtc/base/basicdefs.h"
+#include "webrtc/base/logging.h"
+#include "webrtc/base/thread.h"
#ifdef FEATURE_ENABLE_SSL
-#include "talk/base/ssladapter.h"
+#include "webrtc/base/ssladapter.h"
#endif
#ifdef USE_SSLSTREAM
-#include "talk/base/socketstream.h"
+#include "webrtc/base/socketstream.h"
#ifdef FEATURE_ENABLE_SSL
-#include "talk/base/sslstreamadapter.h"
+#include "webrtc/base/sslstreamadapter.h"
#endif // FEATURE_ENABLE_SSL
#endif // USE_SSLSTREAM
@@ -54,16 +54,16 @@
}
void XmppSocket::CreateCricketSocket(int family) {
- talk_base::Thread* pth = talk_base::Thread::Current();
+ rtc::Thread* pth = rtc::Thread::Current();
if (family == AF_UNSPEC) {
family = AF_INET;
}
- talk_base::AsyncSocket* socket =
+ rtc::AsyncSocket* socket =
pth->socketserver()->CreateAsyncSocket(family, SOCK_STREAM);
#ifndef USE_SSLSTREAM
#ifdef FEATURE_ENABLE_SSL
if (tls_ != buzz::TLS_DISABLED) {
- socket = talk_base::SSLAdapter::Create(socket);
+ socket = rtc::SSLAdapter::Create(socket);
}
#endif // FEATURE_ENABLE_SSL
cricket_socket_ = socket;
@@ -74,10 +74,10 @@
cricket_socket_->SignalCloseEvent.connect(this, &XmppSocket::OnCloseEvent);
#else // USE_SSLSTREAM
cricket_socket_ = socket;
- stream_ = new talk_base::SocketStream(cricket_socket_);
+ stream_ = new rtc::SocketStream(cricket_socket_);
#ifdef FEATURE_ENABLE_SSL
if (tls_ != buzz::TLS_DISABLED)
- stream_ = talk_base::SSLStreamAdapter::Create(stream_);
+ stream_ = rtc::SSLStreamAdapter::Create(stream_);
#endif // FEATURE_ENABLE_SSL
stream_->SignalEvent.connect(this, &XmppSocket::OnEvent);
#endif // USE_SSLSTREAM
@@ -93,11 +93,11 @@
}
#ifndef USE_SSLSTREAM
-void XmppSocket::OnReadEvent(talk_base::AsyncSocket * socket) {
+void XmppSocket::OnReadEvent(rtc::AsyncSocket * socket) {
SignalRead();
}
-void XmppSocket::OnWriteEvent(talk_base::AsyncSocket * socket) {
+void XmppSocket::OnWriteEvent(rtc::AsyncSocket * socket) {
// Write bytes if there are any
while (buffer_.Length() != 0) {
int written = cricket_socket_->Send(buffer_.Data(), buffer_.Length());
@@ -111,7 +111,7 @@
}
}
-void XmppSocket::OnConnectEvent(talk_base::AsyncSocket * socket) {
+void XmppSocket::OnConnectEvent(rtc::AsyncSocket * socket) {
#if defined(FEATURE_ENABLE_SSL)
if (state_ == buzz::AsyncSocket::STATE_TLS_CONNECTING) {
state_ = buzz::AsyncSocket::STATE_TLS_OPEN;
@@ -124,20 +124,20 @@
SignalConnected();
}
-void XmppSocket::OnCloseEvent(talk_base::AsyncSocket * socket, int error) {
+void XmppSocket::OnCloseEvent(rtc::AsyncSocket * socket, int error) {
SignalCloseEvent(error);
}
#else // USE_SSLSTREAM
-void XmppSocket::OnEvent(talk_base::StreamInterface* stream,
+void XmppSocket::OnEvent(rtc::StreamInterface* stream,
int events, int err) {
- if ((events & talk_base::SE_OPEN)) {
+ if ((events & rtc::SE_OPEN)) {
#if defined(FEATURE_ENABLE_SSL)
if (state_ == buzz::AsyncSocket::STATE_TLS_CONNECTING) {
state_ = buzz::AsyncSocket::STATE_TLS_OPEN;
SignalSSLConnected();
- events |= talk_base::SE_WRITE;
+ events |= rtc::SE_WRITE;
} else
#endif
{
@@ -145,28 +145,28 @@
SignalConnected();
}
}
- if ((events & talk_base::SE_READ))
+ if ((events & rtc::SE_READ))
SignalRead();
- if ((events & talk_base::SE_WRITE)) {
+ if ((events & rtc::SE_WRITE)) {
// Write bytes if there are any
while (buffer_.Length() != 0) {
- talk_base::StreamResult result;
+ rtc::StreamResult result;
size_t written;
int error;
result = stream_->Write(buffer_.Data(), buffer_.Length(),
&written, &error);
- if (result == talk_base::SR_ERROR) {
+ if (result == rtc::SR_ERROR) {
LOG(LS_ERROR) << "Send error: " << error;
return;
}
- if (result == talk_base::SR_BLOCK)
+ if (result == rtc::SR_BLOCK)
return;
- ASSERT(result == talk_base::SR_SUCCESS);
+ ASSERT(result == rtc::SR_SUCCESS);
ASSERT(written > 0);
buffer_.Shift(written);
}
}
- if ((events & talk_base::SE_CLOSE))
+ if ((events & rtc::SE_CLOSE))
SignalCloseEvent(err);
}
#endif // USE_SSLSTREAM
@@ -183,7 +183,7 @@
return 0;
}
-bool XmppSocket::Connect(const talk_base::SocketAddress& addr) {
+bool XmppSocket::Connect(const rtc::SocketAddress& addr) {
if (cricket_socket_ == NULL) {
CreateCricketSocket(addr.family());
}
@@ -201,8 +201,8 @@
return true;
}
#else // USE_SSLSTREAM
- talk_base::StreamResult result = stream_->Read(data, len, len_read, NULL);
- if (result == talk_base::SR_SUCCESS)
+ rtc::StreamResult result = stream_->Read(data, len, len_read, NULL);
+ if (result == rtc::SR_SUCCESS)
return true;
#endif // USE_SSLSTREAM
return false;
@@ -213,7 +213,7 @@
#ifndef USE_SSLSTREAM
OnWriteEvent(cricket_socket_);
#else // USE_SSLSTREAM
- OnEvent(stream_, talk_base::SE_WRITE, 0);
+ OnEvent(stream_, rtc::SE_WRITE, 0);
#endif // USE_SSLSTREAM
return true;
}
@@ -241,13 +241,13 @@
if (tls_ == buzz::TLS_DISABLED)
return false;
#ifndef USE_SSLSTREAM
- talk_base::SSLAdapter* ssl_adapter =
- static_cast<talk_base::SSLAdapter *>(cricket_socket_);
+ rtc::SSLAdapter* ssl_adapter =
+ static_cast<rtc::SSLAdapter *>(cricket_socket_);
if (ssl_adapter->StartSSL(domainname.c_str(), false) != 0)
return false;
#else // USE_SSLSTREAM
- talk_base::SSLStreamAdapter* ssl_stream =
- static_cast<talk_base::SSLStreamAdapter *>(stream_);
+ rtc::SSLStreamAdapter* ssl_stream =
+ static_cast<rtc::SSLStreamAdapter *>(stream_);
if (ssl_stream->StartSSLWithServer(domainname.c_str()) != 0)
return false;
#endif // USE_SSLSTREAM
diff --git a/xmpp/xmppsocket.h b/xmpp/xmppsocket.h
index f89333f..e32ce4c 100644
--- a/xmpp/xmppsocket.h
+++ b/xmpp/xmppsocket.h
@@ -28,9 +28,9 @@
#ifndef TALK_XMPP_XMPPSOCKET_H_
#define TALK_XMPP_XMPPSOCKET_H_
-#include "talk/base/asyncsocket.h"
-#include "talk/base/bytebuffer.h"
-#include "talk/base/sigslot.h"
+#include "webrtc/base/asyncsocket.h"
+#include "webrtc/base/bytebuffer.h"
+#include "webrtc/base/sigslot.h"
#include "talk/xmpp/asyncsocket.h"
#include "talk/xmpp/xmppengine.h"
@@ -38,11 +38,11 @@
// SSL, as opposed to the SSLAdapter socket adapter.
// #define USE_SSLSTREAM
-namespace talk_base {
+namespace rtc {
class StreamInterface;
class SocketAddress;
};
-extern talk_base::AsyncSocket* cricket_socket_;
+extern rtc::AsyncSocket* cricket_socket_;
namespace buzz {
@@ -55,7 +55,7 @@
virtual buzz::AsyncSocket::Error error();
virtual int GetError();
- virtual bool Connect(const talk_base::SocketAddress& addr);
+ virtual bool Connect(const rtc::SocketAddress& addr);
virtual bool Read(char * data, size_t len, size_t* len_read);
virtual bool Write(const char * data, size_t len);
virtual bool Close();
@@ -66,20 +66,20 @@
private:
void CreateCricketSocket(int family);
#ifndef USE_SSLSTREAM
- void OnReadEvent(talk_base::AsyncSocket * socket);
- void OnWriteEvent(talk_base::AsyncSocket * socket);
- void OnConnectEvent(talk_base::AsyncSocket * socket);
- void OnCloseEvent(talk_base::AsyncSocket * socket, int error);
+ void OnReadEvent(rtc::AsyncSocket * socket);
+ void OnWriteEvent(rtc::AsyncSocket * socket);
+ void OnConnectEvent(rtc::AsyncSocket * socket);
+ void OnCloseEvent(rtc::AsyncSocket * socket, int error);
#else // USE_SSLSTREAM
- void OnEvent(talk_base::StreamInterface* stream, int events, int err);
+ void OnEvent(rtc::StreamInterface* stream, int events, int err);
#endif // USE_SSLSTREAM
- talk_base::AsyncSocket * cricket_socket_;
+ rtc::AsyncSocket * cricket_socket_;
#ifdef USE_SSLSTREAM
- talk_base::StreamInterface *stream_;
+ rtc::StreamInterface *stream_;
#endif // USE_SSLSTREAM
buzz::AsyncSocket::State state_;
- talk_base::ByteBuffer buffer_;
+ rtc::ByteBuffer buffer_;
buzz::TlsOptions tls_;
};
diff --git a/xmpp/xmppstanzaparser.cc b/xmpp/xmppstanzaparser.cc
index 6c3ef5f..1b75f28 100644
--- a/xmpp/xmppstanzaparser.cc
+++ b/xmpp/xmppstanzaparser.cc
@@ -28,7 +28,7 @@
#include "talk/xmpp/xmppstanzaparser.h"
#include "talk/xmllite/xmlelement.h"
-#include "talk/base/common.h"
+#include "webrtc/base/common.h"
#include "talk/xmpp/constants.h"
#ifdef EXPAT_RELATIVE_PATH
#include "expat.h"
@@ -98,8 +98,8 @@
void
XmppStanzaParser::IncomingError(
XmlParseContext * pctx, XML_Error errCode) {
- UNUSED(pctx);
- UNUSED(errCode);
+ RTC_UNUSED(pctx);
+ RTC_UNUSED(errCode);
psph_->XmlError();
}
diff --git a/xmpp/xmppstanzaparser_unittest.cc b/xmpp/xmppstanzaparser_unittest.cc
index 06faf87..3930a9d 100644
--- a/xmpp/xmppstanzaparser_unittest.cc
+++ b/xmpp/xmppstanzaparser_unittest.cc
@@ -4,8 +4,8 @@
#include <string>
#include <sstream>
#include <iostream>
-#include "talk/base/common.h"
-#include "talk/base/gunit.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/gunit.h"
#include "talk/xmllite/xmlelement.h"
#include "talk/xmpp/xmppstanzaparser.h"
diff --git a/xmpp/xmpptask.h b/xmpp/xmpptask.h
index 6a88f98..ab13289 100644
--- a/xmpp/xmpptask.h
+++ b/xmpp/xmpptask.h
@@ -30,9 +30,9 @@
#include <string>
#include <deque>
-#include "talk/base/sigslot.h"
-#include "talk/base/task.h"
-#include "talk/base/taskparent.h"
+#include "webrtc/base/sigslot.h"
+#include "webrtc/base/task.h"
+#include "webrtc/base/taskparent.h"
#include "talk/xmpp/xmppengine.h"
namespace buzz {
@@ -94,9 +94,9 @@
// We really ought to inherit from a TaskParentInterface, but we tried
// that and it's way too complicated to change
// Task/TaskParent/TaskRunner. For now, this works.
-class XmppTaskParentInterface : public talk_base::Task {
+class XmppTaskParentInterface : public rtc::Task {
public:
- explicit XmppTaskParentInterface(talk_base::TaskParent* parent)
+ explicit XmppTaskParentInterface(rtc::TaskParent* parent)
: Task(parent) {
}
virtual ~XmppTaskParentInterface() {}
@@ -176,7 +176,7 @@
bool stopped_;
std::deque<XmlElement*> stanza_queue_;
- talk_base::scoped_ptr<XmlElement> next_stanza_;
+ rtc::scoped_ptr<XmlElement> next_stanza_;
std::string id_;
#ifdef _DEBUG
diff --git a/xmpp/xmppthread.cc b/xmpp/xmppthread.cc
index 716aaf8..e67bffe 100644
--- a/xmpp/xmppthread.cc
+++ b/xmpp/xmppthread.cc
@@ -36,7 +36,7 @@
const uint32 MSG_LOGIN = 1;
const uint32 MSG_DISCONNECT = 2;
-struct LoginData: public talk_base::MessageData {
+struct LoginData: public rtc::MessageData {
LoginData(const buzz::XmppClientSettings& s) : xcs(s) {}
virtual ~LoginData() {}
@@ -55,7 +55,7 @@
}
void XmppThread::ProcessMessages(int cms) {
- talk_base::Thread::ProcessMessages(cms);
+ rtc::Thread::ProcessMessages(cms);
}
void XmppThread::Login(const buzz::XmppClientSettings& xcs) {
@@ -69,7 +69,7 @@
void XmppThread::OnStateChange(buzz::XmppEngine::State state) {
}
-void XmppThread::OnMessage(talk_base::Message* pmsg) {
+void XmppThread::OnMessage(rtc::Message* pmsg) {
if (pmsg->message_id == MSG_LOGIN) {
ASSERT(pmsg->pdata != NULL);
LoginData* data = reinterpret_cast<LoginData*>(pmsg->pdata);
diff --git a/xmpp/xmppthread.h b/xmpp/xmppthread.h
index 62a5ce6..a42fa4d 100644
--- a/xmpp/xmppthread.h
+++ b/xmpp/xmppthread.h
@@ -28,7 +28,7 @@
#ifndef TALK_XMPP_XMPPTHREAD_H_
#define TALK_XMPP_XMPPTHREAD_H_
-#include "talk/base/thread.h"
+#include "webrtc/base/thread.h"
#include "talk/xmpp/xmppclientsettings.h"
#include "talk/xmpp/xmppengine.h"
#include "talk/xmpp/xmpppump.h"
@@ -37,7 +37,7 @@
namespace buzz {
class XmppThread:
- public talk_base::Thread, buzz::XmppPumpNotify, talk_base::MessageHandler {
+ public rtc::Thread, buzz::XmppPumpNotify, rtc::MessageHandler {
public:
XmppThread();
~XmppThread();
@@ -53,7 +53,7 @@
buzz::XmppPump* pump_;
void OnStateChange(buzz::XmppEngine::State state);
- void OnMessage(talk_base::Message* pmsg);
+ void OnMessage(rtc::Message* pmsg);
};
} // namespace buzz