OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 146 matching lines...) Loading... |
157 static const char kAttributeRtcpFb[] = "rtcp-fb"; | 157 static const char kAttributeRtcpFb[] = "rtcp-fb"; |
158 static const char kAttributeSendRecv[] = "sendrecv"; | 158 static const char kAttributeSendRecv[] = "sendrecv"; |
159 static const char kAttributeInactive[] = "inactive"; | 159 static const char kAttributeInactive[] = "inactive"; |
160 // draft-ietf-mmusic-sctp-sdp-07 | 160 // draft-ietf-mmusic-sctp-sdp-07 |
161 // a=sctp-port | 161 // a=sctp-port |
162 static const char kAttributeSctpPort[] = "sctp-port"; | 162 static const char kAttributeSctpPort[] = "sctp-port"; |
163 | 163 |
164 // Experimental flags | 164 // Experimental flags |
165 static const char kAttributeXGoogleFlag[] = "x-google-flag"; | 165 static const char kAttributeXGoogleFlag[] = "x-google-flag"; |
166 static const char kValueConference[] = "conference"; | 166 static const char kValueConference[] = "conference"; |
167 static const char kAttributeXGoogleBufferLatency[] = | |
168 "x-google-buffer-latency"; | |
169 | 167 |
170 // Candidate | 168 // Candidate |
171 static const char kCandidateHost[] = "host"; | 169 static const char kCandidateHost[] = "host"; |
172 static const char kCandidateSrflx[] = "srflx"; | 170 static const char kCandidateSrflx[] = "srflx"; |
173 // TODO: How to map the prflx with circket candidate type | 171 // TODO: How to map the prflx with circket candidate type |
174 // static const char kCandidatePrflx[] = "prflx"; | 172 // static const char kCandidatePrflx[] = "prflx"; |
175 static const char kCandidateRelay[] = "relay"; | 173 static const char kCandidateRelay[] = "relay"; |
176 static const char kTcpCandidateType[] = "tcptype"; | 174 static const char kTcpCandidateType[] = "tcptype"; |
177 | 175 |
178 static const char kSdpDelimiterEqual = '='; | 176 static const char kSdpDelimiterEqual = '='; |
(...skipping 1241 matching lines...) Loading... |
1420 os << " " << it->session_params; | 1418 os << " " << it->session_params; |
1421 } | 1419 } |
1422 AddLine(os.str(), message); | 1420 AddLine(os.str(), message); |
1423 } | 1421 } |
1424 | 1422 |
1425 // RFC 4566 | 1423 // RFC 4566 |
1426 // a=rtpmap:<payload type> <encoding name>/<clock rate> | 1424 // a=rtpmap:<payload type> <encoding name>/<clock rate> |
1427 // [/<encodingparameters>] | 1425 // [/<encodingparameters>] |
1428 BuildRtpMap(media_desc, media_type, message); | 1426 BuildRtpMap(media_desc, media_type, message); |
1429 | 1427 |
1430 // Specify latency for buffered mode. | |
1431 // a=x-google-buffer-latency:<value> | |
1432 if (media_desc->buffered_mode_latency() != cricket::kBufferedModeDisabled) { | |
1433 std::ostringstream os; | |
1434 InitAttrLine(kAttributeXGoogleBufferLatency, &os); | |
1435 os << kSdpDelimiterColon << media_desc->buffered_mode_latency(); | |
1436 AddLine(os.str(), message); | |
1437 } | |
1438 | |
1439 for (StreamParamsVec::const_iterator track = media_desc->streams().begin(); | 1428 for (StreamParamsVec::const_iterator track = media_desc->streams().begin(); |
1440 track != media_desc->streams().end(); ++track) { | 1429 track != media_desc->streams().end(); ++track) { |
1441 // Require that the track belongs to a media stream, | 1430 // Require that the track belongs to a media stream, |
1442 // ie the sync_label is set. This extra check is necessary since the | 1431 // ie the sync_label is set. This extra check is necessary since the |
1443 // MediaContentDescription always contains a streamparam with an ssrc even | 1432 // MediaContentDescription always contains a streamparam with an ssrc even |
1444 // if no track or media stream have been created. | 1433 // if no track or media stream have been created. |
1445 if (track->sync_label.empty()) continue; | 1434 if (track->sync_label.empty()) continue; |
1446 | 1435 |
1447 // Build the ssrc-group lines. | 1436 // Build the ssrc-group lines. |
1448 for (size_t i = 0; i < track->ssrc_groups.size(); ++i) { | 1437 for (size_t i = 0; i < track->ssrc_groups.size(); ++i) { |
(...skipping 1175 matching lines...) Loading... |
2624 } else if (HasAttribute(line, kAttributeXGoogleFlag)) { | 2613 } else if (HasAttribute(line, kAttributeXGoogleFlag)) { |
2625 // Experimental attribute. Conference mode activates more aggressive | 2614 // Experimental attribute. Conference mode activates more aggressive |
2626 // AEC and NS settings. | 2615 // AEC and NS settings. |
2627 // TODO: expose API to set these directly. | 2616 // TODO: expose API to set these directly. |
2628 std::string flag_value; | 2617 std::string flag_value; |
2629 if (!GetValue(line, kAttributeXGoogleFlag, &flag_value, error)) { | 2618 if (!GetValue(line, kAttributeXGoogleFlag, &flag_value, error)) { |
2630 return false; | 2619 return false; |
2631 } | 2620 } |
2632 if (flag_value.compare(kValueConference) == 0) | 2621 if (flag_value.compare(kValueConference) == 0) |
2633 media_desc->set_conference_mode(true); | 2622 media_desc->set_conference_mode(true); |
2634 } else if (HasAttribute(line, kAttributeXGoogleBufferLatency)) { | |
2635 // Experimental attribute. | |
2636 // TODO: expose API to set this directly. | |
2637 std::string flag_value; | |
2638 if (!GetValue(line, kAttributeXGoogleBufferLatency, &flag_value, | |
2639 error)) { | |
2640 return false; | |
2641 } | |
2642 int buffer_latency = 0; | |
2643 if (!GetValueFromString(line, flag_value, &buffer_latency, error)) { | |
2644 return false; | |
2645 } | |
2646 if (buffer_latency < 0) { | |
2647 return ParseFailed(line, "Buffer latency less than 0.", error); | |
2648 } | |
2649 media_desc->set_buffered_mode_latency(buffer_latency); | |
2650 } | 2623 } |
2651 } else { | 2624 } else { |
2652 // Only parse lines that we are interested of. | 2625 // Only parse lines that we are interested of. |
2653 LOG(LS_INFO) << "Ignored line: " << line; | 2626 LOG(LS_INFO) << "Ignored line: " << line; |
2654 continue; | 2627 continue; |
2655 } | 2628 } |
2656 } | 2629 } |
2657 | 2630 |
2658 // Create tracks from the |ssrc_infos|. | 2631 // Create tracks from the |ssrc_infos|. |
2659 CreateTracksFromSsrcInfos(ssrc_infos, &tracks); | 2632 CreateTracksFromSsrcInfos(ssrc_infos, &tracks); |
(...skipping 438 matching lines...) Loading... |
3098 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( | 3071 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( |
3099 media_desc, payload_type, feedback_param); | 3072 media_desc, payload_type, feedback_param); |
3100 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { | 3073 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { |
3101 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( | 3074 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( |
3102 media_desc, payload_type, feedback_param); | 3075 media_desc, payload_type, feedback_param); |
3103 } | 3076 } |
3104 return true; | 3077 return true; |
3105 } | 3078 } |
3106 | 3079 |
3107 } // namespace webrtc | 3080 } // namespace webrtc |
OLD | NEW |