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

Side by Side 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: Add missing updated_options 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "talk/media/base/videocapturer.h" 44 #include "talk/media/base/videocapturer.h"
45 #include "talk/session/media/channel.h" 45 #include "talk/session/media/channel.h"
46 #include "talk/session/media/channelmanager.h" 46 #include "talk/session/media/channelmanager.h"
47 #include "talk/session/media/mediasession.h" 47 #include "talk/session/media/mediasession.h"
48 #include "webrtc/base/basictypes.h" 48 #include "webrtc/base/basictypes.h"
49 #include "webrtc/base/checks.h" 49 #include "webrtc/base/checks.h"
50 #include "webrtc/base/helpers.h" 50 #include "webrtc/base/helpers.h"
51 #include "webrtc/base/logging.h" 51 #include "webrtc/base/logging.h"
52 #include "webrtc/base/stringencode.h" 52 #include "webrtc/base/stringencode.h"
53 #include "webrtc/base/stringutils.h" 53 #include "webrtc/base/stringutils.h"
54 #include "webrtc/call.h"
54 #include "webrtc/p2p/base/portallocator.h" 55 #include "webrtc/p2p/base/portallocator.h"
56 #include "webrtc/p2p/base/transportchannel.h"
55 57
56 using cricket::ContentInfo; 58 using cricket::ContentInfo;
57 using cricket::ContentInfos; 59 using cricket::ContentInfos;
58 using cricket::MediaContentDescription; 60 using cricket::MediaContentDescription;
59 using cricket::SessionDescription; 61 using cricket::SessionDescription;
60 using cricket::TransportInfo; 62 using cricket::TransportInfo;
61 63
62 using cricket::LOCAL_PORT_TYPE; 64 using cricket::LOCAL_PORT_TYPE;
63 using cricket::STUN_PORT_TYPE; 65 using cricket::STUN_PORT_TYPE;
64 using cricket::RELAY_PORT_TYPE; 66 using cricket::RELAY_PORT_TYPE;
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 return true; 524 return true;
523 } 525 }
524 } 526 }
525 return false; 527 return false;
526 } 528 }
527 529
528 private: 530 private:
529 bool ice_restart_; 531 bool ice_restart_;
530 }; 532 };
531 533
532 WebRtcSession::WebRtcSession(cricket::ChannelManager* channel_manager, 534 WebRtcSession::WebRtcSession(webrtc::MediaControllerInterface* media_controller,
533 rtc::Thread* signaling_thread, 535 rtc::Thread* signaling_thread,
534 rtc::Thread* worker_thread, 536 rtc::Thread* worker_thread,
535 cricket::PortAllocator* port_allocator) 537 cricket::PortAllocator* port_allocator)
536 : signaling_thread_(signaling_thread), 538 : signaling_thread_(signaling_thread),
537 worker_thread_(worker_thread), 539 worker_thread_(worker_thread),
538 port_allocator_(port_allocator), 540 port_allocator_(port_allocator),
539 // RFC 3264: The numeric value of the session id and version in the 541 // RFC 3264: The numeric value of the session id and version in the
540 // o line MUST be representable with a "64 bit signed integer". 542 // o line MUST be representable with a "64 bit signed integer".
541 // Due to this constraint session id |sid_| is max limited to LLONG_MAX. 543 // Due to this constraint session id |sid_| is max limited to LLONG_MAX.
542 sid_(rtc::ToString(rtc::CreateRandomId64() & LLONG_MAX)), 544 sid_(rtc::ToString(rtc::CreateRandomId64() & LLONG_MAX)),
543 transport_controller_(new cricket::TransportController(signaling_thread, 545 transport_controller_(new cricket::TransportController(signaling_thread,
544 worker_thread, 546 worker_thread,
545 port_allocator)), 547 port_allocator)),
546 channel_manager_(channel_manager), 548 media_controller_(media_controller),
549 channel_manager_(media_controller_->channel_manager()),
547 ice_observer_(NULL), 550 ice_observer_(NULL),
548 ice_connection_state_(PeerConnectionInterface::kIceConnectionNew), 551 ice_connection_state_(PeerConnectionInterface::kIceConnectionNew),
549 ice_connection_receiving_(true), 552 ice_connection_receiving_(true),
550 older_version_remote_peer_(false), 553 older_version_remote_peer_(false),
551 dtls_enabled_(false), 554 dtls_enabled_(false),
552 data_channel_type_(cricket::DCT_NONE), 555 data_channel_type_(cricket::DCT_NONE),
553 ice_restart_latch_(new IceRestartAnswerLatch), 556 ice_restart_latch_(new IceRestartAnswerLatch),
554 metrics_observer_(NULL) { 557 metrics_observer_(NULL) {
555 transport_controller_->SetIceRole(cricket::ICEROLE_CONTROLLED); 558 transport_controller_->SetIceRole(cricket::ICEROLE_CONTROLLED);
556 transport_controller_->SignalConnectionState.connect( 559 transport_controller_->SignalConnectionState.connect(
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 } 759 }
757 port_allocator()->set_candidate_filter( 760 port_allocator()->set_candidate_filter(
758 ConvertIceTransportTypeToCandidateFilter(rtc_configuration.type)); 761 ConvertIceTransportTypeToCandidateFilter(rtc_configuration.type));
759 762
760 if (rtc_configuration.enable_localhost_ice_candidate) { 763 if (rtc_configuration.enable_localhost_ice_candidate) {
761 port_allocator()->set_flags( 764 port_allocator()->set_flags(
762 port_allocator()->flags() | 765 port_allocator()->flags() |
763 cricket::PORTALLOCATOR_ENABLE_LOCALHOST_CANDIDATE); 766 cricket::PORTALLOCATOR_ENABLE_LOCALHOST_CANDIDATE);
764 } 767 }
765 768
766 media_controller_.reset(MediaControllerInterface::Create(
767 worker_thread(), channel_manager_->media_engine()->GetVoE()));
768
769 return true; 769 return true;
770 } 770 }
771 771
772 void WebRtcSession::Close() { 772 void WebRtcSession::Close() {
773 SetState(STATE_CLOSED); 773 SetState(STATE_CLOSED);
774 RemoveUnusedChannels(nullptr); 774 RemoveUnusedChannels(nullptr);
775 ASSERT(!voice_channel_); 775 ASSERT(!voice_channel_);
776 ASSERT(!video_channel_); 776 ASSERT(!video_channel_);
777 ASSERT(!data_channel_); 777 ASSERT(!data_channel_);
778 } 778 }
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after
1837 LOG(LS_WARNING) << "max-bundle failed to enable bundling."; 1837 LOG(LS_WARNING) << "max-bundle failed to enable bundling.";
1838 return false; 1838 return false;
1839 } 1839 }
1840 } 1840 }
1841 1841
1842 return true; 1842 return true;
1843 } 1843 }
1844 1844
1845 bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content) { 1845 bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content) {
1846 voice_channel_.reset(channel_manager_->CreateVoiceChannel( 1846 voice_channel_.reset(channel_manager_->CreateVoiceChannel(
1847 media_controller_.get(), transport_controller_.get(), content->name, true, 1847 media_controller_, transport_controller_.get(), content->name, true,
1848 audio_options_)); 1848 audio_options_));
1849 if (!voice_channel_) { 1849 if (!voice_channel_) {
1850 return false; 1850 return false;
1851 } 1851 }
1852 1852
1853 voice_channel_->SignalDtlsSetupFailure.connect( 1853 voice_channel_->SignalDtlsSetupFailure.connect(
1854 this, &WebRtcSession::OnDtlsSetupFailure); 1854 this, &WebRtcSession::OnDtlsSetupFailure);
1855 1855
1856 SignalVoiceChannelCreated(); 1856 SignalVoiceChannelCreated();
1857 voice_channel_->transport_channel()->SignalSentPacket.connect(
1858 this, &WebRtcSession::OnSentPacket_w);
1857 return true; 1859 return true;
1858 } 1860 }
1859 1861
1860 bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content) { 1862 bool WebRtcSession::CreateVideoChannel(const cricket::ContentInfo* content) {
1861 video_channel_.reset(channel_manager_->CreateVideoChannel( 1863 video_channel_.reset(channel_manager_->CreateVideoChannel(
1862 media_controller_.get(), transport_controller_.get(), content->name, true, 1864 media_controller_, transport_controller_.get(), content->name, true,
1863 video_options_)); 1865 video_options_));
1864 if (!video_channel_) { 1866 if (!video_channel_) {
1865 return false; 1867 return false;
1866 } 1868 }
1867 1869
1868 video_channel_->SignalDtlsSetupFailure.connect( 1870 video_channel_->SignalDtlsSetupFailure.connect(
1869 this, &WebRtcSession::OnDtlsSetupFailure); 1871 this, &WebRtcSession::OnDtlsSetupFailure);
1870 1872
1871 SignalVideoChannelCreated(); 1873 SignalVideoChannelCreated();
1874 video_channel_->transport_channel()->SignalSentPacket.connect(
1875 this, &WebRtcSession::OnSentPacket_w);
1872 return true; 1876 return true;
1873 } 1877 }
1874 1878
1875 bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content) { 1879 bool WebRtcSession::CreateDataChannel(const cricket::ContentInfo* content) {
1876 bool sctp = (data_channel_type_ == cricket::DCT_SCTP); 1880 bool sctp = (data_channel_type_ == cricket::DCT_SCTP);
1877 data_channel_.reset(channel_manager_->CreateDataChannel( 1881 data_channel_.reset(channel_manager_->CreateDataChannel(
1878 transport_controller_.get(), content->name, !sctp, data_channel_type_)); 1882 transport_controller_.get(), content->name, !sctp, data_channel_type_));
1879 if (!data_channel_) { 1883 if (!data_channel_) {
1880 return false; 1884 return false;
1881 } 1885 }
1882 1886
1883 if (sctp) { 1887 if (sctp) {
1884 data_channel_->SignalDataReceived.connect( 1888 data_channel_->SignalDataReceived.connect(
1885 this, &WebRtcSession::OnDataChannelMessageReceived); 1889 this, &WebRtcSession::OnDataChannelMessageReceived);
1886 } 1890 }
1887 1891
1888 data_channel_->SignalDtlsSetupFailure.connect( 1892 data_channel_->SignalDtlsSetupFailure.connect(
1889 this, &WebRtcSession::OnDtlsSetupFailure); 1893 this, &WebRtcSession::OnDtlsSetupFailure);
1890 1894
1891 SignalDataChannelCreated(); 1895 SignalDataChannelCreated();
1896 data_channel_->transport_channel()->SignalSentPacket.connect(
1897 this, &WebRtcSession::OnSentPacket_w);
1892 return true; 1898 return true;
1893 } 1899 }
1894 1900
1895 void WebRtcSession::OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp) { 1901 void WebRtcSession::OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp) {
1896 SetError(ERROR_TRANSPORT, 1902 SetError(ERROR_TRANSPORT,
1897 rtcp ? kDtlsSetupFailureRtcp : kDtlsSetupFailureRtp); 1903 rtcp ? kDtlsSetupFailureRtcp : kDtlsSetupFailureRtp);
1898 } 1904 }
1899 1905
1900 void WebRtcSession::OnDataChannelMessageReceived( 1906 void WebRtcSession::OnDataChannelMessageReceived(
1901 cricket::DataChannel* channel, 1907 cricket::DataChannel* channel,
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
2198 2204
2199 if (!srtp_cipher.empty()) { 2205 if (!srtp_cipher.empty()) {
2200 metrics_observer_->IncrementSparseEnumCounter( 2206 metrics_observer_->IncrementSparseEnumCounter(
2201 srtp_counter_type, rtc::GetSrtpCryptoSuiteFromName(srtp_cipher)); 2207 srtp_counter_type, rtc::GetSrtpCryptoSuiteFromName(srtp_cipher));
2202 } 2208 }
2203 if (ssl_cipher) { 2209 if (ssl_cipher) {
2204 metrics_observer_->IncrementSparseEnumCounter(ssl_counter_type, ssl_cipher); 2210 metrics_observer_->IncrementSparseEnumCounter(ssl_counter_type, ssl_cipher);
2205 } 2211 }
2206 } 2212 }
2207 2213
2214 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel,
2215 const rtc::SentPacket& sent_packet) {
2216 RTC_DCHECK(worker_thread()->IsCurrent());
2217 media_controller_->call_w()->OnSentPacket(sent_packet);
2218 }
2219
2208 } // namespace webrtc 2220 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698