Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Unified Diff: webrtc/p2p/base/rawtransportchannel.cc

Issue 1246913005: TransportController refactoring (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Set media engine on voice channel Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/p2p/base/rawtransportchannel.cc
diff --git a/webrtc/p2p/base/rawtransportchannel.cc b/webrtc/p2p/base/rawtransportchannel.cc
index b032e63cdae2c18c8b7217d5bd7c33a134308d61..182857818e81e71622b268a287c9cd332cb87d58 100644
--- a/webrtc/p2p/base/rawtransportchannel.cc
+++ b/webrtc/p2p/base/rawtransportchannel.cc
@@ -22,31 +22,20 @@
#if defined(FEATURE_ENABLE_PSTN)
-namespace {
-
-const uint32 MSG_DESTROY_RTC_UNUSED_PORTS = 1;
-
-} // namespace
-
namespace cricket {
RawTransportChannel::RawTransportChannel(const std::string& content_name,
int component,
RawTransport* transport,
- rtc::Thread *worker_thread,
- PortAllocator *allocator)
- : TransportChannelImpl(content_name, component),
- raw_transport_(transport),
- allocator_(allocator),
- allocator_session_(NULL),
- stun_port_(NULL),
- relay_port_(NULL),
- port_(NULL),
- use_relay_(false) {
- if (worker_thread == NULL)
- worker_thread_ = raw_transport_->worker_thread();
- else
- worker_thread_ = worker_thread;
+ PortAllocator* allocator)
+ : TransportChannelImpl(content_name, component),
+ raw_transport_(transport),
+ allocator_(allocator),
+ allocator_session_(NULL),
+ stun_port_(NULL),
+ relay_port_(NULL),
+ port_(NULL),
+ use_relay_(false) {
}
RawTransportChannel::~RawTransportChannel() {
@@ -158,7 +147,8 @@ void RawTransportChannel::OnPortReady(
}
void RawTransportChannel::OnCandidatesReady(
- PortAllocatorSession *session, const std::vector<Candidate>& candidates) {
+ PortAllocatorSession* session,
+ const std::vector<Candidate>& candidates) {
ASSERT(session == allocator_session_);
ASSERT(candidates.size() >= 1);
@@ -207,14 +197,13 @@ void RawTransportChannel::SetPort(PortInterface* port) {
// We don't need any ports other than the one we picked.
allocator_session_->StopGettingPorts();
- worker_thread_->Post(
- this, MSG_DESTROY_RTC_UNUSED_PORTS, NULL);
+ DestroyUnusedPorts();
// Send a message to the other client containing our address.
ASSERT(port_->Candidates().size() >= 1);
ASSERT(port_->Candidates()[0].protocol() == "udp");
- SignalCandidateReady(this, port_->Candidates()[0]);
+ SignalCandidateGathered(this, port_->Candidates()[0]);
// Read all packets from this port.
port_->EnablePortPackets();
@@ -243,8 +232,7 @@ void RawTransportChannel::OnReadPacket(
SignalReadPacket(this, data, size, rtc::CreatePacketTime(0), 0);
}
-void RawTransportChannel::OnMessage(rtc::Message* msg) {
- ASSERT(msg->message_id == MSG_DESTROY_RTC_UNUSED_PORTS);
+void RawTransportChannel::DestroyUnusedPorts() {
ASSERT(port_ != NULL);
if (port_ != stun_port_) {
stun_port_->Destroy();

Powered by Google App Engine
This is Rietveld 408576698