Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 183 return mdesc && mdesc->type() == media_type; | 183 return mdesc && mdesc->type() == media_type; |
| 184 } | 184 } |
| 185 | 185 |
| 186 static cricket::MediaContentDirection | 186 static cricket::MediaContentDirection |
| 187 GetMediaDirection(const ContentInfo* content) { | 187 GetMediaDirection(const ContentInfo* content) { |
| 188 cricket::MediaContentDescription* desc = | 188 cricket::MediaContentDescription* desc = |
| 189 reinterpret_cast<cricket::MediaContentDescription*>(content->description); | 189 reinterpret_cast<cricket::MediaContentDescription*>(content->description); |
| 190 return desc->direction(); | 190 return desc->direction(); |
| 191 } | 191 } |
| 192 | 192 |
| 193 static void AddRtxCodec(const VideoCodec& rtx_codec, | 193 static void AddSecondaryCodec(const VideoCodec& secondary_codec, |
|
perkj_webrtc
2016/11/17 20:41:12
Why not just AddCodec if you want to keep it at al
brandtr
2016/11/21 09:16:30
After a second thought, I don't think the the asse
| |
| 194 std::vector<VideoCodec>* codecs) { | 194 std::vector<VideoCodec>* codecs) { |
| 195 ASSERT_FALSE(cricket::FindCodecById(*codecs, rtx_codec.id)); | 195 ASSERT_FALSE(cricket::FindCodecById(*codecs, secondary_codec.id)); |
| 196 codecs->push_back(rtx_codec); | 196 codecs->push_back(secondary_codec); |
| 197 } | 197 } |
| 198 | 198 |
| 199 template <class T> | 199 template <class T> |
| 200 static std::vector<std::string> GetCodecNames(const std::vector<T>& codecs) { | 200 static std::vector<std::string> GetCodecNames(const std::vector<T>& codecs) { |
| 201 std::vector<std::string> codec_names; | 201 std::vector<std::string> codec_names; |
| 202 for (const auto& codec : codecs) { | 202 for (const auto& codec : codecs) { |
| 203 codec_names.push_back(codec.name); | 203 codec_names.push_back(codec.name); |
| 204 } | 204 } |
| 205 return codec_names; | 205 return codec_names; |
| 206 } | 206 } |
| (...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1624 EXPECT_EQ(video_streams[0], updated_video_streams[0]); | 1624 EXPECT_EQ(video_streams[0], updated_video_streams[0]); |
| 1625 EXPECT_EQ(kVideoTrack2, updated_video_streams[1].id); | 1625 EXPECT_EQ(kVideoTrack2, updated_video_streams[1].id); |
| 1626 // All media streams in one PeerConnection share one CNAME. | 1626 // All media streams in one PeerConnection share one CNAME. |
| 1627 EXPECT_EQ(updated_video_streams[1].cname, updated_video_streams[0].cname); | 1627 EXPECT_EQ(updated_video_streams[1].cname, updated_video_streams[0].cname); |
| 1628 | 1628 |
| 1629 const StreamParamsVec& updated_data_streams = updated_dcd->streams(); | 1629 const StreamParamsVec& updated_data_streams = updated_dcd->streams(); |
| 1630 ASSERT_EQ(1U, updated_data_streams.size()); | 1630 ASSERT_EQ(1U, updated_data_streams.size()); |
| 1631 EXPECT_TRUE(data_streams[0] == updated_data_streams[0]); | 1631 EXPECT_TRUE(data_streams[0] == updated_data_streams[0]); |
| 1632 } | 1632 } |
| 1633 | 1633 |
| 1634 | |
| 1635 // Create an updated offer after creating an answer to the original offer and | 1634 // Create an updated offer after creating an answer to the original offer and |
| 1636 // verify that the codecs that were part of the original answer are not changed | 1635 // verify that the codecs that were part of the original answer are not changed |
| 1637 // in the updated offer. | 1636 // in the updated offer. |
| 1638 TEST_F(MediaSessionDescriptionFactoryTest, | 1637 TEST_F(MediaSessionDescriptionFactoryTest, |
| 1639 RespondentCreatesOfferAfterCreatingAnswer) { | 1638 RespondentCreatesOfferAfterCreatingAnswer) { |
| 1640 MediaSessionOptions opts; | 1639 MediaSessionOptions opts; |
| 1641 opts.recv_audio = true; | 1640 opts.recv_audio = true; |
| 1642 opts.recv_video = true; | 1641 opts.recv_video = true; |
| 1643 | 1642 |
| 1644 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL)); | 1643 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL)); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1687 // Create an updated offer after creating an answer to the original offer and | 1686 // Create an updated offer after creating an answer to the original offer and |
| 1688 // verify that the codecs that were part of the original answer are not changed | 1687 // verify that the codecs that were part of the original answer are not changed |
| 1689 // in the updated offer. In this test Rtx is enabled. | 1688 // in the updated offer. In this test Rtx is enabled. |
| 1690 TEST_F(MediaSessionDescriptionFactoryTest, | 1689 TEST_F(MediaSessionDescriptionFactoryTest, |
| 1691 RespondentCreatesOfferAfterCreatingAnswerWithRtx) { | 1690 RespondentCreatesOfferAfterCreatingAnswerWithRtx) { |
| 1692 MediaSessionOptions opts; | 1691 MediaSessionOptions opts; |
| 1693 opts.recv_video = true; | 1692 opts.recv_video = true; |
| 1694 opts.recv_audio = false; | 1693 opts.recv_audio = false; |
| 1695 std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1); | 1694 std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1); |
| 1696 // This creates rtx for H264 with the payload type |f1_| uses. | 1695 // This creates rtx for H264 with the payload type |f1_| uses. |
| 1697 AddRtxCodec(VideoCodec::CreateRtxCodec(126, kVideoCodecs1[1].id), &f1_codecs); | 1696 AddSecondaryCodec(VideoCodec::CreateRtxCodec(126, kVideoCodecs1[1].id), |
| 1697 &f1_codecs); | |
| 1698 f1_.set_video_codecs(f1_codecs); | 1698 f1_.set_video_codecs(f1_codecs); |
| 1699 | 1699 |
| 1700 std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2); | 1700 std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2); |
| 1701 // This creates rtx for H264 with the payload type |f2_| uses. | 1701 // This creates rtx for H264 with the payload type |f2_| uses. |
| 1702 AddRtxCodec(VideoCodec::CreateRtxCodec(125, kVideoCodecs2[0].id), &f2_codecs); | 1702 AddSecondaryCodec(VideoCodec::CreateRtxCodec(125, kVideoCodecs2[0].id), |
| 1703 &f2_codecs); | |
| 1703 f2_.set_video_codecs(f2_codecs); | 1704 f2_.set_video_codecs(f2_codecs); |
| 1704 | 1705 |
| 1705 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL)); | 1706 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL)); |
| 1706 ASSERT_TRUE(offer.get() != NULL); | 1707 ASSERT_TRUE(offer.get() != NULL); |
| 1707 std::unique_ptr<SessionDescription> answer( | 1708 std::unique_ptr<SessionDescription> answer( |
| 1708 f2_.CreateAnswer(offer.get(), opts, NULL)); | 1709 f2_.CreateAnswer(offer.get(), opts, NULL)); |
| 1709 | 1710 |
| 1710 const VideoContentDescription* vcd = | 1711 const VideoContentDescription* vcd = |
| 1711 GetFirstVideoContentDescription(answer.get()); | 1712 GetFirstVideoContentDescription(answer.get()); |
| 1712 | 1713 |
| 1713 std::vector<VideoCodec> expected_codecs = MAKE_VECTOR(kVideoCodecsAnswer); | 1714 std::vector<VideoCodec> expected_codecs = MAKE_VECTOR(kVideoCodecsAnswer); |
| 1714 AddRtxCodec(VideoCodec::CreateRtxCodec(126, kVideoCodecs1[1].id), | 1715 AddSecondaryCodec(VideoCodec::CreateRtxCodec(126, kVideoCodecs1[1].id), |
| 1715 &expected_codecs); | 1716 &expected_codecs); |
| 1716 | 1717 |
| 1717 EXPECT_EQ(expected_codecs, vcd->codecs()); | 1718 EXPECT_EQ(expected_codecs, vcd->codecs()); |
| 1718 | 1719 |
| 1719 // Now, make sure we get same result (except for the order) if |f2_| creates | 1720 // Now, make sure we get same result (except for the order) if |f2_| creates |
| 1720 // an updated offer even though the default payload types between |f1_| and | 1721 // an updated offer even though the default payload types between |f1_| and |
| 1721 // |f2_| are different. | 1722 // |f2_| are different. |
| 1722 std::unique_ptr<SessionDescription> updated_offer( | 1723 std::unique_ptr<SessionDescription> updated_offer( |
| 1723 f2_.CreateOffer(opts, answer.get())); | 1724 f2_.CreateOffer(opts, answer.get())); |
| 1724 ASSERT_TRUE(updated_offer); | 1725 ASSERT_TRUE(updated_offer); |
| 1725 std::unique_ptr<SessionDescription> updated_answer( | 1726 std::unique_ptr<SessionDescription> updated_answer( |
| 1726 f1_.CreateAnswer(updated_offer.get(), opts, answer.get())); | 1727 f1_.CreateAnswer(updated_offer.get(), opts, answer.get())); |
| 1727 | 1728 |
| 1728 const VideoContentDescription* updated_vcd = | 1729 const VideoContentDescription* updated_vcd = |
| 1729 GetFirstVideoContentDescription(updated_answer.get()); | 1730 GetFirstVideoContentDescription(updated_answer.get()); |
| 1730 | 1731 |
| 1731 EXPECT_EQ(expected_codecs, updated_vcd->codecs()); | 1732 EXPECT_EQ(expected_codecs, updated_vcd->codecs()); |
| 1732 } | 1733 } |
| 1733 | 1734 |
| 1734 // Create an updated offer that adds video after creating an audio only answer | 1735 // Create an updated offer that adds video after creating an audio only answer |
| 1735 // to the original offer. This test verifies that if a video codec and the RTX | 1736 // to the original offer. This test verifies that if a video codec and the RTX |
| 1736 // codec have the same default payload type as an audio codec that is already in | 1737 // codec have the same default payload type as an audio codec that is already in |
| 1737 // use, the added codecs payload types are changed. | 1738 // use, the added codecs payload types are changed. |
| 1738 TEST_F(MediaSessionDescriptionFactoryTest, | 1739 TEST_F(MediaSessionDescriptionFactoryTest, |
| 1739 RespondentCreatesOfferWithVideoAndRtxAfterCreatingAudioAnswer) { | 1740 RespondentCreatesOfferWithVideoAndRtxAfterCreatingAudioAnswer) { |
| 1740 std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1); | 1741 std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1); |
| 1741 // This creates rtx for H264 with the payload type |f1_| uses. | 1742 // This creates rtx for H264 with the payload type |f1_| uses. |
| 1742 AddRtxCodec(VideoCodec::CreateRtxCodec(126, kVideoCodecs1[1].id), &f1_codecs); | 1743 AddSecondaryCodec(VideoCodec::CreateRtxCodec(126, kVideoCodecs1[1].id), |
| 1744 &f1_codecs); | |
| 1743 f1_.set_video_codecs(f1_codecs); | 1745 f1_.set_video_codecs(f1_codecs); |
| 1744 | 1746 |
| 1745 MediaSessionOptions opts; | 1747 MediaSessionOptions opts; |
| 1746 opts.recv_audio = true; | 1748 opts.recv_audio = true; |
| 1747 opts.recv_video = false; | 1749 opts.recv_video = false; |
| 1748 | 1750 |
| 1749 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL)); | 1751 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL)); |
| 1750 std::unique_ptr<SessionDescription> answer( | 1752 std::unique_ptr<SessionDescription> answer( |
| 1751 f2_.CreateAnswer(offer.get(), opts, NULL)); | 1753 f2_.CreateAnswer(offer.get(), opts, NULL)); |
| 1752 | 1754 |
| 1753 const AudioContentDescription* acd = | 1755 const AudioContentDescription* acd = |
| 1754 GetFirstAudioContentDescription(answer.get()); | 1756 GetFirstAudioContentDescription(answer.get()); |
| 1755 EXPECT_EQ(MAKE_VECTOR(kAudioCodecsAnswer), acd->codecs()); | 1757 EXPECT_EQ(MAKE_VECTOR(kAudioCodecsAnswer), acd->codecs()); |
| 1756 | 1758 |
| 1757 // Now - let |f2_| add video with RTX and let the payload type the RTX codec | 1759 // Now - let |f2_| add video with RTX and let the payload type the RTX codec |
| 1758 // reference be the same as an audio codec that was negotiated in the | 1760 // reference be the same as an audio codec that was negotiated in the |
| 1759 // first offer/answer exchange. | 1761 // first offer/answer exchange. |
| 1760 opts.recv_audio = true; | 1762 opts.recv_audio = true; |
| 1761 opts.recv_video = true; | 1763 opts.recv_video = true; |
| 1762 | 1764 |
| 1763 std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2); | 1765 std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2); |
| 1764 int used_pl_type = acd->codecs()[0].id; | 1766 int used_pl_type = acd->codecs()[0].id; |
| 1765 f2_codecs[0].id = used_pl_type; // Set the payload type for H264. | 1767 f2_codecs[0].id = used_pl_type; // Set the payload type for H264. |
| 1766 AddRtxCodec(VideoCodec::CreateRtxCodec(125, used_pl_type), &f2_codecs); | 1768 AddSecondaryCodec(VideoCodec::CreateRtxCodec(125, used_pl_type), &f2_codecs); |
| 1767 f2_.set_video_codecs(f2_codecs); | 1769 f2_.set_video_codecs(f2_codecs); |
| 1768 | 1770 |
| 1769 std::unique_ptr<SessionDescription> updated_offer( | 1771 std::unique_ptr<SessionDescription> updated_offer( |
| 1770 f2_.CreateOffer(opts, answer.get())); | 1772 f2_.CreateOffer(opts, answer.get())); |
| 1771 ASSERT_TRUE(updated_offer); | 1773 ASSERT_TRUE(updated_offer); |
| 1772 std::unique_ptr<SessionDescription> updated_answer( | 1774 std::unique_ptr<SessionDescription> updated_answer( |
| 1773 f1_.CreateAnswer(updated_offer.get(), opts, answer.get())); | 1775 f1_.CreateAnswer(updated_offer.get(), opts, answer.get())); |
| 1774 | 1776 |
| 1775 const AudioContentDescription* updated_acd = | 1777 const AudioContentDescription* updated_acd = |
| 1776 GetFirstAudioContentDescription(answer.get()); | 1778 GetFirstAudioContentDescription(answer.get()); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 1793 // without RTX, and with different default payload types. | 1795 // without RTX, and with different default payload types. |
| 1794 // Verify that the added RTX codec references the correct payload type. | 1796 // Verify that the added RTX codec references the correct payload type. |
| 1795 TEST_F(MediaSessionDescriptionFactoryTest, | 1797 TEST_F(MediaSessionDescriptionFactoryTest, |
| 1796 RespondentCreatesOfferWithRtxAfterCreatingAnswerWithoutRtx) { | 1798 RespondentCreatesOfferWithRtxAfterCreatingAnswerWithoutRtx) { |
| 1797 MediaSessionOptions opts; | 1799 MediaSessionOptions opts; |
| 1798 opts.recv_video = true; | 1800 opts.recv_video = true; |
| 1799 opts.recv_audio = true; | 1801 opts.recv_audio = true; |
| 1800 | 1802 |
| 1801 std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2); | 1803 std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2); |
| 1802 // This creates rtx for H264 with the payload type |f2_| uses. | 1804 // This creates rtx for H264 with the payload type |f2_| uses. |
| 1803 AddRtxCodec(VideoCodec::CreateRtxCodec(125, kVideoCodecs2[0].id), &f2_codecs); | 1805 AddSecondaryCodec(VideoCodec::CreateRtxCodec(125, kVideoCodecs2[0].id), |
| 1806 &f2_codecs); | |
| 1804 f2_.set_video_codecs(f2_codecs); | 1807 f2_.set_video_codecs(f2_codecs); |
| 1805 | 1808 |
| 1806 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, nullptr)); | 1809 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, nullptr)); |
| 1807 ASSERT_TRUE(offer.get() != nullptr); | 1810 ASSERT_TRUE(offer.get() != nullptr); |
| 1808 std::unique_ptr<SessionDescription> answer( | 1811 std::unique_ptr<SessionDescription> answer( |
| 1809 f2_.CreateAnswer(offer.get(), opts, nullptr)); | 1812 f2_.CreateAnswer(offer.get(), opts, nullptr)); |
| 1810 | 1813 |
| 1811 const VideoContentDescription* vcd = | 1814 const VideoContentDescription* vcd = |
| 1812 GetFirstVideoContentDescription(answer.get()); | 1815 GetFirstVideoContentDescription(answer.get()); |
| 1813 | 1816 |
| 1814 std::vector<VideoCodec> expected_codecs = MAKE_VECTOR(kVideoCodecsAnswer); | 1817 std::vector<VideoCodec> expected_codecs = MAKE_VECTOR(kVideoCodecsAnswer); |
| 1815 EXPECT_EQ(expected_codecs, vcd->codecs()); | 1818 EXPECT_EQ(expected_codecs, vcd->codecs()); |
| 1816 | 1819 |
| 1817 // Now, ensure that the RTX codec is created correctly when |f2_| creates an | 1820 // Now, ensure that the RTX codec is created correctly when |f2_| creates an |
| 1818 // updated offer, even though the default payload types are different from | 1821 // updated offer, even though the default payload types are different from |
| 1819 // those of |f1_|. | 1822 // those of |f1_|. |
| 1820 std::unique_ptr<SessionDescription> updated_offer( | 1823 std::unique_ptr<SessionDescription> updated_offer( |
| 1821 f2_.CreateOffer(opts, answer.get())); | 1824 f2_.CreateOffer(opts, answer.get())); |
| 1822 ASSERT_TRUE(updated_offer); | 1825 ASSERT_TRUE(updated_offer); |
| 1823 | 1826 |
| 1824 const VideoContentDescription* updated_vcd = | 1827 const VideoContentDescription* updated_vcd = |
| 1825 GetFirstVideoContentDescription(updated_offer.get()); | 1828 GetFirstVideoContentDescription(updated_offer.get()); |
| 1826 | 1829 |
| 1827 // New offer should attempt to add H263, and RTX for H264. | 1830 // New offer should attempt to add H263, and RTX for H264. |
| 1828 expected_codecs.push_back(kVideoCodecs2[1]); | 1831 expected_codecs.push_back(kVideoCodecs2[1]); |
| 1829 AddRtxCodec(VideoCodec::CreateRtxCodec(125, kVideoCodecs1[1].id), | 1832 AddSecondaryCodec(VideoCodec::CreateRtxCodec(125, kVideoCodecs1[1].id), |
| 1830 &expected_codecs); | 1833 &expected_codecs); |
| 1831 EXPECT_EQ(expected_codecs, updated_vcd->codecs()); | 1834 EXPECT_EQ(expected_codecs, updated_vcd->codecs()); |
| 1832 } | 1835 } |
| 1833 | 1836 |
| 1834 // Test that RTX is ignored when there is no associated payload type parameter. | 1837 // Test that RTX is ignored when there is no associated payload type parameter. |
| 1835 TEST_F(MediaSessionDescriptionFactoryTest, RtxWithoutApt) { | 1838 TEST_F(MediaSessionDescriptionFactoryTest, RtxWithoutApt) { |
| 1836 MediaSessionOptions opts; | 1839 MediaSessionOptions opts; |
| 1837 opts.recv_video = true; | 1840 opts.recv_video = true; |
| 1838 opts.recv_audio = false; | 1841 opts.recv_audio = false; |
| 1839 std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1); | 1842 std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1); |
| 1840 // This creates RTX without associated payload type parameter. | 1843 // This creates RTX without associated payload type parameter. |
| 1841 AddRtxCodec(VideoCodec(126, cricket::kRtxCodecName), &f1_codecs); | 1844 AddSecondaryCodec(VideoCodec(126, cricket::kRtxCodecName), &f1_codecs); |
| 1842 f1_.set_video_codecs(f1_codecs); | 1845 f1_.set_video_codecs(f1_codecs); |
| 1843 | 1846 |
| 1844 std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2); | 1847 std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2); |
| 1845 // This creates RTX for H264 with the payload type |f2_| uses. | 1848 // This creates RTX for H264 with the payload type |f2_| uses. |
| 1846 AddRtxCodec(VideoCodec::CreateRtxCodec(125, kVideoCodecs2[0].id), &f2_codecs); | 1849 AddSecondaryCodec(VideoCodec::CreateRtxCodec(125, kVideoCodecs2[0].id), |
| 1850 &f2_codecs); | |
| 1847 f2_.set_video_codecs(f2_codecs); | 1851 f2_.set_video_codecs(f2_codecs); |
| 1848 | 1852 |
| 1849 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL)); | 1853 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL)); |
| 1850 ASSERT_TRUE(offer.get() != NULL); | 1854 ASSERT_TRUE(offer.get() != NULL); |
| 1851 // kCodecParamAssociatedPayloadType will always be added to the offer when RTX | 1855 // kCodecParamAssociatedPayloadType will always be added to the offer when RTX |
| 1852 // is selected. Manually remove kCodecParamAssociatedPayloadType so that it | 1856 // is selected. Manually remove kCodecParamAssociatedPayloadType so that it |
| 1853 // is possible to test that that RTX is dropped when | 1857 // is possible to test that that RTX is dropped when |
| 1854 // kCodecParamAssociatedPayloadType is missing in the offer. | 1858 // kCodecParamAssociatedPayloadType is missing in the offer. |
| 1855 VideoContentDescription* desc = | 1859 VideoContentDescription* desc = |
| 1856 static_cast<cricket::VideoContentDescription*>( | 1860 static_cast<cricket::VideoContentDescription*>( |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 1875 } | 1879 } |
| 1876 | 1880 |
| 1877 // Test that RTX will be filtered out in the answer if its associated payload | 1881 // Test that RTX will be filtered out in the answer if its associated payload |
| 1878 // type doesn't match the local value. | 1882 // type doesn't match the local value. |
| 1879 TEST_F(MediaSessionDescriptionFactoryTest, FilterOutRtxIfAptDoesntMatch) { | 1883 TEST_F(MediaSessionDescriptionFactoryTest, FilterOutRtxIfAptDoesntMatch) { |
| 1880 MediaSessionOptions opts; | 1884 MediaSessionOptions opts; |
| 1881 opts.recv_video = true; | 1885 opts.recv_video = true; |
| 1882 opts.recv_audio = false; | 1886 opts.recv_audio = false; |
| 1883 std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1); | 1887 std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1); |
| 1884 // This creates RTX for H264 in sender. | 1888 // This creates RTX for H264 in sender. |
| 1885 AddRtxCodec(VideoCodec::CreateRtxCodec(126, kVideoCodecs1[1].id), &f1_codecs); | 1889 AddSecondaryCodec(VideoCodec::CreateRtxCodec(126, kVideoCodecs1[1].id), |
| 1890 &f1_codecs); | |
| 1886 f1_.set_video_codecs(f1_codecs); | 1891 f1_.set_video_codecs(f1_codecs); |
| 1887 | 1892 |
| 1888 std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2); | 1893 std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2); |
| 1889 // This creates RTX for H263 in receiver. | 1894 // This creates RTX for H263 in receiver. |
| 1890 AddRtxCodec(VideoCodec::CreateRtxCodec(125, kVideoCodecs2[1].id), &f2_codecs); | 1895 AddSecondaryCodec(VideoCodec::CreateRtxCodec(125, kVideoCodecs2[1].id), |
| 1896 &f2_codecs); | |
| 1891 f2_.set_video_codecs(f2_codecs); | 1897 f2_.set_video_codecs(f2_codecs); |
| 1892 | 1898 |
| 1893 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL)); | 1899 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL)); |
| 1894 ASSERT_TRUE(offer.get() != NULL); | 1900 ASSERT_TRUE(offer.get() != NULL); |
| 1895 // Associated payload type doesn't match, therefore, RTX codec is removed in | 1901 // Associated payload type doesn't match, therefore, RTX codec is removed in |
| 1896 // the answer. | 1902 // the answer. |
| 1897 std::unique_ptr<SessionDescription> answer( | 1903 std::unique_ptr<SessionDescription> answer( |
| 1898 f2_.CreateAnswer(offer.get(), opts, NULL)); | 1904 f2_.CreateAnswer(offer.get(), opts, NULL)); |
| 1899 | 1905 |
| 1900 std::vector<std::string> codec_names = | 1906 std::vector<std::string> codec_names = |
| 1901 GetCodecNames(GetFirstVideoContentDescription(answer.get())->codecs()); | 1907 GetCodecNames(GetFirstVideoContentDescription(answer.get())->codecs()); |
| 1902 EXPECT_EQ(codec_names.end(), std::find(codec_names.begin(), codec_names.end(), | 1908 EXPECT_EQ(codec_names.end(), std::find(codec_names.begin(), codec_names.end(), |
| 1903 cricket::kRtxCodecName)); | 1909 cricket::kRtxCodecName)); |
| 1904 } | 1910 } |
| 1905 | 1911 |
| 1906 // Test that when multiple RTX codecs are offered, only the matched RTX codec | 1912 // Test that when multiple RTX codecs are offered, only the matched RTX codec |
| 1907 // is added in the answer, and the unsupported RTX codec is filtered out. | 1913 // is added in the answer, and the unsupported RTX codec is filtered out. |
| 1908 TEST_F(MediaSessionDescriptionFactoryTest, | 1914 TEST_F(MediaSessionDescriptionFactoryTest, |
| 1909 FilterOutUnsupportedRtxWhenCreatingAnswer) { | 1915 FilterOutUnsupportedRtxWhenCreatingAnswer) { |
| 1910 MediaSessionOptions opts; | 1916 MediaSessionOptions opts; |
| 1911 opts.recv_video = true; | 1917 opts.recv_video = true; |
| 1912 opts.recv_audio = false; | 1918 opts.recv_audio = false; |
| 1913 std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1); | 1919 std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1); |
| 1914 // This creates RTX for H264-SVC in sender. | 1920 // This creates RTX for H264-SVC in sender. |
| 1915 AddRtxCodec(VideoCodec::CreateRtxCodec(125, kVideoCodecs1[0].id), &f1_codecs); | 1921 AddSecondaryCodec(VideoCodec::CreateRtxCodec(125, kVideoCodecs1[0].id), |
| 1922 &f1_codecs); | |
| 1916 f1_.set_video_codecs(f1_codecs); | 1923 f1_.set_video_codecs(f1_codecs); |
| 1917 | 1924 |
| 1918 // This creates RTX for H264 in sender. | 1925 // This creates RTX for H264 in sender. |
| 1919 AddRtxCodec(VideoCodec::CreateRtxCodec(126, kVideoCodecs1[1].id), &f1_codecs); | 1926 AddSecondaryCodec(VideoCodec::CreateRtxCodec(126, kVideoCodecs1[1].id), |
| 1927 &f1_codecs); | |
| 1920 f1_.set_video_codecs(f1_codecs); | 1928 f1_.set_video_codecs(f1_codecs); |
| 1921 | 1929 |
| 1922 std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2); | 1930 std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2); |
| 1923 // This creates RTX for H264 in receiver. | 1931 // This creates RTX for H264 in receiver. |
| 1924 AddRtxCodec(VideoCodec::CreateRtxCodec(124, kVideoCodecs2[0].id), &f2_codecs); | 1932 AddSecondaryCodec(VideoCodec::CreateRtxCodec(124, kVideoCodecs2[0].id), |
| 1933 &f2_codecs); | |
| 1925 f2_.set_video_codecs(f2_codecs); | 1934 f2_.set_video_codecs(f2_codecs); |
| 1926 | 1935 |
| 1927 // H264-SVC codec is removed in the answer, therefore, associated RTX codec | 1936 // H264-SVC codec is removed in the answer, therefore, associated RTX codec |
| 1928 // for H264-SVC should also be removed. | 1937 // for H264-SVC should also be removed. |
| 1929 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL)); | 1938 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL)); |
| 1930 ASSERT_TRUE(offer.get() != NULL); | 1939 ASSERT_TRUE(offer.get() != NULL); |
| 1931 std::unique_ptr<SessionDescription> answer( | 1940 std::unique_ptr<SessionDescription> answer( |
| 1932 f2_.CreateAnswer(offer.get(), opts, NULL)); | 1941 f2_.CreateAnswer(offer.get(), opts, NULL)); |
| 1933 const VideoContentDescription* vcd = | 1942 const VideoContentDescription* vcd = |
| 1934 GetFirstVideoContentDescription(answer.get()); | 1943 GetFirstVideoContentDescription(answer.get()); |
| 1935 std::vector<VideoCodec> expected_codecs = MAKE_VECTOR(kVideoCodecsAnswer); | 1944 std::vector<VideoCodec> expected_codecs = MAKE_VECTOR(kVideoCodecsAnswer); |
| 1936 AddRtxCodec(VideoCodec::CreateRtxCodec(126, kVideoCodecs1[1].id), | 1945 AddSecondaryCodec(VideoCodec::CreateRtxCodec(126, kVideoCodecs1[1].id), |
| 1937 &expected_codecs); | 1946 &expected_codecs); |
| 1938 | 1947 |
| 1939 EXPECT_EQ(expected_codecs, vcd->codecs()); | 1948 EXPECT_EQ(expected_codecs, vcd->codecs()); |
| 1940 } | 1949 } |
| 1941 | 1950 |
| 1942 // Test that after one RTX codec has been negotiated, a new offer can attempt | 1951 // Test that after one RTX codec has been negotiated, a new offer can attempt |
| 1943 // to add another. | 1952 // to add another. |
| 1944 TEST_F(MediaSessionDescriptionFactoryTest, AddSecondRtxInNewOffer) { | 1953 TEST_F(MediaSessionDescriptionFactoryTest, AddSecondRtxInNewOffer) { |
| 1945 MediaSessionOptions opts; | 1954 MediaSessionOptions opts; |
| 1946 opts.recv_video = true; | 1955 opts.recv_video = true; |
| 1947 opts.recv_audio = false; | 1956 opts.recv_audio = false; |
| 1948 std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1); | 1957 std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1); |
| 1949 // This creates RTX for H264 for the offerer. | 1958 // This creates RTX for H264 for the offerer. |
| 1950 AddRtxCodec(VideoCodec::CreateRtxCodec(126, kVideoCodecs1[1].id), &f1_codecs); | 1959 AddSecondaryCodec(VideoCodec::CreateRtxCodec(126, kVideoCodecs1[1].id), |
| 1960 &f1_codecs); | |
| 1951 f1_.set_video_codecs(f1_codecs); | 1961 f1_.set_video_codecs(f1_codecs); |
| 1952 | 1962 |
| 1953 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, nullptr)); | 1963 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, nullptr)); |
| 1954 ASSERT_TRUE(offer); | 1964 ASSERT_TRUE(offer); |
| 1955 const VideoContentDescription* vcd = | 1965 const VideoContentDescription* vcd = |
| 1956 GetFirstVideoContentDescription(offer.get()); | 1966 GetFirstVideoContentDescription(offer.get()); |
| 1957 | 1967 |
| 1958 std::vector<VideoCodec> expected_codecs = MAKE_VECTOR(kVideoCodecs1); | 1968 std::vector<VideoCodec> expected_codecs = MAKE_VECTOR(kVideoCodecs1); |
| 1959 AddRtxCodec(VideoCodec::CreateRtxCodec(126, kVideoCodecs1[1].id), | 1969 AddSecondaryCodec(VideoCodec::CreateRtxCodec(126, kVideoCodecs1[1].id), |
| 1960 &expected_codecs); | 1970 &expected_codecs); |
| 1961 EXPECT_EQ(expected_codecs, vcd->codecs()); | 1971 EXPECT_EQ(expected_codecs, vcd->codecs()); |
| 1962 | 1972 |
| 1963 // Now, attempt to add RTX for H264-SVC. | 1973 // Now, attempt to add RTX for H264-SVC. |
| 1964 AddRtxCodec(VideoCodec::CreateRtxCodec(125, kVideoCodecs1[0].id), &f1_codecs); | 1974 AddSecondaryCodec(VideoCodec::CreateRtxCodec(125, kVideoCodecs1[0].id), |
| 1975 &f1_codecs); | |
| 1965 f1_.set_video_codecs(f1_codecs); | 1976 f1_.set_video_codecs(f1_codecs); |
| 1966 | 1977 |
| 1967 std::unique_ptr<SessionDescription> updated_offer( | 1978 std::unique_ptr<SessionDescription> updated_offer( |
| 1968 f1_.CreateOffer(opts, offer.get())); | 1979 f1_.CreateOffer(opts, offer.get())); |
| 1969 ASSERT_TRUE(updated_offer); | 1980 ASSERT_TRUE(updated_offer); |
| 1970 vcd = GetFirstVideoContentDescription(updated_offer.get()); | 1981 vcd = GetFirstVideoContentDescription(updated_offer.get()); |
| 1971 | 1982 |
| 1972 AddRtxCodec(VideoCodec::CreateRtxCodec(125, kVideoCodecs1[0].id), | 1983 AddSecondaryCodec(VideoCodec::CreateRtxCodec(125, kVideoCodecs1[0].id), |
| 1973 &expected_codecs); | 1984 &expected_codecs); |
| 1974 EXPECT_EQ(expected_codecs, vcd->codecs()); | 1985 EXPECT_EQ(expected_codecs, vcd->codecs()); |
| 1975 } | 1986 } |
| 1976 | 1987 |
| 1977 // Test that when RTX is used in conjunction with simulcast, an RTX ssrc is | 1988 // Test that when RTX is used in conjunction with simulcast, an RTX ssrc is |
| 1978 // generated for each simulcast ssrc and correctly grouped. | 1989 // generated for each simulcast ssrc and correctly grouped. |
| 1979 TEST_F(MediaSessionDescriptionFactoryTest, SimSsrcsGenerateMultipleRtxSsrcs) { | 1990 TEST_F(MediaSessionDescriptionFactoryTest, SimSsrcsGenerateMultipleRtxSsrcs) { |
| 1980 MediaSessionOptions opts; | 1991 MediaSessionOptions opts; |
| 1981 opts.recv_video = true; | 1992 opts.recv_video = true; |
| 1982 opts.recv_audio = false; | 1993 opts.recv_audio = false; |
| 1983 | 1994 |
| 1984 // Add simulcast streams. | 1995 // Add simulcast streams. |
| 1985 opts.AddSendVideoStream("stream1", "stream1label", 3); | 1996 opts.AddSendVideoStream("stream1", "stream1label", 3); |
| 1986 | 1997 |
| 1987 // Use a single real codec, and then add RTX for it. | 1998 // Use a single real codec, and then add RTX for it. |
| 1988 std::vector<VideoCodec> f1_codecs; | 1999 std::vector<VideoCodec> f1_codecs; |
| 1989 f1_codecs.push_back(VideoCodec(97, "H264")); | 2000 f1_codecs.push_back(VideoCodec(97, "H264")); |
| 1990 AddRtxCodec(VideoCodec::CreateRtxCodec(125, 97), &f1_codecs); | 2001 AddSecondaryCodec(VideoCodec::CreateRtxCodec(125, 97), &f1_codecs); |
| 1991 f1_.set_video_codecs(f1_codecs); | 2002 f1_.set_video_codecs(f1_codecs); |
| 1992 | 2003 |
| 1993 // Ensure that the offer has an RTX ssrc for each regular ssrc, and that there | 2004 // Ensure that the offer has an RTX ssrc for each regular ssrc, and that there |
| 1994 // is a FID ssrc + grouping for each. | 2005 // is a FID ssrc + grouping for each. |
| 1995 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL)); | 2006 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL)); |
| 1996 ASSERT_TRUE(offer.get() != NULL); | 2007 ASSERT_TRUE(offer.get() != NULL); |
| 1997 VideoContentDescription* desc = static_cast<VideoContentDescription*>( | 2008 VideoContentDescription* desc = static_cast<VideoContentDescription*>( |
| 1998 offer->GetContentDescriptionByName(cricket::CN_VIDEO)); | 2009 offer->GetContentDescriptionByName(cricket::CN_VIDEO)); |
| 1999 ASSERT_TRUE(desc != NULL); | 2010 ASSERT_TRUE(desc != NULL); |
| 2000 EXPECT_TRUE(desc->multistream()); | 2011 EXPECT_TRUE(desc->multistream()); |
| 2001 const StreamParamsVec& streams = desc->streams(); | 2012 const StreamParamsVec& streams = desc->streams(); |
| 2002 // Single stream. | 2013 // Single stream. |
| 2003 ASSERT_EQ(1u, streams.size()); | 2014 ASSERT_EQ(1u, streams.size()); |
| 2004 // Stream should have 6 ssrcs: 3 for video, 3 for RTX. | 2015 // Stream should have 6 ssrcs: 3 for video, 3 for RTX. |
| 2005 EXPECT_EQ(6u, streams[0].ssrcs.size()); | 2016 EXPECT_EQ(6u, streams[0].ssrcs.size()); |
| 2006 // And should have a SIM group for the simulcast. | 2017 // And should have a SIM group for the simulcast. |
| 2007 EXPECT_TRUE(streams[0].has_ssrc_group("SIM")); | 2018 EXPECT_TRUE(streams[0].has_ssrc_group("SIM")); |
| 2008 // And a FID group for RTX. | 2019 // And a FID group for RTX. |
| 2009 EXPECT_TRUE(streams[0].has_ssrc_group("FID")); | 2020 EXPECT_TRUE(streams[0].has_ssrc_group("FID")); |
| 2010 std::vector<uint32_t> primary_ssrcs; | 2021 std::vector<uint32_t> primary_ssrcs; |
| 2011 streams[0].GetPrimarySsrcs(&primary_ssrcs); | 2022 streams[0].GetPrimarySsrcs(&primary_ssrcs); |
| 2012 EXPECT_EQ(3u, primary_ssrcs.size()); | 2023 EXPECT_EQ(3u, primary_ssrcs.size()); |
| 2013 std::vector<uint32_t> fid_ssrcs; | 2024 std::vector<uint32_t> fid_ssrcs; |
| 2014 streams[0].GetFidSsrcs(primary_ssrcs, &fid_ssrcs); | 2025 streams[0].GetFidSsrcs(primary_ssrcs, &fid_ssrcs); |
| 2015 EXPECT_EQ(3u, fid_ssrcs.size()); | 2026 EXPECT_EQ(3u, fid_ssrcs.size()); |
| 2016 } | 2027 } |
| 2017 | 2028 |
| 2029 // Test that, when the FlexFEC codec is added, a FlexFEC ssrc is created | |
| 2030 // together with a FEC-FR grouping. | |
| 2031 TEST_F(MediaSessionDescriptionFactoryTest, GenerateFlexfecSsrc) { | |
| 2032 MediaSessionOptions opts; | |
| 2033 opts.recv_video = true; | |
| 2034 opts.recv_audio = false; | |
| 2035 | |
| 2036 // Add single stream. | |
| 2037 opts.AddSendVideoStream("stream1", "stream1label", 1); | |
| 2038 | |
| 2039 // Use a single real codec, and then add FlexFEC for it. | |
| 2040 std::vector<VideoCodec> f1_codecs; | |
| 2041 f1_codecs.push_back(VideoCodec(97, "H264")); | |
| 2042 AddSecondaryCodec(VideoCodec(118, "flexfec-03"), &f1_codecs); | |
| 2043 f1_.set_video_codecs(f1_codecs); | |
| 2044 | |
| 2045 // Ensure that the offer has a single FlexFEC ssrc and that | |
| 2046 // there is no FEC-FR ssrc + grouping for each. | |
| 2047 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, nullptr)); | |
| 2048 ASSERT_TRUE(offer.get() != nullptr); | |
| 2049 VideoContentDescription* desc = static_cast<VideoContentDescription*>( | |
| 2050 offer->GetContentDescriptionByName(cricket::CN_VIDEO)); | |
| 2051 ASSERT_TRUE(desc != nullptr); | |
| 2052 EXPECT_TRUE(desc->multistream()); | |
| 2053 const StreamParamsVec& streams = desc->streams(); | |
| 2054 // Single stream. | |
| 2055 ASSERT_EQ(1u, streams.size()); | |
| 2056 // Stream should have 2 ssrcs: 1 for video, 1 for FlexFEC. | |
| 2057 EXPECT_EQ(2u, streams[0].ssrcs.size()); | |
| 2058 // And should a FEC-FR group for FlexFEC. | |
|
perkj_webrtc
2016/11/17 20:41:12
and should have
brandtr
2016/11/21 09:16:30
Done.
| |
| 2059 EXPECT_TRUE(streams[0].has_ssrc_group("FEC-FR")); | |
| 2060 std::vector<uint32_t> primary_ssrcs; | |
| 2061 streams[0].GetPrimarySsrcs(&primary_ssrcs); | |
| 2062 ASSERT_EQ(1u, primary_ssrcs.size()); | |
| 2063 uint32_t flexfec_ssrc; | |
| 2064 EXPECT_TRUE(streams[0].GetFecFrSsrc(primary_ssrcs[0], &flexfec_ssrc)); | |
| 2065 EXPECT_NE(flexfec_ssrc, 0u); | |
| 2066 } | |
| 2067 | |
| 2068 // Test that FlexFEC is disabled for simulcast. | |
| 2069 // TODO(brandtr): Remove this test when we support simulcast, either through | |
| 2070 // multiple FlexfecSenders, or through multistream protection. | |
| 2071 TEST_F(MediaSessionDescriptionFactoryTest, SimSsrcsGenerateNoFlexfecSsrcs) { | |
| 2072 MediaSessionOptions opts; | |
| 2073 opts.recv_video = true; | |
| 2074 opts.recv_audio = false; | |
| 2075 | |
| 2076 // Add simulcast streams. | |
| 2077 opts.AddSendVideoStream("stream1", "stream1label", 3); | |
| 2078 | |
| 2079 // Use a single real codec, and then add FlexFEC for it. | |
| 2080 std::vector<VideoCodec> f1_codecs; | |
| 2081 f1_codecs.push_back(VideoCodec(97, "H264")); | |
| 2082 AddSecondaryCodec(VideoCodec(118, "flexfec-03"), &f1_codecs); | |
| 2083 f1_.set_video_codecs(f1_codecs); | |
| 2084 | |
| 2085 // Ensure that the offer has no FlexFEC ssrcs for each regular ssrc, and that | |
| 2086 // there is no FEC-FR ssrc + grouping for each. | |
| 2087 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, nullptr)); | |
| 2088 ASSERT_TRUE(offer.get() != nullptr); | |
| 2089 VideoContentDescription* desc = static_cast<VideoContentDescription*>( | |
| 2090 offer->GetContentDescriptionByName(cricket::CN_VIDEO)); | |
| 2091 ASSERT_TRUE(desc != nullptr); | |
| 2092 EXPECT_FALSE(desc->multistream()); | |
| 2093 const StreamParamsVec& streams = desc->streams(); | |
| 2094 // Single stream. | |
| 2095 ASSERT_EQ(1u, streams.size()); | |
| 2096 // Stream should have 3 ssrcs: 3 for video, 0 for FlexFEC. | |
| 2097 EXPECT_EQ(3u, streams[0].ssrcs.size()); | |
| 2098 // And should have a SIM group for the simulcast. | |
| 2099 EXPECT_TRUE(streams[0].has_ssrc_group("SIM")); | |
| 2100 // And not a FEC-FR group for FlexFEC. | |
| 2101 EXPECT_FALSE(streams[0].has_ssrc_group("FEC-FR")); | |
| 2102 std::vector<uint32_t> primary_ssrcs; | |
| 2103 streams[0].GetPrimarySsrcs(&primary_ssrcs); | |
| 2104 EXPECT_EQ(3u, primary_ssrcs.size()); | |
| 2105 for (uint32_t primary_ssrc : primary_ssrcs) { | |
| 2106 uint32_t flexfec_ssrc; | |
| 2107 EXPECT_FALSE(streams[0].GetFecFrSsrc(primary_ssrc, &flexfec_ssrc)); | |
| 2108 } | |
| 2109 } | |
| 2110 | |
| 2018 // Create an updated offer after creating an answer to the original offer and | 2111 // Create an updated offer after creating an answer to the original offer and |
| 2019 // verify that the RTP header extensions that were part of the original answer | 2112 // verify that the RTP header extensions that were part of the original answer |
| 2020 // are not changed in the updated offer. | 2113 // are not changed in the updated offer. |
| 2021 TEST_F(MediaSessionDescriptionFactoryTest, | 2114 TEST_F(MediaSessionDescriptionFactoryTest, |
| 2022 RespondentCreatesOfferAfterCreatingAnswerWithRtpExtensions) { | 2115 RespondentCreatesOfferAfterCreatingAnswerWithRtpExtensions) { |
| 2023 MediaSessionOptions opts; | 2116 MediaSessionOptions opts; |
| 2024 opts.recv_audio = true; | 2117 opts.recv_audio = true; |
| 2025 opts.recv_video = true; | 2118 opts.recv_video = true; |
| 2026 | 2119 |
| 2027 f1_.set_audio_rtp_header_extensions(MAKE_VECTOR(kAudioRtpExtension1)); | 2120 f1_.set_audio_rtp_header_extensions(MAKE_VECTOR(kAudioRtpExtension1)); |
| (...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2855 << ", got: " << format_codecs(acd->codecs()) | 2948 << ", got: " << format_codecs(acd->codecs()) |
| 2856 << "; Offered: " << MediaContentDirectionToString(offer_direction) | 2949 << "; Offered: " << MediaContentDirectionToString(offer_direction) |
| 2857 << ", answerer wants: " | 2950 << ", answerer wants: " |
| 2858 << MediaContentDirectionToString(answer_direction) | 2951 << MediaContentDirectionToString(answer_direction) |
| 2859 << "; got: " << MediaContentDirectionToString(acd->direction()); | 2952 << "; got: " << MediaContentDirectionToString(acd->direction()); |
| 2860 } else { | 2953 } else { |
| 2861 EXPECT_EQ(offer_direction, cricket::MD_INACTIVE) | 2954 EXPECT_EQ(offer_direction, cricket::MD_INACTIVE) |
| 2862 << "Only inactive offers are allowed to not generate any audio content"; | 2955 << "Only inactive offers are allowed to not generate any audio content"; |
| 2863 } | 2956 } |
| 2864 } | 2957 } |
| 2865 } | 2958 |
| 2959 } // namespace | |
| 2866 | 2960 |
| 2867 class AudioCodecsOfferTest | 2961 class AudioCodecsOfferTest |
| 2868 : public ::testing::TestWithParam<std::tr1::tuple<MediaContentDirection, | 2962 : public ::testing::TestWithParam<std::tr1::tuple<MediaContentDirection, |
| 2869 bool>> { | 2963 bool>> { |
| 2870 }; | 2964 }; |
| 2871 | 2965 |
| 2872 TEST_P(AudioCodecsOfferTest, TestCodecsInOffer) { | 2966 TEST_P(AudioCodecsOfferTest, TestCodecsInOffer) { |
| 2873 TestAudioCodecsOffer(std::tr1::get<0>(GetParam()), | 2967 TestAudioCodecsOffer(std::tr1::get<0>(GetParam()), |
| 2874 std::tr1::get<1>(GetParam())); | 2968 std::tr1::get<1>(GetParam())); |
| 2875 } | 2969 } |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 2900 ::testing::Combine( | 2994 ::testing::Combine( |
| 2901 ::testing::Values(cricket::MD_SENDONLY, | 2995 ::testing::Values(cricket::MD_SENDONLY, |
| 2902 cricket::MD_RECVONLY, | 2996 cricket::MD_RECVONLY, |
| 2903 cricket::MD_SENDRECV, | 2997 cricket::MD_SENDRECV, |
| 2904 cricket::MD_INACTIVE), | 2998 cricket::MD_INACTIVE), |
| 2905 ::testing::Values(cricket::MD_SENDONLY, | 2999 ::testing::Values(cricket::MD_SENDONLY, |
| 2906 cricket::MD_RECVONLY, | 3000 cricket::MD_RECVONLY, |
| 2907 cricket::MD_SENDRECV, | 3001 cricket::MD_SENDRECV, |
| 2908 cricket::MD_INACTIVE), | 3002 cricket::MD_INACTIVE), |
| 2909 ::testing::Bool())); | 3003 ::testing::Bool())); |
| OLD | NEW |