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

Side by Side Diff: webrtc/api/webrtcsdp_unittest.cc

Issue 1762003003: If MSID is encoded in both ways, make the SSRC-level one take priority. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Adding unit test. Created 4 years, 9 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/api/webrtcsdp.cc ('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 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2011 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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 "a=ssrc:3 label:video_track_id_1\r\n" 405 "a=ssrc:3 label:video_track_id_1\r\n"
406 "a=ssrc:5 cname:stream_2_cname\r\n" 406 "a=ssrc:5 cname:stream_2_cname\r\n"
407 "a=ssrc:5 msid:local_stream_2 video_track_id_2\r\n" 407 "a=ssrc:5 msid:local_stream_2 video_track_id_2\r\n"
408 "a=ssrc:5 mslabel:local_stream_2\r\n" 408 "a=ssrc:5 mslabel:local_stream_2\r\n"
409 "a=ssrc:5 label:video_track_id_2\r\n" 409 "a=ssrc:5 label:video_track_id_2\r\n"
410 "a=ssrc:6 cname:stream_2_cname\r\n" 410 "a=ssrc:6 cname:stream_2_cname\r\n"
411 "a=ssrc:6 msid:local_stream_2 video_track_id_3\r\n" 411 "a=ssrc:6 msid:local_stream_2 video_track_id_3\r\n"
412 "a=ssrc:6 mslabel:local_stream_2\r\n" 412 "a=ssrc:6 mslabel:local_stream_2\r\n"
413 "a=ssrc:6 label:video_track_id_3\r\n"; 413 "a=ssrc:6 label:video_track_id_3\r\n";
414 414
415 // Plan B SDP reference string, with 2 streams, 2 audio tracks and 3 video
416 // tracks, but with the unified plan "a=msid" attribute.
417 static const char kPlanBSdpFullStringWithMsid[] =
418 "v=0\r\n"
419 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n"
420 "s=-\r\n"
421 "t=0 0\r\n"
422 "a=msid-semantic: WMS local_stream_1 local_stream_2\r\n"
423 "m=audio 2345 RTP/SAVPF 111 103 104\r\n"
424 "c=IN IP4 74.125.127.126\r\n"
425 "a=rtcp:2347 IN IP4 74.125.127.126\r\n"
426 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1234 typ host "
427 "generation 2\r\n"
428 "a=candidate:a0+B/1 2 udp 2130706432 192.168.1.5 1235 typ host "
429 "generation 2\r\n"
430 "a=candidate:a0+B/2 1 udp 2130706432 ::1 1238 typ host "
431 "generation 2\r\n"
432 "a=candidate:a0+B/2 2 udp 2130706432 ::1 1239 typ host "
433 "generation 2\r\n"
434 "a=candidate:a0+B/3 1 udp 2130706432 74.125.127.126 2345 typ srflx "
435 "raddr 192.168.1.5 rport 2346 "
436 "generation 2\r\n"
437 "a=candidate:a0+B/3 2 udp 2130706432 74.125.127.126 2347 typ srflx "
438 "raddr 192.168.1.5 rport 2348 "
439 "generation 2\r\n"
440 "a=ice-ufrag:ufrag_voice\r\na=ice-pwd:pwd_voice\r\n"
441 "a=mid:audio_content_name\r\n"
442 "a=msid:local_stream_1 audio_track_id_1\r\n"
443 "a=sendrecv\r\n"
444 "a=rtcp-mux\r\n"
445 "a=rtcp-rsize\r\n"
446 "a=crypto:1 AES_CM_128_HMAC_SHA1_32 "
447 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32 "
448 "dummy_session_params\r\n"
449 "a=rtpmap:111 opus/48000/2\r\n"
450 "a=rtpmap:103 ISAC/16000\r\n"
451 "a=rtpmap:104 ISAC/32000\r\n"
452 "a=ssrc:1 cname:stream_1_cname\r\n"
453 "a=ssrc:1 msid:local_stream_1 audio_track_id_1\r\n"
454 "a=ssrc:1 mslabel:local_stream_1\r\n"
455 "a=ssrc:1 label:audio_track_id_1\r\n"
456 "a=ssrc:4 cname:stream_2_cname\r\n"
457 "a=ssrc:4 msid:local_stream_2 audio_track_id_2\r\n"
458 "a=ssrc:4 mslabel:local_stream_2\r\n"
459 "a=ssrc:4 label:audio_track_id_2\r\n"
460 "m=video 3457 RTP/SAVPF 120\r\n"
461 "c=IN IP4 74.125.224.39\r\n"
462 "a=rtcp:3456 IN IP4 74.125.224.39\r\n"
463 "a=candidate:a0+B/1 2 udp 2130706432 192.168.1.5 1236 typ host "
464 "generation 2\r\n"
465 "a=candidate:a0+B/1 1 udp 2130706432 192.168.1.5 1237 typ host "
466 "generation 2\r\n"
467 "a=candidate:a0+B/2 2 udp 2130706432 ::1 1240 typ host "
468 "generation 2\r\n"
469 "a=candidate:a0+B/2 1 udp 2130706432 ::1 1241 typ host "
470 "generation 2\r\n"
471 "a=candidate:a0+B/4 2 udp 2130706432 74.125.224.39 3456 typ relay "
472 "generation 2\r\n"
473 "a=candidate:a0+B/4 1 udp 2130706432 74.125.224.39 3457 typ relay "
474 "generation 2\r\n"
475 "a=ice-ufrag:ufrag_video\r\na=ice-pwd:pwd_video\r\n"
476 "a=mid:video_content_name\r\n"
477 "a=msid:local_stream_1 video_track_id_1\r\n"
478 "a=sendrecv\r\n"
479 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 "
480 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32\r\n"
481 "a=rtpmap:120 VP8/90000\r\n"
482 "a=ssrc-group:FEC 2 3\r\n"
483 "a=ssrc:2 cname:stream_1_cname\r\n"
484 "a=ssrc:2 msid:local_stream_1 video_track_id_1\r\n"
485 "a=ssrc:2 mslabel:local_stream_1\r\n"
486 "a=ssrc:2 label:video_track_id_1\r\n"
487 "a=ssrc:3 cname:stream_1_cname\r\n"
488 "a=ssrc:3 msid:local_stream_1 video_track_id_1\r\n"
489 "a=ssrc:3 mslabel:local_stream_1\r\n"
490 "a=ssrc:3 label:video_track_id_1\r\n"
491 "a=ssrc:5 cname:stream_2_cname\r\n"
492 "a=ssrc:5 msid:local_stream_2 video_track_id_2\r\n"
493 "a=ssrc:5 mslabel:local_stream_2\r\n"
494 "a=ssrc:5 label:video_track_id_2\r\n"
495 "a=ssrc:6 cname:stream_2_cname\r\n"
496 "a=ssrc:6 msid:local_stream_2 video_track_id_3\r\n"
497 "a=ssrc:6 mslabel:local_stream_2\r\n"
498 "a=ssrc:6 label:video_track_id_3\r\n";
499
415 // Unified Plan SDP reference string, with 2 streams, 2 audio tracks and 3 video 500 // Unified Plan SDP reference string, with 2 streams, 2 audio tracks and 3 video
416 // tracks. 501 // tracks.
417 static const char kUnifiedPlanSdpFullString[] = 502 static const char kUnifiedPlanSdpFullString[] =
418 "v=0\r\n" 503 "v=0\r\n"
419 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n" 504 "o=- 18446744069414584320 18446462598732840960 IN IP4 127.0.0.1\r\n"
420 "s=-\r\n" 505 "s=-\r\n"
421 "t=0 0\r\n" 506 "t=0 0\r\n"
422 "a=msid-semantic: WMS local_stream_1\r\n" 507 "a=msid-semantic: WMS local_stream_1\r\n"
423 // Audio track 1, stream 1 (with candidates). 508 // Audio track 1, stream 1 (with candidates).
424 "m=audio 2345 RTP/SAVPF 111 103 104\r\n" 509 "m=audio 2345 RTP/SAVPF 111 103 104\r\n"
(...skipping 2544 matching lines...) Expand 10 before | Expand all | Expand 10 after
2969 EXPECT_TRUE(SdpDeserialize(kPlanBSdpFullString, &deserialized_description)); 3054 EXPECT_TRUE(SdpDeserialize(kPlanBSdpFullString, &deserialized_description));
2970 3055
2971 EXPECT_TRUE(CompareSessionDescription(jdesc_, deserialized_description)); 3056 EXPECT_TRUE(CompareSessionDescription(jdesc_, deserialized_description));
2972 } 3057 }
2973 3058
2974 TEST_F(WebRtcSdpTest, SerializePlanBSessionDescription) { 3059 TEST_F(WebRtcSdpTest, SerializePlanBSessionDescription) {
2975 MakePlanBDescription(); 3060 MakePlanBDescription();
2976 TestSerialize(jdesc_, false); 3061 TestSerialize(jdesc_, false);
2977 } 3062 }
2978 3063
3064 // Some WebRTC endpoints include the msid in both the Plan B and Unified Plan
3065 // ways, to make SDP that's compatible with both Plan B and Unified Plan (to
3066 // some extent). If we parse this, the Plan B msid attribute (which is more
3067 // specific, since it's at the SSRC level) should take priority.
3068 TEST_F(WebRtcSdpTest, DeserializePlanBSessionDescriptionWithMsid) {
3069 MakePlanBDescription();
3070
3071 JsepSessionDescription deserialized_description(kDummyString);
3072 EXPECT_TRUE(
3073 SdpDeserialize(kPlanBSdpFullStringWithMsid, &deserialized_description));
3074
3075 EXPECT_TRUE(CompareSessionDescription(jdesc_, deserialized_description));
3076 }
3077
2979 TEST_F(WebRtcSdpTest, DeserializeUnifiedPlanSessionDescription) { 3078 TEST_F(WebRtcSdpTest, DeserializeUnifiedPlanSessionDescription) {
2980 MakeUnifiedPlanDescription(); 3079 MakeUnifiedPlanDescription();
2981 3080
2982 JsepSessionDescription deserialized_description(kDummyString); 3081 JsepSessionDescription deserialized_description(kDummyString);
2983 EXPECT_TRUE( 3082 EXPECT_TRUE(
2984 SdpDeserialize(kUnifiedPlanSdpFullString, &deserialized_description)); 3083 SdpDeserialize(kUnifiedPlanSdpFullString, &deserialized_description));
2985 3084
2986 EXPECT_TRUE(CompareSessionDescription(jdesc_, deserialized_description)); 3085 EXPECT_TRUE(CompareSessionDescription(jdesc_, deserialized_description));
2987 } 3086 }
2988 3087
2989 TEST_F(WebRtcSdpTest, SerializeUnifiedPlanSessionDescription) { 3088 TEST_F(WebRtcSdpTest, SerializeUnifiedPlanSessionDescription) {
2990 MakeUnifiedPlanDescription(); 3089 MakeUnifiedPlanDescription();
2991 TestSerialize(jdesc_, true); 3090 TestSerialize(jdesc_, true);
2992 } 3091 }
OLDNEW
« no previous file with comments | « webrtc/api/webrtcsdp.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698