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 27 matching lines...) Expand all Loading... |
38 #include "talk/app/webrtc/jsepsessiondescription.h" | 38 #include "talk/app/webrtc/jsepsessiondescription.h" |
39 #include "talk/media/base/codec.h" | 39 #include "talk/media/base/codec.h" |
40 #include "talk/media/base/constants.h" | 40 #include "talk/media/base/constants.h" |
41 #include "talk/media/base/cryptoparams.h" | 41 #include "talk/media/base/cryptoparams.h" |
42 #include "talk/media/base/rtputils.h" | 42 #include "talk/media/base/rtputils.h" |
43 #include "talk/media/sctp/sctpdataengine.h" | 43 #include "talk/media/sctp/sctpdataengine.h" |
44 #include "webrtc/p2p/base/candidate.h" | 44 #include "webrtc/p2p/base/candidate.h" |
45 #include "webrtc/p2p/base/constants.h" | 45 #include "webrtc/p2p/base/constants.h" |
46 #include "webrtc/p2p/base/port.h" | 46 #include "webrtc/p2p/base/port.h" |
47 #include "talk/session/media/mediasession.h" | 47 #include "talk/session/media/mediasession.h" |
| 48 #include "webrtc/base/arraysize.h" |
48 #include "webrtc/base/common.h" | 49 #include "webrtc/base/common.h" |
49 #include "webrtc/base/logging.h" | 50 #include "webrtc/base/logging.h" |
50 #include "webrtc/base/messagedigest.h" | 51 #include "webrtc/base/messagedigest.h" |
51 #include "webrtc/base/stringutils.h" | 52 #include "webrtc/base/stringutils.h" |
52 | 53 |
53 using cricket::AudioContentDescription; | 54 using cricket::AudioContentDescription; |
54 using cricket::Candidate; | 55 using cricket::Candidate; |
55 using cricket::Candidates; | 56 using cricket::Candidates; |
56 using cricket::ContentDescription; | 57 using cricket::ContentDescription; |
57 using cricket::ContentInfo; | 58 using cricket::ContentInfo; |
(...skipping 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1518 | 1519 |
1519 bool IsFmtpParam(const std::string& name) { | 1520 bool IsFmtpParam(const std::string& name) { |
1520 const char* kFmtpParams[] = { | 1521 const char* kFmtpParams[] = { |
1521 kCodecParamMinPTime, kCodecParamSPropStereo, | 1522 kCodecParamMinPTime, kCodecParamSPropStereo, |
1522 kCodecParamStereo, kCodecParamUseInbandFec, kCodecParamUseDtx, | 1523 kCodecParamStereo, kCodecParamUseInbandFec, kCodecParamUseDtx, |
1523 kCodecParamStartBitrate, kCodecParamMaxBitrate, kCodecParamMinBitrate, | 1524 kCodecParamStartBitrate, kCodecParamMaxBitrate, kCodecParamMinBitrate, |
1524 kCodecParamMaxQuantization, kCodecParamSctpProtocol, kCodecParamSctpStreams, | 1525 kCodecParamMaxQuantization, kCodecParamSctpProtocol, kCodecParamSctpStreams, |
1525 kCodecParamMaxAverageBitrate, kCodecParamMaxPlaybackRate, | 1526 kCodecParamMaxAverageBitrate, kCodecParamMaxPlaybackRate, |
1526 kCodecParamAssociatedPayloadType | 1527 kCodecParamAssociatedPayloadType |
1527 }; | 1528 }; |
1528 for (size_t i = 0; i < ARRAY_SIZE(kFmtpParams); ++i) { | 1529 for (size_t i = 0; i < arraysize(kFmtpParams); ++i) { |
1529 if (_stricmp(name.c_str(), kFmtpParams[i]) == 0) { | 1530 if (_stricmp(name.c_str(), kFmtpParams[i]) == 0) { |
1530 return true; | 1531 return true; |
1531 } | 1532 } |
1532 } | 1533 } |
1533 return false; | 1534 return false; |
1534 } | 1535 } |
1535 | 1536 |
1536 // Retreives fmtp parameters from |params|, which may contain other parameters | 1537 // Retreives fmtp parameters from |params|, which may contain other parameters |
1537 // as well, and puts them in |fmtp_parameters|. | 1538 // as well, and puts them in |fmtp_parameters|. |
1538 void GetFmtpParams(const cricket::CodecParameterMap& params, | 1539 void GetFmtpParams(const cricket::CodecParameterMap& params, |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2075 if (!media_desc) { | 2076 if (!media_desc) { |
2076 return; | 2077 return; |
2077 } | 2078 } |
2078 int preference = static_cast<int>(fmts.size()); | 2079 int preference = static_cast<int>(fmts.size()); |
2079 std::vector<int>::const_iterator it = fmts.begin(); | 2080 std::vector<int>::const_iterator it = fmts.begin(); |
2080 bool add_new_codec = false; | 2081 bool add_new_codec = false; |
2081 for (; it != fmts.end(); ++it) { | 2082 for (; it != fmts.end(); ++it) { |
2082 int payload_type = *it; | 2083 int payload_type = *it; |
2083 if (!media_desc->HasCodec(payload_type) && | 2084 if (!media_desc->HasCodec(payload_type) && |
2084 payload_type >= 0 && | 2085 payload_type >= 0 && |
2085 payload_type < ARRAY_SIZE(kStaticPayloadAudioCodecs)) { | 2086 payload_type < arraysize(kStaticPayloadAudioCodecs)) { |
2086 std::string encoding_name = kStaticPayloadAudioCodecs[payload_type].name; | 2087 std::string encoding_name = kStaticPayloadAudioCodecs[payload_type].name; |
2087 int clock_rate = kStaticPayloadAudioCodecs[payload_type].clockrate; | 2088 int clock_rate = kStaticPayloadAudioCodecs[payload_type].clockrate; |
2088 int channels = kStaticPayloadAudioCodecs[payload_type].channels; | 2089 int channels = kStaticPayloadAudioCodecs[payload_type].channels; |
2089 media_desc->AddCodec(cricket::AudioCodec(payload_type, encoding_name, | 2090 media_desc->AddCodec(cricket::AudioCodec(payload_type, encoding_name, |
2090 clock_rate, 0, channels, | 2091 clock_rate, 0, channels, |
2091 preference)); | 2092 preference)); |
2092 add_new_codec = true; | 2093 add_new_codec = true; |
2093 } | 2094 } |
2094 --preference; | 2095 --preference; |
2095 } | 2096 } |
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3056 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( | 3057 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( |
3057 media_desc, payload_type, feedback_param); | 3058 media_desc, payload_type, feedback_param); |
3058 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { | 3059 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { |
3059 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( | 3060 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( |
3060 media_desc, payload_type, feedback_param); | 3061 media_desc, payload_type, feedback_param); |
3061 } | 3062 } |
3062 return true; | 3063 return true; |
3063 } | 3064 } |
3064 | 3065 |
3065 } // namespace webrtc | 3066 } // namespace webrtc |
OLD | NEW |