OLD | NEW |
---|---|
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 27 matching lines...) Expand all Loading... | |
38 #include "talk/app/webrtc/mediaconstraintsinterface.h" | 38 #include "talk/app/webrtc/mediaconstraintsinterface.h" |
39 #include "talk/app/webrtc/mediastreamsignaling.h" | 39 #include "talk/app/webrtc/mediastreamsignaling.h" |
40 #include "talk/app/webrtc/peerconnectioninterface.h" | 40 #include "talk/app/webrtc/peerconnectioninterface.h" |
41 #include "talk/app/webrtc/webrtcsessiondescriptionfactory.h" | 41 #include "talk/app/webrtc/webrtcsessiondescriptionfactory.h" |
42 #include "talk/media/base/constants.h" | 42 #include "talk/media/base/constants.h" |
43 #include "talk/media/base/videocapturer.h" | 43 #include "talk/media/base/videocapturer.h" |
44 #include "talk/session/media/channel.h" | 44 #include "talk/session/media/channel.h" |
45 #include "talk/session/media/channelmanager.h" | 45 #include "talk/session/media/channelmanager.h" |
46 #include "talk/session/media/mediasession.h" | 46 #include "talk/session/media/mediasession.h" |
47 #include "webrtc/base/basictypes.h" | 47 #include "webrtc/base/basictypes.h" |
48 #include "webrtc/base/bind.h" | |
48 #include "webrtc/base/checks.h" | 49 #include "webrtc/base/checks.h" |
49 #include "webrtc/base/helpers.h" | 50 #include "webrtc/base/helpers.h" |
50 #include "webrtc/base/logging.h" | 51 #include "webrtc/base/logging.h" |
51 #include "webrtc/base/stringencode.h" | 52 #include "webrtc/base/stringencode.h" |
52 #include "webrtc/base/stringutils.h" | 53 #include "webrtc/base/stringutils.h" |
53 #include "webrtc/p2p/base/portallocator.h" | 54 #include "webrtc/p2p/base/portallocator.h" |
54 | 55 |
55 using cricket::ContentInfo; | 56 using cricket::ContentInfo; |
56 using cricket::ContentInfos; | 57 using cricket::ContentInfos; |
57 using cricket::MediaContentDescription; | 58 using cricket::MediaContentDescription; |
58 using cricket::SessionDescription; | 59 using cricket::SessionDescription; |
59 using cricket::TransportInfo; | 60 using cricket::TransportInfo; |
60 | 61 |
61 using cricket::LOCAL_PORT_TYPE; | 62 using cricket::LOCAL_PORT_TYPE; |
62 using cricket::STUN_PORT_TYPE; | 63 using cricket::STUN_PORT_TYPE; |
63 using cricket::RELAY_PORT_TYPE; | 64 using cricket::RELAY_PORT_TYPE; |
64 using cricket::PRFLX_PORT_TYPE; | 65 using cricket::PRFLX_PORT_TYPE; |
65 | 66 |
67 using rtc::Bind; | |
68 | |
66 namespace webrtc { | 69 namespace webrtc { |
67 | 70 |
68 // Error messages | 71 // Error messages |
69 const char kBundleWithoutRtcpMux[] = "RTCP-MUX must be enabled when BUNDLE " | 72 const char kBundleWithoutRtcpMux[] = "RTCP-MUX must be enabled when BUNDLE " |
70 "is enabled."; | 73 "is enabled."; |
71 const char kCreateChannelFailed[] = "Failed to create channels."; | 74 const char kCreateChannelFailed[] = "Failed to create channels."; |
72 const char kInvalidCandidates[] = "Description contains invalid candidates."; | 75 const char kInvalidCandidates[] = "Description contains invalid candidates."; |
73 const char kInvalidSdp[] = "Invalid session description."; | 76 const char kInvalidSdp[] = "Invalid session description."; |
74 const char kMlineMismatch[] = | 77 const char kMlineMismatch[] = |
75 "Offer and answer descriptions m-lines are not matching. Rejecting answer."; | 78 "Offer and answer descriptions m-lines are not matching. Rejecting answer."; |
(...skipping 1681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1757 const std::string content_name = data_channel_->content_name(); | 1760 const std::string content_name = data_channel_->content_name(); |
1758 channel_manager_->DestroyDataChannel(data_channel_.release()); | 1761 channel_manager_->DestroyDataChannel(data_channel_.release()); |
1759 } | 1762 } |
1760 } | 1763 } |
1761 | 1764 |
1762 // TODO(mallinath) - Add a correct error code if the channels are not created | 1765 // TODO(mallinath) - Add a correct error code if the channels are not created |
1763 // due to BUNDLE is enabled but rtcp-mux is disabled. | 1766 // due to BUNDLE is enabled but rtcp-mux is disabled. |
1764 bool WebRtcSession::CreateChannels(const SessionDescription* desc) { | 1767 bool WebRtcSession::CreateChannels(const SessionDescription* desc) { |
1765 // Creating the media channels and transport proxies. | 1768 // Creating the media channels and transport proxies. |
1766 const cricket::ContentInfo* voice = cricket::GetFirstAudioContent(desc); | 1769 const cricket::ContentInfo* voice = cricket::GetFirstAudioContent(desc); |
1770 bool voice_channel_created = false; | |
1767 if (voice && !voice->rejected && !voice_channel_) { | 1771 if (voice && !voice->rejected && !voice_channel_) { |
1768 if (!CreateVoiceChannel(voice)) { | 1772 if (!CreateVoiceChannel(voice)) { |
1769 LOG(LS_ERROR) << "Failed to create voice channel."; | 1773 LOG(LS_ERROR) << "Failed to create voice channel."; |
1770 return false; | 1774 return false; |
1771 } | 1775 } |
1776 voice_channel_created = true; | |
1772 } | 1777 } |
1773 | 1778 |
1774 const cricket::ContentInfo* video = cricket::GetFirstVideoContent(desc); | 1779 const cricket::ContentInfo* video = cricket::GetFirstVideoContent(desc); |
1780 bool video_channel_created = false; | |
1775 if (video && !video->rejected && !video_channel_) { | 1781 if (video && !video->rejected && !video_channel_) { |
1776 if (!CreateVideoChannel(video)) { | 1782 if (!CreateVideoChannel(video)) { |
1777 LOG(LS_ERROR) << "Failed to create video channel."; | 1783 LOG(LS_ERROR) << "Failed to create video channel."; |
1778 return false; | 1784 return false; |
1779 } | 1785 } |
1786 video_channel_created = true; | |
1780 } | 1787 } |
1781 | 1788 |
1782 const cricket::ContentInfo* data = cricket::GetFirstDataContent(desc); | 1789 const cricket::ContentInfo* data = cricket::GetFirstDataContent(desc); |
1783 if (data_channel_type_ != cricket::DCT_NONE && | 1790 if (data_channel_type_ != cricket::DCT_NONE && |
1784 data && !data->rejected && !data_channel_) { | 1791 data && !data->rejected && !data_channel_) { |
1785 if (!CreateDataChannel(data)) { | 1792 if (!CreateDataChannel(data)) { |
1786 LOG(LS_ERROR) << "Failed to create data channel."; | 1793 LOG(LS_ERROR) << "Failed to create data channel."; |
1787 return false; | 1794 return false; |
1788 } | 1795 } |
1789 } | 1796 } |
(...skipping 17 matching lines...) Expand all Loading... | |
1807 if (!bundle_group) { | 1814 if (!bundle_group) { |
1808 LOG(LS_WARNING) << "max-bundle specified without BUNDLE specified"; | 1815 LOG(LS_WARNING) << "max-bundle specified without BUNDLE specified"; |
1809 return false; | 1816 return false; |
1810 } | 1817 } |
1811 if (!EnableBundle(*bundle_group)) { | 1818 if (!EnableBundle(*bundle_group)) { |
1812 LOG(LS_WARNING) << "max-bundle failed to enable bundling."; | 1819 LOG(LS_WARNING) << "max-bundle failed to enable bundling."; |
1813 return false; | 1820 return false; |
1814 } | 1821 } |
1815 } | 1822 } |
1816 | 1823 |
1824 if (voice_channel_created) { | |
pthatcher1
2015/10/08 20:27:55
It's not necessary to put this after the bundle co
stefan-webrtc
2015/10/09 14:18:44
Right, makes sense.
I didn't figure out a good wa
| |
1825 worker_thread()->Invoke<void>( | |
1826 Bind(&MediaControllerInterface::ConnectToSignalSentPacket_w, | |
1827 media_controller_.get(), voice_channel_->transport_channel())); | |
1828 } | |
1829 if (video_channel_created) { | |
1830 worker_thread()->Invoke<void>( | |
1831 Bind(&MediaControllerInterface::ConnectToSignalSentPacket_w, | |
1832 media_controller_.get(), video_channel_->transport_channel())); | |
1833 } | |
1834 | |
1817 return true; | 1835 return true; |
1818 } | 1836 } |
1819 | 1837 |
1820 bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content) { | 1838 bool WebRtcSession::CreateVoiceChannel(const cricket::ContentInfo* content) { |
1821 voice_channel_.reset(channel_manager_->CreateVoiceChannel( | 1839 voice_channel_.reset(channel_manager_->CreateVoiceChannel( |
1822 media_controller_.get(), transport_controller(), content->name, true, | 1840 media_controller_.get(), transport_controller(), content->name, true, |
1823 audio_options_)); | 1841 audio_options_)); |
1824 if (!voice_channel_) { | 1842 if (!voice_channel_) { |
1825 return false; | 1843 return false; |
1826 } | 1844 } |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2179 if (!srtp_cipher.empty()) { | 2197 if (!srtp_cipher.empty()) { |
2180 metrics_observer_->IncrementSparseEnumCounter( | 2198 metrics_observer_->IncrementSparseEnumCounter( |
2181 srtp_counter_type, rtc::GetSrtpCryptoSuiteFromName(srtp_cipher)); | 2199 srtp_counter_type, rtc::GetSrtpCryptoSuiteFromName(srtp_cipher)); |
2182 } | 2200 } |
2183 if (ssl_cipher) { | 2201 if (ssl_cipher) { |
2184 metrics_observer_->IncrementSparseEnumCounter(ssl_counter_type, ssl_cipher); | 2202 metrics_observer_->IncrementSparseEnumCounter(ssl_counter_type, ssl_cipher); |
2185 } | 2203 } |
2186 } | 2204 } |
2187 | 2205 |
2188 } // namespace webrtc | 2206 } // namespace webrtc |
OLD | NEW |