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

Unified Diff: talk/app/webrtc/webrtcsession.cc

Issue 1363573002: Wire up transport sequence number / send time callbacks to webrtc via libjingle. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Cleanup Created 5 years, 2 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: talk/app/webrtc/webrtcsession.cc
diff --git a/talk/app/webrtc/webrtcsession.cc b/talk/app/webrtc/webrtcsession.cc
index 2ab9a1e6969599983724f9ffdce7aebb91b5d418..381f5a9d526c3bdb42f9bacd0adfe69ba4837f4b 100644
--- a/talk/app/webrtc/webrtcsession.cc
+++ b/talk/app/webrtc/webrtcsession.cc
@@ -45,12 +45,14 @@
#include "talk/session/media/channelmanager.h"
#include "talk/session/media/mediasession.h"
#include "webrtc/base/basictypes.h"
+#include "webrtc/base/bind.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/helpers.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/stringencode.h"
#include "webrtc/base/stringutils.h"
#include "webrtc/p2p/base/portallocator.h"
+#include "webrtc/p2p/base/transportchannel.h"
using cricket::ContentInfo;
using cricket::ContentInfos;
@@ -63,6 +65,8 @@ using cricket::STUN_PORT_TYPE;
using cricket::RELAY_PORT_TYPE;
using cricket::PRFLX_PORT_TYPE;
+using rtc::Bind;
+
namespace webrtc {
// Error messages
@@ -536,12 +540,11 @@ class IceRestartAnswerLatch {
bool ice_restart_;
};
-WebRtcSession::WebRtcSession(
- cricket::ChannelManager* channel_manager,
- rtc::Thread* signaling_thread,
- rtc::Thread* worker_thread,
- cricket::PortAllocator* port_allocator,
- MediaStreamSignaling* mediastream_signaling)
+WebRtcSession::WebRtcSession(webrtc::MediaControllerInterface* media_controller,
+ rtc::Thread* signaling_thread,
+ rtc::Thread* worker_thread,
+ cricket::PortAllocator* port_allocator,
+ MediaStreamSignaling* mediastream_signaling)
: cricket::BaseSession(signaling_thread,
worker_thread,
port_allocator,
@@ -550,7 +553,8 @@ WebRtcSession::WebRtcSession(
// RFC 3264: The numeric value of the session id and version in the
// o line MUST be representable with a "64 bit signed integer".
// Due to this constraint session id |sid_| is max limited to LLONG_MAX.
- channel_manager_(channel_manager),
+ media_controller_(media_controller),
+ channel_manager_(media_controller_->channel_manager()),
mediastream_signaling_(mediastream_signaling),
ice_observer_(NULL),
ice_connection_state_(PeerConnectionInterface::kIceConnectionNew),
@@ -776,9 +780,6 @@ bool WebRtcSession::Initialize(
cricket::PORTALLOCATOR_ENABLE_LOCALHOST_CANDIDATE);
}
- media_controller_.reset(MediaControllerInterface::Create(
- worker_thread(), channel_manager_->media_engine()->GetVoE()));
-
return true;
}
@@ -1819,7 +1820,7 @@ bool WebRtcSession::CreateChannels(const SessionDescription* desc) {
bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content) {
voice_channel_.reset(channel_manager_->CreateVoiceChannel(
- media_controller_.get(), transport_controller(), content->name, true,
+ media_controller_, transport_controller(), content->name, true,
audio_options_));
if (!voice_channel_) {
return false;
@@ -1827,12 +1828,14 @@ bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content) {
voice_channel_->SignalDtlsSetupFailure.connect(
this, &WebRtcSession::OnDtlsSetupFailure);
+ voice_channel_->transport_channel()->SignalSentPacket.connect(
+ this, &WebRtcSession::OnSentPacket);
return true;
}
bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content) {
video_channel_.reset(channel_manager_->CreateVideoChannel(
- media_controller_.get(), transport_controller(), content->name, true,
+ media_controller_, transport_controller(), content->name, true,
video_options_));
if (!video_channel_) {
return false;
@@ -1840,6 +1843,8 @@ bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content) {
video_channel_->SignalDtlsSetupFailure.connect(
this, &WebRtcSession::OnDtlsSetupFailure);
+ video_channel_->transport_channel()->SignalSentPacket.connect(
+ this, &WebRtcSession::OnSentPacket);
return true;
}
@@ -1862,6 +1867,8 @@ bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content) {
data_channel_->SignalDtlsSetupFailure.connect(
this, &WebRtcSession::OnDtlsSetupFailure);
+ data_channel_->transport_channel()->SignalSentPacket.connect(
+ this, &WebRtcSession::OnSentPacket);
return true;
}
@@ -2185,4 +2192,16 @@ void WebRtcSession::ReportNegotiatedCiphers(
}
}
+void WebRtcSession::OnSentPacket(cricket::TransportChannel* channel,
+ const rtc::SentPacket& sent_packet) {
+ worker_thread()->Invoke<void>(
+ rtc::Bind(&WebRtcSession::OnSentPacket_w, this, sent_packet));
+ media_controller_->call_w()->OnSentPacket(sent_packet);
pthatcher1 2015/10/13 05:31:13 Two things: 1. If you hop to the worker thread,
stefan-webrtc 2015/10/13 08:09:20 You are right, it should. Keeping OnSentPacket_w.
+}
+
+void WebRtcSession::OnSentPacket_w(const rtc::SentPacket& sent_packet) {
+ RTC_DCHECK(worker_thread()->IsCurrent());
+ media_controller_->call_w()->OnSentPacket(sent_packet);
+}
+
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698