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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
509 // Store the new StreamParams in current_streams. | 509 // Store the new StreamParams in current_streams. |
510 // This is necessary so that we can use the CNAME for other media types. | 510 // This is necessary so that we can use the CNAME for other media types. |
511 current_streams->push_back(stream_param); | 511 current_streams->push_back(stream_param); |
512 } else { | 512 } else { |
513 content_description->AddStream(*param); | 513 content_description->AddStream(*param); |
514 } | 514 } |
515 } | 515 } |
516 return true; | 516 return true; |
517 } | 517 } |
518 | 518 |
519 // Updates the transport infos of the |sdesc| according to the given | |
520 // |bundle_group|. The transport infos of the content names within the | |
521 // |bundle_group| should be updated to use the ufrag and pwd of the first | |
522 // content within the |bundle_group|. | |
523 static bool UpdateTransportInfoForBundle(const ContentGroup& bundle_group, | |
524 SessionDescription* sdesc) { | |
525 // The bundle should not be empty. | |
526 if (!sdesc || !bundle_group.FirstContentName()) { | |
527 return false; | |
528 } | |
529 | |
530 // We should definitely have a transport for the first content. | |
531 const std::string& selected_content_name = *bundle_group.FirstContentName(); | |
532 const TransportInfo* selected_transport_info = | |
533 sdesc->GetTransportInfoByName(selected_content_name); | |
534 if (!selected_transport_info) { | |
535 return false; | |
536 } | |
537 | |
538 // Set the other contents to use the same ICE credentials. | |
539 const std::string& selected_ufrag = | |
540 selected_transport_info->description.ice_ufrag; | |
541 const std::string& selected_pwd = | |
542 selected_transport_info->description.ice_pwd; | |
543 for (TransportInfos::iterator it = | |
544 sdesc->transport_infos().begin(); | |
545 it != sdesc->transport_infos().end(); ++it) { | |
546 if (bundle_group.HasContentName(it->content_name) && | |
547 it->content_name != selected_content_name) { | |
548 it->description.ice_ufrag = selected_ufrag; | |
549 it->description.ice_pwd = selected_pwd; | |
550 } | |
551 } | |
552 return true; | |
553 } | |
554 | |
555 // Gets the CryptoParamsVec of the given |content_name| from |sdesc|, and | 519 // Gets the CryptoParamsVec of the given |content_name| from |sdesc|, and |
556 // sets it to |cryptos|. | 520 // sets it to |cryptos|. |
557 static bool GetCryptosByName(const SessionDescription* sdesc, | 521 static bool GetCryptosByName(const SessionDescription* sdesc, |
558 const std::string& content_name, | 522 const std::string& content_name, |
559 CryptoParamsVec* cryptos) { | 523 CryptoParamsVec* cryptos) { |
560 if (!sdesc || !cryptos) { | 524 if (!sdesc || !cryptos) { |
561 return false; | 525 return false; |
562 } | 526 } |
563 | 527 |
564 const ContentInfo* content = sdesc->GetContentByName(content_name); | 528 const ContentInfo* content = sdesc->GetContentByName(content_name); |
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1287 | 1251 |
1288 // Bundle the contents together, if we've been asked to do so, and update any | 1252 // Bundle the contents together, if we've been asked to do so, and update any |
1289 // parameters that need to be tweaked for BUNDLE. | 1253 // parameters that need to be tweaked for BUNDLE. |
1290 if (options.bundle_enabled) { | 1254 if (options.bundle_enabled) { |
1291 ContentGroup offer_bundle(GROUP_TYPE_BUNDLE); | 1255 ContentGroup offer_bundle(GROUP_TYPE_BUNDLE); |
1292 for (ContentInfos::const_iterator content = offer->contents().begin(); | 1256 for (ContentInfos::const_iterator content = offer->contents().begin(); |
1293 content != offer->contents().end(); ++content) { | 1257 content != offer->contents().end(); ++content) { |
1294 offer_bundle.AddContentName(content->name); | 1258 offer_bundle.AddContentName(content->name); |
1295 } | 1259 } |
1296 offer->AddGroup(offer_bundle); | 1260 offer->AddGroup(offer_bundle); |
1297 if (!UpdateTransportInfoForBundle(offer_bundle, offer.get())) { | |
1298 LOG(LS_ERROR) << "CreateOffer failed to UpdateTransportInfoForBundle."; | |
1299 return NULL; | |
1300 } | |
1301 if (!UpdateCryptoParamsForBundle(offer_bundle, offer.get())) { | 1261 if (!UpdateCryptoParamsForBundle(offer_bundle, offer.get())) { |
1302 LOG(LS_ERROR) << "CreateOffer failed to UpdateCryptoParamsForBundle."; | 1262 LOG(LS_ERROR) << "CreateOffer failed to UpdateCryptoParamsForBundle."; |
1303 return NULL; | 1263 return NULL; |
1304 } | 1264 } |
1305 } | 1265 } |
1306 | 1266 |
1307 return offer.release(); | 1267 return offer.release(); |
1308 } | 1268 } |
1309 | 1269 |
1310 SessionDescription* MediaSessionDescriptionFactory::CreateAnswer( | 1270 SessionDescription* MediaSessionDescriptionFactory::CreateAnswer( |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1347 const ContentGroup* offer_bundle = offer->GetGroupByName(GROUP_TYPE_BUNDLE); | 1307 const ContentGroup* offer_bundle = offer->GetGroupByName(GROUP_TYPE_BUNDLE); |
1348 ContentGroup answer_bundle(GROUP_TYPE_BUNDLE); | 1308 ContentGroup answer_bundle(GROUP_TYPE_BUNDLE); |
1349 for (ContentInfos::const_iterator content = answer->contents().begin(); | 1309 for (ContentInfos::const_iterator content = answer->contents().begin(); |
1350 content != answer->contents().end(); ++content) { | 1310 content != answer->contents().end(); ++content) { |
1351 if (!content->rejected && offer_bundle->HasContentName(content->name)) { | 1311 if (!content->rejected && offer_bundle->HasContentName(content->name)) { |
1352 answer_bundle.AddContentName(content->name); | 1312 answer_bundle.AddContentName(content->name); |
1353 } | 1313 } |
1354 } | 1314 } |
1355 if (answer_bundle.FirstContentName()) { | 1315 if (answer_bundle.FirstContentName()) { |
1356 answer->AddGroup(answer_bundle); | 1316 answer->AddGroup(answer_bundle); |
1357 | |
1358 // Share the same ICE credentials and crypto params across all contents, | |
1359 // as BUNDLE requires. | |
Taylor Brandstetter
2015/11/18 22:40:17
Actually, BUNDLE doesn't require this, as far as I
| |
1360 if (!UpdateTransportInfoForBundle(answer_bundle, answer.get())) { | |
1361 LOG(LS_ERROR) << "CreateAnswer failed to UpdateTransportInfoForBundle."; | |
1362 return NULL; | |
1363 } | |
1364 | |
1365 if (!UpdateCryptoParamsForBundle(answer_bundle, answer.get())) { | 1317 if (!UpdateCryptoParamsForBundle(answer_bundle, answer.get())) { |
1366 LOG(LS_ERROR) << "CreateAnswer failed to UpdateCryptoParamsForBundle."; | 1318 LOG(LS_ERROR) << "CreateAnswer failed to UpdateCryptoParamsForBundle."; |
1367 return NULL; | 1319 return NULL; |
1368 } | 1320 } |
1369 } | 1321 } |
1370 } | 1322 } |
1371 | 1323 |
1372 return answer.release(); | 1324 return answer.release(); |
1373 } | 1325 } |
1374 | 1326 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1446 | 1398 |
1447 // Add our default RTP header extensions that are not in | 1399 // Add our default RTP header extensions that are not in |
1448 // |current_description|. | 1400 // |current_description|. |
1449 FindRtpHdrExtsToOffer(audio_rtp_header_extensions(), audio_extensions, | 1401 FindRtpHdrExtsToOffer(audio_rtp_header_extensions(), audio_extensions, |
1450 &all_extensions, &used_ids); | 1402 &all_extensions, &used_ids); |
1451 FindRtpHdrExtsToOffer(video_rtp_header_extensions(), video_extensions, | 1403 FindRtpHdrExtsToOffer(video_rtp_header_extensions(), video_extensions, |
1452 &all_extensions, &used_ids); | 1404 &all_extensions, &used_ids); |
1453 } | 1405 } |
1454 | 1406 |
1455 bool MediaSessionDescriptionFactory::AddTransportOffer( | 1407 bool MediaSessionDescriptionFactory::AddTransportOffer( |
1456 const std::string& content_name, | 1408 const std::string& content_name, |
1457 const TransportOptions& transport_options, | 1409 const TransportOptions& transport_options, |
1458 const SessionDescription* current_desc, | 1410 bool ice_restart, |
1459 SessionDescription* offer_desc) const { | 1411 const SessionDescription* current_desc, |
1412 SessionDescription* offer_desc) const { | |
1460 if (!transport_desc_factory_) | 1413 if (!transport_desc_factory_) |
1461 return false; | 1414 return false; |
1462 const TransportDescription* current_tdesc = | 1415 const TransportDescription* current_tdesc = |
1463 GetTransportDescription(content_name, current_desc); | 1416 GetTransportDescription(content_name, current_desc); |
1464 rtc::scoped_ptr<TransportDescription> new_tdesc( | 1417 rtc::scoped_ptr<TransportDescription> new_tdesc( |
1465 transport_desc_factory_->CreateOffer(transport_options, current_tdesc)); | 1418 transport_desc_factory_->CreateOffer(transport_options, ice_restart, |
1419 current_tdesc)); | |
1466 bool ret = (new_tdesc.get() != NULL && | 1420 bool ret = (new_tdesc.get() != NULL && |
1467 offer_desc->AddTransportInfo(TransportInfo(content_name, *new_tdesc))); | 1421 offer_desc->AddTransportInfo(TransportInfo(content_name, *new_tdesc))); |
1468 if (!ret) { | 1422 if (!ret) { |
1469 LOG(LS_ERROR) | 1423 LOG(LS_ERROR) |
1470 << "Failed to AddTransportOffer, content name=" << content_name; | 1424 << "Failed to AddTransportOffer, content name=" << content_name; |
1471 } | 1425 } |
1472 return ret; | 1426 return ret; |
1473 } | 1427 } |
1474 | 1428 |
1475 TransportDescription* MediaSessionDescriptionFactory::CreateTransportAnswer( | 1429 TransportDescription* MediaSessionDescriptionFactory::CreateTransportAnswer( |
1476 const std::string& content_name, | 1430 const std::string& content_name, |
1477 const SessionDescription* offer_desc, | 1431 const SessionDescription* offer_desc, |
1478 const TransportOptions& transport_options, | 1432 const TransportOptions& transport_options, |
1433 bool ice_restart, | |
1479 const SessionDescription* current_desc) const { | 1434 const SessionDescription* current_desc) const { |
1480 if (!transport_desc_factory_) | 1435 if (!transport_desc_factory_) |
1481 return NULL; | 1436 return NULL; |
1482 const TransportDescription* offer_tdesc = | 1437 const TransportDescription* offer_tdesc = |
1483 GetTransportDescription(content_name, offer_desc); | 1438 GetTransportDescription(content_name, offer_desc); |
1484 const TransportDescription* current_tdesc = | 1439 const TransportDescription* current_tdesc = |
1485 GetTransportDescription(content_name, current_desc); | 1440 GetTransportDescription(content_name, current_desc); |
1486 return | 1441 return transport_desc_factory_->CreateAnswer(offer_tdesc, transport_options, |
1487 transport_desc_factory_->CreateAnswer(offer_tdesc, transport_options, | 1442 ice_restart, current_tdesc); |
1488 current_tdesc); | |
1489 } | 1443 } |
1490 | 1444 |
1491 bool MediaSessionDescriptionFactory::AddTransportAnswer( | 1445 bool MediaSessionDescriptionFactory::AddTransportAnswer( |
1492 const std::string& content_name, | 1446 const std::string& content_name, |
1493 const TransportDescription& transport_desc, | 1447 const TransportDescription& transport_desc, |
1494 SessionDescription* answer_desc) const { | 1448 SessionDescription* answer_desc) const { |
1495 if (!answer_desc->AddTransportInfo(TransportInfo(content_name, | 1449 if (!answer_desc->AddTransportInfo(TransportInfo(content_name, |
1496 transport_desc))) { | 1450 transport_desc))) { |
1497 LOG(LS_ERROR) | 1451 LOG(LS_ERROR) |
1498 << "Failed to AddTransportAnswer, content name=" << content_name; | 1452 << "Failed to AddTransportAnswer, content name=" << content_name; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1541 } else { | 1495 } else { |
1542 if (options.recv_audio) { | 1496 if (options.recv_audio) { |
1543 audio->set_direction(MD_RECVONLY); | 1497 audio->set_direction(MD_RECVONLY); |
1544 } else { | 1498 } else { |
1545 audio->set_direction(MD_INACTIVE); | 1499 audio->set_direction(MD_INACTIVE); |
1546 } | 1500 } |
1547 } | 1501 } |
1548 | 1502 |
1549 desc->AddContent(CN_AUDIO, NS_JINGLE_RTP, audio.release()); | 1503 desc->AddContent(CN_AUDIO, NS_JINGLE_RTP, audio.release()); |
1550 if (!AddTransportOffer(CN_AUDIO, options.transport_options, | 1504 if (!AddTransportOffer(CN_AUDIO, options.transport_options, |
1551 current_description, desc)) { | 1505 options.audio_ice_restart, current_description, |
1506 desc)) { | |
1552 return false; | 1507 return false; |
1553 } | 1508 } |
1554 | 1509 |
1555 return true; | 1510 return true; |
1556 } | 1511 } |
1557 | 1512 |
1558 bool MediaSessionDescriptionFactory::AddVideoContentForOffer( | 1513 bool MediaSessionDescriptionFactory::AddVideoContentForOffer( |
1559 const MediaSessionOptions& options, | 1514 const MediaSessionOptions& options, |
1560 const SessionDescription* current_description, | 1515 const SessionDescription* current_description, |
1561 const RtpHeaderExtensions& video_rtp_extensions, | 1516 const RtpHeaderExtensions& video_rtp_extensions, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1596 } else { | 1551 } else { |
1597 if (options.recv_video) { | 1552 if (options.recv_video) { |
1598 video->set_direction(MD_RECVONLY); | 1553 video->set_direction(MD_RECVONLY); |
1599 } else { | 1554 } else { |
1600 video->set_direction(MD_INACTIVE); | 1555 video->set_direction(MD_INACTIVE); |
1601 } | 1556 } |
1602 } | 1557 } |
1603 | 1558 |
1604 desc->AddContent(CN_VIDEO, NS_JINGLE_RTP, video.release()); | 1559 desc->AddContent(CN_VIDEO, NS_JINGLE_RTP, video.release()); |
1605 if (!AddTransportOffer(CN_VIDEO, options.transport_options, | 1560 if (!AddTransportOffer(CN_VIDEO, options.transport_options, |
1606 current_description, desc)) { | 1561 options.video_ice_restart, current_description, |
1562 desc)) { | |
1607 return false; | 1563 return false; |
1608 } | 1564 } |
1609 | 1565 |
1610 return true; | 1566 return true; |
1611 } | 1567 } |
1612 | 1568 |
1613 bool MediaSessionDescriptionFactory::AddDataContentForOffer( | 1569 bool MediaSessionDescriptionFactory::AddDataContentForOffer( |
1614 const MediaSessionOptions& options, | 1570 const MediaSessionOptions& options, |
1615 const SessionDescription* current_description, | 1571 const SessionDescription* current_description, |
1616 DataCodecs* data_codecs, | 1572 DataCodecs* data_codecs, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1655 } | 1611 } |
1656 | 1612 |
1657 if (is_sctp) { | 1613 if (is_sctp) { |
1658 desc->AddContent(CN_DATA, NS_JINGLE_DRAFT_SCTP, data.release()); | 1614 desc->AddContent(CN_DATA, NS_JINGLE_DRAFT_SCTP, data.release()); |
1659 } else { | 1615 } else { |
1660 data->set_bandwidth(options.data_bandwidth); | 1616 data->set_bandwidth(options.data_bandwidth); |
1661 SetMediaProtocol(secure_transport, data.get()); | 1617 SetMediaProtocol(secure_transport, data.get()); |
1662 desc->AddContent(CN_DATA, NS_JINGLE_RTP, data.release()); | 1618 desc->AddContent(CN_DATA, NS_JINGLE_RTP, data.release()); |
1663 } | 1619 } |
1664 if (!AddTransportOffer(CN_DATA, options.transport_options, | 1620 if (!AddTransportOffer(CN_DATA, options.transport_options, |
1665 current_description, desc)) { | 1621 options.data_ice_restart, current_description, desc)) { |
1666 return false; | 1622 return false; |
1667 } | 1623 } |
1668 return true; | 1624 return true; |
1669 } | 1625 } |
1670 | 1626 |
1671 bool MediaSessionDescriptionFactory::AddAudioContentForAnswer( | 1627 bool MediaSessionDescriptionFactory::AddAudioContentForAnswer( |
1672 const SessionDescription* offer, | 1628 const SessionDescription* offer, |
1673 const MediaSessionOptions& options, | 1629 const MediaSessionOptions& options, |
1674 const SessionDescription* current_description, | 1630 const SessionDescription* current_description, |
1675 StreamParamsVec* current_streams, | 1631 StreamParamsVec* current_streams, |
1676 SessionDescription* answer) const { | 1632 SessionDescription* answer) const { |
1677 const ContentInfo* audio_content = GetFirstAudioContent(offer); | 1633 const ContentInfo* audio_content = GetFirstAudioContent(offer); |
1678 | 1634 |
1679 scoped_ptr<TransportDescription> audio_transport( | 1635 scoped_ptr<TransportDescription> audio_transport(CreateTransportAnswer( |
1680 CreateTransportAnswer(audio_content->name, offer, | 1636 audio_content->name, offer, options.transport_options, |
1681 options.transport_options, | 1637 options.audio_ice_restart, current_description)); |
1682 current_description)); | |
1683 if (!audio_transport) { | 1638 if (!audio_transport) { |
1684 return false; | 1639 return false; |
1685 } | 1640 } |
1686 | 1641 |
1687 AudioCodecs audio_codecs = audio_codecs_; | 1642 AudioCodecs audio_codecs = audio_codecs_; |
1688 if (!options.vad_enabled) { | 1643 if (!options.vad_enabled) { |
1689 StripCNCodecs(&audio_codecs); | 1644 StripCNCodecs(&audio_codecs); |
1690 } | 1645 } |
1691 | 1646 |
1692 bool bundle_enabled = | 1647 bool bundle_enabled = |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1728 return true; | 1683 return true; |
1729 } | 1684 } |
1730 | 1685 |
1731 bool MediaSessionDescriptionFactory::AddVideoContentForAnswer( | 1686 bool MediaSessionDescriptionFactory::AddVideoContentForAnswer( |
1732 const SessionDescription* offer, | 1687 const SessionDescription* offer, |
1733 const MediaSessionOptions& options, | 1688 const MediaSessionOptions& options, |
1734 const SessionDescription* current_description, | 1689 const SessionDescription* current_description, |
1735 StreamParamsVec* current_streams, | 1690 StreamParamsVec* current_streams, |
1736 SessionDescription* answer) const { | 1691 SessionDescription* answer) const { |
1737 const ContentInfo* video_content = GetFirstVideoContent(offer); | 1692 const ContentInfo* video_content = GetFirstVideoContent(offer); |
1738 scoped_ptr<TransportDescription> video_transport( | 1693 scoped_ptr<TransportDescription> video_transport(CreateTransportAnswer( |
1739 CreateTransportAnswer(video_content->name, offer, | 1694 video_content->name, offer, options.transport_options, |
1740 options.transport_options, | 1695 options.video_ice_restart, current_description)); |
1741 current_description)); | |
1742 if (!video_transport) { | 1696 if (!video_transport) { |
1743 return false; | 1697 return false; |
1744 } | 1698 } |
1745 | 1699 |
1746 scoped_ptr<VideoContentDescription> video_answer( | 1700 scoped_ptr<VideoContentDescription> video_answer( |
1747 new VideoContentDescription()); | 1701 new VideoContentDescription()); |
1748 // Do not require or create SDES cryptos if DTLS is used. | 1702 // Do not require or create SDES cryptos if DTLS is used. |
1749 cricket::SecurePolicy sdes_policy = | 1703 cricket::SecurePolicy sdes_policy = |
1750 video_transport->secure() ? cricket::SEC_DISABLED : secure(); | 1704 video_transport->secure() ? cricket::SEC_DISABLED : secure(); |
1751 bool bundle_enabled = | 1705 bool bundle_enabled = |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1784 return true; | 1738 return true; |
1785 } | 1739 } |
1786 | 1740 |
1787 bool MediaSessionDescriptionFactory::AddDataContentForAnswer( | 1741 bool MediaSessionDescriptionFactory::AddDataContentForAnswer( |
1788 const SessionDescription* offer, | 1742 const SessionDescription* offer, |
1789 const MediaSessionOptions& options, | 1743 const MediaSessionOptions& options, |
1790 const SessionDescription* current_description, | 1744 const SessionDescription* current_description, |
1791 StreamParamsVec* current_streams, | 1745 StreamParamsVec* current_streams, |
1792 SessionDescription* answer) const { | 1746 SessionDescription* answer) const { |
1793 const ContentInfo* data_content = GetFirstDataContent(offer); | 1747 const ContentInfo* data_content = GetFirstDataContent(offer); |
1794 scoped_ptr<TransportDescription> data_transport( | 1748 scoped_ptr<TransportDescription> data_transport(CreateTransportAnswer( |
1795 CreateTransportAnswer(data_content->name, offer, | 1749 data_content->name, offer, options.transport_options, |
1796 options.transport_options, | 1750 options.data_ice_restart, current_description)); |
1797 current_description)); | |
1798 if (!data_transport) { | 1751 if (!data_transport) { |
1799 return false; | 1752 return false; |
1800 } | 1753 } |
1801 bool is_sctp = (options.data_channel_type == DCT_SCTP); | 1754 bool is_sctp = (options.data_channel_type == DCT_SCTP); |
1802 std::vector<DataCodec> data_codecs(data_codecs_); | 1755 std::vector<DataCodec> data_codecs(data_codecs_); |
1803 FilterDataCodecs(&data_codecs, is_sctp); | 1756 FilterDataCodecs(&data_codecs, is_sctp); |
1804 | 1757 |
1805 scoped_ptr<DataContentDescription> data_answer( | 1758 scoped_ptr<DataContentDescription> data_answer( |
1806 new DataContentDescription()); | 1759 new DataContentDescription()); |
1807 // Do not require or create SDES cryptos if DTLS is used. | 1760 // Do not require or create SDES cryptos if DTLS is used. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1855 } | 1808 } |
1856 | 1809 |
1857 bool IsVideoContent(const ContentInfo* content) { | 1810 bool IsVideoContent(const ContentInfo* content) { |
1858 return IsMediaContentOfType(content, MEDIA_TYPE_VIDEO); | 1811 return IsMediaContentOfType(content, MEDIA_TYPE_VIDEO); |
1859 } | 1812 } |
1860 | 1813 |
1861 bool IsDataContent(const ContentInfo* content) { | 1814 bool IsDataContent(const ContentInfo* content) { |
1862 return IsMediaContentOfType(content, MEDIA_TYPE_DATA); | 1815 return IsMediaContentOfType(content, MEDIA_TYPE_DATA); |
1863 } | 1816 } |
1864 | 1817 |
1865 static const ContentInfo* GetFirstMediaContent(const ContentInfos& contents, | 1818 const ContentInfo* GetFirstMediaContent(const ContentInfos& contents, |
1866 MediaType media_type) { | 1819 MediaType media_type) { |
1867 for (ContentInfos::const_iterator content = contents.begin(); | 1820 for (ContentInfos::const_iterator content = contents.begin(); |
1868 content != contents.end(); content++) { | 1821 content != contents.end(); content++) { |
1869 if (IsMediaContentOfType(&*content, media_type)) { | 1822 if (IsMediaContentOfType(&*content, media_type)) { |
1870 return &*content; | 1823 return &*content; |
1871 } | 1824 } |
1872 } | 1825 } |
1873 return NULL; | 1826 return NULL; |
1874 } | 1827 } |
1875 | 1828 |
1876 const ContentInfo* GetFirstAudioContent(const ContentInfos& contents) { | 1829 const ContentInfo* GetFirstAudioContent(const ContentInfos& contents) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1924 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_VIDEO)); | 1877 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_VIDEO)); |
1925 } | 1878 } |
1926 | 1879 |
1927 const DataContentDescription* GetFirstDataContentDescription( | 1880 const DataContentDescription* GetFirstDataContentDescription( |
1928 const SessionDescription* sdesc) { | 1881 const SessionDescription* sdesc) { |
1929 return static_cast<const DataContentDescription*>( | 1882 return static_cast<const DataContentDescription*>( |
1930 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_DATA)); | 1883 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_DATA)); |
1931 } | 1884 } |
1932 | 1885 |
1933 } // namespace cricket | 1886 } // namespace cricket |
OLD | NEW |