OLD | NEW |
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 563 matching lines...) Loading... |
574 cricket::IsValidRtpPayloadType(*payload_type); | 574 cricket::IsValidRtpPayloadType(*payload_type); |
575 } | 575 } |
576 | 576 |
577 // |msid_stream_id| and |msid_track_id| represent the stream/track ID from the | 577 // |msid_stream_id| and |msid_track_id| represent the stream/track ID from the |
578 // "a=msid" attribute, if it exists. They are empty if the attribute does not | 578 // "a=msid" attribute, if it exists. They are empty if the attribute does not |
579 // exist. | 579 // exist. |
580 void CreateTracksFromSsrcInfos(const SsrcInfoVec& ssrc_infos, | 580 void CreateTracksFromSsrcInfos(const SsrcInfoVec& ssrc_infos, |
581 const std::string& msid_stream_id, | 581 const std::string& msid_stream_id, |
582 const std::string& msid_track_id, | 582 const std::string& msid_track_id, |
583 StreamParamsVec* tracks) { | 583 StreamParamsVec* tracks) { |
584 ASSERT(tracks != NULL); | 584 RTC_DCHECK(tracks != NULL); |
585 ASSERT(msid_stream_id.empty() == msid_track_id.empty()); | 585 RTC_DCHECK(msid_stream_id.empty() == msid_track_id.empty()); |
586 for (SsrcInfoVec::const_iterator ssrc_info = ssrc_infos.begin(); | 586 for (SsrcInfoVec::const_iterator ssrc_info = ssrc_infos.begin(); |
587 ssrc_info != ssrc_infos.end(); ++ssrc_info) { | 587 ssrc_info != ssrc_infos.end(); ++ssrc_info) { |
588 if (ssrc_info->cname.empty()) { | 588 if (ssrc_info->cname.empty()) { |
589 continue; | 589 continue; |
590 } | 590 } |
591 | 591 |
592 std::string stream_id; | 592 std::string stream_id; |
593 std::string track_id; | 593 std::string track_id; |
594 if (ssrc_info->stream_id.empty() && !ssrc_info->mslabel.empty()) { | 594 if (ssrc_info->stream_id.empty() && !ssrc_info->mslabel.empty()) { |
595 // If there's no msid and there's mslabel, we consider this is a sdp from | 595 // If there's no msid and there's mslabel, we consider this is a sdp from |
(...skipping 228 matching lines...) Loading... |
824 AddLine(kSessionName, &message); | 824 AddLine(kSessionName, &message); |
825 | 825 |
826 // Time Description. | 826 // Time Description. |
827 AddLine(kTimeDescription, &message); | 827 AddLine(kTimeDescription, &message); |
828 | 828 |
829 // Group | 829 // Group |
830 if (desc->HasGroup(cricket::GROUP_TYPE_BUNDLE)) { | 830 if (desc->HasGroup(cricket::GROUP_TYPE_BUNDLE)) { |
831 std::string group_line = kAttrGroup; | 831 std::string group_line = kAttrGroup; |
832 const cricket::ContentGroup* group = | 832 const cricket::ContentGroup* group = |
833 desc->GetGroupByName(cricket::GROUP_TYPE_BUNDLE); | 833 desc->GetGroupByName(cricket::GROUP_TYPE_BUNDLE); |
834 ASSERT(group != NULL); | 834 RTC_DCHECK(group != NULL); |
835 const cricket::ContentNames& content_names = group->content_names(); | 835 const cricket::ContentNames& content_names = group->content_names(); |
836 for (cricket::ContentNames::const_iterator it = content_names.begin(); | 836 for (cricket::ContentNames::const_iterator it = content_names.begin(); |
837 it != content_names.end(); ++it) { | 837 it != content_names.end(); ++it) { |
838 group_line.append(" "); | 838 group_line.append(" "); |
839 group_line.append(*it); | 839 group_line.append(*it); |
840 } | 840 } |
841 AddLine(group_line, &message); | 841 AddLine(group_line, &message); |
842 } | 842 } |
843 | 843 |
844 // MediaStream semantics | 844 // MediaStream semantics |
(...skipping 36 matching lines...) Loading... |
881 return SdpSerializeCandidate(candidate.candidate()); | 881 return SdpSerializeCandidate(candidate.candidate()); |
882 } | 882 } |
883 | 883 |
884 // Serializes a cricket Candidate. | 884 // Serializes a cricket Candidate. |
885 std::string SdpSerializeCandidate(const cricket::Candidate& candidate) { | 885 std::string SdpSerializeCandidate(const cricket::Candidate& candidate) { |
886 std::string message; | 886 std::string message; |
887 std::vector<cricket::Candidate> candidates(1, candidate); | 887 std::vector<cricket::Candidate> candidates(1, candidate); |
888 BuildCandidate(candidates, true, &message); | 888 BuildCandidate(candidates, true, &message); |
889 // From WebRTC draft section 4.8.1.1 candidate-attribute will be | 889 // From WebRTC draft section 4.8.1.1 candidate-attribute will be |
890 // just candidate:<candidate> not a=candidate:<blah>CRLF | 890 // just candidate:<candidate> not a=candidate:<blah>CRLF |
891 ASSERT(message.find("a=") == 0); | 891 RTC_DCHECK(message.find("a=") == 0); |
892 message.erase(0, 2); | 892 message.erase(0, 2); |
893 ASSERT(message.find(kLineBreak) == message.size() - 2); | 893 RTC_DCHECK(message.find(kLineBreak) == message.size() - 2); |
894 message.resize(message.size() - 2); | 894 message.resize(message.size() - 2); |
895 return message; | 895 return message; |
896 } | 896 } |
897 | 897 |
898 bool SdpDeserialize(const std::string& message, | 898 bool SdpDeserialize(const std::string& message, |
899 JsepSessionDescription* jdesc, | 899 JsepSessionDescription* jdesc, |
900 SdpParseError* error) { | 900 SdpParseError* error) { |
901 std::string session_id; | 901 std::string session_id; |
902 std::string session_version; | 902 std::string session_version; |
903 TransportDescription session_td("", ""); | 903 TransportDescription session_td("", ""); |
(...skipping 27 matching lines...) Loading... |
931 it = candidates.begin(); it != candidates.end(); ++it) { | 931 it = candidates.begin(); it != candidates.end(); ++it) { |
932 jdesc->AddCandidate(*it); | 932 jdesc->AddCandidate(*it); |
933 delete *it; | 933 delete *it; |
934 } | 934 } |
935 return true; | 935 return true; |
936 } | 936 } |
937 | 937 |
938 bool SdpDeserializeCandidate(const std::string& message, | 938 bool SdpDeserializeCandidate(const std::string& message, |
939 JsepIceCandidate* jcandidate, | 939 JsepIceCandidate* jcandidate, |
940 SdpParseError* error) { | 940 SdpParseError* error) { |
941 ASSERT(jcandidate != NULL); | 941 RTC_DCHECK(jcandidate != NULL); |
942 Candidate candidate; | 942 Candidate candidate; |
943 if (!ParseCandidate(message, &candidate, error, true)) { | 943 if (!ParseCandidate(message, &candidate, error, true)) { |
944 return false; | 944 return false; |
945 } | 945 } |
946 jcandidate->SetCandidate(candidate); | 946 jcandidate->SetCandidate(candidate); |
947 return true; | 947 return true; |
948 } | 948 } |
949 | 949 |
950 bool SdpDeserializeCandidate(const std::string& transport_name, | 950 bool SdpDeserializeCandidate(const std::string& transport_name, |
951 const std::string& message, | 951 const std::string& message, |
952 cricket::Candidate* candidate, | 952 cricket::Candidate* candidate, |
953 SdpParseError* error) { | 953 SdpParseError* error) { |
954 ASSERT(candidate != nullptr); | 954 RTC_DCHECK(candidate != nullptr); |
955 if (!ParseCandidate(message, candidate, error, true)) { | 955 if (!ParseCandidate(message, candidate, error, true)) { |
956 return false; | 956 return false; |
957 } | 957 } |
958 candidate->set_transport_name(transport_name); | 958 candidate->set_transport_name(transport_name); |
959 return true; | 959 return true; |
960 } | 960 } |
961 | 961 |
962 bool ParseCandidate(const std::string& message, Candidate* candidate, | 962 bool ParseCandidate(const std::string& message, Candidate* candidate, |
963 SdpParseError* error, bool is_raw) { | 963 SdpParseError* error, bool is_raw) { |
964 ASSERT(candidate != NULL); | 964 RTC_DCHECK(candidate != NULL); |
965 | 965 |
966 // Get the first line from |message|. | 966 // Get the first line from |message|. |
967 std::string first_line = message; | 967 std::string first_line = message; |
968 size_t pos = 0; | 968 size_t pos = 0; |
969 GetLine(message, &pos, &first_line); | 969 GetLine(message, &pos, &first_line); |
970 | 970 |
971 // Makes sure |message| contains only one line. | 971 // Makes sure |message| contains only one line. |
972 if (message.size() > first_line.size()) { | 972 if (message.size() > first_line.size()) { |
973 std::string left, right; | 973 std::string left, right; |
974 if (rtc::tokenize_first(message, kNewLine, &left, &right) && | 974 if (rtc::tokenize_first(message, kNewLine, &left, &right) && |
(...skipping 233 matching lines...) Loading... |
1208 *extmap = RtpExtension(uri, value); | 1208 *extmap = RtpExtension(uri, value); |
1209 return true; | 1209 return true; |
1210 } | 1210 } |
1211 | 1211 |
1212 void BuildMediaDescription(const ContentInfo* content_info, | 1212 void BuildMediaDescription(const ContentInfo* content_info, |
1213 const TransportInfo* transport_info, | 1213 const TransportInfo* transport_info, |
1214 const MediaType media_type, | 1214 const MediaType media_type, |
1215 const std::vector<Candidate>& candidates, | 1215 const std::vector<Candidate>& candidates, |
1216 bool unified_plan_sdp, | 1216 bool unified_plan_sdp, |
1217 std::string* message) { | 1217 std::string* message) { |
1218 ASSERT(message != NULL); | 1218 RTC_DCHECK(message != NULL); |
1219 if (content_info == NULL || message == NULL) { | 1219 if (content_info == NULL || message == NULL) { |
1220 return; | 1220 return; |
1221 } | 1221 } |
1222 // TODO: Rethink if we should use sprintfn instead of stringstream. | 1222 // TODO: Rethink if we should use sprintfn instead of stringstream. |
1223 // According to the style guide, streams should only be used for logging. | 1223 // According to the style guide, streams should only be used for logging. |
1224 // http://google-styleguide.googlecode.com/svn/ | 1224 // http://google-styleguide.googlecode.com/svn/ |
1225 // trunk/cppguide.xml?showone=Streams#Streams | 1225 // trunk/cppguide.xml?showone=Streams#Streams |
1226 std::ostringstream os; | 1226 std::ostringstream os; |
1227 const MediaContentDescription* media_desc = | 1227 const MediaContentDescription* media_desc = |
1228 static_cast<const MediaContentDescription*>( | 1228 static_cast<const MediaContentDescription*>( |
1229 content_info->description); | 1229 content_info->description); |
1230 ASSERT(media_desc != NULL); | 1230 RTC_DCHECK(media_desc != NULL); |
1231 | 1231 |
1232 int sctp_port = cricket::kSctpDefaultPort; | 1232 int sctp_port = cricket::kSctpDefaultPort; |
1233 | 1233 |
1234 // RFC 4566 | 1234 // RFC 4566 |
1235 // m=<media> <port> <proto> <fmt> | 1235 // m=<media> <port> <proto> <fmt> |
1236 // fmt is a list of payload type numbers that MAY be used in the session. | 1236 // fmt is a list of payload type numbers that MAY be used in the session. |
1237 const char* type = NULL; | 1237 const char* type = NULL; |
1238 if (media_type == cricket::MEDIA_TYPE_AUDIO) | 1238 if (media_type == cricket::MEDIA_TYPE_AUDIO) |
1239 type = kMediaTypeAudio; | 1239 type = kMediaTypeAudio; |
1240 else if (media_type == cricket::MEDIA_TYPE_VIDEO) | 1240 else if (media_type == cricket::MEDIA_TYPE_VIDEO) |
(...skipping 471 matching lines...) Loading... |
1712 } | 1712 } |
1713 if (!rtc::FromString(found->second, value)) { | 1713 if (!rtc::FromString(found->second, value)) { |
1714 return false; | 1714 return false; |
1715 } | 1715 } |
1716 return true; | 1716 return true; |
1717 } | 1717 } |
1718 | 1718 |
1719 void BuildRtpMap(const MediaContentDescription* media_desc, | 1719 void BuildRtpMap(const MediaContentDescription* media_desc, |
1720 const MediaType media_type, | 1720 const MediaType media_type, |
1721 std::string* message) { | 1721 std::string* message) { |
1722 ASSERT(message != NULL); | 1722 RTC_DCHECK(message != NULL); |
1723 ASSERT(media_desc != NULL); | 1723 RTC_DCHECK(media_desc != NULL); |
1724 std::ostringstream os; | 1724 std::ostringstream os; |
1725 if (media_type == cricket::MEDIA_TYPE_VIDEO) { | 1725 if (media_type == cricket::MEDIA_TYPE_VIDEO) { |
1726 const VideoContentDescription* video_desc = | 1726 const VideoContentDescription* video_desc = |
1727 static_cast<const VideoContentDescription*>(media_desc); | 1727 static_cast<const VideoContentDescription*>(media_desc); |
1728 for (std::vector<cricket::VideoCodec>::const_iterator it = | 1728 for (std::vector<cricket::VideoCodec>::const_iterator it = |
1729 video_desc->codecs().begin(); | 1729 video_desc->codecs().begin(); |
1730 it != video_desc->codecs().end(); ++it) { | 1730 it != video_desc->codecs().end(); ++it) { |
1731 // RFC 4566 | 1731 // RFC 4566 |
1732 // a=rtpmap:<payload type> <encoding name>/<clock rate> | 1732 // a=rtpmap:<payload type> <encoding name>/<clock rate> |
1733 // [/<encodingparameters>] | 1733 // [/<encodingparameters>] |
1734 if (it->id != kWildcardPayloadType) { | 1734 if (it->id != kWildcardPayloadType) { |
1735 InitAttrLine(kAttributeRtpmap, &os); | 1735 InitAttrLine(kAttributeRtpmap, &os); |
1736 os << kSdpDelimiterColon << it->id << " " << it->name | 1736 os << kSdpDelimiterColon << it->id << " " << it->name |
1737 << "/" << kDefaultVideoClockrate; | 1737 << "/" << kDefaultVideoClockrate; |
1738 AddLine(os.str(), message); | 1738 AddLine(os.str(), message); |
1739 } | 1739 } |
1740 AddRtcpFbLines(*it, message); | 1740 AddRtcpFbLines(*it, message); |
1741 AddFmtpLine(*it, message); | 1741 AddFmtpLine(*it, message); |
1742 } | 1742 } |
1743 } else if (media_type == cricket::MEDIA_TYPE_AUDIO) { | 1743 } else if (media_type == cricket::MEDIA_TYPE_AUDIO) { |
1744 const AudioContentDescription* audio_desc = | 1744 const AudioContentDescription* audio_desc = |
1745 static_cast<const AudioContentDescription*>(media_desc); | 1745 static_cast<const AudioContentDescription*>(media_desc); |
1746 std::vector<int> ptimes; | 1746 std::vector<int> ptimes; |
1747 std::vector<int> maxptimes; | 1747 std::vector<int> maxptimes; |
1748 int max_minptime = 0; | 1748 int max_minptime = 0; |
1749 for (std::vector<cricket::AudioCodec>::const_iterator it = | 1749 for (std::vector<cricket::AudioCodec>::const_iterator it = |
1750 audio_desc->codecs().begin(); | 1750 audio_desc->codecs().begin(); |
1751 it != audio_desc->codecs().end(); ++it) { | 1751 it != audio_desc->codecs().end(); ++it) { |
1752 ASSERT(!it->name.empty()); | 1752 RTC_DCHECK(!it->name.empty()); |
1753 // RFC 4566 | 1753 // RFC 4566 |
1754 // a=rtpmap:<payload type> <encoding name>/<clock rate> | 1754 // a=rtpmap:<payload type> <encoding name>/<clock rate> |
1755 // [/<encodingparameters>] | 1755 // [/<encodingparameters>] |
1756 InitAttrLine(kAttributeRtpmap, &os); | 1756 InitAttrLine(kAttributeRtpmap, &os); |
1757 os << kSdpDelimiterColon << it->id << " "; | 1757 os << kSdpDelimiterColon << it->id << " "; |
1758 os << it->name << "/" << it->clockrate; | 1758 os << it->name << "/" << it->clockrate; |
1759 if (it->channels != 1) { | 1759 if (it->channels != 1) { |
1760 os << "/" << it->channels; | 1760 os << "/" << it->channels; |
1761 } | 1761 } |
1762 AddLine(os.str(), message); | 1762 AddLine(os.str(), message); |
(...skipping 11 matching lines...) Loading... |
1774 if (GetParameter(kCodecParamMaxPTime, it->params, &maxptime)) { | 1774 if (GetParameter(kCodecParamMaxPTime, it->params, &maxptime)) { |
1775 maxptimes.push_back(maxptime); | 1775 maxptimes.push_back(maxptime); |
1776 } | 1776 } |
1777 } | 1777 } |
1778 // Populate the maxptime attribute with the smallest maxptime of all codecs | 1778 // Populate the maxptime attribute with the smallest maxptime of all codecs |
1779 // under the same m-line. | 1779 // under the same m-line. |
1780 int min_maxptime = INT_MAX; | 1780 int min_maxptime = INT_MAX; |
1781 if (GetMinValue(maxptimes, &min_maxptime)) { | 1781 if (GetMinValue(maxptimes, &min_maxptime)) { |
1782 AddAttributeLine(kCodecParamMaxPTime, min_maxptime, message); | 1782 AddAttributeLine(kCodecParamMaxPTime, min_maxptime, message); |
1783 } | 1783 } |
1784 ASSERT(min_maxptime > max_minptime); | 1784 RTC_DCHECK(min_maxptime > max_minptime); |
1785 // Populate the ptime attribute with the smallest ptime or the largest | 1785 // Populate the ptime attribute with the smallest ptime or the largest |
1786 // minptime, whichever is the largest, for all codecs under the same m-line. | 1786 // minptime, whichever is the largest, for all codecs under the same m-line. |
1787 int ptime = INT_MAX; | 1787 int ptime = INT_MAX; |
1788 if (GetMinValue(ptimes, &ptime)) { | 1788 if (GetMinValue(ptimes, &ptime)) { |
1789 ptime = std::min(ptime, min_maxptime); | 1789 ptime = std::min(ptime, min_maxptime); |
1790 ptime = std::max(ptime, max_minptime); | 1790 ptime = std::max(ptime, max_minptime); |
1791 AddAttributeLine(kCodecParamPTime, ptime, message); | 1791 AddAttributeLine(kCodecParamPTime, ptime, message); |
1792 } | 1792 } |
1793 } else if (media_type == cricket::MEDIA_TYPE_DATA) { | 1793 } else if (media_type == cricket::MEDIA_TYPE_DATA) { |
1794 const DataContentDescription* data_desc = | 1794 const DataContentDescription* data_desc = |
(...skipping 255 matching lines...) Loading... |
2050 session_extmaps->push_back(extmap); | 2050 session_extmaps->push_back(extmap); |
2051 } | 2051 } |
2052 } | 2052 } |
2053 | 2053 |
2054 return true; | 2054 return true; |
2055 } | 2055 } |
2056 | 2056 |
2057 bool ParseGroupAttribute(const std::string& line, | 2057 bool ParseGroupAttribute(const std::string& line, |
2058 cricket::SessionDescription* desc, | 2058 cricket::SessionDescription* desc, |
2059 SdpParseError* error) { | 2059 SdpParseError* error) { |
2060 ASSERT(desc != NULL); | 2060 RTC_DCHECK(desc != NULL); |
2061 | 2061 |
2062 // RFC 5888 and draft-holmberg-mmusic-sdp-bundle-negotiation-00 | 2062 // RFC 5888 and draft-holmberg-mmusic-sdp-bundle-negotiation-00 |
2063 // a=group:BUNDLE video voice | 2063 // a=group:BUNDLE video voice |
2064 std::vector<std::string> fields; | 2064 std::vector<std::string> fields; |
2065 rtc::split(line.substr(kLinePrefixLength), | 2065 rtc::split(line.substr(kLinePrefixLength), |
2066 kSdpDelimiterSpace, &fields); | 2066 kSdpDelimiterSpace, &fields); |
2067 std::string semantics; | 2067 std::string semantics; |
2068 if (!GetValue(fields[0], kAttributeGroup, &semantics, error)) { | 2068 if (!GetValue(fields[0], kAttributeGroup, &semantics, error)) { |
2069 return false; | 2069 return false; |
2070 } | 2070 } |
(...skipping 207 matching lines...) Loading... |
2278 return media_desc; | 2278 return media_desc; |
2279 } | 2279 } |
2280 | 2280 |
2281 bool ParseMediaDescription(const std::string& message, | 2281 bool ParseMediaDescription(const std::string& message, |
2282 const TransportDescription& session_td, | 2282 const TransportDescription& session_td, |
2283 const RtpHeaderExtensions& session_extmaps, | 2283 const RtpHeaderExtensions& session_extmaps, |
2284 size_t* pos, | 2284 size_t* pos, |
2285 cricket::SessionDescription* desc, | 2285 cricket::SessionDescription* desc, |
2286 std::vector<JsepIceCandidate*>* candidates, | 2286 std::vector<JsepIceCandidate*>* candidates, |
2287 SdpParseError* error) { | 2287 SdpParseError* error) { |
2288 ASSERT(desc != NULL); | 2288 RTC_DCHECK(desc != NULL); |
2289 std::string line; | 2289 std::string line; |
2290 int mline_index = -1; | 2290 int mline_index = -1; |
2291 | 2291 |
2292 // Zero or more media descriptions | 2292 // Zero or more media descriptions |
2293 // RFC 4566 | 2293 // RFC 4566 |
2294 // m=<media> <port> <proto> <fmt> | 2294 // m=<media> <port> <proto> <fmt> |
2295 while (GetLineWithType(message, pos, &line, kLineTypeMedia)) { | 2295 while (GetLineWithType(message, pos, &line, kLineTypeMedia)) { |
2296 ++mline_index; | 2296 ++mline_index; |
2297 | 2297 |
2298 std::vector<std::string> fields; | 2298 std::vector<std::string> fields; |
(...skipping 283 matching lines...) Loading... |
2582 int mline_index, | 2582 int mline_index, |
2583 const std::string& protocol, | 2583 const std::string& protocol, |
2584 const std::vector<int>& payload_types, | 2584 const std::vector<int>& payload_types, |
2585 size_t* pos, | 2585 size_t* pos, |
2586 std::string* content_name, | 2586 std::string* content_name, |
2587 bool* bundle_only, | 2587 bool* bundle_only, |
2588 MediaContentDescription* media_desc, | 2588 MediaContentDescription* media_desc, |
2589 TransportDescription* transport, | 2589 TransportDescription* transport, |
2590 std::vector<JsepIceCandidate*>* candidates, | 2590 std::vector<JsepIceCandidate*>* candidates, |
2591 SdpParseError* error) { | 2591 SdpParseError* error) { |
2592 ASSERT(media_desc != NULL); | 2592 RTC_DCHECK(media_desc != NULL); |
2593 ASSERT(content_name != NULL); | 2593 RTC_DCHECK(content_name != NULL); |
2594 ASSERT(transport != NULL); | 2594 RTC_DCHECK(transport != NULL); |
2595 | 2595 |
2596 if (media_type == cricket::MEDIA_TYPE_AUDIO) { | 2596 if (media_type == cricket::MEDIA_TYPE_AUDIO) { |
2597 MaybeCreateStaticPayloadAudioCodecs( | 2597 MaybeCreateStaticPayloadAudioCodecs( |
2598 payload_types, static_cast<AudioContentDescription*>(media_desc)); | 2598 payload_types, static_cast<AudioContentDescription*>(media_desc)); |
2599 } | 2599 } |
2600 | 2600 |
2601 // The media level "ice-ufrag" and "ice-pwd". | 2601 // The media level "ice-ufrag" and "ice-pwd". |
2602 // The candidates before update the media level "ice-pwd" and "ice-ufrag". | 2602 // The candidates before update the media level "ice-pwd" and "ice-ufrag". |
2603 Candidates candidates_orig; | 2603 Candidates candidates_orig; |
2604 std::string line; | 2604 std::string line; |
(...skipping 234 matching lines...) Loading... |
2839 // only rtcp-fb. | 2839 // only rtcp-fb. |
2840 if (!VerifyVideoCodecs(video_desc)) { | 2840 if (!VerifyVideoCodecs(video_desc)) { |
2841 return ParseFailed("Failed to parse video codecs correctly.", error); | 2841 return ParseFailed("Failed to parse video codecs correctly.", error); |
2842 } | 2842 } |
2843 } | 2843 } |
2844 | 2844 |
2845 // RFC 5245 | 2845 // RFC 5245 |
2846 // Update the candidates with the media level "ice-pwd" and "ice-ufrag". | 2846 // Update the candidates with the media level "ice-pwd" and "ice-ufrag". |
2847 for (Candidates::iterator it = candidates_orig.begin(); | 2847 for (Candidates::iterator it = candidates_orig.begin(); |
2848 it != candidates_orig.end(); ++it) { | 2848 it != candidates_orig.end(); ++it) { |
2849 ASSERT((*it).username().empty() || | 2849 RTC_DCHECK((*it).username().empty() || |
2850 (*it).username() == transport->ice_ufrag); | 2850 (*it).username() == transport->ice_ufrag); |
2851 (*it).set_username(transport->ice_ufrag); | 2851 (*it).set_username(transport->ice_ufrag); |
2852 ASSERT((*it).password().empty()); | 2852 RTC_DCHECK((*it).password().empty()); |
2853 (*it).set_password(transport->ice_pwd); | 2853 (*it).set_password(transport->ice_pwd); |
2854 candidates->push_back( | 2854 candidates->push_back( |
2855 new JsepIceCandidate(mline_id, mline_index, *it)); | 2855 new JsepIceCandidate(mline_id, mline_index, *it)); |
2856 } | 2856 } |
2857 return true; | 2857 return true; |
2858 } | 2858 } |
2859 | 2859 |
2860 bool ParseSsrcAttribute(const std::string& line, SsrcInfoVec* ssrc_infos, | 2860 bool ParseSsrcAttribute(const std::string& line, SsrcInfoVec* ssrc_infos, |
2861 SdpParseError* error) { | 2861 SdpParseError* error) { |
2862 ASSERT(ssrc_infos != NULL); | 2862 RTC_DCHECK(ssrc_infos != NULL); |
2863 // RFC 5576 | 2863 // RFC 5576 |
2864 // a=ssrc:<ssrc-id> <attribute> | 2864 // a=ssrc:<ssrc-id> <attribute> |
2865 // a=ssrc:<ssrc-id> <attribute>:<value> | 2865 // a=ssrc:<ssrc-id> <attribute>:<value> |
2866 std::string field1, field2; | 2866 std::string field1, field2; |
2867 if (!rtc::tokenize_first(line.substr(kLinePrefixLength), kSdpDelimiterSpace, | 2867 if (!rtc::tokenize_first(line.substr(kLinePrefixLength), kSdpDelimiterSpace, |
2868 &field1, &field2)) { | 2868 &field1, &field2)) { |
2869 const size_t expected_fields = 2; | 2869 const size_t expected_fields = 2; |
2870 return ParseFailedExpectFieldNum(line, expected_fields, error); | 2870 return ParseFailedExpectFieldNum(line, expected_fields, error); |
2871 } | 2871 } |
2872 | 2872 |
(...skipping 58 matching lines...) Loading... |
2931 // The label isn't defined. | 2931 // The label isn't defined. |
2932 // label:<value> | 2932 // label:<value> |
2933 ssrc_info->label = value; | 2933 ssrc_info->label = value; |
2934 } | 2934 } |
2935 return true; | 2935 return true; |
2936 } | 2936 } |
2937 | 2937 |
2938 bool ParseSsrcGroupAttribute(const std::string& line, | 2938 bool ParseSsrcGroupAttribute(const std::string& line, |
2939 SsrcGroupVec* ssrc_groups, | 2939 SsrcGroupVec* ssrc_groups, |
2940 SdpParseError* error) { | 2940 SdpParseError* error) { |
2941 ASSERT(ssrc_groups != NULL); | 2941 RTC_DCHECK(ssrc_groups != NULL); |
2942 // RFC 5576 | 2942 // RFC 5576 |
2943 // a=ssrc-group:<semantics> <ssrc-id> ... | 2943 // a=ssrc-group:<semantics> <ssrc-id> ... |
2944 std::vector<std::string> fields; | 2944 std::vector<std::string> fields; |
2945 rtc::split(line.substr(kLinePrefixLength), | 2945 rtc::split(line.substr(kLinePrefixLength), |
2946 kSdpDelimiterSpace, &fields); | 2946 kSdpDelimiterSpace, &fields); |
2947 const size_t expected_min_fields = 2; | 2947 const size_t expected_min_fields = 2; |
2948 if (fields.size() < expected_min_fields) { | 2948 if (fields.size() < expected_min_fields) { |
2949 return ParseFailedExpectMinFieldNum(line, expected_min_fields, error); | 2949 return ParseFailedExpectMinFieldNum(line, expected_min_fields, error); |
2950 } | 2950 } |
2951 std::string semantics; | 2951 std::string semantics; |
(...skipping 273 matching lines...) Loading... |
3225 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( | 3225 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( |
3226 media_desc, payload_type, feedback_param); | 3226 media_desc, payload_type, feedback_param); |
3227 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { | 3227 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { |
3228 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( | 3228 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( |
3229 media_desc, payload_type, feedback_param); | 3229 media_desc, payload_type, feedback_param); |
3230 } | 3230 } |
3231 return true; | 3231 return true; |
3232 } | 3232 } |
3233 | 3233 |
3234 } // namespace webrtc | 3234 } // namespace webrtc |
OLD | NEW |