OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 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 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1588 } | 1588 } |
1589 } else { | 1589 } else { |
1590 if (options.recv_audio) { | 1590 if (options.recv_audio) { |
1591 audio->set_direction(MD_RECVONLY); | 1591 audio->set_direction(MD_RECVONLY); |
1592 } else { | 1592 } else { |
1593 audio->set_direction(MD_INACTIVE); | 1593 audio->set_direction(MD_INACTIVE); |
1594 } | 1594 } |
1595 } | 1595 } |
1596 | 1596 |
1597 desc->AddContent(CN_AUDIO, NS_JINGLE_RTP, audio.release()); | 1597 desc->AddContent(CN_AUDIO, NS_JINGLE_RTP, audio.release()); |
1598 if (!AddTransportOffer(CN_AUDIO, options.transport_options, | 1598 if (!AddTransportOffer(CN_AUDIO, options.audio_transport_options, |
1599 current_description, desc)) { | 1599 current_description, desc)) { |
1600 return false; | 1600 return false; |
1601 } | 1601 } |
1602 | 1602 |
1603 return true; | 1603 return true; |
1604 } | 1604 } |
1605 | 1605 |
1606 bool MediaSessionDescriptionFactory::AddVideoContentForOffer( | 1606 bool MediaSessionDescriptionFactory::AddVideoContentForOffer( |
1607 const MediaSessionOptions& options, | 1607 const MediaSessionOptions& options, |
1608 const SessionDescription* current_description, | 1608 const SessionDescription* current_description, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1643 } | 1643 } |
1644 } else { | 1644 } else { |
1645 if (options.recv_video) { | 1645 if (options.recv_video) { |
1646 video->set_direction(MD_RECVONLY); | 1646 video->set_direction(MD_RECVONLY); |
1647 } else { | 1647 } else { |
1648 video->set_direction(MD_INACTIVE); | 1648 video->set_direction(MD_INACTIVE); |
1649 } | 1649 } |
1650 } | 1650 } |
1651 | 1651 |
1652 desc->AddContent(CN_VIDEO, NS_JINGLE_RTP, video.release()); | 1652 desc->AddContent(CN_VIDEO, NS_JINGLE_RTP, video.release()); |
1653 if (!AddTransportOffer(CN_VIDEO, options.transport_options, | 1653 if (!AddTransportOffer(CN_VIDEO, options.video_transport_options, |
1654 current_description, desc)) { | 1654 current_description, desc)) { |
1655 return false; | 1655 return false; |
1656 } | 1656 } |
1657 | 1657 |
1658 return true; | 1658 return true; |
1659 } | 1659 } |
1660 | 1660 |
1661 bool MediaSessionDescriptionFactory::AddDataContentForOffer( | 1661 bool MediaSessionDescriptionFactory::AddDataContentForOffer( |
1662 const MediaSessionOptions& options, | 1662 const MediaSessionOptions& options, |
1663 const SessionDescription* current_description, | 1663 const SessionDescription* current_description, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1702 return false; | 1702 return false; |
1703 } | 1703 } |
1704 | 1704 |
1705 if (is_sctp) { | 1705 if (is_sctp) { |
1706 desc->AddContent(CN_DATA, NS_JINGLE_DRAFT_SCTP, data.release()); | 1706 desc->AddContent(CN_DATA, NS_JINGLE_DRAFT_SCTP, data.release()); |
1707 } else { | 1707 } else { |
1708 data->set_bandwidth(options.data_bandwidth); | 1708 data->set_bandwidth(options.data_bandwidth); |
1709 SetMediaProtocol(secure_transport, data.get()); | 1709 SetMediaProtocol(secure_transport, data.get()); |
1710 desc->AddContent(CN_DATA, NS_JINGLE_RTP, data.release()); | 1710 desc->AddContent(CN_DATA, NS_JINGLE_RTP, data.release()); |
1711 } | 1711 } |
1712 if (!AddTransportOffer(CN_DATA, options.transport_options, | 1712 if (!AddTransportOffer(CN_DATA, options.data_transport_options, |
1713 current_description, desc)) { | 1713 current_description, desc)) { |
1714 return false; | 1714 return false; |
1715 } | 1715 } |
1716 return true; | 1716 return true; |
1717 } | 1717 } |
1718 | 1718 |
1719 bool MediaSessionDescriptionFactory::AddAudioContentForAnswer( | 1719 bool MediaSessionDescriptionFactory::AddAudioContentForAnswer( |
1720 const SessionDescription* offer, | 1720 const SessionDescription* offer, |
1721 const MediaSessionOptions& options, | 1721 const MediaSessionOptions& options, |
1722 const SessionDescription* current_description, | 1722 const SessionDescription* current_description, |
1723 StreamParamsVec* current_streams, | 1723 StreamParamsVec* current_streams, |
1724 SessionDescription* answer) const { | 1724 SessionDescription* answer) const { |
1725 const ContentInfo* audio_content = GetFirstAudioContent(offer); | 1725 const ContentInfo* audio_content = GetFirstAudioContent(offer); |
1726 | 1726 |
1727 scoped_ptr<TransportDescription> audio_transport( | 1727 scoped_ptr<TransportDescription> audio_transport(CreateTransportAnswer( |
1728 CreateTransportAnswer(audio_content->name, offer, | 1728 audio_content->name, offer, options.audio_transport_options, |
1729 options.transport_options, | 1729 current_description)); |
1730 current_description)); | |
1731 if (!audio_transport) { | 1730 if (!audio_transport) { |
1732 return false; | 1731 return false; |
1733 } | 1732 } |
1734 | 1733 |
1735 AudioCodecs audio_codecs = audio_codecs_; | 1734 AudioCodecs audio_codecs = audio_codecs_; |
1736 if (!options.vad_enabled) { | 1735 if (!options.vad_enabled) { |
1737 StripCNCodecs(&audio_codecs); | 1736 StripCNCodecs(&audio_codecs); |
1738 } | 1737 } |
1739 | 1738 |
1740 bool bundle_enabled = | 1739 bool bundle_enabled = |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1776 return true; | 1775 return true; |
1777 } | 1776 } |
1778 | 1777 |
1779 bool MediaSessionDescriptionFactory::AddVideoContentForAnswer( | 1778 bool MediaSessionDescriptionFactory::AddVideoContentForAnswer( |
1780 const SessionDescription* offer, | 1779 const SessionDescription* offer, |
1781 const MediaSessionOptions& options, | 1780 const MediaSessionOptions& options, |
1782 const SessionDescription* current_description, | 1781 const SessionDescription* current_description, |
1783 StreamParamsVec* current_streams, | 1782 StreamParamsVec* current_streams, |
1784 SessionDescription* answer) const { | 1783 SessionDescription* answer) const { |
1785 const ContentInfo* video_content = GetFirstVideoContent(offer); | 1784 const ContentInfo* video_content = GetFirstVideoContent(offer); |
1786 scoped_ptr<TransportDescription> video_transport( | 1785 scoped_ptr<TransportDescription> video_transport(CreateTransportAnswer( |
1787 CreateTransportAnswer(video_content->name, offer, | 1786 video_content->name, offer, options.video_transport_options, |
1788 options.transport_options, | 1787 current_description)); |
1789 current_description)); | |
1790 if (!video_transport) { | 1788 if (!video_transport) { |
1791 return false; | 1789 return false; |
1792 } | 1790 } |
1793 | 1791 |
1794 scoped_ptr<VideoContentDescription> video_answer( | 1792 scoped_ptr<VideoContentDescription> video_answer( |
1795 new VideoContentDescription()); | 1793 new VideoContentDescription()); |
1796 // Do not require or create SDES cryptos if DTLS is used. | 1794 // Do not require or create SDES cryptos if DTLS is used. |
1797 cricket::SecurePolicy sdes_policy = | 1795 cricket::SecurePolicy sdes_policy = |
1798 video_transport->secure() ? cricket::SEC_DISABLED : secure(); | 1796 video_transport->secure() ? cricket::SEC_DISABLED : secure(); |
1799 bool bundle_enabled = | 1797 bool bundle_enabled = |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1832 return true; | 1830 return true; |
1833 } | 1831 } |
1834 | 1832 |
1835 bool MediaSessionDescriptionFactory::AddDataContentForAnswer( | 1833 bool MediaSessionDescriptionFactory::AddDataContentForAnswer( |
1836 const SessionDescription* offer, | 1834 const SessionDescription* offer, |
1837 const MediaSessionOptions& options, | 1835 const MediaSessionOptions& options, |
1838 const SessionDescription* current_description, | 1836 const SessionDescription* current_description, |
1839 StreamParamsVec* current_streams, | 1837 StreamParamsVec* current_streams, |
1840 SessionDescription* answer) const { | 1838 SessionDescription* answer) const { |
1841 const ContentInfo* data_content = GetFirstDataContent(offer); | 1839 const ContentInfo* data_content = GetFirstDataContent(offer); |
1842 scoped_ptr<TransportDescription> data_transport( | 1840 scoped_ptr<TransportDescription> data_transport(CreateTransportAnswer( |
1843 CreateTransportAnswer(data_content->name, offer, | 1841 data_content->name, offer, options.data_transport_options, |
1844 options.transport_options, | 1842 current_description)); |
1845 current_description)); | |
1846 if (!data_transport) { | 1843 if (!data_transport) { |
1847 return false; | 1844 return false; |
1848 } | 1845 } |
1849 bool is_sctp = (options.data_channel_type == DCT_SCTP); | 1846 bool is_sctp = (options.data_channel_type == DCT_SCTP); |
1850 std::vector<DataCodec> data_codecs(data_codecs_); | 1847 std::vector<DataCodec> data_codecs(data_codecs_); |
1851 FilterDataCodecs(&data_codecs, is_sctp); | 1848 FilterDataCodecs(&data_codecs, is_sctp); |
1852 | 1849 |
1853 scoped_ptr<DataContentDescription> data_answer( | 1850 scoped_ptr<DataContentDescription> data_answer( |
1854 new DataContentDescription()); | 1851 new DataContentDescription()); |
1855 // Do not require or create SDES cryptos if DTLS is used. | 1852 // Do not require or create SDES cryptos if DTLS is used. |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1972 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_VIDEO)); | 1969 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_VIDEO)); |
1973 } | 1970 } |
1974 | 1971 |
1975 const DataContentDescription* GetFirstDataContentDescription( | 1972 const DataContentDescription* GetFirstDataContentDescription( |
1976 const SessionDescription* sdesc) { | 1973 const SessionDescription* sdesc) { |
1977 return static_cast<const DataContentDescription*>( | 1974 return static_cast<const DataContentDescription*>( |
1978 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_DATA)); | 1975 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_DATA)); |
1979 } | 1976 } |
1980 | 1977 |
1981 } // namespace cricket | 1978 } // namespace cricket |
OLD | NEW |