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

Side by Side Diff: talk/session/media/mediasession.cc

Issue 1406803004: Fixing some issues with the direction attribute of m-lines in offers. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing a comment. Created 5 years, 1 month 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 | « talk/app/webrtc/webrtcsession_unittest.cc ('k') | webrtc/p2p/base/sessiondescription.h » ('j') | 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 * 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 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 // Make sure the answer media content direction is per default set as 1029 // Make sure the answer media content direction is per default set as
1030 // described in RFC3264 section 6.1. 1030 // described in RFC3264 section 6.1.
1031 switch (offer->direction()) { 1031 switch (offer->direction()) {
1032 case MD_INACTIVE: 1032 case MD_INACTIVE:
1033 answer->set_direction(MD_INACTIVE); 1033 answer->set_direction(MD_INACTIVE);
1034 break; 1034 break;
1035 case MD_SENDONLY: 1035 case MD_SENDONLY:
1036 answer->set_direction(MD_RECVONLY); 1036 answer->set_direction(MD_RECVONLY);
1037 break; 1037 break;
1038 case MD_RECVONLY: 1038 case MD_RECVONLY:
1039 answer->set_direction(MD_SENDONLY); 1039 answer->set_direction(answer->streams().empty() ? MD_INACTIVE
1040 : MD_SENDONLY);
1040 break; 1041 break;
1041 case MD_SENDRECV: 1042 case MD_SENDRECV:
1042 answer->set_direction(MD_SENDRECV); 1043 answer->set_direction(answer->streams().empty() ? MD_RECVONLY
1044 : MD_SENDRECV);
pthatcher 2015/11/23 18:00:52 It looks like this breaks data channels. If we're
1043 break; 1045 break;
1044 default: 1046 default:
1047 RTC_DCHECK(false && "MediaContentDescription has unexpected direction.");
1045 break; 1048 break;
1046 } 1049 }
1047 1050
1048 return true; 1051 return true;
1049 } 1052 }
1050 1053
1051 static bool IsMediaProtocolSupported(MediaType type, 1054 static bool IsMediaProtocolSupported(MediaType type,
1052 const std::string& protocol, 1055 const std::string& protocol,
1053 bool secure_transport) { 1056 bool secure_transport) {
1054 // Data channels can have a protocol of SCTP or SCTP/DTLS. 1057 // Data channels can have a protocol of SCTP or SCTP/DTLS.
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
1522 add_legacy_, 1525 add_legacy_,
1523 current_streams, 1526 current_streams,
1524 audio.get())) { 1527 audio.get())) {
1525 return false; 1528 return false;
1526 } 1529 }
1527 audio->set_lang(lang_); 1530 audio->set_lang(lang_);
1528 1531
1529 bool secure_transport = (transport_desc_factory_->secure() != SEC_DISABLED); 1532 bool secure_transport = (transport_desc_factory_->secure() != SEC_DISABLED);
1530 SetMediaProtocol(secure_transport, audio.get()); 1533 SetMediaProtocol(secure_transport, audio.get());
1531 1534
1532 if (!options.recv_audio) { 1535 if (!audio->streams().empty()) {
1533 audio->set_direction(MD_SENDONLY); 1536 if (options.recv_audio) {
1537 audio->set_direction(MD_SENDRECV);
1538 } else {
1539 audio->set_direction(MD_SENDONLY);
1540 }
1541 } else {
1542 if (options.recv_audio) {
1543 audio->set_direction(MD_RECVONLY);
1544 } else {
1545 audio->set_direction(MD_INACTIVE);
1546 }
1534 } 1547 }
1535 1548
1536 desc->AddContent(CN_AUDIO, NS_JINGLE_RTP, audio.release()); 1549 desc->AddContent(CN_AUDIO, NS_JINGLE_RTP, audio.release());
1537 if (!AddTransportOffer(CN_AUDIO, options.transport_options, 1550 if (!AddTransportOffer(CN_AUDIO, options.transport_options,
1538 current_description, desc)) { 1551 current_description, desc)) {
1539 return false; 1552 return false;
1540 } 1553 }
1541 1554
1542 return true; 1555 return true;
1543 } 1556 }
(...skipping 23 matching lines...) Expand all
1567 current_streams, 1580 current_streams,
1568 video.get())) { 1581 video.get())) {
1569 return false; 1582 return false;
1570 } 1583 }
1571 1584
1572 video->set_bandwidth(options.video_bandwidth); 1585 video->set_bandwidth(options.video_bandwidth);
1573 1586
1574 bool secure_transport = (transport_desc_factory_->secure() != SEC_DISABLED); 1587 bool secure_transport = (transport_desc_factory_->secure() != SEC_DISABLED);
1575 SetMediaProtocol(secure_transport, video.get()); 1588 SetMediaProtocol(secure_transport, video.get());
1576 1589
1577 if (!options.recv_video) { 1590 if (!video->streams().empty()) {
1578 video->set_direction(MD_SENDONLY); 1591 if (options.recv_video) {
1592 video->set_direction(MD_SENDRECV);
1593 } else {
1594 video->set_direction(MD_SENDONLY);
1595 }
1596 } else {
1597 if (options.recv_video) {
1598 video->set_direction(MD_RECVONLY);
1599 } else {
1600 video->set_direction(MD_INACTIVE);
1601 }
1579 } 1602 }
1580 1603
1581 desc->AddContent(CN_VIDEO, NS_JINGLE_RTP, video.release()); 1604 desc->AddContent(CN_VIDEO, NS_JINGLE_RTP, video.release());
1582 if (!AddTransportOffer(CN_VIDEO, options.transport_options, 1605 if (!AddTransportOffer(CN_VIDEO, options.transport_options,
1583 current_description, desc)) { 1606 current_description, desc)) {
1584 return false; 1607 return false;
1585 } 1608 }
1586 1609
1587 return true; 1610 return true;
1588 } 1611 }
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
1901 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_VIDEO)); 1924 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_VIDEO));
1902 } 1925 }
1903 1926
1904 const DataContentDescription* GetFirstDataContentDescription( 1927 const DataContentDescription* GetFirstDataContentDescription(
1905 const SessionDescription* sdesc) { 1928 const SessionDescription* sdesc) {
1906 return static_cast<const DataContentDescription*>( 1929 return static_cast<const DataContentDescription*>(
1907 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_DATA)); 1930 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_DATA));
1908 } 1931 }
1909 1932
1910 } // namespace cricket 1933 } // namespace cricket
OLDNEW
« no previous file with comments | « talk/app/webrtc/webrtcsession_unittest.cc ('k') | webrtc/p2p/base/sessiondescription.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698