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

Side by Side Diff: webrtc/pc/mediasession.cc

Issue 1671173002: Track pending ICE restarts independently for different media sections. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Merging with master. Created 4 years, 10 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
« no previous file with comments | « webrtc/pc/mediasession.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2004 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 } 714 }
715 } 715 }
716 return false; 716 return false;
717 } 717 }
718 718
719 template <class C> 719 template <class C>
720 static bool IsRtxCodec(const C& codec) { 720 static bool IsRtxCodec(const C& codec) {
721 return stricmp(codec.name.c_str(), kRtxCodecName) == 0; 721 return stricmp(codec.name.c_str(), kRtxCodecName) == 0;
722 } 722 }
723 723
724 static TransportOptions GetTransportOptions(const MediaSessionOptions& options,
725 const std::string& content_name) {
726 auto it = options.transport_options.find(content_name);
727 if (it == options.transport_options.end()) {
728 return TransportOptions();
729 }
730 return it->second;
731 }
732
724 // Create a media content to be offered in a session-initiate, 733 // Create a media content to be offered in a session-initiate,
725 // according to the given options.rtcp_mux, options.is_muc, 734 // according to the given options.rtcp_mux, options.is_muc,
726 // options.streams, codecs, secure_transport, crypto, and streams. If we don't 735 // options.streams, codecs, secure_transport, crypto, and streams. If we don't
727 // currently have crypto (in current_cryptos) and it is enabled (in 736 // currently have crypto (in current_cryptos) and it is enabled (in
728 // secure_policy), crypto is created (according to crypto_suites). If 737 // secure_policy), crypto is created (according to crypto_suites). If
729 // add_legacy_stream is true, and current_streams is empty, a legacy 738 // add_legacy_stream is true, and current_streams is empty, a legacy
730 // stream is created. The created content is added to the offer. 739 // stream is created. The created content is added to the offer.
731 template <class C> 740 template <class C>
732 static bool CreateMediaContentOffer( 741 static bool CreateMediaContentOffer(
733 const MediaSessionOptions& options, 742 const MediaSessionOptions& options,
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 } 1588 }
1580 } else { 1589 } else {
1581 if (options.recv_audio) { 1590 if (options.recv_audio) {
1582 audio->set_direction(MD_RECVONLY); 1591 audio->set_direction(MD_RECVONLY);
1583 } else { 1592 } else {
1584 audio->set_direction(MD_INACTIVE); 1593 audio->set_direction(MD_INACTIVE);
1585 } 1594 }
1586 } 1595 }
1587 1596
1588 desc->AddContent(content_name, NS_JINGLE_RTP, audio.release()); 1597 desc->AddContent(content_name, NS_JINGLE_RTP, audio.release());
1589 if (!AddTransportOffer(content_name, options.audio_transport_options, 1598 if (!AddTransportOffer(content_name,
1599 GetTransportOptions(options, content_name),
1590 current_description, desc)) { 1600 current_description, desc)) {
1591 return false; 1601 return false;
1592 } 1602 }
1593 1603
1594 return true; 1604 return true;
1595 } 1605 }
1596 1606
1597 bool MediaSessionDescriptionFactory::AddVideoContentForOffer( 1607 bool MediaSessionDescriptionFactory::AddVideoContentForOffer(
1598 const MediaSessionOptions& options, 1608 const MediaSessionOptions& options,
1599 const SessionDescription* current_description, 1609 const SessionDescription* current_description,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1639 } 1649 }
1640 } else { 1650 } else {
1641 if (options.recv_video) { 1651 if (options.recv_video) {
1642 video->set_direction(MD_RECVONLY); 1652 video->set_direction(MD_RECVONLY);
1643 } else { 1653 } else {
1644 video->set_direction(MD_INACTIVE); 1654 video->set_direction(MD_INACTIVE);
1645 } 1655 }
1646 } 1656 }
1647 1657
1648 desc->AddContent(content_name, NS_JINGLE_RTP, video.release()); 1658 desc->AddContent(content_name, NS_JINGLE_RTP, video.release());
1649 if (!AddTransportOffer(content_name, options.video_transport_options, 1659 if (!AddTransportOffer(content_name,
1660 GetTransportOptions(options, content_name),
1650 current_description, desc)) { 1661 current_description, desc)) {
1651 return false; 1662 return false;
1652 } 1663 }
1653 1664
1654 return true; 1665 return true;
1655 } 1666 }
1656 1667
1657 bool MediaSessionDescriptionFactory::AddDataContentForOffer( 1668 bool MediaSessionDescriptionFactory::AddDataContentForOffer(
1658 const MediaSessionOptions& options, 1669 const MediaSessionOptions& options,
1659 const SessionDescription* current_description, 1670 const SessionDescription* current_description,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 return false; 1714 return false;
1704 } 1715 }
1705 1716
1706 if (is_sctp) { 1717 if (is_sctp) {
1707 desc->AddContent(content_name, NS_JINGLE_DRAFT_SCTP, data.release()); 1718 desc->AddContent(content_name, NS_JINGLE_DRAFT_SCTP, data.release());
1708 } else { 1719 } else {
1709 data->set_bandwidth(options.data_bandwidth); 1720 data->set_bandwidth(options.data_bandwidth);
1710 SetMediaProtocol(secure_transport, data.get()); 1721 SetMediaProtocol(secure_transport, data.get());
1711 desc->AddContent(content_name, NS_JINGLE_RTP, data.release()); 1722 desc->AddContent(content_name, NS_JINGLE_RTP, data.release());
1712 } 1723 }
1713 if (!AddTransportOffer(content_name, options.data_transport_options, 1724 if (!AddTransportOffer(content_name,
1725 GetTransportOptions(options, content_name),
1714 current_description, desc)) { 1726 current_description, desc)) {
1715 return false; 1727 return false;
1716 } 1728 }
1717 return true; 1729 return true;
1718 } 1730 }
1719 1731
1720 bool MediaSessionDescriptionFactory::AddAudioContentForAnswer( 1732 bool MediaSessionDescriptionFactory::AddAudioContentForAnswer(
1721 const SessionDescription* offer, 1733 const SessionDescription* offer,
1722 const MediaSessionOptions& options, 1734 const MediaSessionOptions& options,
1723 const SessionDescription* current_description, 1735 const SessionDescription* current_description,
1724 StreamParamsVec* current_streams, 1736 StreamParamsVec* current_streams,
1725 SessionDescription* answer) const { 1737 SessionDescription* answer) const {
1726 const ContentInfo* audio_content = GetFirstAudioContent(offer); 1738 const ContentInfo* audio_content = GetFirstAudioContent(offer);
1727 1739
1728 scoped_ptr<TransportDescription> audio_transport(CreateTransportAnswer( 1740 scoped_ptr<TransportDescription> audio_transport(CreateTransportAnswer(
1729 audio_content->name, offer, options.audio_transport_options, 1741 audio_content->name, offer,
1730 current_description)); 1742 GetTransportOptions(options, audio_content->name), current_description));
1731 if (!audio_transport) { 1743 if (!audio_transport) {
1732 return false; 1744 return false;
1733 } 1745 }
1734 1746
1735 AudioCodecs audio_codecs = audio_codecs_; 1747 AudioCodecs audio_codecs = audio_codecs_;
1736 if (!options.vad_enabled) { 1748 if (!options.vad_enabled) {
1737 StripCNCodecs(&audio_codecs); 1749 StripCNCodecs(&audio_codecs);
1738 } 1750 }
1739 1751
1740 bool bundle_enabled = 1752 bool bundle_enabled =
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1777 } 1789 }
1778 1790
1779 bool MediaSessionDescriptionFactory::AddVideoContentForAnswer( 1791 bool MediaSessionDescriptionFactory::AddVideoContentForAnswer(
1780 const SessionDescription* offer, 1792 const SessionDescription* offer,
1781 const MediaSessionOptions& options, 1793 const MediaSessionOptions& options,
1782 const SessionDescription* current_description, 1794 const SessionDescription* current_description,
1783 StreamParamsVec* current_streams, 1795 StreamParamsVec* current_streams,
1784 SessionDescription* answer) const { 1796 SessionDescription* answer) const {
1785 const ContentInfo* video_content = GetFirstVideoContent(offer); 1797 const ContentInfo* video_content = GetFirstVideoContent(offer);
1786 scoped_ptr<TransportDescription> video_transport(CreateTransportAnswer( 1798 scoped_ptr<TransportDescription> video_transport(CreateTransportAnswer(
1787 video_content->name, offer, options.video_transport_options, 1799 video_content->name, offer,
1788 current_description)); 1800 GetTransportOptions(options, video_content->name), current_description));
1789 if (!video_transport) { 1801 if (!video_transport) {
1790 return false; 1802 return false;
1791 } 1803 }
1792 1804
1793 scoped_ptr<VideoContentDescription> video_answer( 1805 scoped_ptr<VideoContentDescription> video_answer(
1794 new VideoContentDescription()); 1806 new VideoContentDescription());
1795 // Do not require or create SDES cryptos if DTLS is used. 1807 // Do not require or create SDES cryptos if DTLS is used.
1796 cricket::SecurePolicy sdes_policy = 1808 cricket::SecurePolicy sdes_policy =
1797 video_transport->secure() ? cricket::SEC_DISABLED : secure(); 1809 video_transport->secure() ? cricket::SEC_DISABLED : secure();
1798 bool bundle_enabled = 1810 bool bundle_enabled =
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1832 } 1844 }
1833 1845
1834 bool MediaSessionDescriptionFactory::AddDataContentForAnswer( 1846 bool MediaSessionDescriptionFactory::AddDataContentForAnswer(
1835 const SessionDescription* offer, 1847 const SessionDescription* offer,
1836 const MediaSessionOptions& options, 1848 const MediaSessionOptions& options,
1837 const SessionDescription* current_description, 1849 const SessionDescription* current_description,
1838 StreamParamsVec* current_streams, 1850 StreamParamsVec* current_streams,
1839 SessionDescription* answer) const { 1851 SessionDescription* answer) const {
1840 const ContentInfo* data_content = GetFirstDataContent(offer); 1852 const ContentInfo* data_content = GetFirstDataContent(offer);
1841 scoped_ptr<TransportDescription> data_transport(CreateTransportAnswer( 1853 scoped_ptr<TransportDescription> data_transport(CreateTransportAnswer(
1842 data_content->name, offer, options.data_transport_options, 1854 data_content->name, offer,
1843 current_description)); 1855 GetTransportOptions(options, data_content->name), current_description));
1844 if (!data_transport) { 1856 if (!data_transport) {
1845 return false; 1857 return false;
1846 } 1858 }
1847 bool is_sctp = (options.data_channel_type == DCT_SCTP); 1859 bool is_sctp = (options.data_channel_type == DCT_SCTP);
1848 std::vector<DataCodec> data_codecs(data_codecs_); 1860 std::vector<DataCodec> data_codecs(data_codecs_);
1849 FilterDataCodecs(&data_codecs, is_sctp); 1861 FilterDataCodecs(&data_codecs, is_sctp);
1850 1862
1851 scoped_ptr<DataContentDescription> data_answer( 1863 scoped_ptr<DataContentDescription> data_answer(
1852 new DataContentDescription()); 1864 new DataContentDescription());
1853 // Do not require or create SDES cryptos if DTLS is used. 1865 // Do not require or create SDES cryptos if DTLS is used.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1901 } 1913 }
1902 1914
1903 bool IsVideoContent(const ContentInfo* content) { 1915 bool IsVideoContent(const ContentInfo* content) {
1904 return IsMediaContentOfType(content, MEDIA_TYPE_VIDEO); 1916 return IsMediaContentOfType(content, MEDIA_TYPE_VIDEO);
1905 } 1917 }
1906 1918
1907 bool IsDataContent(const ContentInfo* content) { 1919 bool IsDataContent(const ContentInfo* content) {
1908 return IsMediaContentOfType(content, MEDIA_TYPE_DATA); 1920 return IsMediaContentOfType(content, MEDIA_TYPE_DATA);
1909 } 1921 }
1910 1922
1911 static const ContentInfo* GetFirstMediaContent(const ContentInfos& contents, 1923 const ContentInfo* GetFirstMediaContent(const ContentInfos& contents,
1912 MediaType media_type) { 1924 MediaType media_type) {
1913 for (ContentInfos::const_iterator content = contents.begin(); 1925 for (ContentInfos::const_iterator content = contents.begin();
1914 content != contents.end(); content++) { 1926 content != contents.end(); content++) {
1915 if (IsMediaContentOfType(&*content, media_type)) { 1927 if (IsMediaContentOfType(&*content, media_type)) {
1916 return &*content; 1928 return &*content;
1917 } 1929 }
1918 } 1930 }
1919 return NULL; 1931 return nullptr;
1920 } 1932 }
1921 1933
1922 const ContentInfo* GetFirstAudioContent(const ContentInfos& contents) { 1934 const ContentInfo* GetFirstAudioContent(const ContentInfos& contents) {
1923 return GetFirstMediaContent(contents, MEDIA_TYPE_AUDIO); 1935 return GetFirstMediaContent(contents, MEDIA_TYPE_AUDIO);
1924 } 1936 }
1925 1937
1926 const ContentInfo* GetFirstVideoContent(const ContentInfos& contents) { 1938 const ContentInfo* GetFirstVideoContent(const ContentInfos& contents) {
1927 return GetFirstMediaContent(contents, MEDIA_TYPE_VIDEO); 1939 return GetFirstMediaContent(contents, MEDIA_TYPE_VIDEO);
1928 } 1940 }
1929 1941
1930 const ContentInfo* GetFirstDataContent(const ContentInfos& contents) { 1942 const ContentInfo* GetFirstDataContent(const ContentInfos& contents) {
1931 return GetFirstMediaContent(contents, MEDIA_TYPE_DATA); 1943 return GetFirstMediaContent(contents, MEDIA_TYPE_DATA);
1932 } 1944 }
1933 1945
1934 static const ContentInfo* GetFirstMediaContent(const SessionDescription* sdesc, 1946 static const ContentInfo* GetFirstMediaContent(const SessionDescription* sdesc,
1935 MediaType media_type) { 1947 MediaType media_type) {
1936 if (sdesc == NULL) 1948 if (sdesc == nullptr) {
1937 return NULL; 1949 return nullptr;
1950 }
1938 1951
1939 return GetFirstMediaContent(sdesc->contents(), media_type); 1952 return GetFirstMediaContent(sdesc->contents(), media_type);
1940 } 1953 }
1941 1954
1942 const ContentInfo* GetFirstAudioContent(const SessionDescription* sdesc) { 1955 const ContentInfo* GetFirstAudioContent(const SessionDescription* sdesc) {
1943 return GetFirstMediaContent(sdesc, MEDIA_TYPE_AUDIO); 1956 return GetFirstMediaContent(sdesc, MEDIA_TYPE_AUDIO);
1944 } 1957 }
1945 1958
1946 const ContentInfo* GetFirstVideoContent(const SessionDescription* sdesc) { 1959 const ContentInfo* GetFirstVideoContent(const SessionDescription* sdesc) {
1947 return GetFirstMediaContent(sdesc, MEDIA_TYPE_VIDEO); 1960 return GetFirstMediaContent(sdesc, MEDIA_TYPE_VIDEO);
(...skipping 22 matching lines...) Expand all
1970 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_VIDEO)); 1983 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_VIDEO));
1971 } 1984 }
1972 1985
1973 const DataContentDescription* GetFirstDataContentDescription( 1986 const DataContentDescription* GetFirstDataContentDescription(
1974 const SessionDescription* sdesc) { 1987 const SessionDescription* sdesc) {
1975 return static_cast<const DataContentDescription*>( 1988 return static_cast<const DataContentDescription*>(
1976 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_DATA)); 1989 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_DATA));
1977 } 1990 }
1978 1991
1979 } // namespace cricket 1992 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/pc/mediasession.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698