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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 RtpHeaderExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 8), | 140 RtpHeaderExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 8), |
141 RtpHeaderExtension("http://google.com/testing/audio_something", 10), | 141 RtpHeaderExtension("http://google.com/testing/audio_something", 10), |
142 }; | 142 }; |
143 | 143 |
144 static const RtpHeaderExtension kAudioRtpExtension2[] = { | 144 static const RtpHeaderExtension kAudioRtpExtension2[] = { |
145 RtpHeaderExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 2), | 145 RtpHeaderExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 2), |
146 RtpHeaderExtension("http://google.com/testing/audio_something_else", 8), | 146 RtpHeaderExtension("http://google.com/testing/audio_something_else", 8), |
147 RtpHeaderExtension("http://google.com/testing/both_audio_and_video", 7), | 147 RtpHeaderExtension("http://google.com/testing/both_audio_and_video", 7), |
148 }; | 148 }; |
149 | 149 |
| 150 static const RtpHeaderExtension kAudioRtpExtension3[] = { |
| 151 RtpHeaderExtension("http://google.com/testing/audio_something", 2), |
| 152 RtpHeaderExtension("http://google.com/testing/both_audio_and_video", 3), |
| 153 }; |
| 154 |
150 static const RtpHeaderExtension kAudioRtpExtensionAnswer[] = { | 155 static const RtpHeaderExtension kAudioRtpExtensionAnswer[] = { |
151 RtpHeaderExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 8), | 156 RtpHeaderExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 8), |
152 }; | 157 }; |
153 | 158 |
154 static const RtpHeaderExtension kVideoRtpExtension1[] = { | 159 static const RtpHeaderExtension kVideoRtpExtension1[] = { |
155 RtpHeaderExtension("urn:ietf:params:rtp-hdrext:toffset", 14), | 160 RtpHeaderExtension("urn:ietf:params:rtp-hdrext:toffset", 14), |
156 RtpHeaderExtension("http://google.com/testing/video_something", 13), | 161 RtpHeaderExtension("http://google.com/testing/video_something", 13), |
157 }; | 162 }; |
158 | 163 |
159 static const RtpHeaderExtension kVideoRtpExtension2[] = { | 164 static const RtpHeaderExtension kVideoRtpExtension2[] = { |
160 RtpHeaderExtension("urn:ietf:params:rtp-hdrext:toffset", 2), | 165 RtpHeaderExtension("urn:ietf:params:rtp-hdrext:toffset", 2), |
161 RtpHeaderExtension("http://google.com/testing/video_something_else", 14), | 166 RtpHeaderExtension("http://google.com/testing/video_something_else", 14), |
162 RtpHeaderExtension("http://google.com/testing/both_audio_and_video", 7), | 167 RtpHeaderExtension("http://google.com/testing/both_audio_and_video", 7), |
163 }; | 168 }; |
164 | 169 |
| 170 static const RtpHeaderExtension kVideoRtpExtension3[] = { |
| 171 RtpHeaderExtension("http://google.com/testing/video_something", 4), |
| 172 RtpHeaderExtension("http://google.com/testing/both_audio_and_video", 5), |
| 173 }; |
| 174 |
165 static const RtpHeaderExtension kVideoRtpExtensionAnswer[] = { | 175 static const RtpHeaderExtension kVideoRtpExtensionAnswer[] = { |
166 RtpHeaderExtension("urn:ietf:params:rtp-hdrext:toffset", 14), | 176 RtpHeaderExtension("urn:ietf:params:rtp-hdrext:toffset", 14), |
167 }; | 177 }; |
168 | 178 |
169 static const uint32 kSimulcastParamsSsrc[] = {10, 11, 20, 21, 30, 31}; | 179 static const uint32 kSimulcastParamsSsrc[] = {10, 11, 20, 21, 30, 31}; |
170 static const uint32 kSimSsrc[] = {10, 20, 30}; | 180 static const uint32 kSimSsrc[] = {10, 20, 30}; |
171 static const uint32 kFec1Ssrc[] = {10, 11}; | 181 static const uint32 kFec1Ssrc[] = {10, 11}; |
172 static const uint32 kFec2Ssrc[] = {20, 21}; | 182 static const uint32 kFec2Ssrc[] = {20, 21}; |
173 static const uint32 kFec3Ssrc[] = {30, 31}; | 183 static const uint32 kFec3Ssrc[] = {30, 31}; |
174 | 184 |
(...skipping 1684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1859 GetFirstAudioContentDescription(updated_offer.get()); | 1869 GetFirstAudioContentDescription(updated_offer.get()); |
1860 EXPECT_EQ(MAKE_VECTOR(kUpdatedAudioRtpExtensions), | 1870 EXPECT_EQ(MAKE_VECTOR(kUpdatedAudioRtpExtensions), |
1861 updated_acd->rtp_header_extensions()); | 1871 updated_acd->rtp_header_extensions()); |
1862 | 1872 |
1863 const VideoContentDescription* updated_vcd = | 1873 const VideoContentDescription* updated_vcd = |
1864 GetFirstVideoContentDescription(updated_offer.get()); | 1874 GetFirstVideoContentDescription(updated_offer.get()); |
1865 EXPECT_EQ(MAKE_VECTOR(kUpdatedVideoRtpExtensions), | 1875 EXPECT_EQ(MAKE_VECTOR(kUpdatedVideoRtpExtensions), |
1866 updated_vcd->rtp_header_extensions()); | 1876 updated_vcd->rtp_header_extensions()); |
1867 } | 1877 } |
1868 | 1878 |
| 1879 // Verify that if the same RTP extension URI is used for audio and video, the |
| 1880 // same ID is used. Also verify that the ID isn't changed when creating an |
| 1881 // updated offer (this was previously a bug). |
| 1882 TEST_F(MediaSessionDescriptionFactoryTest, |
| 1883 RtpHeaderExtensionIdReused) { |
| 1884 MediaSessionOptions opts; |
| 1885 opts.recv_audio = true; |
| 1886 opts.recv_video = true; |
| 1887 |
| 1888 f1_.set_audio_rtp_header_extensions(MAKE_VECTOR(kAudioRtpExtension3)); |
| 1889 f1_.set_video_rtp_header_extensions(MAKE_VECTOR(kVideoRtpExtension3)); |
| 1890 |
| 1891 rtc::scoped_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL)); |
| 1892 |
| 1893 // Since the audio extensions used ID 3 for "both_audio_and_video", so should |
| 1894 // the video extensions. |
| 1895 const RtpHeaderExtension kExpectedVideoRtpExtension[] = { |
| 1896 kVideoRtpExtension3[0], |
| 1897 kAudioRtpExtension3[1], |
| 1898 }; |
| 1899 |
| 1900 EXPECT_EQ(MAKE_VECTOR(kAudioRtpExtension3), |
| 1901 GetFirstAudioContentDescription( |
| 1902 offer.get())->rtp_header_extensions()); |
| 1903 EXPECT_EQ(MAKE_VECTOR(kExpectedVideoRtpExtension), |
| 1904 GetFirstVideoContentDescription( |
| 1905 offer.get())->rtp_header_extensions()); |
| 1906 |
| 1907 // Nothing should change when creating a new offer |
| 1908 rtc::scoped_ptr<SessionDescription> updated_offer( |
| 1909 f1_.CreateOffer(opts, offer.get())); |
| 1910 |
| 1911 EXPECT_EQ(MAKE_VECTOR(kAudioRtpExtension3), |
| 1912 GetFirstAudioContentDescription( |
| 1913 updated_offer.get())->rtp_header_extensions()); |
| 1914 EXPECT_EQ(MAKE_VECTOR(kExpectedVideoRtpExtension), |
| 1915 GetFirstVideoContentDescription( |
| 1916 updated_offer.get())->rtp_header_extensions()); |
| 1917 } |
| 1918 |
1869 TEST(MediaSessionDescription, CopySessionDescription) { | 1919 TEST(MediaSessionDescription, CopySessionDescription) { |
1870 SessionDescription source; | 1920 SessionDescription source; |
1871 cricket::ContentGroup group(cricket::CN_AUDIO); | 1921 cricket::ContentGroup group(cricket::CN_AUDIO); |
1872 source.AddGroup(group); | 1922 source.AddGroup(group); |
1873 AudioContentDescription* acd(new AudioContentDescription()); | 1923 AudioContentDescription* acd(new AudioContentDescription()); |
1874 acd->set_codecs(MAKE_VECTOR(kAudioCodecs1)); | 1924 acd->set_codecs(MAKE_VECTOR(kAudioCodecs1)); |
1875 acd->AddLegacyStream(1); | 1925 acd->AddLegacyStream(1); |
1876 source.AddContent(cricket::CN_AUDIO, cricket::NS_JINGLE_RTP, acd); | 1926 source.AddContent(cricket::CN_AUDIO, cricket::NS_JINGLE_RTP, acd); |
1877 VideoContentDescription* vcd(new VideoContentDescription()); | 1927 VideoContentDescription* vcd(new VideoContentDescription()); |
1878 vcd->set_codecs(MAKE_VECTOR(kVideoCodecs1)); | 1928 vcd->set_codecs(MAKE_VECTOR(kVideoCodecs1)); |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2256 offer.reset(f1_.CreateOffer(options, NULL)); | 2306 offer.reset(f1_.CreateOffer(options, NULL)); |
2257 ASSERT_TRUE(offer.get() != NULL); | 2307 ASSERT_TRUE(offer.get() != NULL); |
2258 audio_content = offer->GetContentByName("audio"); | 2308 audio_content = offer->GetContentByName("audio"); |
2259 EXPECT_TRUE(VerifyNoCNCodecs(audio_content)); | 2309 EXPECT_TRUE(VerifyNoCNCodecs(audio_content)); |
2260 rtc::scoped_ptr<SessionDescription> answer( | 2310 rtc::scoped_ptr<SessionDescription> answer( |
2261 f1_.CreateAnswer(offer.get(), options, NULL)); | 2311 f1_.CreateAnswer(offer.get(), options, NULL)); |
2262 ASSERT_TRUE(answer.get() != NULL); | 2312 ASSERT_TRUE(answer.get() != NULL); |
2263 audio_content = answer->GetContentByName("audio"); | 2313 audio_content = answer->GetContentByName("audio"); |
2264 EXPECT_TRUE(VerifyNoCNCodecs(audio_content)); | 2314 EXPECT_TRUE(VerifyNoCNCodecs(audio_content)); |
2265 } | 2315 } |
OLD | NEW |